Skip to content

fix(inspector): forward EIP-7708 transfer logs - #3796

Closed
0xalpharush wants to merge 3 commits into
bluealloy:glam-devnet-7from
0xalpharush:agent/eip7708-inspector-logs
Closed

0xalpharush wants to merge 3 commits into
bluealloy:glam-devnet-7from
0xalpharush:agent/eip7708-inspector-logs

Conversation

@0xalpharush

@0xalpharush 0xalpharush commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Forward journal-created EIP-7708 ETH transfer logs through Inspector::log for frame initialization and SELFDESTRUCT transfers.

Also fix SELFDESTRUCT inspector callbacks so they use the relevant journal entry and report the correct value:

  • ignore stale earlier SELFDESTRUCT journal entries when an account selfdestructs to itself
  • report the preserved account balance for Amsterdam SELFDESTRUCT-to-self instead of the journal bookkeeping value

This branch is retargeted onto glam-devnet-7 / #3795.

Sequencing

This PR currently carries the stale-SELFDESTRUCT journal fix that is also isolated in #3797, because the Amsterdam preserved-value fix depends on inspecting the correct SELFDESTRUCT journal entry. If #3797 lands first, this branch should be rebased and the duplicate stale-journal commit dropped, leaving only the EIP-7708 log forwarding and Amsterdam preserved-value fixes. If this combined PR lands first, #3797 can be closed as a subset.

Impact

Receipts already contained the EIP-7708 transfer logs, but revm inspector consumers could miss them because the inspector handler only forwarded LOG opcode and precompile logs. Execution and state were already correct; tracer output was incomplete.

SELFDESTRUCT inspector consumers could also observe misleading callback data in selfdestruct-to-self cases: stale journal entries could be reused, and Amsterdam preserved-balance cases could report 0 even when the account retained value.

Root Cause

The inspector handler needed to forward journal-created EIP-7708 ETH transfer logs after frame initialization and SELFDESTRUCT transfers.

For SELFDESTRUCT, the inspector path also needed to inspect the most recent relevant AccountDestroyed journal entry for the target account. Amsterdam/EIP-8246 selfdestruct-to-self preserves the account balance and records had_balance = 0 for revert bookkeeping, so the callback value must come from the preserved account balance instead of that journal field.

Testing

@codspeed

codspeed Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.74%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

#### 🎉 Hooray! `codspeed-rust` just leveled up to 4.4.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

❌ 1 regressed benchmark
✅ 180 untouched benchmarks
⏩ 1 skipped benchmark1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation snailtracer-inspect 187.4 ms 214.7 ms -12.74%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing 0xalpharush:agent/eip7708-inspector-logs (0977207) with glam-devnet-7 (3b2393b)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

@0xalpharush
0xalpharush force-pushed the agent/eip7708-inspector-logs branch from 825a01f to 0977207 Compare July 13, 2026 20:19
@0xalpharush
0xalpharush changed the base branch from rakita/eip2780-runtime-gas-phase to glam-devnet-7 July 13, 2026 20:20
if (opcode::LOG0..=opcode::LOG4).contains(&opcode) {
inspect_log(interpreter, context, &mut inspector);
} else {
inspect_eip7708_transfer_logs(context, &mut inspector, logs_i);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could remove the previous lines LOG0..= and just use inspect_eip7708_transfer_logs to report every log.

next_action
}

#[inline]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#[inline]
#[inline(never)]

Comment on lines +344 to +349
#[inline]
fn is_eip7708_transfer_log(log: &Log) -> bool {
log.address == ETH_TRANSFER_LOG_ADDRESS
&& log.data.topics().first() == Some(&ETH_TRANSFER_LOG_TOPIC)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And remove this if we want to use it for every log

Suggested change
#[inline]
fn is_eip7708_transfer_log(log: &Log) -> bool {
log.address == ETH_TRANSFER_LOG_ADDRESS
&& log.data.topics().first() == Some(&ETH_TRANSFER_LOG_TOPIC)
}

@rakita

rakita commented Jul 15, 2026

Copy link
Copy Markdown
Member

This is fixing the missing log for SELFDESTRUCT but i gave me good hint we are missing logs for transfers that are done outside of Interpreter in when transfer_loaded is called here and on create here

This bug is related to glamsterdam. Good find!

rakita added a commit that referenced this pull request Jul 23, 2026
* fix(inspector): forward EIP-7708 transfer logs to the inspector

Backport of the inspector fix from #3796: journal logs emitted outside
LOG* opcodes (EIP-7708 value-transfer logs from calls, tx value transfers
and selfdestructs) were never handed to Inspector::log.

Co-authored-by: 0xalpharush <0xalpharush@protonmail.com>

* refactor(inspector): report all step logs through a single hook

Replace the LOG*-only inspect_log with inspect_step_logs, which forwards
every log the instruction journaled since the pre-step index via log_full.
This covers LOG* and the EIP-7708 transfer logs of value-moving
instructions, and drops the stale-logs().last() guard in favour of exact
index math. The frame-init paths keep the filtered, interpreter-less
variant.

* refactor(inspector): merge the log-forwarding helpers into one cold fn

inspect_step_logs, inspect_step_logs_inner, inspect_eip7708_transfer_logs
and is_eip7708_transfer_log collapse into inspect_logs, which forwards the
logs journaled since logs_i via log_full when an interpreter is available
and log otherwise. It is always cold: each call site keeps only the cheap
journal-length check inline. The 7708 address/topic filter is dropped now
that every journaled log is forwarded, which also flattens the branch chain
in inspect_frame_init.

---------

Co-authored-by: 0xalpharush <0xalpharush@protonmail.com>
@rakita

rakita commented Jul 23, 2026

Copy link
Copy Markdown
Member

Superseed with #3816

@rakita rakita closed this Jul 23, 2026
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