Skip to content

Commit c4a5004

Browse files
authored
Merge pull request #27 from mantle-xyz/fix/op-revm-bvm-eth-deposit-cold-reset
fix(op-revm): reset BVM_ETH to cold after deposit mint to match op-geth
2 parents 56aee9a + 244f2cd commit c4a5004

4 files changed

Lines changed: 1257 additions & 407 deletions

File tree

crates/op-revm/src/api/exec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Implementation of the [`ExecuteEvm`] trait for the [`OpEvm`].
22
use crate::{
3-
evm::OpEvm, handler::OpHandler, transaction::OpTxTr, L1BlockInfo, OpHaltReason, OpSpecId,
4-
OpTransactionError,
3+
evm::OpEvm, handler::OpHandler, transaction::bvm_eth::JournalColdExt, transaction::OpTxTr,
4+
L1BlockInfo, OpHaltReason, OpSpecId, OpTransactionError,
55
};
66
use revm::{
77
context::{result::ExecResultAndState, ContextSetters},
@@ -25,7 +25,7 @@ use revm::{
2525
/// Type alias for Optimism context
2626
pub trait OpContextTr:
2727
ContextTr<
28-
Journal: JournalTr<State = EvmState>,
28+
Journal: JournalTr<State = EvmState> + JournalColdExt,
2929
Tx: OpTxTr,
3030
Cfg: Cfg<Spec = OpSpecId>,
3131
Chain = L1BlockInfo,
@@ -35,7 +35,7 @@ pub trait OpContextTr:
3535

3636
impl<T> OpContextTr for T where
3737
T: ContextTr<
38-
Journal: JournalTr<State = EvmState>,
38+
Journal: JournalTr<State = EvmState> + JournalColdExt,
3939
Tx: OpTxTr,
4040
Cfg: Cfg<Spec = OpSpecId>,
4141
Chain = L1BlockInfo,

crates/op-revm/src/constants.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,3 @@ pub const GAS_ORACLE_CONTRACT: Address = address!("42000000000000000000000000000
7474

7575
/// The address of the sequencer fee wallet, which is block coinbase.
7676
pub const SEQUENCER_FEE_VAULT_ADDRESS: Address = address!("4200000000000000000000000000000000000011");
77-
78-
/// Gas compensation for BVM_ETH mint operations to align with go-ethereum behavior.
79-
///
80-
/// This constant compensates for the gas calculation difference between REVM and go-ethereum
81-
/// when handling BVM_ETH state operations. The value of 4500 is derived from EIP-2929 access
82-
/// list gas costs:
83-
/// - Account access difference: 2500 (cold: 2600, warm: 100)
84-
/// - Storage slot access difference: 2000 (cold: 2100, warm: 100)
85-
///
86-
/// REVM marks BVM_ETH account and storage slots as warm during mint/transfer operations,
87-
/// while go-ethereum keeps them cold. When subsequent EVM execution accesses BVM_ETH,
88-
/// this compensation ensures consistent gas consumption.
89-
pub const BVM_ETH_MINT_GAS_COMPENSATION: u64 = 4500;

0 commit comments

Comments
 (0)