Skip to content

Wallet stats card on the account summary - #17

Open
sqhell wants to merge 5 commits into
red-dev-inc:mainfrom
sqhell:feat/wallet-stats
Open

sqhell wants to merge 5 commits into
red-dev-inc:mainfrom
sqhell:feat/wallet-stats

Conversation

@sqhell

@sqhell sqhell commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

  • A card under the balances with the balance split by pool (Ironwood, Orchard, Sapling, transparent) and the shielded share, transaction and memo counts, first and last activity dates, and how far the scan is behind the chain tip.
  • Everything comes from the local wallet summary and transaction history; no new network calls. The history is re-read only when the fully scanned height moves.

Why

The wallet already knows these figures about itself and nothing showed them. Rows whose values the in-memory store does not yet track (sent and shielded totals) stay hidden rather than show wrong figures. Stacked on the Ironwood PR for the Ironwood balance field.

Stack

Position 13 of 15 in the WebZjs release order, to be merged in this order into main. Builds on #15 (feat/ironwood-pool). GitHub shows the whole stack against main until those merge; the commits of this PR alone are here: sqhell/WebZjs@feat/ironwood-pool...feat/wallet-stats

  1. Make rustfmt and clippy pass on main #20 chore/rust-checks
  2. Reuse one web worker for every sync instead of spawning per call #6 fix/reuse-sync-worker
  3. Accept Trailers-Only gRPC responses from lightwalletd #7 fix/grpc-web-trailers-only
  4. Keep the Full Resync form usable during background syncs #8 fix/resync-dialog
  5. Send again from the transaction history, with a caution for new recipients #9 feat/send-again
  6. Surface PCZT parse and signer errors instead of trapping; readable transfer errors #10 fix/pczt-parse-error
  7. Sign the change-paired Orchard spends NU6.3 bundles require #11 fix/sign-change-paired-spends
  8. Stop a full resync from an old birthday exhausting the wasm heap #12 fix/historic-sync-oom
  9. Point to Full Resync from the end of the transaction history #13 feat/history-resync-hint
  10. Make wallet persistence refuse stale and silent overwrites #14 fix/wallet-store-epochs
  11. Spend and count the Ironwood (NU6.3) pool #15 feat/ironwood-pool
  12. Classify history by what the wallet spent, not only by what it received #16 fix/history-from-spends
  13. Wallet stats card on the account summary #17 feat/wallet-stats (this PR)
  14. Bounded sync steps, instance ids, close and worker poisoning #18 feat/resumable-sync
  15. Resumable, checkpointed full resync driven by sync steps #19 feat/resync-resume

Rust pins reference sqhell/zcash_client_memory and sqhell/librustzcash by revision so CI builds exactly what was tested; once the zcash_client_memory stack (red-dev-inc/zcash_client_memory #16 to #21) merges, the memory pin goes back to red-dev-inc/zcash_client_memory feat/snap-nu63. The integration branch test/all-fixes on the fork merges all fourteen and is the build that was tested end to end.

Tests

cd packages/web-wallet && yarn test

Rust-Checks has failed on main since the NU6.3 toolchain bump: rustfmt
differs in nine files, and clippy on nightly-2025-06-15 rejects ten
uninlined format arguments in webzjs-keys and one map iteration in
webzjs-requests under -D warnings. Apply rustfmt and clippy's own
suggestions; no behaviour changes.
A Full Resync from an early birthday (for example 2,600,000) crashed the
sync worker with `RuntimeError: unreachable` after a few 10,000-block
batches, and the wallet UI hung afterwards.

MemBlockCache::delete in zcash_client_memory was a lazy `async fn`, and
zcash_client_backend::sync::run only awaits the returned futures once
the whole sync has finished, so every downloaded compact block stayed in
the cache for the entire sync. The browser caps wasm memory at 1 GiB and
the allocation failure traps without a panic message.

Point zcash_client_memory at a revision that removes the blocks when
`delete` is called, and that also prunes the nullifier map below the
fully scanned height as zcash_client_sqlite does, so a historic sync no
longer keeps every on-chain nullifier in memory for the life of the
wallet. Measured natively, syncing 800k blocks (2.6M to tip, batch
10,000): peak heap 2,039 MiB before, 524 MiB with the eager delete,
383 MiB with the pruning as well.
Since NU6.3, payments to shielded addresses and the shielded change of
shielding transactions are delivered through the Ironwood pool, and this is
where a wallet's shielded funds live from then on. zcash_client_memory did
not track that pool, so every such transaction failed at creation with
ProposalNotSupported, and Ironwood funds were invisible.

Move the zcash_client_memory pin to the fork revision that tracks the Ironwood
pool (its own commitment tree, notes, nullifiers, balances and
serialization), and make the two wallet-side changes that depend on it:

- pczt_prove proves the Ironwood bundle as well as the Orchard one. The two
  bundles share the circuit and proving key; without the second proof,
  extraction rejects every post-NU6.3 payment to a shielded address.
- The wallet summary reports the Ironwood balance, and the web wallet counts
  it as shielded funds in the balance hook and the snap balance cache.

Verified on mainnet: a payment from legacy Orchard notes to the wallet's own
unified address, which the backend routes through Ironwood, built, signed in
the snap, proved and broadcast, and the resulting Ironwood note was scanned.

Both pins move together with this commit: zcash_client_memory to the fork
revision that exposes spend records and change flags for history queries,
and every librustzcash crate to sqhell/librustzcash, which is the previous
pin (0a2c6d1) plus the upstream fix that records Ironwood outputs when a
transaction is extracted from a PCZT. Without the latter, a payment to a
shielded address signed through the snap left no sent record at all, and
the history later showed only its change as a receipt.
…uning

The pinned revision is the head of the zcash_client_memory PR stack: the
Ironwood pool on top of the nullifier-map pruning tests, then strict
decode, loud encode, the dirty flag, the rewind nullifier fix and block
pruning that the resync and persistence work was tested against.
Adds a card under the balances with figures the wallet already knows about
itself: the balance split by pool (Ironwood, Orchard, Sapling, transparent)
with the shielded share, the transaction and memo counts, first and last
activity dates, and how far the scan is behind the chain tip.

The history utility also totals received, sent and shielded amounts by kind,
but the card does not show them yet: the in-memory store reports zero for
sent and shielded values until it tracks them, so those rows stay hidden
rather than show wrong figures.

Everything comes from the local wallet summary and transaction history, so
no new network calls are made and nothing leaves the browser. The history is
re-read only when the fully scanned height moves, or when a read was cut
short by a sync that started mid-flight.
@sqhell
sqhell force-pushed the feat/wallet-stats branch from 36c2529 to f6ffeed Compare October 19, 2026 17:28

This branch has not been deployed

No deployments
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.

1 participant