fix: correct BLS scheme setting in MigrateLegacyDiffs() when nVersion is present#6961
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
WalkthroughA closing brace is repositioned in Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)src/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-01-07T18:50:44.838ZApplied to files:
⏰ 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). (9)
🔇 Additional comments (1)
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. Comment |
This can't be true... Are you sure @coderabbitai? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1000 @UdjinM6 You're absolutely right, and I apologize for the incorrect AI summary. Looking at the diff, this is a behavior change: Before: The After: The code is unindented and moved outside that conditional block. Now This is exactly as you described in the PR summary: a fix that ensures the BLS legacy scheme is set correctly for all cases where The AI-generated summary incorrectly characterized this as having "identical behavior"—that statement should be disregarded. This is a genuine bug fix that changes the conditions under which 🧠 Learnings used |
f8be956 refactor: rename second BuildNewListFromBlock variant to RebuildListFromBlock (UdjinM6) f3ee1d7 refactor: move verification progress log out of VerifySnapshotPair (UdjinM6) f482f01 fix: drop redundant thread safety annotations (UdjinM6) 6df3a7c docs: add release notes for evodb verify/repair RPCs (UdjinM6) 7decd15 docs: add comprehensive evodb verify/repair documentation (UdjinM6) 17b556a feat: add evodb verify and repair RPC commands (UdjinM6) 5379fce refactor: add CDeterministicMNList::IsEqual method (UdjinM6) 496ed89 refactor: add BuildNewListFromBlock overload accepting explicit prevList (UdjinM6) Pull request description: ## Issue being fixed or feature implemented #6961 should fix the issue for new nodes migrating to v23. This PR aims to provide tools for nodes that updated before the fix implemented in #6961. ## What was done? Preparatory Refactoring (2 commits) 1. BuildNewListFromBlock overload - Added method overload that accepts explicit prevList parameter instead of loading from database. Needed for repair to rebuild from trusted snapshots. 2. CDeterministicMNList::IsEqual - Added equality comparison method to verify recalculated diffs produce correct results. Main Feature (1 commit) 3. evodb verify and repair RPCs - Core implementation: - Two new hidden RPC commands for diagnosing/repairing corrupted evodb diffs - evodb verify - Read-only verification between snapshots (every 576 blocks) - evodb repair - Recalculates corrupted diffs from blockchain data - Fail-fast on critical errors, efficient 16MB batched writes, cache clearing Documentation (2 commits) 4. Comprehensive docs - Full technical documentation in doc/evodb-verify-repair.md 5. Release notes - Short user-facing notes in doc/release-notes-6969.md Key Points - Purpose: Repair corrupted evodb diffs without full reindex (when possible) - Use cases: After crashes, disk corruption, or suspected database issues - Limitations: Can't repair missing snapshots (needs reindex), requires unpruned blocks - Performance: I/O intensive, logs progress every 100 snapshot pairs - Safety: Verifies repairs before committing, clears caches, clear error messages ## How Has This Been Tested? 1. Sync on testnet/mainet with v22.1.3 (save evodb from datadir for repeated experiments) and stop the node 2. Start v23 (with `--noconnect` to avoid altering blocks and chainstate), wait for migration to finish and stop the node 3. Start a node with this patch and run: 1. `evodb verify`, should see a bunch of errors in `verificationErrors` 2. `evodb repair`, should see same errors in `verificationErrors` and none in `repairErrors` (can specify start/stop params from errors in `verificationErrors` to speed things up a bit, `verificationErrors` should look accordingly) 3. `evodb verify` or `evodb repair` again, should see no errors now ## Breaking Changes n/a ## Checklist: - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK f8be956 Tree-SHA512: 0cddb7f9fb3ae5519ae8cdb868aafbaeace35ca9f5fa7319d7ddbee3466e7765a21a8bae402983e3fc8f0a2ffab32c8bc60149af65bc2522143ca939b081c605
…Diffs()` when `nVersion` is present 65c33ea fix: correct BLS scheme setting in `MigrateLegacyDiffs()` when `nVersion` is present (UdjinM6) Pull request description: ## Issue being fixed or feature implemented BLS public key legacy scheme is only being set when `nVersion` field is missing and needed to be auto-filled, instead of being set whenever a `pubKeyOperator` field is present. ## What was done? Moved the `SetLegacy()` call outside the `nVersion` check. ## How Has This Been Tested? Migrate on mainnet at block 2367886 ## Breaking Changes n/a ## Checklist: - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: kwvg: utACK 65c33ea Tree-SHA512: e68bc9ae9dc8fa0c780b64225ea1b9be10c1a097dd10cbc5d7d91a6e84ac0ffb75c37dd2b7bd60e7e93f25b8c395e74054b9e2360f3ea549b9e293fd2308e15e
f8be956 refactor: rename second BuildNewListFromBlock variant to RebuildListFromBlock (UdjinM6) f3ee1d7 refactor: move verification progress log out of VerifySnapshotPair (UdjinM6) f482f01 fix: drop redundant thread safety annotations (UdjinM6) 6df3a7c docs: add release notes for evodb verify/repair RPCs (UdjinM6) 7decd15 docs: add comprehensive evodb verify/repair documentation (UdjinM6) 17b556a feat: add evodb verify and repair RPC commands (UdjinM6) 5379fce refactor: add CDeterministicMNList::IsEqual method (UdjinM6) 496ed89 refactor: add BuildNewListFromBlock overload accepting explicit prevList (UdjinM6) Pull request description: ## Issue being fixed or feature implemented dashpay#6961 should fix the issue for new nodes migrating to v23. This PR aims to provide tools for nodes that updated before the fix implemented in dashpay#6961. ## What was done? Preparatory Refactoring (2 commits) 1. BuildNewListFromBlock overload - Added method overload that accepts explicit prevList parameter instead of loading from database. Needed for repair to rebuild from trusted snapshots. 2. CDeterministicMNList::IsEqual - Added equality comparison method to verify recalculated diffs produce correct results. Main Feature (1 commit) 3. evodb verify and repair RPCs - Core implementation: - Two new hidden RPC commands for diagnosing/repairing corrupted evodb diffs - evodb verify - Read-only verification between snapshots (every 576 blocks) - evodb repair - Recalculates corrupted diffs from blockchain data - Fail-fast on critical errors, efficient 16MB batched writes, cache clearing Documentation (2 commits) 4. Comprehensive docs - Full technical documentation in doc/evodb-verify-repair.md 5. Release notes - Short user-facing notes in doc/release-notes-6969.md Key Points - Purpose: Repair corrupted evodb diffs without full reindex (when possible) - Use cases: After crashes, disk corruption, or suspected database issues - Limitations: Can't repair missing snapshots (needs reindex), requires unpruned blocks - Performance: I/O intensive, logs progress every 100 snapshot pairs - Safety: Verifies repairs before committing, clears caches, clear error messages ## How Has This Been Tested? 1. Sync on testnet/mainet with v22.1.3 (save evodb from datadir for repeated experiments) and stop the node 2. Start v23 (with `--noconnect` to avoid altering blocks and chainstate), wait for migration to finish and stop the node 3. Start a node with this patch and run: 1. `evodb verify`, should see a bunch of errors in `verificationErrors` 2. `evodb repair`, should see same errors in `verificationErrors` and none in `repairErrors` (can specify start/stop params from errors in `verificationErrors` to speed things up a bit, `verificationErrors` should look accordingly) 3. `evodb verify` or `evodb repair` again, should see no errors now ## Breaking Changes n/a ## Checklist: - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK f8be956 Tree-SHA512: 0cddb7f9fb3ae5519ae8cdb868aafbaeace35ca9f5fa7319d7ddbee3466e7765a21a8bae402983e3fc8f0a2ffab32c8bc60149af65bc2522143ca939b081c605
736bb26 chore: bump manpages for 23.0.1 (pasta) d5c7d25 chore: bump nMinimumChainWork and defaultAssumeValid (pasta) 4f8aa71 chore: bump version to 23.0.1 (pasta) 0865b7c docs: add release notes for 23.0.1 (pasta) 2048b42 Merge #6986: test: new commandline argument -tinyblk to use blk size just 64kb instead 16Mb (pasta) 1a9b20c Merge #7013: fix: update BuildTestVectors call to adjust batch size based on output flag (pasta) 36e4679 Merge #7009: fix: include QDebug directly (pasta) 69d0c9c Merge #6999: feat: verify and repair evodb diffs automatically at node startup (pasta) ca16437 Merge #6996: perf: reduce cs_main lock scope in evodb verify/repair operations (pasta) 207526e Merge #6977: fix: bls benchmarks crash when ran independently (pasta) 226aaf4 Merge #6969: feat: add evodb verify and repair RPC commands (pasta) 92abe9b Merge #6964: perf: remove duplicated check of same key in the instant send database (pasta) 5a1ec4c Merge #6961: fix: correct BLS scheme setting in `MigrateLegacyDiffs()` when `nVersion` is present (pasta) bf653d3 Merge #6949: depends: Qt 5.15.18 (pasta) faf58cd merge bitcoin#30774: Qt 5.15.16 (Kittywhiskers Van Gogh) 6a995f5 Merge #6944: fix: HD chain encryption check ordering issue (pasta) Pull request description: ## Issue being fixed or feature implemented See commits; release v23.0.1 ## What was done? see commits ## How Has This Been Tested? ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] 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 _(for repository code-owners and collaborators only)_ ACKs for top commit: kwvg: utACK 736bb26 Tree-SHA512: fe02c4c3e520b11af54d09c47bda94112313456f9f1cb6d14e78ef16704b2a8ec8feb80fa914c55e152db2bcac7f278291824aaa36c8079eb9e0c9bff9e554a4
fe1cff3 chore: bump release to 23.0.2 (pasta) a8f15c1 Merge #7032: fix: drop gsl usage from RebuildListFromBlock function wrapper (pasta) 736bb26 chore: bump manpages for 23.0.1 (pasta) d5c7d25 chore: bump nMinimumChainWork and defaultAssumeValid (pasta) 4f8aa71 chore: bump version to 23.0.1 (pasta) 0865b7c docs: add release notes for 23.0.1 (pasta) 2048b42 Merge #6986: test: new commandline argument -tinyblk to use blk size just 64kb instead 16Mb (pasta) 1a9b20c Merge #7013: fix: update BuildTestVectors call to adjust batch size based on output flag (pasta) 36e4679 Merge #7009: fix: include QDebug directly (pasta) 69d0c9c Merge #6999: feat: verify and repair evodb diffs automatically at node startup (pasta) ca16437 Merge #6996: perf: reduce cs_main lock scope in evodb verify/repair operations (pasta) 207526e Merge #6977: fix: bls benchmarks crash when ran independently (pasta) 226aaf4 Merge #6969: feat: add evodb verify and repair RPC commands (pasta) 92abe9b Merge #6964: perf: remove duplicated check of same key in the instant send database (pasta) 5a1ec4c Merge #6961: fix: correct BLS scheme setting in `MigrateLegacyDiffs()` when `nVersion` is present (pasta) bf653d3 Merge #6949: depends: Qt 5.15.18 (pasta) faf58cd merge bitcoin#30774: Qt 5.15.16 (Kittywhiskers Van Gogh) 6a995f5 Merge #6944: fix: HD chain encryption check ordering issue (pasta) 6fd7059 chore: mark v23 as release (pasta) ae08f53 docs: integrate 6946 release notes into final (pasta) 74a222d Merge #6946: feat: show seed on wallet creation (pasta) 877343a Merge #6943: fix: don't treat arrays/objects as string literals for composite methods (pasta) 00368fb Merge #6940: fix: reuse best clsig to avoid potential race condition (pasta) 8eceb98 Merge #6938: fix: logic error in `CheckDecryptionKey` (pasta) 3f30664 Merge #6929: fix: repair `makeseeds.py`, `getblockchaininfo[softforks]` help text, drop extra `generate`s from test, resolve macOS GID issue (pasta) 7ba4f1c Merge #6928: docs: update man pages for 23.0 (pasta) a6c1d6a Merge #6920: chore: update minimum chain work, tx stats, checkpoints, seeds and SECURITY.md for v23 (pasta) 84df1f0 Merge #6909: chore: Translations 2025-10 (pasta) a6449b1 Merge #6885: fix: improve governance/proposal dialog strings (pasta) ebf3a64 docs: typos (pasta) 4ad5533 docs: typos (pasta) f407453 doc: Replace Bitcoin Core PR references with Dash Core backport PRs (pasta) 78d0725 docs: add note on proto bump and platformban p2p (pasta) e0519c3 docs: fix whitespace errors (pasta) bc8db22 docs: minor improvements to release notes (pasta) c338511 docs: reorganize rpc updates to organize extended address changes (thephez) 700c46e style: make heading style consistent (thephez) bd636bd docs: add contributors (pasta) 6d29bc3 docs: revert changes deferred to v24 (pasta) 615f5ff docs: make the downgrade warning more confident (pasta) 567771a Apply suggestions from code review (PastaPastaPasta) 2b3211a docs: add link to 22.1.3 release notes (pasta) 548a38a docs: remove individual release notes files (pasta) e770c25 docs: add v23.0.0 release notes and archive v22.1.3 (pasta) Pull request description: ## Issue being fixed or feature implemented Includes changes from 23.0.0 release too because we never merged it back. ## What was done? ## How Has This Been Tested? ## Breaking Changes ## Checklist: - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 491db4a kwvg: utACK 491db4a Tree-SHA512: 61895cd1f9d01ac7be1d407afe1ddd24b98e8242cb03229ecd586a4d2d1c43dbc62c98da52a8c715b3a5943fb40e99b23251e691f778779af9d6da94392122a3
Issue being fixed or feature implemented
BLS public key legacy scheme is only being set when
nVersionfield is missing and needed to be auto-filled, instead of being set whenever apubKeyOperatorfield is present.What was done?
Moved the
SetLegacy()call outside thenVersioncheck.How Has This Been Tested?
Migrate on mainnet at block 2367886
Breaking Changes
n/a
Checklist: