paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.99k stars 1.21k forks source link

refactor: unify logic for blocks removal #12743

Closed klkvr closed 8 hours ago

klkvr commented 14 hours ago

Builds on top of https://github.com/paradigmxyz/reth/pull/12741

Similarly to https://github.com/paradigmxyz/reth/pull/12694 this unifies code paths for block removal.

Bodies removal is handled in remove_bodies_above method which is called directly in BodyStage. During live sync the blocks removal is now handled through remove_blocks_above method which is similar to remove_block_range which is now removed.

take_block_range is also removed and its usage in take_block_and_execution_range is replaced with a call to sealed_block_with_senders_range followed by remove_blocks_above

Block removal methods now also operate on StorageLocation enum.

The two additional changes are: