-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor(engine, tree): connect buffered blocks on pruner finish #4613
Conversation
1c62f61
to
458e3b9
Compare
Codecov Report
... and 9 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
what does this fix exactly?
/// `N` is the `max_reorg_depth` plus the number of block hashes needed to satisfy the | ||
/// `BLOCKHASH` opcode in the EVM. |
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 why we need this?
why do we need to store additional canonical hashes intended for execution in the tree?
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.
from my other PR, if I'm not mistaken:
reth/crates/blockchain-tree/src/config.rs
Lines 78 to 82 in 9fde694
/// It is calculated as the maximum of `max_reorg_depth` (which is the number of blocks required | |
/// for the deepest reorg possible according to the consensus protocol) and | |
/// `num_of_additional_canonical_block_hashes` (which is the number of block hashes needed to | |
/// satisfy the `BLOCKHASH` opcode in the EVM. See [`crate::BundleStateDataRef::block_hash`] and | |
/// [`crate::AppendableChain::new_canonical_head_fork`] where it's used). |
@mattsse when we finish the pruner, we need to connect the blocks buffered during the pruning. We've already been doing it, but also doing this reth/crates/blockchain-tree/src/blockchain_tree.rs Lines 775 to 783 in 458e3b9
In case of scenario when the pipeline run is finished, we need to check the canonical hashes in database because they might've been changed: reth/crates/consensus/beacon/src/engine/mod.rs Lines 1326 to 1343 in 11f5f3f
It wasn't a bug, we just did an unnecessary work and used one function for both cases (pipeline & pruner) which might be confusing. |
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.
lgmt, I like this naming better
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.
lgtm
69d88bc
to
33123ae
Compare
Two main changes:
restore_canonical_hashes
, because we only need the buffered blocks part when pruner finishes.restore_canonical_hashes
toconnect_buffered_blocks_to_canonical_hashes
andrestore_canonical_hashes_and_finalize
toconnect_buffered_blocks_to_canonical_hashes_and_finalize
accordingly.