Skip to content

evm: discard logs on top-level revert#48

Open
tellabg wants to merge 29 commits intostateless-consensus:mainfrom
tellabg:fix-log-revert
Open

evm: discard logs on top-level revert#48
tellabg wants to merge 29 commits intostateless-consensus:mainfrom
tellabg:fix-log-revert

Conversation

@tellabg
Copy link
Copy Markdown

@tellabg tellabg commented Feb 16, 2026

When a transaction reverts at top level, all logs must be discarded from the receipt.

Previously, logs from evmone host callbacks were returned regardless of execution outcome.

Fixes logRevert block test.

1 file changed: vm.zig

Depends on: #47 (eip-7623-calldata-floor)

gballet and others added 29 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.
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.
When a transaction's top-level execution reverts, all logs emitted
during execution must be discarded. The receipt should contain an
empty log list and bloom filter.

Previously, logs accumulated via evmone's emit_log host callback
were returned regardless of the execution outcome, causing receipts
root mismatches in tests like logRevert.
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