Skip to main content

Module access_list

Module access_list 

Source
Expand description

EIP-2930 access list builder with L2 profitability accounting.

The caller supplies the addresses and storage slots to include; this module decides whether attaching the list is profitable, not which slots are interesting (it carries no protocol-specific slot knowledge). The trade-off is purely economic: pre-declaring an account/slot warms it (cheaper EIP-2929 execution) but costs L1 data to post the list. Slots whose serialized form is mostly zero bytes (e.g. small, low-entropy values) are cheap to post; dense, high-entropy 32-byte keys are expensive on L1 — so the value of a given entry depends on its bytes, which is why the include/exclude decision is left to the caller and the profitability check below.

On L2, automatically disables itself when L1 fees rise high enough that the L1 data cost exceeds the L2 execution savings. Arbitrum uses ArbGasInfo pricing with exact EIP-2930 RLP data gas; OP Stack chains use GasPriceOracle.getL1Fee(bytes) to compare whole transactions with and without the access list.

On L1 (Ethereum): Access lists always save gas (no L1 data posting overhead), so use into_access_list_always() to skip the profitability check.

Modules§

ArbGasInfo
Module containing a contract’s types and functions.
OpGasPriceOracle
Module containing a contract’s types and functions.

Structs§

SmartAccessList
An EIP-2930 access list builder with L2 profitability accounting.

Enums§

AccessListPricing
Pricing inputs used when deciding whether to include a simulation access list.
ChainType
Chain fee model used by helpers that only need to identify the chain’s L1 base-fee oracle.

Constants§

OP_GAS_PRICE_ORACLE
Optimism GasPriceOracle predeploy (Bedrock+).

Functions§

access_list_if_profitable
Evaluate whether an existing access list is profitable on Arbitrum.
access_list_rlp_data_gas
Exact L1 calldata gas for the EIP-2930 RLP encoding of an access list.
apply_access_list
Filter already-warm and excluded addresses from an access list, then apply it to the transaction request.
compute_op_l1_fee
Compute the OP stack L1 data fee for a given transaction calldata.
l1_data_gas_for_bytes
L1 calldata gas for a byte slice: zero bytes = 4 gas, non-zero = 16 gas.
query_l1_base_fee_for_chain
Query the current L1 base fee estimate, dispatching to the correct predeploy based on chain type. Returns U256::ZERO for L1 chains or on failure.
resolve_access_list
Select the appropriate access list strategy based on pricing inputs.