Skip to content

Consistently handle log topics and data ownership#8

Merged
garyschulte merged 2 commits intoConsensys:mainfrom
garyschulte:fix/log-data-ownership-deinit
Mar 11, 2026
Merged

Consistently handle log topics and data ownership#8
garyschulte merged 2 commits intoConsensys:mainfrom
garyschulte:fix/log-data-ownership-deinit

Conversation

@garyschulte
Copy link
Copy Markdown
Collaborator

@garyschulte garyschulte commented Mar 11, 2026

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 data and 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.Log now owns heap-allocated data and topics (when non-empty) and provides Log.deinit() to free them.

LOG opcode emission (host_ops.zig) now heap-copies the log data slice (previously referenced interpreter memory) so logs remain valid after interpreter teardown, and all log cleanup sites (JournalInner.deinit, commitTx, discardTx, finalize, checkpointRevert, and ExecutionResult.deinit) are switched from manual topic frees to calling log.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.

…me broken spec tests in zevm-stateless

Signed-off-by: garyschulte <garyschulte@gmail.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

…ng fails

Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte merged commit c728935 into Consensys:main Mar 11, 2026
6 checks passed
@garyschulte garyschulte deleted the fix/log-data-ownership-deinit branch March 11, 2026 23:17
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