-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test: compatibility of upgradetohd wih encryption and determinism of addresses for descriptor wallets #6762
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
Conversation
WalkthroughThe test script for the ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
01783cf to
d842fea
Compare
| @@ -1,11 +1,12 @@ | |||
| #!/usr/bin/env python3 | |||
| # Copyright (c) 2016 The Bitcoin Core developers | |||
| # Copyright (c) 2016 The Dash Core developers | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Copyright (c) 2016 The Dash Core developers | |
| # Copyright (c) 2025 The Dash Core developers |
| self.log.info("Test upgradetohd with user defined mnemonic") | ||
| self.test_upgradetohd_custom(False, False) | ||
|
|
||
| self.log.info("Test upgradetohd with user defined mnemonic, encrypt wallet after creation") | ||
| self.test_upgradetohd_custom(True, False) | ||
|
|
||
| self.log.info("Test upgradetohd with user defined mnemonic, encrypt wallet after upgradetohd") | ||
| self.test_upgradetohd_custom(False, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add these tests in wallet_mnemonicbits.py? Could we tweak wallet_upgradetohd.py to accept --legacy-wallet/--descriptors instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because descriptor wallets are not compatible with usehd=0, adding descriptor wallets to wallet_upgradetohd.py will require some re-work of this funtional test.
Let me try, maybe that's not so bad to tweak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/functional/wallet_mnemonicbits.py (1)
124-159: Comprehensive upgrade testing with minor suggestions.The test method effectively covers the key scenarios for upgrading wallets with custom mnemonics under various encryption conditions. The wallet naming scheme and test structure are well-designed.
Consider the following minor improvements:
- Verify mnemonic preservation: Add assertions to ensure the custom mnemonic is actually preserved after upgrade:
+ # Verify mnemonic is preserved after upgrade + for wname in wnames: + if to_encrypt_1 or to_encrypt_2: + self.nodes[0].get_wallet_rpc(wname).walletpassphrase("123", 100) + actual_mnemonic = self.get_mnemonic(self.nodes[0].get_wallet_rpc(wname)) + assert_equal(actual_mnemonic, custom_mnemonic)
- Add timeout buffer: Consider increasing the walletpassphrase timeout to handle all operations:
- self.nodes[0].get_wallet_rpc(wname).walletpassphrase("123", 100) + self.nodes[0].get_wallet_rpc(wname).walletpassphrase("123", 300)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
test/functional/wallet_mnemonicbits.py(2 hunks)test/functional/wallet_upgradetohd.py(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- test/functional/wallet_upgradetohd.py
🧰 Additional context used
📓 Path-based instructions (1)
test/functional/**/*.py
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- CLAUDE.md
🧠 Learnings (2)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
test/functional/wallet_mnemonicbits.py (1)
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
🧬 Code Graph Analysis (1)
test/functional/wallet_mnemonicbits.py (3)
test/functional/test_framework/test_framework.py (1)
BitcoinTestFramework(101-1130)test/functional/test_framework/util.py (1)
assert_equal(69-74)test/functional/test_framework/test_node.py (1)
get_wallet_rpc(360-366)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: win64-build / Build source
- GitHub Check: linux64_nowallet-build / Build source
- GitHub Check: arm-linux-build / Build source
- GitHub Check: Lint / Run linters
- GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
- GitHub Check: x86_64-apple-darwin / Build depends
- GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (5)
test/functional/wallet_mnemonicbits.py (5)
7-7: Import addition looks good.Adding
COINBASE_MATURITYimport is appropriate for the test's need to generate blocks beyond coinbase maturity for transaction confirmation.
98-105: Good refactoring of mnemonic assertions.The unified approach for mnemonic length assertions across descriptor and legacy wallets improves code consistency and maintainability. The blank wallet creation and upgrade test provides valuable coverage for the upgrade functionality.
108-112: Proper test setup for fund distribution.The block generation beyond coinbase maturity and fund distribution to custom addresses follows standard functional test patterns. This setup is essential for the subsequent upgrade tests to verify balances.
115-122: Comprehensive encryption scenario coverage.The three test calls effectively cover all encryption scenarios: no encryption, encryption after creation, and encryption after upgrade. The clear logging messages help with test debugging and understanding.
13-18: Manual verification required for custom mnemonic derivationThe automated check failed due to missing Python packages in this environment. Please manually confirm that the following hard-coded addresses match the BIP-44 derivation (m/44'/0'/0'/0/0) for the given mnemonic and passphrase:
• File: test/functional/wallet_mnemonicbits.py (lines 13–18)
- mnemonic:
"similar behave slot swim scissors throw planet view ghost laugh drift calm"- custom_address_1 (no passphrase):
"yLpq97zZUsFQ2rdMqhcPKkYT36MoPK4Hob"- custom_address_2 (passphrase = "custom-passphrase"):
"yYBPeZQcqgQHu9dxA5pKBWtYbK2hwfFHxf"Ensure these values are correctly derived before merging.
|
Closed in favor of #6763 as it's more thorough testing |
04c8c97 test: move helper get_mnemonic to test_framework/util (Konstantin Akimov) 1e70ee8 test: enable --descriptors for wallet_upgradetohd.py (Konstantin Akimov) 0322b7c test: ensure determinism of addresses for specific mnemonic (Konstantin Akimov) af4b618 test: make wallet_upgradetohd works for descriptor wallets too (Konstantin Akimov) 0267fb7 fix: copyright for wallet_upgradetohd.py (Konstantin Akimov) 62c4ec1 test: remove duplicated code from wallet_mnemonicbits.py by using helper get_mnemonic (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented `upgradetohd` has comprehensive tests for case of blank legacy wallet -> HD legacy wallet. This PR replaces #6762 ## What was done? - add descriptor wallets to scope of wallet_updatetohd.py - add tests for deterministic of generated addresses from mnemonic (with & without mnemonic_passphrase) ## How Has This Been Tested? See `wallet_upgadetohd.py` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 04c8c97 Tree-SHA512: 7d007b48642f938efb501ef9b36a1e3506e9f658e332a5a845b91784298935669d747c7a616c558b4727644540d9e481d94690ee05e921d6bed6aea4253a7b5a
… fix error message 4dca765 test: follow-up #6762 - removed related TODO from functional test (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Once both #6762 and #6763 are merged, no more need to have a workaround with manual lock / unlock of descriptor wallet before `upgradetohd`. I fixes CI failure on develop also due to conflict. ## What was done? Removed this workaround from `wallet_upgradetohd.py` ## How Has This Been Tested? See CI ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: DashCoreAutoGuix: utACK 4dca765 (used wrong account, disregard) PastaPastaPasta: utACK 4dca765 kwvg: utACK 4dca765 Tree-SHA512: 435359f53f42c29f3e6885ab6fbeabd1a31135fe67a15b894e6f4a92a0aced3e96e0f1bb38598eb74eb251df1f6ae603e033ee41e3bf500bcc4d6c5c1031b800
…iptors 04c8c97 test: move helper get_mnemonic to test_framework/util (Konstantin Akimov) 1e70ee8 test: enable --descriptors for wallet_upgradetohd.py (Konstantin Akimov) 0322b7c test: ensure determinism of addresses for specific mnemonic (Konstantin Akimov) af4b618 test: make wallet_upgradetohd works for descriptor wallets too (Konstantin Akimov) 0267fb7 fix: copyright for wallet_upgradetohd.py (Konstantin Akimov) 62c4ec1 test: remove duplicated code from wallet_mnemonicbits.py by using helper get_mnemonic (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented `upgradetohd` has comprehensive tests for case of blank legacy wallet -> HD legacy wallet. This PR replaces dashpay#6762 ## What was done? - add descriptor wallets to scope of wallet_updatetohd.py - add tests for deterministic of generated addresses from mnemonic (with & without mnemonic_passphrase) ## How Has This Been Tested? See `wallet_upgadetohd.py` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 04c8c97 Tree-SHA512: 7d007b48642f938efb501ef9b36a1e3506e9f658e332a5a845b91784298935669d747c7a616c558b4727644540d9e481d94690ee05e921d6bed6aea4253a7b5a
…remove workaround and fix error message 4dca765 test: follow-up dashpay#6762 - removed related TODO from functional test (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Once both dashpay#6762 and dashpay#6763 are merged, no more need to have a workaround with manual lock / unlock of descriptor wallet before `upgradetohd`. I fixes CI failure on develop also due to conflict. ## What was done? Removed this workaround from `wallet_upgradetohd.py` ## How Has This Been Tested? See CI ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: DashCoreAutoGuix: utACK 4dca765 (used wrong account, disregard) PastaPastaPasta: utACK 4dca765 kwvg: utACK 4dca765 Tree-SHA512: 435359f53f42c29f3e6885ab6fbeabd1a31135fe67a15b894e6f4a92a0aced3e96e0f1bb38598eb74eb251df1f6ae603e033ee41e3bf500bcc4d6c5c1031b800
…iptors 04c8c97 test: move helper get_mnemonic to test_framework/util (Konstantin Akimov) 1e70ee8 test: enable --descriptors for wallet_upgradetohd.py (Konstantin Akimov) 0322b7c test: ensure determinism of addresses for specific mnemonic (Konstantin Akimov) af4b618 test: make wallet_upgradetohd works for descriptor wallets too (Konstantin Akimov) 0267fb7 fix: copyright for wallet_upgradetohd.py (Konstantin Akimov) 62c4ec1 test: remove duplicated code from wallet_mnemonicbits.py by using helper get_mnemonic (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented `upgradetohd` has comprehensive tests for case of blank legacy wallet -> HD legacy wallet. This PR replaces dashpay#6762 ## What was done? - add descriptor wallets to scope of wallet_updatetohd.py - add tests for deterministic of generated addresses from mnemonic (with & without mnemonic_passphrase) ## How Has This Been Tested? See `wallet_upgadetohd.py` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 04c8c97 Tree-SHA512: 7d007b48642f938efb501ef9b36a1e3506e9f658e332a5a845b91784298935669d747c7a616c558b4727644540d9e481d94690ee05e921d6bed6aea4253a7b5a
…remove workaround and fix error message 4dca765 test: follow-up dashpay#6762 - removed related TODO from functional test (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Once both dashpay#6762 and dashpay#6763 are merged, no more need to have a workaround with manual lock / unlock of descriptor wallet before `upgradetohd`. I fixes CI failure on develop also due to conflict. ## What was done? Removed this workaround from `wallet_upgradetohd.py` ## How Has This Been Tested? See CI ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: DashCoreAutoGuix: utACK 4dca765 (used wrong account, disregard) PastaPastaPasta: utACK 4dca765 kwvg: utACK 4dca765 Tree-SHA512: 435359f53f42c29f3e6885ab6fbeabd1a31135fe67a15b894e6f4a92a0aced3e96e0f1bb38598eb74eb251df1f6ae603e033ee41e3bf500bcc4d6c5c1031b800
…iptors 04c8c97 test: move helper get_mnemonic to test_framework/util (Konstantin Akimov) 1e70ee8 test: enable --descriptors for wallet_upgradetohd.py (Konstantin Akimov) 0322b7c test: ensure determinism of addresses for specific mnemonic (Konstantin Akimov) af4b618 test: make wallet_upgradetohd works for descriptor wallets too (Konstantin Akimov) 0267fb7 fix: copyright for wallet_upgradetohd.py (Konstantin Akimov) 62c4ec1 test: remove duplicated code from wallet_mnemonicbits.py by using helper get_mnemonic (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented `upgradetohd` has comprehensive tests for case of blank legacy wallet -> HD legacy wallet. This PR replaces dashpay#6762 ## What was done? - add descriptor wallets to scope of wallet_updatetohd.py - add tests for deterministic of generated addresses from mnemonic (with & without mnemonic_passphrase) ## How Has This Been Tested? See `wallet_upgadetohd.py` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK 04c8c97 Tree-SHA512: 7d007b48642f938efb501ef9b36a1e3506e9f658e332a5a845b91784298935669d747c7a616c558b4727644540d9e481d94690ee05e921d6bed6aea4253a7b5a
…remove workaround and fix error message 4dca765 test: follow-up dashpay#6762 - removed related TODO from functional test (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Once both dashpay#6762 and dashpay#6763 are merged, no more need to have a workaround with manual lock / unlock of descriptor wallet before `upgradetohd`. I fixes CI failure on develop also due to conflict. ## What was done? Removed this workaround from `wallet_upgradetohd.py` ## How Has This Been Tested? See CI ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: DashCoreAutoGuix: utACK 4dca765 (used wrong account, disregard) PastaPastaPasta: utACK 4dca765 kwvg: utACK 4dca765 Tree-SHA512: 435359f53f42c29f3e6885ab6fbeabd1a31135fe67a15b894e6f4a92a0aced3e96e0f1bb38598eb74eb251df1f6ae603e033ee41e3bf500bcc4d6c5c1031b800
Issue being fixed or feature implemented
upgradetohdhas comprehensive tests for case of blank legacy wallet -> HD legacy wallet. Seewallet_upgradetohd.py. But there are lack of some scenarios for descriptor wallets; such as: determinism of addresses, compatibility of mnemonic between legacy & descriptors wallets and upgradetohd for wallets with passwords.What was done?
How Has This Been Tested?
See changes in
wallet_mnemonicbits.pyBreaking Changes
N/A
Checklist: