-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat!: Insertion of best CL signature in CbTx #5262
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
|
This pull request has conflicts, please rebase. |
|
This pull request has conflicts, please rebase. |
|
@ogabrielides We'll have to update DIP(s) with this change, right? |
|
@thephez Correct. Once this PR is merged I will open a new one for the DIPs. |
|
@PastaPastaPasta @UdjinM6 Adjusted to latest decisions. (Why CI isn't starting?) |
src/evo/cbtx.cpp
Outdated
| bool isCbV20 = cbTx.nVersion == CCbTx::CB_V20_VERSION; | ||
| if (isV20 != isCbV20) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cbtx-version"); |
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.
| bool isCbV20 = cbTx.nVersion == CCbTx::CB_V20_VERSION; | |
| if (isV20 != isCbV20) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cbtx-version"); | |
| if (isV20 && cbTx.nVersion != CCbTx::CB_V20_VERSION) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cbtx-version"); |
src/evo/cbtx.cpp
Outdated
| return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-payload"); | ||
| } | ||
|
|
||
| if (cbTx.nVersion >= CCbTx::CB_V20_VERSION) { |
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.
we shouldn't allow a version greater than current version
src/evo/cbtx.cpp
Outdated
| // IsNull() doesn't exist for CBLSSignature: we assume that a non valid BLS sig is null | ||
| return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-clsig"); | ||
| } | ||
| int prevBlockCoinbaseCLHeight = pindexPrev->nHeight - static_cast<int>(prevBlockCoinbaseChainlock.value().second) - 1; |
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.
give this variable a name :) maybe expand prevBlockCoinbaseChainlock.value() earlier into blsSig and blockHeightDiff or something like that
src/evo/cbtx.cpp
Outdated
| return true; | ||
| } | ||
|
|
||
| bool EmplaceBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, const int nHeight, std::optional<std::pair<CBLSSignature, uint32_t>> prevBlockCoinbaseChainlock, uint32_t& bestCLHeightDiff, CBLSSignature& bestCLSignature) |
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.
we also should probably not use return parameters
|
|
||
| std::optional<std::pair<CBLSSignature, uint32_t>> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex) | ||
| { | ||
| auto opt_cbtx = GetCoinbaseTx(pindex); |
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.
we should probably storecbtx.bestCLSignature, cbtx.bestCLHeightDiff in state somewhere so we don't have to load blocks from disk
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.
Do you mean to cache {cbtx.bestCLSignature, cbtx.bestCLHeightDiff} per block ?
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.
Implemented in #5347 by the way
|
pls see https://github.com/UdjinM6/dash/commits/pr5262 for some suggestions |
|
@PastaPastaPasta @UdjinM6 Applied (most of) the suggestions |
UdjinM6
left a comment
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.
pls see 48a323f and below
…b_v20 in CheckCbTxBestChainlock
UdjinM6
left a comment
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.
LGTM, utACK
PastaPastaPasta
left a comment
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.
utACK for squash merge, let's do it :)
## Issue being fixed or feature implemented Implementation of Randomness Beacon Part 2. This PR is the next step of #5262. Starting from v20 activation fork, members for quorums are sorted using (if available) the best CL signature found in Coinbase. If no CL signature is present yet, then the usual way is used (By using Blockhash instead) ## What was done? ## How Has This Been Tested? Test `feature_llmq_rotation.py` was updated to cover both rotated and non-rotated quorums. 2 quorums are mined first to ensure Chainlock are working earlier. Then dip_24 activation is replaced by v20 activation. The only direct way to test this change is to make sure that all expected quorums after v20 activation are properly formed. Note: A `wait_for_chainlocked_block_all_nodes` is called between every rotation cycle to ensure that Coinbase will use a different Chainlock signature. ## Breaking Changes Yes, quorum members will be calculated differently. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] 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)_ --------- Co-authored-by: UdjinM6 <[email protected]>
Relates to dashpay/dash#5262
* docs: deprecate MSG_LEGACY_TXLOCK_REQUEST Aligns with dashpay/dash#5483 * chore: update link to prev version of docs * docs: update mnlistdiff nversion location Relates to dashpay/dash#5450 * docs(p2p): update mnlistdiff Relates to dashpay/dash#5377 * docs: update cbtx for v3 Relates to dashpay/dash#5262 * docs: update mnhf with details of final implementation Relates to dashpay/dash#5469 and dashpay/dash#5505 * docs: note removal of NODE_GETUTXO Relates to dashpay/dash#5500 * chore: revert "docs: update mnhf with details of final implementation" This reverts commit 8e4bf6c since there may still be additional changes to the implementation (it's not merged)
## Issue being fixed or feature implemented ## What was done? Added release notes for #5262. ## How Has This Been Tested? ## Breaking Changes ## 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 - [x] 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)_ --------- Co-authored-by: PastaPastaPasta <[email protected]> Co-authored-by: thephez <[email protected]> Co-authored-by: UdjinM6 <[email protected]>
* docs: deprecate MSG_LEGACY_TXLOCK_REQUEST Aligns with dashpay/dash#5483 * chore: update link to prev version of docs * docs: update mnlistdiff nversion location Relates to dashpay/dash#5450 * docs(p2p): update mnlistdiff Relates to dashpay/dash#5377 * docs: update cbtx for v3 Relates to dashpay/dash#5262 * docs: update mnhf with details of final implementation Relates to dashpay/dash#5469 and dashpay/dash#5505 * docs: note removal of NODE_GETUTXO Relates to dashpay/dash#5500 * chore: revert "docs: update mnhf with details of final implementation" This reverts commit 8e4bf6c since there may still be additional changes to the implementation (it's not merged)
* docs: deprecate MSG_LEGACY_TXLOCK_REQUEST Aligns with dashpay/dash#5483 * chore: update link to prev version of docs * docs: update mnlistdiff nversion location Relates to dashpay/dash#5450 * docs(p2p): update mnlistdiff Relates to dashpay/dash#5377 * docs: update cbtx for v3 Relates to dashpay/dash#5262 * docs: update mnhf with details of final implementation Relates to dashpay/dash#5469 and dashpay/dash#5505 * docs: note removal of NODE_GETUTXO Relates to dashpay/dash#5500 * chore: revert "docs: update mnhf with details of final implementation" This reverts commit 8e4bf6c since there may still be additional changes to the implementation (it's not merged)
Issue being fixed or feature implemented
What was done?
CbTx. Added fieldsbestCLHeightDiff,bestCLSignatureCbTx(if available) or null signature.How Has This Been Tested?
Basically, activated v20 on in the beginning of
feature_llmq_chainlocks.pyBreaking Changes
Yes, new version of CbTx
Checklist:
For repository code-owners and collaborators only