Module gas

Source
Expand description

Gas calculation utilities.

Macros§

tri 🔒
const Option ?.

Structs§

Gas
Represents the state of gas during execution.
InitialAndFloorGas
Init and floor gas from transaction

Constants§

ACCESS_LIST_ADDRESS
ACCESS_LIST_STORAGE_KEY
BASE
BLOCKHASH
CALLVALUE
CALL_STIPEND
CODEDEPOSIT
COLD_ACCOUNT_ACCESS_COST
COLD_SLOAD_COST
CONDITION_JUMP_GAS
COPY
CREATE
DATA_LOADN_GAS
DATA_LOAD_GAS
EOF_CREATE_GAS
EXP
HIGH
INITCODE_WORD_COST
EIP-3860 : Limit and meter initcode
INSTANBUL_SLOAD_GAS
EIP-1884: Repricing for trie-size-dependent opcodes
JUMPDEST
KECCAK256
KECCAK256WORD
LOG
LOGDATA
LOGTOPIC
LOW
MEMORY
MID
MIN_CALLEE_GAS
NEWACCOUNT
NON_ZERO_BYTE_DATA_COST
The cost of a non-zero byte in calldata.
NON_ZERO_BYTE_DATA_COST_ISTANBUL
The cost of a non-zero byte in calldata adjusted by EIP-2028.
NON_ZERO_BYTE_MULTIPLIER
The multiplier for a non zero byte in calldata.
NON_ZERO_BYTE_MULTIPLIER_ISTANBUL
The multiplier for a non zero byte in calldata adjusted by EIP-2028.
REFUND_SSTORE_CLEARS
RETF_GAS
SELFDESTRUCT
SSTORE_RESET
SSTORE_SET
STANDARD_TOKEN_COST
The standard cost of calldata token.
TOTAL_COST_FLOOR_PER_TOKEN
VERYLOW
WARM_SSTORE_RESET
WARM_STORAGE_READ_COST
ZERO

Functions§

calc_tx_floor_cost
Calculate the transaction cost floor as specified in EIP-7623.
calculate_initial_tx_gas
Initial gas that is deducted for transaction to be included. Initial gas contains initial stipend gas, gas for access list and input data.
call_cost
Calculate call gas cost for the call instruction.
cost_per_word
Calculate the cost of buffer per word.
create2_cost
CREATE2 opcode cost calculation.
dyn_exp_cost
EXP opcode cost calculation.
dyn_keccak256_cost
KECCAK256 opcode cost calculation.
dyn_log_cost
LOG opcode cost calculation.
dyn_verylowcopy_cost
*COPY opcodes cost calculation.
exp_cost
EXP opcode cost calculation.
extcodecopy_cost
EXTCODECOPY opcode cost calculation.
get_tokens_in_calldata
Retrieve the total number of tokens in calldata.
initcode_cost
EIP-3860: Limit and meter initcode
keccak256_cost
KECCAK256 opcode cost calculation.
log_cost
LOG opcode cost calculation.
memory_gas
Memory expansion cost calculation for a given number of words.
memory_gas_for_len
Memory expansion cost calculation for a given memory length.
selfdestruct_cost
SELFDESTRUCT opcode cost calculation.
sload_cost
SLOAD opcode cost calculation.
sstore_cost
SSTORE opcode cost calculation.
sstore_refund
SSTORE opcode refund calculation.
verylowcopy_cost
*COPY opcodes cost calculation.
warm_cold_cost
Berlin warm and cold storage access cost for account access.
warm_cold_cost_with_delegation
Berlin warm and cold storage access cost for account access.