Skip to content

feat(history): show shielded-pool activity in the Home history - #1690

Draft
HashEngineering wants to merge 9 commits into
feat/advanced-internal-transferfrom
feat/shielded-history-rows
Draft

HashEngineering wants to merge 9 commits into
feat/advanced-internal-transferfrom
feat/shielded-history-rows

Conversation

@HashEngineering

Copy link
Copy Markdown
Collaborator

Stacked on #1683 (feat/advanced-internal-transfer).

Problem

QA D-19T1-05: registering a username paid from the shielded pool spends 0.03 DASH with no Core transaction, so Home history shows nothing and the shielded balance drops unexplained. The DashPay welcome disclaimer also quoted the transparent balance ("You have 0.00000737 Dash") on a wallet about to pay from shielded.

What changes

  • Shielded activity in the Home history. One tx_display_cache row per SDK shielded_activities entry that has no Core transaction of its own. Room 22 → 23 adds a source column (0 = L1, 1 = shielded). L1 writers now clear and count L1 rows only; the wallet wipe still clears everything.
    • The value is the entry's effect on the Home total (L1 + shielded). Outgoing rows show amount + fee, so the username row reads −0.03 "Upgrade Fee". Credits convert at 1e11 per DASH, rounded down to the duff.
    • Not shown, because the Core transaction already has a row: shield from Core, and a withdrawal to the wallet's own Core address once the wallet holds the payout. While the payout waits in the Platform withdrawal queue, the withdrawal shows as "Unshielded".
    • A withdrawal to a foreign Core address, an unshield to someone else's Platform address, and a top-up of someone else's identity read "Sent". Ownership is resolved against the active wallet; an unknown owner never gets an own-balance label.
    • An own spend with only self-change, and outgoing entries with no known fee, get no row rather than a wrong amount.
    • ShieldedHistoryRowSync re-plans on shielded activity changes and on Core history changes (debounced). It replaces the shielded rows in one transaction and stops for a wallet wipe. A failed read or write writes nothing and retries.
  • Detail sheet for these rows, built on the existing transaction sheet: type, amount, network fee, date, status, From/To balances and memo. It follows the entry live and closes if the entry fails. Block explorer, tax category, memo edit and report issue are hidden (there is no Core txid).
  • Welcome disclaimer quotes the shielded balance when the shielded pool will pay the username.

Deferred (no SDK data)

  • Platform address transfers and withdrawals, and Identity credit transfers, withdrawals and top-ups. The SDK keeps only their current balances.

Known limits

  • After a restore, an own shield funded from an asset lock can show twice: once as shielded "Received", once as the Core "Shielded" row. The SDK activity row carries no Core txid to match on.
  • Activity dates are the SDK's record time, so a restored wallet's history sorts at the restore time.
  • A withdrawal to an own address the SDK has not derived yet reads "Sent". A withdrawal to an own address that already received coins gets no row until its payout lands.
  • For up to one debounce window after an own withdrawal's payout lands, both rows can show.

Testing

  • :wallet:compile_testNet3DebugKotlin passes.
  • New unit tests pass: ShieldedHistoryRowsTest, ShieldedHistoryRowSyncTest, ShieldedHistoryRowSyncRetryTest, PlatformActivityDetailFeedTest, AppDatabaseMigration22to23Test (real Room, from schema 22), UsernameDisclaimerBalanceTest.
  • Affected suites pass: ShieldedBalanceServiceTest, TxDisplayCache*, AssetLockKindResolver*. de.schildbach.wallet.service.platform.* (2,425 tests) last ran on the first commit, before the review fixes.
  • The 22 → 23 step was added to the instrumented DatabaseMigrationTest, but not run: androidTest does not compile at the base, for unrelated reasons.
  • Not yet tested on a device.

Local pre-review

  • Round 1: 4 blocking findings, fixed in b75b588.
  • Round 2: 2 blocking findings, fixed in 50711d0.
  • The round-2 fixes have not been reviewed again, because of the two-round limit.

🤖 Generated with Claude Code

HashEngineering and others added 4 commits November 9, 2026 07:59
A username paid from the shielded pool, a shielded send or an unshield to
a Platform address creates no Core transaction, so the Home history had no
row for it and the balance drop was unexplained (QA D-19T1-05).

Add one tx_display_cache row per SDK shielded_activities entry that has no
Core transaction of its own (Room 22 -> 23 adds a `source` column). The
value is the entry's effect on the Home total (L1 + shielded): outgoing
kinds show amount + fee, so the username row reads -0.03. ShieldFromAssetLock
and Withdrawal are skipped because their Core transaction already has an L1
row; ShieldedSpend (self-change, fee unknown) and outgoing entries without a
known fee get no row rather than a wrong amount. L1 writers now clear and
count L1 rows only.

ShieldedHistoryRowSync collects the activity feed on IO, replaces the
shielded rows in one transaction, ignores the not-ready state, and stops
for a wallet wipe. Tapping a shielded row opens the transaction detail
sheet with the type, amount, fee, date, status, From/To balances and memo.

Platform address and Identity credit history are deferred: the SDK keeps
only their current balances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…name

The DashPay welcome disclaimer said "You have 0.00000737 Dash" (the
transparent balance) on a wallet about to pay the username from its
shielded balance. Quote the shielded balance when the fee will be paid
from the shielded pool; otherwise keep the transparent balance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A withdrawal to a foreign Core address now gets a "Sent" row; only a
  withdrawal to this wallet's own Core address is left to its L1 row. An
  unresolvable payout gets no row rather than risk a double count.
- An unshield to someone else's Platform address and a top-up of someone
  else's identity read "Sent" instead of an internal move to the user's
  own balance. Ownership is resolved against the snapshot's wallet; an
  unknown owner falls back to the neutral "Sent".
- The detail sheet follows the entry in the live feed, so it updates on
  settlement and closes when the entry fails or the wallet changes.
- A failed cache write goes through the feed's retry path instead of
  waiting for the next activity change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A failed SDK read while resolving who a shielded payout went to now
  fails the whole sync pass before anything is written and retries, so
  existing rows are kept. Only an undecodable payout stays "unknown".
  The detail sheet keeps its last detail and retries on such a failure.
- A withdrawal to this wallet's own Core address shows as "Unshielded"
  until the wallet holds a Core output paying that address; only then is
  it left to its L1 row. The sync also re-plans on Core history changes
  (DisplayCacheRefreshBus, debounced), and an unchanged plan writes
  nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thepastaclaw

thepastaclaw commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit c35f177. Normal review starts when eligible; priority review starts as soon as a slot is available.

…ry-rows

Picks up cac4f5c (phase-1 through #1675, #1677/#1678/#1680, int37 pin).

Conflicts resolved by keeping both sides:
- AppDatabaseMigrations: our 22->23 tx_display_cache.source migration plus
  the base's data-only removeCrowdNodeCacheRows callback (base stays at v22,
  so AppDatabase is v23 with 23.json unchanged).
- PlatformSyncService: both shieldedHistoryRowSync and
  transparentUsernameCreation constructor params; the six platform tests and
  IdentityConditionalWriteTest pass both.
- DatabaseMigrationTest: our migrate22to23 plus the base's crowdnode cache
  tests; its migrations array now includes migration22to23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HashEngineering HashEngineering self-assigned this Nov 10, 2026
HashEngineering and others added 4 commits November 10, 2026 11:49
- replaceShieldedRows compares and writes in one transaction: one read,
  nothing written when the plan is unchanged, only new or changed rows
  upserted.
- ShieldedActivityEntry derives pending and amount from status and
  amountCredits.
- signedTotalDuffs returns a sealed result; ShieldedKindSpec carries
  isSend; the test-only planShieldedHistoryRow wrapper is gone.
- Core script decoding uses dashj via TxInfoConverter.standardAddressOf
  (exact 25/23-byte templates only), replacing CoreAddressVersions.
- TransactionResultViewBinder shares one bindHeader, and the icon table
  lives in TxDisplayCacheEntry.iconResFor.
- TxDisplayCacheDao queries name SOURCE_L1 / SOURCE_SHIELDED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants