Skip to content

1/5: Enrich DecryptedOutput with nullifier and position metadata#14

Closed
czarcas7ic wants to merge 1 commit into
mainfrom
adam/enriched-decrypted-output
Closed

1/5: Enrich DecryptedOutput with nullifier and position metadata#14
czarcas7ic wants to merge 1 commit into
mainfrom
adam/enriched-decrypted-output

Conversation

@czarcas7ic
Copy link
Copy Markdown

@czarcas7ic czarcas7ic commented Apr 10, 2026

Summary

  • Add TxBundlePositions, compute_enriched_outputs(), and collect_wallet_note_positions() to the decrypt module for enriching decrypted outputs with nullifier bytes and commitment tree positions post-decryption
  • Add WalletWrite::notify_wallet_note_positions and prune_tracked_nullifiers trait methods with default no-op implementations for backends to override
  • Add ScanningKeys::from_account_ufvks_with_scopes for selective scope inclusion during batch scanning
  • Change ReceivedShieldedOutput::nullifier() to return an owned value instead of a borrowed one
  • Tighten the enrichment API so compute_enriched_outputs() derives the transaction reference from DecryptedTransaction, and re-export the new helpers from the crate root so this slice is independently lint-clean
  • Wire notify_wallet_note_positions through the SQLite and memory backends now that the high-level WalletWrite hook exists, and add the owning backend changelog entry in this branch

Context

This is PR 1/5 in a stacked PR series implementing External-IVK-only batch scanning. This PR adds the API foundations that the rest of the stack builds on, plus the concrete high-level hook overrides needed to keep the new WalletWrite contract from being a silent no-op on backends that already have the underlying scan-complete machinery.

Full stack:

  1. This PR — API foundations
  2. adam/sync-enhancement-pipeline — Core behavioral change
  3. adam/sqlite-enhancement-support — SQLite backend implementation
  4. adam/memory-backend-enhancement — Memory backend implementation
  5. adam/external-ivk-scan-tests — Tests and changelogs

Review focus

  • compute_enriched_outputs() API shape in decrypt.rs and whether deriving the transaction from DecryptedTransaction is the right invariant
  • The nullifier() return type change and its downstream compatibility
  • The new WalletWrite hook contract and the concrete SQLite / memory overrides for notify_wallet_note_positions

Test plan

  • cargo clippy -p zcash_client_backend --all-features -- -D warnings
  • cargo check -p zcash_client_sqlite --all-features
  • cargo check -p zcash_client_memory --all-features

@czarcas7ic czarcas7ic force-pushed the adam/enriched-decrypted-output branch 4 times, most recently from 4433894 to 0695f91 Compare April 10, 2026 07:06
Add infrastructure for enriching decrypted transaction outputs with
nullifier bytes and commitment tree positions after decryption. This
enables the upcoming External-only batch scanning optimization, where
Internal-scope change notes are recovered during enhancement and need
spend metadata computed post-hoc.

- Add TxBundlePositions, compute_enriched_outputs() to decrypt module
- Add WalletWrite::notify_wallet_note_positions and
  prune_tracked_nullifiers trait methods (default no-ops)
- Add ScanningKeys::from_account_ufvks_with_scopes for selective
  scope inclusion
- Change ReceivedShieldedOutput::nullifier() to return owned value
- Wire detect_*_spend closures in store_decrypted_tx to use enriched
  nullifiers
- Enrich decrypt_and_store_transaction via compute_enriched_outputs

Co-Authored-By: Claude <noreply@anthropic.com>
@czarcas7ic czarcas7ic force-pushed the adam/enriched-decrypted-output branch from 0695f91 to a1f3f63 Compare April 15, 2026 17:17
@czarcas7ic czarcas7ic closed this Apr 16, 2026
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