@ethereumjs/evm
Version:
JavaScript Ethereum Virtual Machine (EVM) implementation
56 lines • 2.81 kB
TypeScript
import type { Common } from '@ethereumjs/common';
import type { Address } from '@ethereumjs/util';
import type { RunState } from '../interpreter.ts';
/** Set by the gas handler; consumed in {@link Interpreter.runStep} after gas is charged. */
export type Eip7928PostTargetCallOog = {
outOffset: bigint;
outLength: bigint;
};
/** True when `regularGas + stateGas` fits in `gas_left + state_gas_reservoir` (EIP-8037). */
export declare function canAfford(runState: RunState, regularGas: bigint, stateGas?: bigint): boolean;
export declare function newAccountStateGasCost(common: Common, runState: RunState): bigint;
/** Pre-target OOG: trap before any target access / BAL entry. */
export declare function eip7928TrapPreTarget(runState: RunState, common: Common, gas: bigint): void;
/** Post-target CALL OOG: burn remaining frame gas and exceptional-halt in runStep. */
export declare function eip7928SchedulePostTargetCallOog(runState: RunState, outOffset: bigint, outLength: bigint): bigint;
/** Post-target CREATE OOG: charge accrued gas only; opcode pushes 0. */
export declare function eip7928PostTargetCreateOog(runState: RunState, common: Common, gas: bigint): bigint;
export declare function consumeEip7928PostTargetCallOog(runState: RunState): void;
export declare function getCallNewAccountPostCosts(runState: RunState, common: Common, toAddress: Address): Promise<{
regular: bigint;
state: bigint;
createsNewAccount: boolean;
}>;
export type CallFamilyGasOpts = {
currentGasLimit: bigint;
toAddress: Address;
value: bigint;
inOffset: bigint;
inLength: bigint;
outOffset: bigint;
outLength: bigint;
includeValueTransfer: boolean;
includeNewAccountPostCheck: boolean;
eip7702GetAccessCost: (runState: RunState, common: Common, address: Address, charge2929Gas: boolean) => Promise<{
gas: bigint;
delegationAddress: Uint8Array | null;
}>;
eip7702WarmAddress: (runState: RunState, delegationAddress: Uint8Array) => void;
};
/**
* Shared EIP-2929 / EIP-7928 / EIP-8037 gas path for CALL, CALLCODE, DELEGATECALL, STATICCALL.
*/
export declare function callFamilyGas(runState: RunState, gas: bigint, common: Common, opts: CallFamilyGasOpts): Promise<bigint>;
export type Create7928GasOpts = {
offset: bigint;
length: bigint;
salt?: Uint8Array;
/** Extra pre-initcode gas (CREATE2 keccak). */
extraPreTargetGas?: bigint;
preChargeLabel: string;
};
/**
* Shared EIP-7928 / EIP-8037 gas path for CREATE and CREATE2.
*/
export declare function create7928Gas(runState: RunState, gas: bigint, common: Common, opts: Create7928GasOpts, getCreateTargetAddressBytes: (runState: RunState, initCode: Uint8Array, salt?: Uint8Array) => Promise<Uint8Array>): Promise<bigint>;
//# sourceMappingURL=EIP7928.d.ts.map