Expand description
Gas calculation utilities and constants. EVM gas calculation utilities.
Structs§
- Gas
- Represents the state of gas during execution.
- Initial
AndFloor Gas - Init and floor gas from transaction
- Memory
Gas - Utility struct that speeds up calculation of memory expansion It contains the current memory length and its memory expansion cost.
Enums§
- Memory
Extension Result - Result of attempting to extend memory during execution.
Constants§
- ACCESS_
LIST_ ADDRESS - Gas cost for accessing an address in the access list (EIP-2929).
- ACCESS_
LIST_ STORAGE_ KEY - Gas cost for accessing a storage key in the access list (EIP-2929).
- BASE
- Base gas cost for basic operations.
- BLOCKHASH
- Gas cost for BLOCKHASH instruction.
- CALLVALUE
- Additional gas cost when a call transfers value.
- CALL_
STIPEND - Gas stipend provided to the recipient of a CALL with value transfer.
- CODEDEPOSIT
- Gas cost per byte for code deposit during contract creation.
- COLD_
ACCOUNT_ ACCESS_ COST - Gas cost for accessing a cold account (EIP-2929).
- COLD_
SLOAD_ COST - Gas cost for SLOAD when accessing a cold storage slot (EIP-2929).
- CONDITION_
JUMP_ GAS - Gas cost for conditional jump instructions.
- COPY
- Gas cost per word for copy operations.
- CREATE
- Gas cost for CREATE instruction.
- DATA_
LOADN_ GAS - Gas cost for DATALOADN instruction.
- DATA_
LOAD_ GAS - Gas cost for DATALOAD instruction.
- EOF_
CREATE_ GAS - Gas cost for EOF CREATE instruction.
- EXP
- Base gas cost for EXP instruction.
- HIGH
- Gas cost for high-cost operations.
- INITCODE_
WORD_ COST - EIP-3860 : Limit and meter initcode
- ISTANBUL_
SLOAD_ GAS - EIP-1884: Repricing for trie-size-dependent opcodes
- JUMPDEST
- Gas cost for JUMPDEST instruction.
- KECCA
K256 - Base gas cost for KECCAK256 instruction.
- KECCA
K256WORD - Gas cost per word for KECCAK256 instruction.
- LOG
- Base gas cost for LOG instructions.
- LOGDATA
- Gas cost per byte of data in LOG instructions.
- LOGTOPIC
- Gas cost per topic in LOG instructions.
- LOW
- Gas cost for low-cost operations.
- MEMORY
- Gas cost per word for memory operations.
- MID
- Gas cost for medium-cost operations.
- MIN_
CALLEE_ GAS - Minimum gas that must be provided to a callee.
- NEWACCOUNT
- Gas cost for creating a new account.
- 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 - Gas refund for SSTORE when clearing a storage slot (setting to zero).
- RETF_
GAS - Gas cost for RETF instruction.
- SELFDESTRUCT
- Gas cost for SELFDESTRUCT instruction.
- SSTORE_
RESET - Gas cost for SSTORE when modifying an existing non-zero storage slot.
- SSTORE_
SET - Gas cost for SSTORE when setting a storage slot from zero to non-zero.
- STANDARD_
TOKEN_ COST - The standard cost of calldata token.
- TOTAL_
COST_ FLOOR_ PER_ TOKEN - The cost floor per token as defined by EIP-2028.
- VERYLOW
- Gas cost for very low-cost operations.
- WARM_
SSTORE_ RESET - Gas cost for SSTORE reset operation on a warm storage slot.
- WARM_
STORAGE_ READ_ COST - Gas cost for reading from a warm storage slot (EIP-2929).
- ZERO
- Gas cost for operations that consume zero gas.
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.
- calculate_
initial_ tx_ gas_ for_ tx - 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.
- copy_
cost - Calculates the gas cost for copy operations based on data length.
- copy_
cost_ verylow *COPY
opcodes cost calculation.- cost_
per_ word - Calculate the cost of buffer per word.
- create2_
cost CREATE2
opcode 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.
- selfdestruct_
cost SELFDESTRUCT
opcode cost calculation.- sload_
cost SLOAD
opcode cost calculation.- sstore_
cost SSTORE
opcode cost calculation.- sstore_
refund SSTORE
opcode refund 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.