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 Jovian daFootprintGasScalar value is packed into a single storage slot. Byte offset within
22/// the storage slot of the 16-byte daFootprintGasScalar attribute.
23pub const DA_FOOTPRINT_GAS_SCALAR_OFFSET: usize = 0;
24
25/// The fixed point decimal scaling factor associated with the operator fee scalar.
26///
27/// Allows users to use 6 decimal points of precision when specifying the operator_fee_scalar.
28pub const OPERATOR_FEE_SCALAR_DECIMAL: u64 = 1_000_000;
29
30/// The Jovian multiplier applied to the operator fee scalar component.
31pub const OPERATOR_FEE_JOVIAN_MULTIPLIER: u64 = 100;
32
33/// The L1 base fee slot.
34pub const L1_BASE_FEE_SLOT: U256 = U256::from_limbs([1u64, 0, 0, 0]);
35/// The L1 overhead slot.
36pub const L1_OVERHEAD_SLOT: U256 = U256::from_limbs([5u64, 0, 0, 0]);
37/// The L1 scalar slot.
38pub const L1_SCALAR_SLOT: U256 = U256::from_limbs([6u64, 0, 0, 0]);
39
40/// [ECOTONE_L1_BLOB_BASE_FEE_SLOT] was added in the Ecotone upgrade and stores the L1 blobBaseFee attribute.
41pub const ECOTONE_L1_BLOB_BASE_FEE_SLOT: U256 = U256::from_limbs([7u64, 0, 0, 0]);
42
43/// As of the ecotone upgrade, this storage slot stores the 32-bit basefeeScalar and blobBaseFeeScalar attributes at
44/// offsets [BASE_FEE_SCALAR_OFFSET] and [BLOB_BASE_FEE_SCALAR_OFFSET] respectively.
45pub const ECOTONE_L1_FEE_SCALARS_SLOT: U256 = U256::from_limbs([3u64, 0, 0, 0]);
46
47/// This storage slot stores the 32-bit operatorFeeScalar and operatorFeeConstant attributes at
48/// offsets [OPERATOR_FEE_SCALAR_OFFSET] and [OPERATOR_FEE_CONSTANT_OFFSET] respectively.
49pub const OPERATOR_FEE_SCALARS_SLOT: U256 = U256::from_limbs([8u64, 0, 0, 0]);
50
51/// As of the Jovian upgrade, this storage slot stores the 32-bit daFootprintGasScalar attribute at
52/// offset [DA_FOOTPRINT_GAS_SCALAR_OFFSET].
53pub const DA_FOOTPRINT_GAS_SCALAR_SLOT: U256 = U256::from_limbs([9u64, 0, 0, 0]);
54
55/// An empty 64-bit set of scalar values.
56pub const EMPTY_SCALARS: [u8; 8] = [0u8; 8];
57
58/// The address of L1 fee recipient.
59pub const L1_FEE_RECIPIENT: Address = address!("0x420000000000000000000000000000000000001A");
60
61/// The address of the operator fee recipient.
62pub const OPERATOR_FEE_RECIPIENT: Address = address!("0x420000000000000000000000000000000000001B");
63
64/// The address of the base fee recipient.
65pub const BASE_FEE_RECIPIENT: Address = address!("0x4200000000000000000000000000000000000019");
66
67/// The address of the L1Block contract.
68pub const L1_BLOCK_CONTRACT: Address = address!("0x4200000000000000000000000000000000000015");