@@ -27,6 +27,7 @@ use alloy_evm::{
2727 Database , Evm , EvmFactory , FromRecoveredTx , FromTxWithEncoded ,
2828} ;
2929use alloy_primitives:: { B256 , U256 } ;
30+ use reth_scroll_chainspec:: { ChainConfig , ScrollChainConfig } ;
3031use revm:: {
3132 context:: {
3233 result:: { InvalidTransaction , ResultAndState } ,
@@ -84,7 +85,7 @@ impl<E, R, Spec> ScrollBlockExecutor<E, R, Spec>
8485where
8586 E : EvmExt ,
8687 R : ScrollReceiptBuilder ,
87- Spec : ScrollHardforks + Clone ,
88+ Spec : ScrollHardforks + ChainConfig < Config = ScrollChainConfig > + Clone ,
8889{
8990 /// Creates a new [`ScrollBlockExecutor`].
9091 pub fn new ( evm : E , ctx : ScrollBlockExecutionCtx , spec : Spec , receipt_builder : R ) -> Self {
@@ -110,7 +111,7 @@ where
110111 + FromTxWithCompressionInfo < R :: Transaction > ,
111112 > ,
112113 R : ScrollReceiptBuilder < Transaction : Transaction + Encodable2718 , Receipt : TxReceipt > ,
113- Spec : ScrollHardforks ,
114+ Spec : ScrollHardforks + ChainConfig < Config = ScrollChainConfig > ,
114115{
115116 /// Executes all transactions in a block, applying pre and post execution changes. The provided
116117 /// transaction compression infos are expected to be in the same order as the
@@ -147,7 +148,7 @@ where
147148 Tx : FromRecoveredTx < R :: Transaction > + FromTxWithEncoded < R :: Transaction > ,
148149 > ,
149150 R : ScrollReceiptBuilder < Transaction : Transaction + Encodable2718 , Receipt : TxReceipt > ,
150- Spec : ScrollHardforks ,
151+ Spec : ScrollHardforks + ChainConfig < Config = ScrollChainConfig > ,
151152{
152153 type Transaction = R :: Transaction ;
153154 type Receipt = R :: Receipt ;
@@ -269,6 +270,7 @@ where
269270 // disable the base fee and nonce checks for l1 messages.
270271 self . evm . with_base_fee_check ( !is_l1_message) ;
271272 self . evm . with_nonce_check ( !is_l1_message) ;
273+ self . evm . with_l1_data_fee_buffer_check ( chain_spec. chain_config ( ) . l1_data_fee_buffer_check ) ;
272274
273275 // execute and return the result.
274276 self . evm . transact ( & tx) . map_err ( move |err| BlockExecutionError :: evm ( err, hash) )
@@ -334,6 +336,8 @@ pub trait EvmExt: Evm {
334336 fn with_base_fee_check ( & mut self , enabled : bool ) ;
335337 /// Sets whether the evm should enable or disable the nonce checks.
336338 fn with_nonce_check ( & mut self , enabled : bool ) ;
339+ /// Sets whether the evm should enable or disable the l1 data fee buffer checks.
340+ fn with_l1_data_fee_buffer_check ( & mut self , enabled : bool ) ;
337341 /// Returns the l1 fee for the transaction.
338342 fn l1_fee ( & self ) -> Option < U256 > ;
339343}
@@ -352,6 +356,10 @@ where
352356 self . ctx_mut ( ) . cfg . disable_nonce_check = !enabled;
353357 }
354358
359+ fn with_l1_data_fee_buffer_check ( & mut self , enabled : bool ) {
360+ self . ctx_mut ( ) . cfg . require_l1_data_fee_buffer = enabled;
361+ }
362+
355363 fn l1_fee ( & self ) -> Option < U256 > {
356364 let l1_block_info = & self . ctx ( ) . chain ;
357365 let transaction_rlp_bytes = self . ctx ( ) . tx . rlp_bytes . as_ref ( ) ?;
@@ -368,8 +376,7 @@ where
368376
369377/// Scroll block executor factory.
370378#[ derive( Debug , Clone , Default , Copy ) ]
371- pub struct ScrollBlockExecutorFactory < R , Spec = ScrollHardfork , P = ScrollDefaultPrecompilesFactory >
372- {
379+ pub struct ScrollBlockExecutorFactory < R , Spec , P = ScrollDefaultPrecompilesFactory > {
373380 /// Receipt builder.
374381 receipt_builder : R ,
375382 /// Chain specification.
@@ -404,7 +411,7 @@ impl<R, Spec, P> ScrollBlockExecutorFactory<R, Spec, P> {
404411impl < R , Spec , P > BlockExecutorFactory for ScrollBlockExecutorFactory < R , Spec , P >
405412where
406413 R : ScrollReceiptBuilder < Transaction : Transaction + Encodable2718 , Receipt : TxReceipt > ,
407- Spec : ScrollHardforks ,
414+ Spec : ScrollHardforks + ChainConfig < Config = ScrollChainConfig > + Clone ,
408415 P : ScrollPrecompilesFactory ,
409416 ScrollTransactionIntoTxEnv < TxEnv > :
410417 FromRecoveredTx < R :: Transaction > + FromTxWithEncoded < R :: Transaction > ,
@@ -428,6 +435,6 @@ where
428435 DB : Database + ' a ,
429436 I : Inspector < <Self :: EvmFactory as EvmFactory >:: Context < & ' a mut State < DB > > > + ' a ,
430437 {
431- ScrollBlockExecutor :: new ( evm, ctx, & self . spec , & self . receipt_builder )
438+ ScrollBlockExecutor :: new ( evm, ctx, self . spec . clone ( ) , & self . receipt_builder )
432439 }
433440}
0 commit comments