Skip to content

evm: implement EIP-7623 calldata floor cost (Prague)#47

Open
tellabg wants to merge 28 commits intostateless-consensus:mainfrom
tellabg:eip-7623-calldata-floor
Open

evm: implement EIP-7623 calldata floor cost (Prague)#47
tellabg wants to merge 28 commits intostateless-consensus:mainfrom
tellabg:eip-7623-calldata-floor

Conversation

@tellabg
Copy link
Copy Markdown

@tellabg tellabg commented Feb 16, 2026

Implements EIP-7623 (Increase calldata cost) for the Prague fork.

In Prague, a floor cost for calldata is introduced. Each byte is counted as tokens (4 per non-zero, 1 per zero) and the intrinsic gas is:

max(standard_cost, base + tokens * 10 + create_cost + access_list_cost)

This fixes the InvalidGasUsed errors in Prague block tests (e.g. bcGasPricerTest/highGasUsage).

Also fixes a pre-existing bug where access list costs were accumulated into data_cost instead of a separate variable.

2 files changed: blockchain.zig (intrinsic gas calculation) + params.zig (new constants)

Depends on: #46 (upgrade-to-0.15.2)

gballet and others added 26 commits May 10, 2025 10:43
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Migrate all source files to 0.15.2 APIs.

Fixes a few issues

Export phant as a reusable module for downstream consumers
Networks up to Cancun use FrontierFork (in-memory block hashes).
Prague uses enablePrague (EIP-2935 block hashes in state).
Unsupported networks return error.UnsupportedNetwork.
- Bug 1: auto-create account in setStorage instead of panicking
- Bug 1b: pre-create contract account in CREATE/CREATE2 before execution
- Bug 2: make EVMC revision configurable (not hardcoded to Shanghai)
- Bug 4: implement emit_log to store logs and use in receipts
- EIP-4788: implement beacon block root system call
- Fix receipt encoding with tx type prefix (EIP-2718)
- Fix pre-EIP-155 legacy tx signature recovery
- Fix ArrayList API for Zig 0.15
- Add debug logging for block execution failures
- startTx: use dbDeepClone instead of shallow clone to prevent
  use-after-free on original_db storage hashmaps
- putAccessedStorageKeys: use put() instead of putNoClobber() to
  handle duplicate storage keys in access lists (bcEIP1559)
- SELFDESTRUCT: transfer balance to beneficiary, only destroy account
  if created in same transaction (Cancun EIP-6780 semantics)
- Track created accounts in StateDB for EIP-6780
- Process self-destructed accounts after tx execution
- BLOCKHASH: pass absolute block number instead of relative index
  to the fork get_parent_block_hash function
…list persistence, SELFDESTRUCT self-transfer
Replace cmake build steps with a native Zig static library build for
evmone. This compiles the 11 C++ source files and keccak.c directly
via Zig's build system, enabling cross-compilation support.

Dependencies intx and ethash are now submodules of evmone (via
tellabg/evmone fork), removing the need for Hunter/cmake.

A cpu_compat.c shim provides __cpu_model and __cpu_indicator_init
symbols that keccak's BMI dispatch expects from GCC runtime but are
absent in Zig's compiler-rt.
Replace cmake build steps with a native Zig static library build for
evmone (master, v0.18.0). This compiles the C++ source files and
keccak.c directly via Zig's build system, enabling cross-compilation.

EOF support was removed upstream (not accepted in protocol), so this
uses the current evmone master which has delegation.cpp instead.

Dependencies intx and ethash are submodules of evmone (via
tellabg/evmone fork). A cpu_compat.c shim provides __cpu_model and
__cpu_indicator_init symbols for keccak's BMI dispatch.
Restore version.zig generation from the original build system. Extracts
version from build.zig.zon and git revision via git rev-parse.
Remove the full copy of zig-eth-secp256k1 from deps/ and replace it
with a URL dependency pointing to tellabg/zig-eth-secp256k1 (Zig 0.15.2
compat branch, PR jsign/zig-eth-secp256k1#6).

This removes ~22,000 lines of vendored code.

Once the upstream PR is merged, the URL can be updated to point to
jsign/zig-eth-secp256k1 directly.
Remove the full copy of zig-rlp from deps/ and replace it with a URL
dependency pointing to tellabg/zig-rlp (Zig 0.15.2 compat branch,
PR gballet/zig-rlp#30).

Once the PR is merged, the URL can be updated to point to
gballet/zig-rlp directly.
@tellabg tellabg force-pushed the eip-7623-calldata-floor branch from 2617974 to 152d0b9 Compare February 16, 2026 23:10
In Prague, EIP-7623 introduces a floor cost for calldata-heavy
transactions. The total gas used is:
  max(standard_gas_used, floor_cost)
where floor_cost = 21000 + tokens * 10 + create_cost + access_list_cost

The floor applies to the final gas_used (after execution and refunds),
NOT to the intrinsic gas. The gas limit must cover at least the floor.

Also fixes a bug where access list costs were accumulated into
data_cost instead of a separate variable.
@tellabg tellabg force-pushed the eip-7623-calldata-floor branch from 152d0b9 to 697c5a3 Compare February 16, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants