Skip to main content

revm_primitives/
eip8037.rs

1//! EIP-8037: State Creation Gas Cost Increase
2//!
3//! Introduces a reservoir model that separates *state gas* (storage/code/account
4//! creation) from *regular* execution gas. State-gas charges are expressed as
5//! a number of "state bytes" that get multiplied by `cost_per_state_byte` (CPSB).
6//! In `bal-devnet-7` / Glamsterdam, CPSB is fixed at `1530`.
7
8/// Blocks per year at a 12-second block time (used by the CPSB formula).
9pub const BLOCKS_PER_YEAR: u64 = 2_628_000;
10
11/// Target yearly state growth budget, in bytes.
12pub const TARGET_STATE_GROWTH_PER_YEAR: u64 = 100 * 1024 * 1024 * 1024;
13
14/// Offset subtracted after rounding in the CPSB formula.
15pub const CPSB_OFFSET: u64 = 9578;
16
17/// Number of high-order bits retained when rounding CPSB.
18pub const CPSB_SIGNIFICANT_BITS: u32 = 5;
19
20/// State bytes charged per SSTORE 0→non-zero.
21pub const SSTORE_SET_BYTES: u64 = 64;
22
23/// State bytes charged when creating a new account.
24pub const NEW_ACCOUNT_BYTES: u64 = 120;
25
26/// State bytes charged per EIP-7702 authorization base cost.
27pub const AUTH_BASE_BYTES: u64 = 23;
28
29/// State bytes charged per byte of deployed code.
30pub const CODE_DEPOSIT_PER_BYTE: u64 = 1;
31
32/// Regular gas component of EIP-7702 `PER_EMPTY_ACCOUNT_COST` under EIP-8037.
33pub const EIP7702_PER_EMPTY_ACCOUNT_REGULAR: u64 = 7500;
34
35/// Cost per state byte (CPSB) for Glamsterdam.
36///
37/// Reference: [EIP-8037: State Creation Gas Cost Increase](https://eips.ethereum.org/EIPS/eip-8037).
38pub const CPSB_GLAMSTERDAM: u64 = 1530;