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(storage): unify blocks insertion logic #12694

Closed klkvr closed 1 day ago

klkvr commented 2 days ago

Updates UnifiedStorageWriter to reuse code paths from BodyStage for blocks writing. This is done by extending BlockWriter methods with an additional write_transactions_to parameter: https://github.com/paradigmxyz/reth/blob/b8980e5982e1d16adadee00230c090f39d8076be/crates/storage/provider/src/traits/block.rs#L67-L71 https://github.com/paradigmxyz/reth/blob/b8980e5982e1d16adadee00230c090f39d8076be/crates/storage/provider/src/traits/block.rs#L10-L19

Same can be done with headers and receipts as well

This required a drive-by change of making SealedBlockWithSenders generic over header and body like SealedBlock

klkvr commented 1 day ago

pending @joshieDo