Skip to content

fix(fill): warn and discard a partial opcode trace instead of reporting it - #3505

Open
jochem-brouwer wants to merge 1 commit into
ethereum:forks/amsterdamfrom
jochem-brouwer:pr/opcode-trace-coverage
Open

fix(fill): warn and discard a partial opcode trace instead of reporting it#3505
jochem-brouwer wants to merge 1 commit into
ethereum:forks/amsterdamfrom
jochem-brouwer:pr/opcode-trace-coverage

Conversation

@jochem-brouwer

Copy link
Copy Markdown
Member

debug_traceBlockByHash returns one entry per transaction. When a single transaction's trace fails, its entry carries an error instead of a result, and the aggregation loop skipped it silently -- returning a well-formed tally that is short by whole transactions, with no exception and no log line. The caller could not tell 17 traced transactions from 18.

That surfaced while filling the compute benchmarks. test_identity_uncachable[size_32, 300M] failed with

Target opcode IDENTITY count mismatch: expected ~1693322 (+-5.0%),
got 1598624

The deficit is 94,698, which is exactly the calls one full-cap transaction makes: (16777216 - 15512 - 17) // 177. The block itself was fine -- all 18 transactions present, 299.998M of 300M gas used -- and the same case passes on re-run (verified four times). Nothing was wrong with the benchmark; one transaction's trace was lost and the shortfall was reported as if it were a real count.

It read as a benchmark bug for exactly as long as it took to notice the count was one whole transaction short. The test's own model is correct: across the ten gas values that passed, its predicted transaction counts match the fixtures exactly and its predicted gas matches to within the 128-143 gas per transaction that WhileGas necessarily strands.

So the aggregators now report how many entries contributed, and a tally that does not cover every transaction is discarded with a warning naming the shortfall. It is not fatal: a missing trace should not throw away a block that filled correctly, and the count can be recovered by re-running. The fixture is still written, it just carries no opcode count.

Struct-log aggregation had the same hole and gets the same treatment; an entry with no structLogs key is a failed trace, not an empty one.

Description

Related Issues or PRs

N/A.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

…ng it

`debug_traceBlockByHash` returns one entry per transaction. When a single
transaction's trace fails, its entry carries an error instead of a
`result`, and the aggregation loop skipped it silently -- returning a
well-formed tally that is short by whole transactions, with no exception
and no log line. The caller could not tell 17 traced transactions from
18.

That surfaced while filling the compute benchmarks.
test_identity_uncachable[size_32, 300M] failed with

    Target opcode IDENTITY count mismatch: expected ~1693322 (+-5.0%),
    got 1598624

The deficit is 94,698, which is exactly the calls one full-cap
transaction makes: (16777216 - 15512 - 17) // 177. The block itself was
fine -- all 18 transactions present, 299.998M of 300M gas used -- and the
same case passes on re-run (verified four times). Nothing was wrong with
the benchmark; one transaction's trace was lost and the shortfall was
reported as if it were a real count.

It read as a benchmark bug for exactly as long as it took to notice the
count was one whole transaction short. The test's own model is correct:
across the ten gas values that passed, its predicted transaction counts
match the fixtures exactly and its predicted gas matches to within the
128-143 gas per transaction that WhileGas necessarily strands.

So the aggregators now report how many entries contributed, and a tally
that does not cover every transaction is discarded with a warning naming
the shortfall. It is not fatal: a missing trace should not throw away a
block that filled correctly, and the count can be recovered by re-running.
The fixture is still written, it just carries no opcode count.

Struct-log aggregation had the same hole and gets the same treatment; an
entry with no `structLogs` key is a failed trace, not an empty one.
@jochem-brouwer jochem-brouwer added backport forks/amsterdam On merge, bot cherry-picks the squash commit to `forks/amsterdam` and opens a PR. Squash only. backport benchmarks/amsterdam On merge, bot cherry-picks the squash commit to `benchmarks/amsterdam` and opens a PR. Squash only. and removed backport forks/amsterdam On merge, bot cherry-picks the squash commit to `forks/amsterdam` and opens a PR. Squash only. labels Sep 2, 2026
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.90%. Comparing base (814b313) to head (d385041).
⚠️ Report is 2 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3505   +/-   ##
================================================
  Coverage            93.90%   93.90%           
================================================
  Files                  624      624           
  Lines                36905    36905           
  Branches              3326     3326           
================================================
  Hits                 34655    34655           
  Misses                1569     1569           
  Partials               681      681           
Flag Coverage Δ
unittests 93.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport benchmarks/amsterdam On merge, bot cherry-picks the squash commit to `benchmarks/amsterdam` and opens a PR. Squash only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant