Skip to content

Implement tracking of ZIP 48 transparent multisig accounts#2144

Draft
nullcopy wants to merge 6 commits intozcash:mainfrom
nullcopy:feat/COR-132/1361-full-transparent-coin-tracking
Draft

Implement tracking of ZIP 48 transparent multisig accounts#2144
nullcopy wants to merge 6 commits intozcash:mainfrom
nullcopy:feat/COR-132/1361-full-transparent-coin-tracking

Conversation

@nullcopy
Copy link
Copy Markdown
Contributor

@nullcopy nullcopy commented Feb 11, 2026

This PR implements support for balance tracking of ZIP 48 transparent multisig accounts. This is a first step towards general P2SH account tracking.

I wanted to get feedback on this, before deciding how to approach general P2SH account support.

resolves #2197
resolves COR-1068

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 14.70588% with 319 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.29%. Comparing base (2a0677e) to head (3fd60d3).

Files with missing lines Patch % Lines
zcash_client_sqlite/src/wallet.rs 20.66% 119 Missing ⚠️
...client_backend/src/data_api/testing/transparent.rs 0.00% 77 Missing ⚠️
zcash_client_sqlite/src/wallet/transparent.rs 22.95% 47 Missing ⚠️
...nt_sqlite/src/wallet/transparent/zip48_multisig.rs 0.00% 34 Missing ⚠️
zcash_client_sqlite/src/lib.rs 0.00% 28 Missing ⚠️
zcash_client_backend/src/data_api/wallet.rs 0.00% 7 Missing ⚠️
...qlite/src/wallet/init/migrations/zip48_multisig.rs 69.23% 4 Missing ⚠️
zcash_client_memory/src/wallet_read.rs 0.00% 2 Missing ⚠️
zcash_client_backend/src/data_api.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2144      +/-   ##
==========================================
- Coverage   73.86%   73.29%   -0.57%     
==========================================
  Files         227      229       +2     
  Lines       37518    37838     +320     
==========================================
+ Hits        27712    27735      +23     
- Misses       9806    10103     +297     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nullcopy nullcopy self-assigned this Feb 12, 2026
@nullcopy nullcopy force-pushed the feat/COR-132/1361-full-transparent-coin-tracking branch from c360cd5 to fd60c3e Compare February 13, 2026 21:44
@nullcopy
Copy link
Copy Markdown
Contributor Author

Just discovered #1153 which should be part of this discussion, as the root cause of most challenges in this PR is the requirement for a UA to contain a shielded receiver.

@nullcopy nullcopy force-pushed the feat/COR-132/1361-full-transparent-coin-tracking branch 4 times, most recently from e764821 to 7495f1f Compare February 16, 2026 21:55
@nullcopy
Copy link
Copy Markdown
Contributor Author

Force pushed to fix test build errors

Copy link
Copy Markdown
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flushing a few comments from review.

Comment on lines +121 to +122
AND hd_seed_fingerprint IS NULL
AND hd_account_index IS NULL
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me think that the hd seed fingerprint and hd account index should potentially no longer be part of the account table; instead, maybe they should be stored in something like an account_derivation table that foreign keys to this one? This relates to my comment about AccountPurpose.

Copy link
Copy Markdown
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flushing my current comments as of 3fd60d3. I haven't closely reviewed the PR, just focused on the areas I think need input for overall design.

@nullcopy nullcopy force-pushed the feat/COR-132/1361-full-transparent-coin-tracking branch from 3fd60d3 to e787251 Compare February 24, 2026 15:21
@nullcopy
Copy link
Copy Markdown
Contributor Author

Force pushed to rebase onto main and address PR feedback

@nullcopy nullcopy marked this pull request as ready for review February 24, 2026 15:26
@nullcopy nullcopy requested review from nuttycom and str4d February 24, 2026 15:27
@nullcopy nullcopy force-pushed the feat/COR-132/1361-full-transparent-coin-tracking branch 2 times, most recently from 5cc8405 to bdab817 Compare February 24, 2026 17:41
@nullcopy
Copy link
Copy Markdown
Contributor Author

Sorry... had to force-push again to resolve conflicts with the merge base and trigger CI

Also fixed a bug in the ZIP 48 multipath descriptor tests

This commit adds a ZIP 48 account type and the methods necessary to
create/import such an account, to the backend interface.
This commit adds changes the database schema and implements the backend
API necessary for view-only support of ZIP 48 multisig accounts.
This commit adds methods to get addresses for a ZIP 48 account.
This commit implements the ZIP 48 address retrieval methods:
* get_next_zip48_multisig_address()
* get_zip48_multisig_address_for_intex()
This commit implements `PartialOrd` and `Ord` on `AccountPubkey`. Then
sort `key_info` so that ZIP 48 multipath descriptor will have a
canonical encoding.
@nullcopy nullcopy force-pushed the feat/COR-132/1361-full-transparent-coin-tracking branch from dc51ecd to c509e83 Compare February 26, 2026 07:37
@nullcopy
Copy link
Copy Markdown
Contributor Author

Force pushed to rebase and drop the Zip48Derivation type (deferring that to a future PR)

Before this, clippy complained that `insert_zip48_multisig_address()`
required too many arguments. This commit bundles related arguments into
a tuple, to cleanly address the issue.
FROM addresses
WHERE account_id = :account_id
AND key_scope = :key_scope
AND redeem_script IS NOT NULL",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should take the "diversifiability" of an address from information at the account level; this query seems fragile to me in the presence of adding other types of redeem scripts.

@nullcopy nullcopy marked this pull request as draft March 23, 2026 20:40
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.

zcash_client_backend: ZIP 48 account + coin tracking

3 participants