Consistently handle log topics and data ownership#8
Merged
garyschulte merged 2 commits intoConsensys:mainfrom Mar 11, 2026
Merged
Consistently handle log topics and data ownership#8garyschulte merged 2 commits intoConsensys:mainfrom
garyschulte merged 2 commits intoConsensys:mainfrom
Conversation
…me broken spec tests in zevm-stateless Signed-off-by: garyschulte <garyschulte@gmail.com>
…ng fails Signed-off-by: garyschulte <garyschulte@gmail.com>
Gabriel-Trintinalia
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix to consistently deinit/free log items and topics.
This enables a clean fix for ~700 zevm-stateless spec-test failures and ~300 skipped tests.
Note
Medium Risk
Touches memory ownership and lifecycle of EVM logs, including new heap copies of log
dataand broader cleanup paths on reverts/commits; mistakes here could cause leaks or use-after-free. Scope is localized to log emission and teardown but affects many execution paths.Overview
Unifies EVM log ownership and cleanup.
primitives.Lognow owns heap-allocateddataandtopics(when non-empty) and providesLog.deinit()to free them.LOG opcode emission (
host_ops.zig) now heap-copies the logdataslice (previously referenced interpreter memory) so logs remain valid after interpreter teardown, and all log cleanup sites (JournalInner.deinit,commitTx,discardTx,finalize,checkpointRevert, andExecutionResult.deinit) are switched from manual topic frees to callinglog.deinit()(also ensuring discarded logs on checkpoint revert are freed).Written by Cursor Bugbot for commit 439e867. This will update automatically on new commits. Configure here.