backport: bitcoin#19438 Introduce deploymentstatus (versionbits improvements)#5740
Merged
Merged
Conversation
5 tasks
PastaPastaPasta
approved these changes
Nov 29, 2023
Member
PastaPastaPasta
left a comment
There was a problem hiding this comment.
utACK for merging via merge commit
UdjinM6
approved these changes
Nov 29, 2023
UdjinM6
left a comment
There was a problem hiding this comment.
light ACK (reindexed on mainnet/testnet)
e48826a tests: remove ComputeBlockVersion shortcut from versionbits tests (Anthony Towns) c5f3672 [refactor] Move ComputeBlockVersion into VersionBitsCache (Anthony Towns) 4a69b4d [move-only] Move ComputeBlockVersion from validation to versionbits (Anthony Towns) 0cfd6c6 [refactor] versionbits: make VersionBitsCache a full class (Anthony Towns) 8ee3e0b [refactor] rpc/blockchain.cpp: SoftForkPushBack (Anthony Towns) 92f48f3 deploymentinfo: Add DeploymentName() (Anthony Towns) ea68b3a [move-only] Rename versionbitsinfo to deploymentinfo (Anthony Towns) c64b2c6 scripted-diff: rename versionbitscache (Anthony Towns) de55304 [refactor] Add versionbits deployments to deploymentstatus.h (Anthony Towns) 2b0d291 [refactor] Add deploymentstatus.h (Anthony Towns) eccd736 versionbits: Use dedicated lock instead of cs_main (Anthony Towns) 36a4ba0 versionbits: correct doxygen comments (Anthony Towns) Pull request description: Introduces helper functions to make it easy to bury future deployments, along the lines of the suggestion from [11398](bitcoin#11398 (comment)) "I would prefer it if a buried deployment wouldn't require all code paths that check the BIP9 status to require changing". This provides three functions: `DeploymentEnabled()` which tests if a deployment can ever be active, `DeploymentActiveAt()` which checks if a deployment should be enforced in the given block, and `DeploymentActiveAfter()` which checks if a deployment should be enforced in the block following the given block, and overloads all three to work both with buried deployments and versionbits deployments. This adds a dedicated lock for the versionbits cache, which is acquired internally by the versionbits functions, rather than relying on `cs_main`. It also moves moves versionbitscache into deploymentstatus to avoid a circular dependency with validation. ACKs for top commit: jnewbery: ACK e48826a gruve-p: ACK bitcoin@e48826a MarcoFalke: re-ACK e48826a 🥈 Tree-SHA512: c846ba64436d36f8180046ad551d8b0d9e20509b9bc185aa2639055fc28803dd8ec2d6771ab337e80da0b40009ad959590d5772f84a0bf6199b65190d4155bed
feec513 to
d70ba2c
Compare
PastaPastaPasta
pushed a commit
that referenced
this pull request
Dec 1, 2023
Prior required changes: bitcoin#19438 from #5740 ## Issue being fixed or feature implemented Assertion failure: ``` assertion: ok file: evo/mnhftx.cpp, line: 287 function: AbstractEHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex*) No debug information available for stacktrace. You should add debug information and then run: dash-qt -printcrashinfo=bvcgc43iinzgc43ijfxgm3ybaadwiyltnawxc5e3ifzxgzlsoruw63ramzqws3dvojstucraebqxg43foj2gs33ohiqg62ykeaqgm2lmmu5cazlwn4xw23timz2hqltdobycyidmnfxgkoragi4docraebthk3tdoruw63r2ebawe43uojqwg5cfjbde2ylomftwk4r2hjjwsz3omfwhgicdjvheqrsnmfxgcz3foi5dur3fordhe33ninqwg2dffbrw63ttoqqegqtmn5rwwslomrsxqkrjbyrelhyaaaaaaaedgkiaaaaaaaadsm4qaaaaaaaa7gpyqaaaaaaaa2njraaaaaaaadkl3caaaaaaaabhxznqaaaaaaadqa2eaaaaaaaax33twaaaaaaabwaihqaaaaaaac7yooqbaaaaaahba45qcaaaaaacwkz2aeaaaaaaeitgeaiaaaaaaaa= dash-qt: evo/mnhftx.cpp:287: AbstractEHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex*): Assertion `ok' failed. ``` This can happen in case if Dash Core has been update from v19 (or earlier v20.alphaX) to v20.0.0 after v20 activation without re-indexing ## What was done? `CMNHFManager` is visiting missing blocks recursively until reach first v20 block or first block actually saved in evoDb. Without changes from bitcoin#19438 there's an other issue: ``` 2023-11-27T11:12:10Z POTENTIAL DEADLOCK DETECTED Previous lock order was: (2) 'cs_main' in llmq/instantsend.cpp:459 (in thread 'isman') (1) 'cs_llmq_vbc' in llmq/utils.cpp:711 (in thread 'isman') Current lock order is: 'cs_dip3list' in qt/masternodelist.cpp:135 (TRY) (in thread 'main') (1) 'cs_llmq_vbc' in llmq/utils.cpp:719 (in thread 'main') (2) 'cs_main' in node/blockstorage.cpp:77 (in thread 'main') Assertion failed: detected inconsistent lock order for 'cs_main' in node/blockstorage.cpp:77 (in thread 'main'), details in debug log. 2023-11-27T11:12:10Z Posix Signal: Aborted ``` ## How Has This Been Tested? Run unit/functional test; run dash-qt on my local backup of problematic storage (succeed without error); reindex testnet. ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [x] 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)_
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue being fixed or feature implemented
We had our own solution for avoid locking
cs_mainthat used to work for most cases.Although, #5736 requires more advanced solution
What was done?
Backport bitcoin#19438
How Has This Been Tested?
Run unit tests/functional tests
Breaking Changes
N/A
Checklist: