go-ethereum/core/vm
jwasinger fd859638bd
core/vm: rework gas measurement for call variants (#33648)
EIP-7928 brings state reads into consensus by recording accounts and storage accessed during execution in the block access list. As part of the spec, we need to check that there is enough gas available to cover the cost component which doesn't depend on looking up state. If this component can't be covered by the available gas, we exit immediately.

The portion of the call dynamic cost which doesn't depend on state look ups:

- EIP2929 call costs
- value transfer cost
- memory expansion cost

This PR:

- breaks up the "inner" gas calculation for each call variant into a pair of stateless/stateful cost methods
- modifies the gas calculation logic of calls to check stateless cost component first, and go out of gas immediately if it is not covered.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-03-19 10:02:49 -06:00
..
program all: fix problematic function name in comment (#32513) 2025-08-29 08:54:23 +08:00
runtime core: miner: reduce allocations in block building (#33375) 2026-02-03 08:19:16 +01:00
testdata core/vm: switch modexp gas computation to uint64 (#32527) 2025-09-08 13:33:10 +02:00
analysis_legacy.go core/vm: add configurable jumpdest analysis cache (#32143) 2025-08-01 13:57:38 +02:00
analysis_legacy_test.go core/vm: using testing.B.Loop (#32660) 2025-09-19 17:06:55 -06:00
common.go core: Implement eip-7954 increase Maximum Contract Size (#33832) 2026-03-12 10:23:49 +08:00
contract.go core/vm: add configurable jumpdest analysis cache (#32143) 2025-08-01 13:57:38 +02:00
contracts.go core/vm: touch precompile object with Amsterdam enabled (#33742) 2026-02-24 21:55:10 +08:00
contracts_fuzz_test.go core/vm: touch precompile object with Amsterdam enabled (#33742) 2026-02-24 21:55:10 +08:00
contracts_test.go core/vm: touch precompile object with Amsterdam enabled (#33742) 2026-02-24 21:55:10 +08:00
doc.go core/vm: remove JIT VM codes (#16362) 2018-03-26 13:48:04 +03:00
eips.go core/vm: implement eip-7843: SLOTNUM (#33589) 2026-02-26 13:53:46 +01:00
errors.go build: update to golangci-lint 1.61.0 (#30587) 2024-10-14 19:25:22 +02:00
evm.go core: Implement eip-7954 increase Maximum Contract Size (#33832) 2026-03-12 10:23:49 +08:00
gas.go core/vm: rework gas measurement for call variants (#33648) 2026-03-19 10:02:49 -06:00
gas_table.go core/vm: rework gas measurement for call variants (#33648) 2026-03-19 10:02:49 -06:00
gas_table_test.go core: Implement eip-7954 increase Maximum Contract Size (#33832) 2026-03-12 10:23:49 +08:00
instructions.go core/vm: Switch to branchless normalization and extend EXCHANGE (#33869) 2026-03-04 10:34:27 +01:00
instructions_test.go core/vm: Switch to branchless normalization and extend EXCHANGE (#33869) 2026-03-04 10:34:27 +01:00
interface.go core: invoke selfdestruct tracer hooks during finalisation (#32919) 2026-01-16 15:10:08 -07:00
interpreter.go cmd, core, eth, tests: prevent state flushing in RPC (#33931) 2026-03-04 14:40:45 +08:00
interpreter_test.go core/vm: using testing.B.Loop (#32660) 2025-09-19 17:06:55 -06:00
jump_table.go core/vm: enable 8024 instructions in Amsterdam (#33928) 2026-03-02 17:01:06 -05:00
jump_table_export.go core/vm: use amsterdam jump table in lookup (#33947) 2026-03-04 13:42:25 +08:00
jump_table_test.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
jumpdests.go core/vm: add configurable jumpdest analysis cache (#32143) 2025-08-01 13:57:38 +02:00
memory.go core/vm: improve memory resize (#33056) 2025-11-26 16:50:16 +01:00
memory_table.go core/vm, cmd/evm: remove EOF (#32000) 2025-06-11 14:50:46 +02:00
memory_test.go core/vm: improve memory resize (#33056) 2025-11-26 16:50:16 +01:00
opcodes.go core/vm: implement eip-7843: SLOTNUM (#33589) 2026-02-26 13:53:46 +01:00
operations_acl.go core/vm: rework gas measurement for call variants (#33648) 2026-03-19 10:02:49 -06:00
operations_verkle.go core/state, core/vm: update stateless gas costs to follow the verkle-gen-7 testnet (#31014) 2025-05-15 20:43:52 +08:00
stack.go core/vm: improved stack swap performance (#30249) 2024-08-06 14:38:47 +02:00
stack_table.go core/vm: 64 bit memory and gas calculations (#19210) 2019-03-12 11:40:05 +02:00