@@ -11,7 +11,7 @@ use crate::{
1111 utils:: {
1212 a2r_withdrawal,
1313 constants:: BASE_TX_GAS ,
14- default_cfg_env , elapsed_ms,
14+ elapsed_ms,
1515 receipts:: {
1616 calculate_receipts_data, calculate_tx_root_and_placeholder_proof, ReceiptsData ,
1717 ReceiptsDataCache , TransactionRootCache ,
@@ -55,9 +55,7 @@ use reth_payload_builder::EthPayloadBuilderAttributes;
5555use reth_primitives:: BlockBody ;
5656use reth_primitives_traits:: { proofs, Block as _} ;
5757use revm:: {
58- context:: BlockEnv ,
59- context_interface:: { block:: BlobExcessGasAndPrice , result:: InvalidTransaction } ,
60- database:: states:: bundle_state:: BundleRetention ,
58+ context_interface:: result:: InvalidTransaction , database:: states:: bundle_state:: BundleRetention ,
6159 primitives:: hardfork:: SpecId ,
6260} ;
6361use serde:: Deserialize ;
@@ -252,37 +250,12 @@ impl BlockBuildingContext {
252250 mev_blocker_price : U256 ,
253251 ) -> BlockBuildingContext {
254252 let block_number = onchain_block. header . number ;
255-
256- let blob_excess_gas_and_price =
257- if chain_spec. is_cancun_active_at_timestamp ( onchain_block. header . timestamp ) {
258- Some ( BlobExcessGasAndPrice :: new (
259- onchain_block. header . excess_blob_gas . unwrap_or_default ( ) ,
260- chain_spec
261- . blob_params_at_timestamp ( onchain_block. header . timestamp )
262- . unwrap_or ( BlobParams :: cancun ( ) )
263- . update_fraction
264- . try_into ( )
265- . expect ( "update_fraction too large for u64" ) ,
266- ) )
267- } else {
268- None
269- } ;
270- let block_env = BlockEnv {
271- number : U256 :: from ( block_number) ,
272- beneficiary,
273- timestamp : U256 :: from ( onchain_block. header . timestamp ) ,
274- difficulty : onchain_block. header . difficulty ,
275- prevrandao : Some ( onchain_block. header . mix_hash ) ,
276- basefee : onchain_block
277- . header
278- . base_fee_per_gas
279- . expect ( "Failed to get basefee" ) , // TODO: improve
280- gas_limit : onchain_block. header . gas_limit ,
281- blob_excess_gas_and_price,
282- } ;
283- let cfg = default_cfg_env ( & chain_spec, timestamp_as_u64 ( & onchain_block) , block_number) ;
284- // @TODO: revise
285- let evm_env = EvmEnv :: from ( ( cfg, block_env) ) ;
253+ let eth_evm_config = EthEvmConfig :: new ( chain_spec. clone ( ) ) ;
254+ let mut evm_env = eth_evm_config
255+ . evm_env ( & onchain_block. header )
256+ . expect ( "evm env config" ) ;
257+ evm_env. block_env . beneficiary = beneficiary;
258+ assert_eq ! ( evm_env. block_env. number, U256 :: from( block_number) ) ;
286259
287260 let withdrawals = Withdrawals :: new (
288261 onchain_block
0 commit comments