-
Notifications
You must be signed in to change notification settings - Fork 9
Add integration test for zcashd key import into zallet #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nullcopy
wants to merge
4
commits into
zcash:main
Choose a base branch
from
nullcopy:feat/zcashd-migration-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8c8b825
ci: Build zallet with zcashd-import feature (except on windows)
nullcopy 41190b8
Add zcashd regtest test wallet and manifests
nullcopy ff88667
Add API-level integration test for zcashd key import into zallet
nullcopy eaa4ee7
Add DB-inspection integration test for zcashd key import
nullcopy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ OS X | |
| ------ | ||
|
|
||
| ``` | ||
| pip3 install pyzmq base58 toml | ||
| pip3 install pyzmq base58 toml bech32 | ||
| ``` | ||
|
|
||
| Setup | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Zcashd regtest test wallet fixture | ||
|
|
||
| Test fixture for `qa/rpc-tests/zcashd_key_import.py` and | ||
| `qa/rpc-tests/zcashd_key_import_db.py`. | ||
|
|
||
| ## Source | ||
|
|
||
| Generated by the regtest wallet builder at | ||
| <https://github.com/nullcopy/zcash-regtest-wallet-builder>. | ||
|
|
||
| - **Generated:** 2026-04-07 | ||
| - **Builder commit:** _unknown — not recorded at generation time_ | ||
|
nullcopy marked this conversation as resolved.
|
||
|
|
||
| Future regenerations MUST fill in the **Builder commit** field above — | ||
| without it the fixture is not reproducible. | ||
|
|
||
| ## Contents | ||
|
|
||
| - `wallet.dat` — Berkeley DB zcashd wallet (~2.9 MB) covering all 9 | ||
| network upgrades from Sprout through NU6.1. | ||
| - `full_manifest.json` — aggregate index of every address and viewing | ||
| key the builder produced. | ||
| - `manifests/phase_NN_*.json` — per-phase records (one per network | ||
| upgrade) listing HD keys plus imported foreign keys of every type | ||
| zcashd supports (transparent privkey/watch-only/P2SH/pubkey, sapling | ||
| spending/viewing, sprout spending/viewing). See the PR #82 | ||
| description for the exact key matrix. | ||
|
|
||
| ## Regenerating | ||
|
|
||
| 1. Clone <https://github.com/nullcopy/zcash-regtest-wallet-builder>, | ||
| note the exact commit hash you have checked out, then follow its | ||
| README to build a fresh wallet. | ||
| 2. Copy `wallet.dat`, `full_manifest.json`, and `manifests/` into this | ||
| directory, overwriting the existing files. **Record the builder | ||
| commit hash from step 1 in the Source section above** — without it | ||
| the fixture is not reproducible. | ||
| 3. Run both tests to confirm the fixture decodes cleanly: | ||
| `python3 qa/rpc-tests/zcashd_key_import.py` and | ||
| `python3 qa/rpc-tests/zcashd_key_import_db.py`. | ||
|
|
||
| ## Sprout caveat | ||
|
|
||
| Sprout keys are present in the fixture but intentionally not asserted | ||
| by either test (zallet does not support sprout). The DB-inspection | ||
| test records them as `SKIP` lines so the gap is visible in the report. | ||
Large diffs are not rendered by default.
Oops, something went wrong.
183 changes: 183 additions & 0 deletions
183
qa/rpc-tests/test-wallet/manifests/phase_00_sprout.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| { | ||
| "phase": 0, | ||
| "network_upgrade": "sprout", | ||
| "network_upgrade_name": "Sprout", | ||
| "zcashd_version": "1.0.15", | ||
| "zcashd_commit": "/MagicBean:1.0.15/", | ||
| "activation_height": 0, | ||
| "phase_start_height": 0, | ||
| "phase_end_height": 199, | ||
| "timestamp": "2026-04-10T19:19:06.820125+00:00", | ||
| "nuparams": {}, | ||
| "addresses": { | ||
| "transparent": [ | ||
| { | ||
| "address": "tmLqHvpx8mvKyzfovyRmbKwaKh8DfwuvYzr", | ||
| "type": "p2pkh" | ||
| }, | ||
| { | ||
| "address": "tmVZjjTMPuBTWrJvyV7TK5vQpDoUSnGEb9f", | ||
| "type": "p2pkh" | ||
| } | ||
| ], | ||
| "sprout": [ | ||
| { | ||
| "address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "type": "sprout" | ||
| }, | ||
| { | ||
| "address": "ztYt7dGoVXFhhtrjCMQxVDHN7NN7BS2uXiCLuHczppN1HSZKD6aXuVzHDA3xX2P5udU6WXGkjruuYwu5hZmX9zCmvWFLSnJ", | ||
| "type": "sprout" | ||
| } | ||
| ], | ||
| "sapling": [], | ||
| "orchard": [], | ||
| "unified": [] | ||
| }, | ||
| "external_addresses": { | ||
| "transparent": [ | ||
| { | ||
| "address": "tmSnh1Qi5UhmDg84coozvvXndLEspLKWYiz", | ||
| "type": "p2pkh" | ||
| } | ||
| ], | ||
| "sprout": [ | ||
| { | ||
| "address": "ztrMd8YELgHyXcQFVKrdrmDMyyq6Vwcs7xTyDNrxqP4wTBMKr572KPinwcvXU9oUTkiTtPYZ3jqQFhbe5EKQJEVuzV5qqsG", | ||
| "type": "sprout" | ||
| } | ||
| ], | ||
| "sapling": [], | ||
| "orchard": [], | ||
| "unified": [] | ||
| }, | ||
| "viewing_keys": { | ||
| "sprout": [ | ||
| { | ||
| "address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "viewing_key": "ZiVthZCMzY2VZKVzk4cgJKqCre95F8VKURdF1vxi8g1c8xyUDeABx6bdLesncJBAHPj2JV9Jpg6aCD1HCSP4Bi8sueyV6MwSW" | ||
| }, | ||
| { | ||
| "address": "ztYt7dGoVXFhhtrjCMQxVDHN7NN7BS2uXiCLuHczppN1HSZKD6aXuVzHDA3xX2P5udU6WXGkjruuYwu5hZmX9zCmvWFLSnJ", | ||
| "viewing_key": "ZiVtYEbCXk6bW8jZMrjaJZP8D4Ad1wqJUwXMd8wqkcJMswBc9Ydbv1cTX9u6yEBk6ZrHz7SMTz5Yzg15kHnvFoEjBHHvf4gAB" | ||
| } | ||
| ], | ||
| "sapling": [], | ||
| "orchard": [] | ||
| }, | ||
| "transactions": [ | ||
| { | ||
| "txid": "16780eb8afe8acef7796318d2037404b42da5ff94dc6fe2ca3e1d11eb3201e27", | ||
| "mined_height": 150, | ||
| "type": "z_shieldcoinbase", | ||
| "from_pool": "transparent", | ||
| "to_pool": "sprout", | ||
| "from_address": "*", | ||
| "to_address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "amount_zec": "200.0", | ||
| "fee_zec": "0.0001", | ||
| "description": "Shield 20 coinbase UTXOs to sprout" | ||
| }, | ||
| { | ||
| "txid": "4c8ec187e7642b160926199a1a0df77f73b728dab19826209a4df02246d00d41", | ||
| "mined_height": 156, | ||
| "type": "sendtoaddress", | ||
| "from_pool": "transparent", | ||
| "to_pool": "transparent", | ||
| "from_address": "tmLqHvpx8mvKyzfovyRmbKwaKh8DfwuvYzr", | ||
| "to_address": "tmVZjjTMPuBTWrJvyV7TK5vQpDoUSnGEb9f", | ||
| "amount_zec": "10.0", | ||
| "fee_zec": "0.0001", | ||
| "description": "transparent -> transparent: 10.0 ZEC" | ||
| }, | ||
| { | ||
| "txid": "6ddca513a32a85fc91c66df317be71a468292a848cbccead4469a206bf22db72", | ||
| "mined_height": 157, | ||
| "type": "z_sendmany", | ||
| "from_pool": "sprout", | ||
| "to_pool": "sprout", | ||
| "from_address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "to_address": "ztYt7dGoVXFhhtrjCMQxVDHN7NN7BS2uXiCLuHczppN1HSZKD6aXuVzHDA3xX2P5udU6WXGkjruuYwu5hZmX9zCmvWFLSnJ", | ||
| "amount_zec": "5.0", | ||
| "fee_zec": "0.0001", | ||
| "description": "sprout -> sprout: 5.0 ZEC" | ||
| }, | ||
| { | ||
| "txid": "6b35a4cf8e8eda464da39179b6e5e2e7355b8fc18cada5b1bc179da45afaa00b", | ||
| "mined_height": 160, | ||
| "type": "z_sendmany", | ||
| "from_pool": "sprout", | ||
| "to_pool": "transparent", | ||
| "from_address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "to_address": "tmLqHvpx8mvKyzfovyRmbKwaKh8DfwuvYzr", | ||
| "amount_zec": "4.0", | ||
| "fee_zec": "0.0001", | ||
| "description": "sprout -> transparent: 4.0 ZEC" | ||
| }, | ||
| { | ||
| "txid": "3ba21578d4cac50c1b3468d8619e98ffedd7efbf431c092ba40515be9790e373", | ||
| "mined_height": 163, | ||
| "type": "sendtoaddress", | ||
| "from_pool": "transparent", | ||
| "to_pool": "external_transparent", | ||
| "from_address": "tmLqHvpx8mvKyzfovyRmbKwaKh8DfwuvYzr", | ||
| "to_address": "tmSnh1Qi5UhmDg84coozvvXndLEspLKWYiz", | ||
| "amount_zec": "2.5", | ||
| "fee_zec": "0.0001", | ||
| "description": "External send: transparent to unknown address" | ||
| }, | ||
| { | ||
| "txid": "067868df553d085920c8553996b7887a47ae4dc80361f023f5b676387914f61c", | ||
| "mined_height": 164, | ||
| "type": "z_sendmany", | ||
| "from_pool": "sprout", | ||
| "to_pool": "external_sprout", | ||
| "from_address": "ztiCinjbRRJtULEw5TQiwHvx5pbHqT2Pdbb8vA14Y4d35Ls5ajie6RqfcAWNATi2v1c5ujgLgJUMSYQ2ACiHc1Yw7nJ3Qap", | ||
| "to_address": "ztrMd8YELgHyXcQFVKrdrmDMyyq6Vwcs7xTyDNrxqP4wTBMKr572KPinwcvXU9oUTkiTtPYZ3jqQFhbe5EKQJEVuzV5qqsG", | ||
| "amount_zec": "2.5", | ||
| "fee_zec": "0.0001", | ||
| "description": "External send: sprout to unknown address" | ||
| } | ||
| ], | ||
| "balances_at_phase_end": { | ||
| "transparent": "791.49998437", | ||
| "sprout": "193.49960000", | ||
| "sapling": "0", | ||
| "orchard": "0" | ||
| }, | ||
| "note_counts": { | ||
| "sprout": 0, | ||
| "sapling": 0, | ||
| "orchard": 0 | ||
| }, | ||
| "utxo_count": 76, | ||
| "coinbase_utxo_count": 72, | ||
| "chain_info": { | ||
| "blocks": 199, | ||
| "bestblockhash": "093ff0a3efeb630ab6b11fd17a8652723b431d5930e171a6b4d3cb3c74028146", | ||
| "chain": "regtest", | ||
| "size_on_disk": 0 | ||
| }, | ||
| "notes": "Genesis era. Mine aggressively here to build the transparent 'bank' (~1500 ZEC) that funds operations in later NUs where coinbase rewards are small due to halving.", | ||
| "imported_keys": { | ||
| "transparent_privkey": { | ||
| "address": "tmN3t6NkCsj7S4ZcZJ4gNQ24qyhvdWgqiGQ", | ||
| "wif": "cVMw3TdX1eFGu6Gji3EzdrdCHoRZ8faHrVrGUWobij16H9UYNN98", | ||
| "label": "imported_privkey_phase0" | ||
| }, | ||
| "transparent_watchonly": { | ||
| "address": "tmVYBJzinfX1tB56jriWCZ3EmTw2ecEY9s4", | ||
| "label": "imported_watchonly_phase0" | ||
| }, | ||
| "sprout_spending": { | ||
| "address": "ztUDFysBz7M2kvYNsBr8fiNqSi9ja1jkzkSjdcQ4VwG1B2mng1teTZCpZ1hvgotFuZGzVW7wb8Jp1LtvAgvQQWv7TS7cJrf", | ||
| "key": "ST16RU1471saGho4cWXzUQTNNgPrUXxoHAPfiVnhwoP6RCBPNyYo", | ||
| "label": "imported_sprout_sk_phase0" | ||
| }, | ||
| "sprout_viewing": { | ||
| "address": "ztdT7VeK29KnUjrsBRE56kCQ25cyZuDtPMVpo1Y1RZHWdNhWi1TvsAwW9AGgCPbSEokCNJE6GRNNqGaDeDRRFjBW6PyByao", | ||
| "key": "ZiVtcob4uFdDaDWQMzie7fzf865LGpDmfvNzvcqZfcu6oSXYR4WQrTxRJPjzMD8jL5KrPkGgeb5kUzMvSqnuy6Uzg3ajLNsa5", | ||
| "label": "imported_sprout_vk_phase0" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.