-
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
fix(tree): retain max(additional, max_reorg_depth)
block hashes
#4612
Conversation
…epth)` block hashes
max(additional_canonical_block_hashes, max_reorg_depth)
block hashesmax(additional, max_reorg_depth)
block hashes
Codecov Report
... and 13 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.
hmm, I get 64+256 but why the tree needs this I'm not convinced, because they should still be in the database and therefore available during execution?
seconding matt, if the block is not covered by max_reorg_depth, then it is present in the db |
@rakita I can't find the place where we check the cache in implementations of |
We clone the hashmap, as it is small, and use it inside I think |
…anonical-block-hashes
ah, I was still looking at the outdated revm API 😄 I see it now, thanks. |
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.
okay, I get it now,
my issue was that it wasn't obvious to me where we're passing the canonical hashes to the state provider.
I think worth adding a note to this type as well
reth/crates/blockchain-tree/src/canonical_chain.rs
Lines 4 to 12 in d846199
/// This keeps track of all blocks of the canonical chain. | |
/// | |
/// This is a wrapper type around an ordered set of block numbers and hashes that belong to the | |
/// canonical chain. | |
#[derive(Debug, Clone, Default)] | |
pub(crate) struct CanonicalChain { | |
/// All blocks of the canonical chain in order. | |
chain: BTreeMap<BlockNumber, BlockHash>, | |
} |
…anonical-block-hashes
…anonical-block-hashes
The actual number of canonical hashes we need to retain in memory is the maximum of how many is required for reorg (64) and for EVM execution (256). So it's 256.