paradigmxyz / reth

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

Move revm config from PayloadConfig down to PayloadBuilder #10446

Open mattsse opened 3 weeks ago

mattsse commented 3 weeks ago

we currently have the cfg and block env setup as part of the payloadattributes types

https://github.com/paradigmxyz/reth/blob/a942467656620836da037fc27cb8057dabf1f98a/crates/payload/primitives/src/traits.rs#L73-L86

this makes it impossible to modify while reusing OptimismPayloadBuilderAttributes for example.

most of this functionality is already provided by the ConfigureEvmEnv trait anyway, so creating cfg and block env should be moved down to the payload builder itself which has access to this

TODO

onbjerg commented 3 weeks ago

Context: Currently for op-reth the evm is configured in ConfigureEvmEnv for general execution, which internally uses revm_spec (defined in reth-evm-optimism under src/config.rs) to determine the spec ID for the EVM.

However, the payload builder configures this in PayloadBuilderAttributes::cfg_and_block_env implemented on OptimismPayloadBuilderAttributes which internally uses a separate function called revm_spec_by_timestamp_after_bedrock (similarly defined in reth-evm-optimism), making it hard to override supported forks in custom op setups (e.g. Alphanet).

garwahl commented 3 weeks ago

Hey @mattsse I can pick this one up, feel free to assign this to me