diff --git a/crates/ee-tests/src/op_revm_tests.rs b/crates/ee-tests/src/op_revm_tests.rs index fa0c6b1244..a48dd2aedb 100644 --- a/crates/ee-tests/src/op_revm_tests.rs +++ b/crates/ee-tests/src/op_revm_tests.rs @@ -1134,11 +1134,9 @@ fn test_system_call() { let mut evm = ctx.build_op(); - evm.system_call_one(SYSTEM_ADDRESS, BENCH_TARGET, bytes!("0x0001")) - .unwrap(); - - // Run evm. - let output = evm.replay().unwrap(); + let _ = evm.system_call_one(SYSTEM_ADDRESS, BENCH_TARGET, bytes!("0x0001")); + let state = evm.finalize(); - compare_or_save_op_testdata("test_system_call.json", &output); + assert!(state.get(&SYSTEM_ADDRESS).is_none()); + assert!(state.get(&BENCH_TARGET).unwrap().is_touched()); } diff --git a/crates/op-revm/src/handler.rs b/crates/op-revm/src/handler.rs index 4d4a6d00ec..f00414ec50 100644 --- a/crates/op-revm/src/handler.rs +++ b/crates/op-revm/src/handler.rs @@ -1109,4 +1109,37 @@ mod tests { let account = evm.ctx().journal_mut().load_account(SENDER).unwrap(); assert_eq!(account.info.balance, expected_refund); } + + #[test] + fn test_tx_low_balance_nonce_unchanged() { + let ctx = Context::op().with_tx( + OpTransaction::builder() + .base(TxEnv::builder().value(U256::from(1000))) + .build_fill(), + ); + + let mut evm = ctx.build_op(); + + let handler = + OpHandler::<_, EVMError<_, OpTransactionError>, EthFrame>::new(); + + let result = handler.validate_against_state_and_deduct_caller(&mut evm); + + assert!(matches!( + result.err().unwrap(), + EVMError::Transaction(OpTransactionError::Base( + InvalidTransaction::LackOfFundForMaxFee { .. } + )) + )); + assert_eq!( + evm.0 + .ctx + .journal_mut() + .load_account(Address::ZERO) + .unwrap() + .info + .nonce, + 0 + ); + } }