@@ -14,12 +14,16 @@ use revm::{
1414 result:: { EVMError , ExecutionResult , HaltReason , InvalidTransaction , ResultAndState } ,
1515 ContextTr , JournalTr ,
1616 } ,
17+ context_interface:: result:: ExecutionResult :: Halt ,
1718 handler:: { EthFrame , EvmTr , FrameResult , Handler } ,
18- interpreter:: { CallOutcome , Gas , InstructionResult , InterpreterResult } ,
19+ interpreter:: {
20+ gas:: calculate_initial_tx_gas_for_tx, CallOutcome , Gas , InstructionResult ,
21+ InterpreterResult ,
22+ } ,
1923 state:: Bytecode ,
2024 ExecuteEvm ,
2125} ;
22- use revm_primitives:: U256 ;
26+ use revm_primitives:: { bytes , hardfork :: SpecId , U256 } ;
2327
2428#[ test]
2529fn test_l1_message_validate_lacking_funds ( ) -> Result < ( ) , Box < dyn core:: error:: Error > > {
@@ -210,3 +214,28 @@ fn test_l1_message_eip_3607() -> Result<(), Box<dyn core::error::Error>> {
210214
211215 Ok ( ( ) )
212216}
217+
218+ #[ test]
219+ fn test_l1_message_should_not_have_floor_gas_as_gas_used ( ) -> Result < ( ) , Box < dyn core:: error:: Error > >
220+ {
221+ let ctx =
222+ context ( ) . modify_cfg_chained ( |cfg| cfg. enable_eip7623 = true ) . modify_tx_chained ( |tx| {
223+ tx. base . data =
224+ bytes ! ( "0x000000000123456789abcdef00000000123456789abcdef00000000123456789abcdef" ) ;
225+ tx. base . tx_type = L1_MESSAGE_TYPE ;
226+ tx. base . caller = CALLER ;
227+ tx. base . gas_limit = 200000 ;
228+ tx. base . value = U256 :: ONE ;
229+ } ) ;
230+ let tx = ctx. tx . clone ( ) ;
231+ let mut evm = ctx. build_scroll ( ) ;
232+ let res = evm. transact ( tx. clone ( ) ) ?;
233+
234+ // floor gas is TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata + 21_000 = 22070;
235+ let expected_init_gas =
236+ calculate_initial_tx_gas_for_tx ( tx, SpecId :: SHANGHAI , true , true ) . initial_gas ;
237+
238+ assert_eq ! ( res. result, Halt { reason: HaltReason :: OutOfFunds , gas_used: expected_init_gas } ) ;
239+
240+ Ok ( ( ) )
241+ }
0 commit comments