Skip to content
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

feat!: calculate quorum members using v20 cbtx clsig #5366

Merged
merged 10 commits into from May 17, 2023

Conversation

ogabrielides
Copy link
Collaborator

@ogabrielides ogabrielides commented May 10, 2023

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:

  • 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)

@ogabrielides ogabrielides marked this pull request as draft May 10, 2023 12:08
@ogabrielides ogabrielides added this to the 20 milestone May 10, 2023
@ogabrielides ogabrielides marked this pull request as ready for review May 10, 2023 13:44
@ogabrielides ogabrielides marked this pull request as draft May 11, 2023 07:08
@ogabrielides ogabrielides marked this pull request as ready for review May 11, 2023 17:35
src/evo/cbtx.cpp Outdated Show resolved Hide resolved
src/llmq/utils.cpp Outdated Show resolved Hide resolved
@ogabrielides ogabrielides requested a review from UdjinM6 May 15, 2023 15:45
UdjinM6
UdjinM6 previously approved these changes May 15, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

src/llmq/utils.cpp Outdated Show resolved Hide resolved
UdjinM6
UdjinM6 previously approved these changes May 16, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

src/llmq/utils.cpp Outdated Show resolved Hide resolved
@ogabrielides ogabrielides requested a review from UdjinM6 May 17, 2023 15:02
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a 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

@UdjinM6 please post reack.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, re-utACK

@UdjinM6 UdjinM6 merged commit 9eee9ee into dashpay:develop May 17, 2023
7 of 8 checks passed
UdjinM6 added a commit that referenced this pull request May 20, 2023
## Issue being fixed or feature implemented
We use `pQuorumBaseBlockIndex` name when we shouldn't and we don't check
that quorum types and block indexes provided as input params in llmq
utils satisfy our requirements. This is kind of ok-ish as long as we use
these functions appropriately but it's better to make things clearer and
to have actual checks imo.

noticed this while reviewing #5366 

## What was done?
Rename `pQuorumBaseBlockIndex` to `pCycleQuorumBaseBlockIndex`/`pindex`
in a few places. Check that quorum types and block indexes have expected
values.

## How Has This Been Tested?
run tests locally

## 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 _(for repository
code-owners and collaborators only)_
@ogabrielides ogabrielides deleted the cbtx_clsig_quorum_members branch June 20, 2023 08:14
PastaPastaPasta added a commit that referenced this pull request Jul 10, 2023
## Issue being fixed or feature implemented
Implementation of Randomness Beacon Part 3.

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)

The actual new way to shuffle is already implemented in
#5366.

SPV clients also need to calculate members, but they only know block
headers.
Since Coinbase is in the actual block, then they lack the required
information to correctly calculate quorum members.

## What was done?
- Message `MNLISTIDFF` is enriched with a new field `quorumsCLSigs`.
This field holds the Chainlock Signature required for each set of
indexes corresponding to quorums in field `newQuorums`.
-  Protocol version has been bumped to `70230`.
- Clients with protocol version greater or equal to `70230` will receive
the new field `quorumsCLSigs`.
- The same field is returned in `protx diff` RPC.

Note:
- Field `quorumsCLSigs` will populated only after v20 activation
- If for one or more quorums, no non-null CL sig was found in CbTx then
a null signature is returned in `quorumsCLSigs`.

## How Has This Been Tested?
- Functional test mininode's protocol version was bumped to `70230`.
- `feature_llmq_rotation.py` checks that `quorumsCLSigs` match in both
P2P and RPC messages.

## Breaking Changes
No

## 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
- [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: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants