-
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
[Consensus Observer] Add block payload verification. #14027
Conversation
7751ad2
to
625a4a3
Compare
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.
00e3c28
to
c118b2c
Compare
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.
c118b2c
to
96ea9e2
Compare
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.
96ea9e2
to
442ea17
Compare
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.
6fab6e1
to
423f631
Compare
795b301
to
da0b809
Compare
}, | ||
}; | ||
|
||
// Verify the payload and inline batches before returning the data. The |
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.
FYI: this (final) verification logic will be moved into consensus observer in the next PR (after we clean up the ordered block verification) 😄
da0b809
to
ae940e9
Compare
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.
pub transactions: Vec<SignedTransaction>, | ||
pub limit: Option<u64>, | ||
pub proof_with_data: ProofWithData, |
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.
this format looks weird, maybe we should have similar enum like Payload? (proof_with_data can carry the actual dat in the data status)
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.
Sounds good! I'll follow up in the next PR (just to unblock this one) 😄
.transactions | ||
.iter() | ||
.cloned() | ||
.collect::<VecDeque<_>>(); |
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.
this doesn't have to be a VecDeque? just a regular iterator should work?
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.
Good spot, yes 😄
|
||
// Verify each of the proof signatures | ||
let validator_verifier = &epoch_state.verifier; | ||
for proof_of_store in &self.transaction_payload.proof_with_data.proofs { |
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 may need to parallelize this, I remember it takes ~200ms to verify big block before
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.
Sounds good. I'll add a comment and then follow up 😄
|
||
// If the payload is for the current epoch, verify the proof signatures | ||
let epoch_state = self.get_epoch_state(); | ||
let verified_payload = if block_epoch == epoch_state.epoch { |
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.
not sure if it's too much complexity to handle messages across epoch. we can state sync after joining the new epoch and then buffer messages from the same epoch
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.
Yeah, I originally started with this, but it turns out to be pretty bad when running at max load across the epoch boundaries. The nodes fall behind and take a while to catch up (spiking the e2e latency). But, we can see how this performs and maybe simplify it if we feel the need (epoch changes are more frequent in our tests) 😄
/// Removes the committed blocks from the payload store | ||
pub fn remove_committed_blocks(&self, committed_blocks: &[Arc<PipelinedBlock>]) { | ||
// Identify the highest epoch and round for the committed blocks | ||
let (highest_epoch, highest_round) = committed_blocks |
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 should be the last one without needing to iterate
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.
Aah, good spot -- yeah, the blocks should already be verified here. 😄
ae940e9
to
6644003
Compare
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
|
Note: most of this code is new unit tests.
Description
This PR makes several improvements to consensus observer. Specifically, it offers the following commits:
reset()
method to the execution client trait. This method is already provided internally bysync_to
and we want to expose it so that we can call it directly whenever consensus observer needs to reset execution state (e.g., on subscription changes).Once this lands, there's a few cleanups and simplifications to be done. I'll have those in the next PR.
Testing Plan
New and existing test infrastructure.