op_revm/constants.rs
1//! Optimism constants used in the Optimism EVM.
2use revm::primitives::{address, Address, U256};
3
4/// The cost of a non-zero byte in the EVM.
5pub const NON_ZERO_BYTE_COST: u64 = 16;
6
7/// The two 4-byte Ecotone fee scalar values are packed into the same storage slot as the 8-byte sequence number.
8/// Byte offset within the storage slot of the 4-byte baseFeeScalar attribute.
9pub const BASE_FEE_SCALAR_OFFSET: usize = 16;
10/// The two 4-byte Ecotone fee scalar values are packed into the same storage slot as the 8-byte sequence number.
11/// Byte offset within the storage slot of the 4-byte blobBaseFeeScalar attribute.
12pub const BLOB_BASE_FEE_SCALAR_OFFSET: usize = 20;
13
14/// The Isthmus operator fee scalar values are similarly packed. Byte offset within
15/// the storage slot of the 4-byte operatorFeeScalar attribute.
16pub const OPERATOR_FEE_SCALAR_OFFSET: usize = 20;
17/// The Isthmus operator fee scalar values are similarly packed. Byte offset within
18/// the storage slot of the 8-byte operatorFeeConstant attribute.
19pub const OPERATOR_FEE_CONSTANT_OFFSET: usize = 24;
20
21/// The fixed point decimal scaling factor associated with the operator fee scalar.
22///
23/// Allows users to use 6 decimal points of precision when specifying the operator_fee_scalar.
24pub const OPERATOR_FEE_SCALAR_DECIMAL: u64 = 1_000_000;
25
26/// The L1 base fee slot.
27pub const L1_BASE_FEE_SLOT: U256 = U256::from_limbs([1u64, 0, 0, 0]);
28/// The L1 overhead slot.
29pub const L1_OVERHEAD_SLOT: U256 = U256::from_limbs([5u64, 0, 0, 0]);
30/// The L1 scalar slot.
31pub const L1_SCALAR_SLOT: U256 = U256::from_limbs([6u64, 0, 0, 0]);
32
33/// [ECOTONE_L1_BLOB_BASE_FEE_SLOT] was added in the Ecotone upgrade and stores the L1 blobBaseFee attribute.
34pub const ECOTONE_L1_BLOB_BASE_FEE_SLOT: U256 = U256::from_limbs([7u64, 0, 0, 0]);
35
36/// As of the ecotone upgrade, this storage slot stores the 32-bit basefeeScalar and blobBaseFeeScalar attributes at
37/// offsets [BASE_FEE_SCALAR_OFFSET] and [BLOB_BASE_FEE_SCALAR_OFFSET] respectively.
38pub const ECOTONE_L1_FEE_SCALARS_SLOT: U256 = U256::from_limbs([3u64, 0, 0, 0]);
39
40/// This storage slot stores the 32-bit operatorFeeScalar and operatorFeeConstant attributes at
41/// offsets [OPERATOR_FEE_SCALAR_OFFSET] and [OPERATOR_FEE_CONSTANT_OFFSET] respectively.
42pub const OPERATOR_FEE_SCALARS_SLOT: U256 = U256::from_limbs([8u64, 0, 0, 0]);
43
44/// An empty 64-bit set of scalar values.
45pub const EMPTY_SCALARS: [u8; 8] = [0u8; 8];
46
47/// The address of L1 fee recipient.
48pub const L1_FEE_RECIPIENT: Address = address!("0x420000000000000000000000000000000000001A");
49
50/// The address of the operator fee recipient.
51pub const OPERATOR_FEE_RECIPIENT: Address = address!("0x420000000000000000000000000000000000001B");
52
53/// The address of the base fee recipient.
54pub const BASE_FEE_RECIPIENT: Address = address!("0x4200000000000000000000000000000000000019");
55
56/// The address of the L1Block contract.
57pub const L1_BLOCK_CONTRACT: Address = address!("0x4200000000000000000000000000000000000015");