UNPKG

@ethereumjs/evm

Version:
68 lines 3.03 kB
import type { Common } from '@ethereumjs/common'; import type { RunState } from '../interpreter.ts'; /** * Returns the gas cost for accessing an address WITHOUT any side effects. * Use this to check if you have enough gas before committing to the access. * * @param {RunState} runState * @param {Uint8Array} address * @param {Common} common * @param {Boolean} chargeGas (default: true) * @param {Boolean} isSelfdestruct (default: false) * @returns {bigint} The gas cost for this address access */ export declare function getAddressAccessCost(runState: RunState, address: Uint8Array, common: Common, chargeGas?: boolean, isSelfdestruct?: boolean): bigint; /** * Warms an address (adds to EIP-2929 accessed addresses set). * Call this AFTER verifying you have enough gas for the access. * * @param {RunState} runState * @param {Uint8Array} address */ export declare function warmAddress(runState: RunState, address: Uint8Array): void; /** * Adds address to BAL (Block Access List) for EIP-7928. * Call this AFTER verifying you have enough gas for the access. * * @param {RunState} runState * @param {Uint8Array} address * @param {Common} common */ export declare function addAddressToBAL(runState: RunState, address: Uint8Array, common: Common): void; /** * Adds address to accessedAddresses set if not already included. * Adjusts cost incurred for executing opcode based on whether address read * is warm/cold. (EIP 2929) * * This is a convenience function that combines getAddressAccessCost + warmAddress. * For fine-grained control (e.g., EIP-7928 BAL with OOG checks), use the * individual functions instead. * * @param {RunState} runState * @param {Uint8Array} address * @param {Common} common * @param {Boolean} chargeGas (default: true) * @param {Boolean} isSelfdestruct (default: false) */ export declare function accessAddressEIP2929(runState: RunState, address: Uint8Array, common: Common, chargeGas?: boolean, isSelfdestruct?: boolean): bigint; /** * Adds (address, key) to accessedStorage tuple set if not already included. * Adjusts cost incurred for executing opcode based on whether storage read * is warm/cold. (EIP 2929) * @param {RunState} runState * @param {Uint8Array} key (to storage slot) * @param {Common} common */ export declare function accessStorageEIP2929(runState: RunState, key: Uint8Array, isSstore: boolean, common: Common, chargeGas?: boolean): bigint; /** * Adjusts cost of SSTORE_RESET_GAS or SLOAD (aka sstorenoop) (EIP-2200) downward when storage * location is already warm * @param {RunState} runState * @param {Uint8Array} key storage slot * @param {BigInt} defaultCost SSTORE_RESET_GAS / SLOAD * @param {string} costName parameter name ('noop') * @param {Common} common * @return {BigInt} adjusted cost */ export declare function adjustSstoreGasEIP2929(runState: RunState, key: Uint8Array, defaultCost: bigint, costName: string, common: Common): bigint; //# sourceMappingURL=EIP2929.d.ts.map