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

Accept out-of-order votes #4327

Closed
wants to merge 10 commits into from
Closed

Accept out-of-order votes #4327

wants to merge 10 commits into from

Conversation

friedger
Copy link
Collaborator

@friedger friedger commented Feb 1, 2024

Description

Currently, .signer-voting rejects votes that are not for the latest round.

This PR removes this restriction. Votes out of round are accepted.

Applicable issues

Additional info (benefits, drawbacks, caveats)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

@friedger friedger changed the base branch from master to next February 1, 2024 15:57
Copy link
Collaborator

@setzeus setzeus left a comment

Choose a reason for hiding this comment

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

Logic change that removes asserting that rounds-check / out-of-order-votes LGTM.

Only have one NIT re: error messages.

Note that we have an consistency in formatting. In pox-4 the error constants are stored as an Int, in this contract, the error constants are stored as (err uint).

No preference for either format but preferable we stick to a single syntax.

Copy link
Member

@MarvinJanssen MarvinJanssen left a comment

Choose a reason for hiding this comment

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

Looks fine to me. The spec requires out-of-order votes?

@saralab saralab requested a review from jcnelson February 2, 2024 14:57
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 34 lines in your changes are missing coverage. Please review.

Comparison is base (2d4d9bd) 72.17% compared to head (1dfc1da) 54.77%.
Report is 3 commits behind head on next.

Files Patch % Lines
...src/chainstate/stacks/boot/signers_voting_tests.rs 0.00% 34 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             next    #4327       +/-   ##
===========================================
- Coverage   72.17%   54.77%   -17.40%     
===========================================
  Files         445      445               
  Lines      317208   317198       -10     
===========================================
- Hits       228945   173757    -55188     
- Misses      88263   143441    +55178     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@friedger
Copy link
Collaborator Author

friedger commented Feb 5, 2024

@jcnelson jcnelson self-requested a review February 5, 2024 18:43
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

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

Putting a hold on this for the time being; it's not ready to merge. Will update with more details later.

Copy link
Contributor

@hstove hstove left a comment

Choose a reason for hiding this comment

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

Other than a few nits, I think this test should evaluate the contract state after the TX's are confirmed (via read-only calls)


// first vote should succeed
let tx1 = &receipts[receipts.len() - 2];
let tx1 = &receipts[receipts.len() - 3];
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it's better to use explicit nonces to avoid these kind of off-by-one errors

@@ -350,7 +359,7 @@ fn vote_for_aggregate_public_key_in_last_block() {
);

// second vote should fail with duplicate vote error
let tx2 = &receipts[receipts.len() - 1];
let tx2 = &receipts[receipts.len() - 2];
Copy link
Contributor

Choose a reason for hiding this comment

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

Also better to use explicit names for the tx instead of tx2. I'd have to read too much into the test just to find out what tx this is testing

Comment on lines 375 to 378
Value::Response(ResponseData {
committed: true,
data: Box::new(Value::Bool(true))
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Value::Response(ResponseData {
committed: true,
data: Box::new(Value::Bool(true))
})
Value::okay_true()

Copy link
Contributor

Choose a reason for hiding this comment

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

Also it's not this PR's code but Value::error(Value::UInt(10002)).unwrap() for errors

@obycode
Copy link
Contributor

obycode commented Feb 12, 2024

These changes are now included in #4360.

@obycode obycode closed this Feb 12, 2024
@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[clarity] .signer-voting need to accept out of round votes
7 participants