Skip to main content

Module utils

Module utils 

Source

Structs§

IntrinsicGas
Precomputed intrinsic-gas components for a transaction.

Functions§

account_to_levm_account
Converts Account to LevmAccount The problem with this is that we don’t have the storage root.
address_to_word
Converts address (H160) to word (U256)
calculate_blob_gas_cost
Calculate the actual blob gas cost.
calculate_create2_address
Calculates the address of a new contract using the CREATE2 opcode as follows
code_has_delegation
create_burn_log
Creates EIP-7708 Burn log (LOG2) for ETH burns. Emitted from SYSTEM_ADDRESS when ETH is burned (e.g. via SELFDESTRUCT).
create_eth_transfer_log
Creates EIP-7708 Transfer log (LOG3) for ETH transfers. Emitted from SYSTEM_ADDRESS when ETH is transferred.
eip7702_get_code
Gets code of an account, returning early if it’s not a delegated account, otherwise Returns tuple (is_delegated, eip7702_cost, code_address, code). Notice that it also inserts the delegated account to the “accessed accounts” set.
eip7702_peek_delegation
First half of eip7702_get_code: read address’s code and detect a delegation designation WITHOUT touching the delegate account.
eip7702_recover_address
get_authorized_address_from_code
Gets the address inside the bytecode if it has been delegated as the EIP7702 determines.
get_base_fee_per_blob_gas
get_max_blob_gas_price
Gets the max blob gas cost for a transaction that a user is willing to pay.
intrinsic_gas_dimensions
Compute (regular, state) intrinsic gas for a transaction without needing a full VM instance. Mirrors VM::get_intrinsic_gas but operates on the raw transaction, fork, and block gas limit (for cpsb derivation). Pre-Amsterdam returns (regular, 0).
intrinsic_gas_floor
Standalone EIP-7623/7976/7981 floor gas for a transaction. Mirrors VM::get_min_gas_used but operates on the raw transaction + fork, so it can be called by mempool admission / the payload builder without needing a VM instance. Returns TX_BASE_COST + floor_rate * total_floor_tokens.
restore_cache_state
Restore the state of the cache to the state it in the callframe backup. Also restores BAL recorder state changes (but not touched_addresses) per EIP-7928.
size_offset_to_usize
Converts U256 size and offset to usize. If the size is zero, the offset will be zero regardless of its original value as it is not relevant
u256_to_usize
Converts a U256 value into usize, returning an error if the value is over 32 bits This is generally used for memory offsets and sizes, 32 bits is more than enough for this purpose.
word_to_address

Type Aliases§

Storage