-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Optimistic signature verification for commit votes #14643
Conversation
⏱️ 3h 59m total CI duration on this PR
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
match commit_msg.req.verify(&epoch_state_clone.verifier) { | ||
Ok(_) => { | ||
let _ = tx.unbounded_send(commit_msg); | ||
let _ = tx.unbounded_send((commit_msg, true)); |
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.
nit: Instead of true
and false
, it reads better if you can create an enum for verified
and unverified
and pass them.
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.
Done.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
for vote in unverified_votes { | ||
let author = vote.author(); | ||
let sig = vote.signature_with_status(); | ||
if vote.ledger_info() == commit_ledger_info { |
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.
I don't understand what does this condition mean, if the ledger info doesn't match we should just filter out those signatures?
@@ -95,7 +74,7 @@ fn aggregate_commit_proof( | |||
// we differentiate buffer items at different stages | |||
// for better code readability | |||
pub struct OrderedItem { | |||
pub unverified_signatures: PartialSignatures, | |||
pub unverified_votes: Vec<CommitVote>, |
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.
using vector here loses the guarantee that one author only has one vote in partial signatures, why this is not a ledger info with unverified signatures?
@@ -704,6 +698,17 @@ impl BufferManager { | |||
} | |||
} | |||
|
|||
fn get_commit_message(commit_vote: CommitVote) -> CommitMessage { |
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.
nit: this type of function typically prefix with gen|generate
not get
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
for vote in unverified_votes.values() { | ||
let sig = vote.signature_with_status(); | ||
if vote.ledger_info() == commit_ledger_info { | ||
li_with_sig.add_signature(vote.author(), sig); |
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.
nit: this function signature looks awkward, it should take a ownership of sig instead of a reference and clone inside
@@ -321,7 +321,7 @@ impl Default for ConsensusConfig { | |||
num_bounded_executor_tasks: 16, | |||
enable_pre_commit: true, | |||
max_pending_rounds_in_commit_vote_cache: 100, | |||
optimistic_sig_verification: false, | |||
optimistic_sig_verification: true, |
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.
disable before landing
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
This PR implements optimistic signature verification to reduce the time required to verify commit votes.
When the optimistic signature verification feature flag is enabled, we will not verify these messages up front. We will accumulate the unverified messages, and when the accumulated voting power is higher than a threshold, we will aggregate all the signatures and verify the aggregated signature.
If the verification fails, we need to verify each individual signature. The ValidatorVerifier stores the list of authors that submitted bad messages, and will disable the optimistic signature verification for these malicious voters.
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Key Areas to Review
Checklist