diff --git a/crates/anvil/src/eth/backend/executor.rs b/crates/anvil/src/eth/backend/executor.rs index d3b54be15355..b13b42eeef3f 100644 --- a/crates/anvil/src/eth/backend/executor.rs +++ b/crates/anvil/src/eth/backend/executor.rs @@ -118,7 +118,7 @@ impl<'a, DB: Db + ?Sized, Validator: TransactionValidator> TransactionExecutor<' let difficulty = self.block_env.difficulty; let beneficiary = self.block_env.coinbase; let timestamp = self.block_env.timestamp.to::(); - let base_fee = if (self.cfg_env.handler_cfg.spec_id as u8) >= (SpecId::LONDON as u8) { + let base_fee = if self.cfg_env.handler_cfg.spec_id >= SpecId::LONDON { Some(self.block_env.basefee.to::()) } else { None @@ -208,6 +208,12 @@ impl<'a, DB: Db + ?Sized, Validator: TransactionValidator> TransactionExecutor<' } fn env_for(&self, tx: &PendingTransaction) -> EnvWithHandlerCfg { + let mut tx_env = tx.to_revm_tx_env(); + if self.cfg_env.handler_cfg.is_optimism { + tx_env.optimism.enveloped_tx = + Some(alloy_rlp::encode(&tx.transaction.transaction).into()); + } + EnvWithHandlerCfg::new_with_cfg_env( self.cfg_env.clone(), self.block_env.clone(), diff --git a/crates/anvil/src/eth/backend/mem/mod.rs b/crates/anvil/src/eth/backend/mem/mod.rs index d1fa2007d04f..810178e75e67 100644 --- a/crates/anvil/src/eth/backend/mem/mod.rs +++ b/crates/anvil/src/eth/backend/mem/mod.rs @@ -838,6 +838,12 @@ impl Backend { > { let mut env = self.next_env(); env.tx = tx.pending_transaction.to_revm_tx_env(); + + if env.handler_cfg.is_optimism { + env.tx.optimism.enveloped_tx = + Some(alloy_rlp::encode(&tx.pending_transaction.transaction.transaction).into()); + } + let db = self.db.read().await; let mut inspector = Inspector::default(); let mut evm = self.new_evm_with_inspector_ref(&*db, env, &mut inspector);