-
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
Verify consensus message author matches with the sender #15386
base: main
Are you sure you want to change the base?
Conversation
⏱️ 3h 27m 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.
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.
consensus/src/epoch_manager.rs
Outdated
@@ -1512,6 +1513,46 @@ impl<P: OnChainConfigProvider> EpochManager<P> { | |||
Ok(()) | |||
} | |||
|
|||
fn check_author(&mut self, peer_id: AccountAddress, msg: &ConsensusMsg) -> anyhow::Result<()> { |
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.
Since this a bug fix, how about a test that verifies the bug is actually fixed ?
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.
consensus/src/epoch_manager.rs
Outdated
@@ -1446,6 +1446,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> { | |||
BlockStage::EPOCH_MANAGER_RECEIVED, | |||
); | |||
} | |||
self.check_author(peer_id, &consensus_msg)?; |
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.
Wondering if this should be part of the UnverifiedEvent.verify
check to keep them all in one place @zekun000 .
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.
Moved the sender verification checks to individual verify functions.
consensus/src/epoch_manager.rs
Outdated
ConsensusMsg::CommitVoteMsg(commit_vote) => Some(commit_vote.author()), | ||
ConsensusMsg::BatchMsg(batch) => batch.author(), | ||
ConsensusMsg::RoundTimeoutMsg(round_timeout) => Some(round_timeout.author()), | ||
ConsensusMsg::BatchResponse(batch_response) => Some(batch_response.author()), |
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 think this works too, even this doesn't go through this path (it goes through rpc), this is the batch author which is not necessarily the responser.
consensus/src/epoch_manager.rs
Outdated
ConsensusMsg::RoundTimeoutMsg(round_timeout) => Some(round_timeout.author()), | ||
ConsensusMsg::BatchResponse(batch_response) => Some(batch_response.author()), | ||
ConsensusMsg::BatchRequestMsg(batch_request) => Some(batch_request.source()), | ||
ConsensusMsg::SignedBatchInfo(sign_batch_info) => sign_batch_info.author(), |
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.
it also feels awkward to only check the first author, probably better to have this check to individual verify function instead of here
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.
Yes. The verify function already checks the author here for each individual signed batch info. So, I originally ignored the author check here by setting author to None
. Should I revert it back?
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 mean instead of having this giant check_author function, check the author inside each individual message's verify function or the UnverifiedEvent::verify function as Balaji mentioned above
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.
Moved the sender verification checks to individual verify functions.
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
|
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
Description
How Has This Been Tested?
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist