Skip to content

perf: ARO pruned 11-edit terminal set (TERMINAL_CONFIRMED_WITH_TRADE)#347

Open
mega-putin[bot] wants to merge 11 commits into
mainfrom
mega-engineer/aro/prune-r4-terminal
Open

perf: ARO pruned 11-edit terminal set (TERMINAL_CONFIRMED_WITH_TRADE)#347
mega-putin[bot] wants to merge 11 commits into
mainfrom
mega-engineer/aro/prune-r4-terminal

Conversation

@mega-putin

@mega-putin mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

ARO terminal gate r4 on current main (7d409ae): 11 surviving edits across execution.rs, instructions.rs, and precompiles.rs. 4 edits dropped by protocol (2 unappliable due to main drift, 1 unappliable, 1 reverify-fail).

Delta (Ir-first, terminal r4 stamp)

Top rows by |Δ%|:

Row Δ%
log_opcodes/revm_latest/log0_32b −3.35%
log_opcodes/op_revm_latest/log0_256b +2.91%
volatile_data/mini_rex/coinbase −2.85%
sstore_heavy/rex5/sload_100 −2.73%
sstore_heavy/op_revm_pinned/sload_100 −2.71%
system_contract_single/rex5/limit_control −2.61%
volatile_data/rex5/timestamp −2.61%
system_contract_single/rex4/limit_control −2.52%

Full 32-row bench_ir_rows in stamp.

Terminal verdict: TERMINAL_CONFIRMED_WITH_TRADE (105 improved, 1 regressed, 55 control rows max|Δ%|=3.35%)

Traded regression

Row Δ%
eip7702_authlist/rex5/400 +0.3368%

Within 1.0% trade cap.

Files changed

  • crates/mega-evm/src/evm/execution.rs — frame_init REX4/REX5 guard hoisting, post_execution EIP-7702 fast-path, transact REX5 inlined loop
  • crates/mega-evm/src/evm/instructions.rs — push1/pop/add hand-inlined compute-gas, log0-4 thin wrappers with Log::new_unchecked, StackInspectTr::discard_top
  • crates/mega-evm/src/evm/precompiles.rs — precompile gas accounting restructured for REX5 non-OOG path

Provenance

Autonomous optimization campaign (ARO, mega-evm-v2-diverge-r2, terminal r4):

  • 11 surviving orders passed recheck on new baseline (build + test + test_full + differential)
  • 4 dropped: order 11 (inspect_storage, unappliable — main already has entry() optimization), orders 12-13 (log, unappliable — SEARCH mismatch on new baseline), order 15 (call, reverify-fail — test_full)
  • Terminal stamp: /tmp/terminal-r4.json sha256 1ecbcaddec7eb130c8c3eea05cfe88a31e71260b3292c7e46cc6bffbcfd96998
  • Toolchain: codspeed=4.18.3;cargo-codspeed=5.0.1;valgrind=3.26.0.codspeed5;rustc=1.96.0

Verification

  • cargo build --release -p mega-evm: ✅
  • cargo test --release -p mega-evm: ✅ (recheck gate)
  • Byte-identical differential: ✅ (recheck gate, evm_semantics_diff probe)

Supersedes #346.

…ompiles

Terminal r4: TERMINAL_CONFIRMED_WITH_TRADE
105 improved, 1 regressed (eip7702_authlist/rex5/400 +0.3368%)
55 control rows max|Δ%|=3.35%, all within 5.0% bound
3 files, +265/-72

Baseline: 7d409ae (current main)
Toolchain: codspeed=4.18.3;cargo-codspeed=5.0.1;valgrind=3.26.0.codspeed5;rustc=1.96.0
Stamp: /tmp/terminal-r4.json sha256=1ecbcaddec7eb130c8c3eea05cfe88a31e71260b3292c7e46cc6bffbcfd96998
@mega-putin mega-putin Bot added comp:core Changes to the `mega-evm` core crate spec:unchanged No change to any `mega-evm`'s behavior api:unchanged No change to the public interface or API agent Generated by AI agents rust Pull requests that update rust code labels Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.38220% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.8%. Comparing base (7d409ae) to head (0fd06a2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/mega-evm/src/evm/instructions.rs 96.0% 2 Missing and 1 partial ⚠️
crates/mega-evm/src/evm/execution.rs 96.4% 2 Missing ⚠️

☔ 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.

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 6.71%

⚡ 9 improved benchmarks
✅ 357 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
mini_rex 5.2 ms 4.8 ms +8.13%
mini_rex 2.8 ms 2.6 ms +7.88%
rex5 5.8 ms 5.4 ms +6.93%
equivalence 1.7 ms 1.6 ms +6.59%
rex5 3.1 ms 2.9 ms +6.57%
rex4 5.9 ms 5.5 ms +6.45%
equivalence 3.3 ms 3.1 ms +6.45%
rex4 3.2 ms 3 ms +5.9%
equivalence 1.3 ms 1.3 ms +5.53%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mega-engineer/aro/prune-r4-terminal (0fd06a2) with main (999c516)

Open in CodSpeed

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Diff mutation score: 100.0% (9/9 viable mutants killed)

  • caught: 9
  • survived (real gaps): 0
  • timed out (inconclusive): 0
  • suppressed (equivalent/dead-code): 2
  • unviable: 0 · timeout total: 0

No new test gaps introduced by this change. 🎉

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

test

@RealiCZ RealiCZ added spec:stable Touches stable spec code — must not change behavior and removed spec:unchanged No change to any `mega-evm`'s behavior labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Diff mutation score: 100.0% (21/21 viable mutants killed)

  • caught: 21
  • survived (real gaps): 0
  • timed out (inconclusive): 0
  • suppressed (equivalent/dead-code): 0
  • unviable: 19 · timeout total: 0

No new test gaps introduced by this change. 🎉

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed. The outcome is intended to stay identical, and I updated the spec text to match the implementation.

This change now documents the CALL_STACK_LIMIT short-circuit as applying to over-deep call-frame initialization generally before interceptor dispatch, while CREATE / CREATE2 remain out of scope.
I also added coverage for the broadened CALLCODE / DELEGATECALL too-deep path and the inspector mirror path so the behavior is pinned by tests rather than just by differential observation.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🔧 Pushed CI fixes.

Agent log
Committed the CI fix as `d283e5b`.

The failing check was the `Build & Test` workflow’s `lint` job on PR head `366ebae`. The job log showed a hard `clippy` error at `crates/mega-evm/src/evm/precompiles.rs:256`: identical `if` / `else if` blocks under `-D warnings`. I collapsed the duplicated branch into the shared `MINI_REX` gate, preserving behavior and removing the lint failure.

Verified locally with the relevant commands:
- `cargo sort --check --workspace --grouped --order package,workspace,lints,profile,bin,benches,dependencies,dev-dependencies,features`
- `cargo fmt --all --check`
- `cargo check`
- `RUSTFLAGS='-D warnings' cargo clippy --workspace --lib --examples --tests --benches --all-features --locked`
- `cargo clippy --workspace --lib --examples --tests --benches --all-features --locked`

There are still non-fatal existing warnings from toolchain/MSRV reporting, but the previously failing `clippy::if_same_then_else` error is resolved.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🔧 CI fixes are ready.

Agent log
Committed `c1075c1` to address the remaining likely CI risk on this PR head.

What I verified:
- The previous PR head was `d283e5b`; job-level checks were still in progress rather than failing.
- The prior concrete lint failure had already been fixed.
- The remaining explicit risk from the PR conversation was Codecov patch coverage in `crates/mega-evm/src/evm/instructions.rs` and `crates/mega-evm/src/evm/execution.rs`.

What I changed:
- Added extra `inspect_frame_init` coverage in `crates/mega-evm/tests/rex5/call_too_deep_guard.rs` for:
  - `DELEGATECALL` inspector override
  - inspector-path TX-limit-exceeded priority over `CallTooDeep`
- Added extra opcode-wrapper coverage in `crates/mega-evm/tests/mini_rex/opcode_wrappers.rs` for:
  - zero-length `LOG` data path
  - topic-underflow after valid `offset`/`len`

Verification run:
- `cargo test -p mega-evm --test rex5 -- call_too_deep_guard`
- `cargo test -p mega-evm --test mini_rex -- opcode_wrappers`
- `cargo fmt --all`
- `cargo fmt --all --check`
- `cargo check -p mega-evm`

The commit has not been pushed. The branch now has:
- `d283e5b` `fix CI: collapse duplicate precompile gas branch`
- `c1075c1` `fix CI: extend coverage for depth guard and log wrappers`

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Clean

  • Reviewed the incremental change since prior review (366ebae): depth-guard now covers CALLCODE/DELEGATECALL in both frame_init and inspect_frame_init, plus the accompanying spec text update in interception.md / rex5.md and new CALLCODE/DELEGATECALL guard tests. Also re-checked the r4 baseline changes: post_execution_without_eip7702_refund_work fast path, REX5 inlined transact loop, hand-inlined add/pop/push1/log_unchecked, and the precompile OOG-first refactor in precompiles.rs.
  • Behavioral equivalence spot-checks:
    • The debug-asserted invariants (eip7702_refund == 0 for non-7702 tx; gas_limit >= initial_gas under REX5) are enforced upstream — revm default apply_eip7702_auth_list early-returns 0, and REX5 validate() rejects initial_gas > gas_limit before pre_execution runs.
    • gen_call_too_deep_result matches revm make_call_frame depth-check output exactly (CallTooDeep, Gas::new(gas_limit), cloned return_memory_offset), and for CALLCODE/DELEGATECALL the sub-tracker push_empty_frame vs before_frame_init + immediate pop are net-equivalent (target_address = caller, so no state-growth recorded; REX5 pop_frame_unwind_parent unwinds any KV flag on the revert path).
    • log_unchecked is safe under Log::new_unchecked because N <= 4 is statically enforced by the wired sites (LOG0..LOG4); discard_top set_len(len-1) is safe because U256 has no drop glue and the empty-stack guard runs first.
    • The precompile refactor preserves the pre-existing gas-recording for both OOG (gas.limit() / KZG fixed cost) and ok-or-revert (normalized spent) branches.
  • Docs and mutation suppressions updated in step with the code; the two new equivalent suppressions correctly identify that REX5 -> REX2/REX4 makes the debug_assert! gate weaker-but-still-always-true.
  • No new actionable findings.
  • Still open from earlier reviews: none.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🔧 Pushed CI fixes.

Agent log
I fixed the failing job: `codecov/patch/mega-evm-core`.

The changes are in commit `f0637bf` (`fix CI: improve patch coverage for guard paths`). I added targeted coverage for:
- `REX5` too-deep `StaticCall` in both `frame_init` and `inspect_frame_init`
- oversized `LOG` operand paths in the handwritten opcode wrappers
- direct REX5 non-KZG precompile error accounting in `crates/mega-evm/src/evm/precompiles.rs`

Verification passed locally:
- `cargo test -p mega-evm --test rex5 -- call_too_deep_guard`
- `cargo test -p mega-evm --test mini_rex -- opcode_wrappers`
- `cargo test -p mega-evm evm::precompiles::tests::test_rex5_non_kzg_precompile_error_records_forwarded_limit`
- `cargo fmt --all --check`
- `cargo check`
- `cargo clippy --workspace --lib --examples --tests --benches --all-features --locked`

I did not push.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

No actionable review feedback remains from @claude[bot]. The comment is an approval-style review with no requested changes and no question to answer, so there’s nothing to patch or reply to.

I verified the current head f0637bf8064e44e61ce3e7e9018caa9c4017a5b0 at job level:

  • Build & Test / lint: success
  • Build & Test / test: success
  • Build & Test / no-std: success
  • Coverage / mega-evm core coverage: success
  • Claude Code / doc-impact: success

Still in progress:

  • Mutation Testing / cargo-mutants gate
  • Mutation Testing / diff-scoped spec-gate
  • CodSpeed / instruction count

The worktree is clean. No code changes were needed, so there is no new commit and no PR comment to post.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Clean

  • PR HEAD (c1075c1) is unchanged since the prior automated review (same commit). No incremental code to re-litigate.
  • Prior round already verified the substantive changes: REX4/REX5 guard hoisting in frame_init, extended CALLCODE/DELEGATECALL coverage in frame_init + inspect_frame_init, REX5 inlined transact loop, non-EIP-7702 post-execution fast-path, hand-inlined add/pop/push1/log_unchecked wrappers with StackInspectTr::discard_top, and the precompile OOG-first refactor.
  • Docs (interception.md, rex5.md) and mutation suppressions are in step with the code.
  • No new actionable findings.
  • Still open from earlier reviews: none.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

No actionable review feedback remains from @claude[bot]. This is an approval-style comment with no requested changes and no question to answer, so there is nothing to patch, no PR reply to post, and no new commit to make.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Clean

  • PR HEAD (f0637bf) is unchanged since the prior automated review at the same commit — no incremental code to re-litigate.
  • Full-diff re-check confirms the substantive changes remain sound: REX4 exceeded-limit gate hoisted before interceptor dispatch, REX5 CALL_STACK_LIMIT guard now covers all FrameInput::Call schemes in both frame_init and inspect_frame_init, non-EIP-7702 post_execution fast path guarded by debug_assert_eq!(eip7702_refund, 0), REX5 inlined transact loop guarded by the REX5 final validate() initial-gas check, hand-inlined add/pop/push1/log_unchecked with Log::new_unchecked statically bounded to N ≤ 4 via StackInspectTr::discard_top, and the precompile OOG-first refactor that preserves compute-gas accounting on all paths (KZG fixed cost, non-KZG forwarded limit, success/revert spent).
  • Docs (interception.md, rex5.md) and mutation suppressions are consistent with the code.
  • No new actionable findings.
  • Still open from earlier reviews: none.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

I addressed the actionable CI feedback from the mutation job by adding a direct regression test that proves EQUIVALENCE must not record precompile compute gas in crates/mega-evm/src/evm/precompiles.rs. That kills the surviving MINI_REX -> EQUIVALENCE spec-gate mutant.

I committed it as 481cb55 with message fix CI: kill precompile spec-gate mutant.

Verification passed locally:

  • cargo test -p mega-evm evm::precompiles::tests::test_kzg_precompile_equivalence_does_not_record_compute_gas
  • cargo fmt --all --check
  • cargo check
  • cargo clippy --workspace --lib --examples --tests --benches --all-features --locked

No PR reply is needed for the latest @claude[bot] comment, since it is approval-only and has no question or requested change.

Generated-by: engineer-agent

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve — clean perf refactor, one minor cleanup nit inline.

Scope check

Perf changes for the ARO terminal set:

  • execution.rs: REX5-inlined transact_run path; new post_execution_without_eip7702_refund_work fast-path; reordered frame_init so REX4 exceeded-limit / REX5 depth guards run before pre-Rex3 oracle detection; widened REX5 depth guard to all 4 CallScheme variants.
  • instructions.rs: inlined push1/pop/add/log_unchecked, added StackInspectTr::discard_top.
  • precompiles.rs: restructured REX5 gas accounting into early-return + ok_or_revert paths (semantically equivalent).
  • Test coverage added for opcode wrappers and the widened depth guard.

Verified

  • Fast-path matches OpHandler::refund when tx_type != Eip7702 (only skips a no-op record_refund(0)).
  • frame_init reordering is safe: REX4 implies REX3, so REX4/REX5 guards and pre-Rex3 oracle detection are mutually exclusive.
  • Widened CallScheme guard is safe under Isthmus: for CALLCODE/DELEGATECALL/STATICCALL, is_call=false in load_acc_and_calc_gas, so charged_new_account_state_gas=false; reservoir is 0 with no AMSTERDAM.
  • Log::new_unchecked is safe because N is compile-time bounded to 0..=4 (debug_assert).
  • Inlined push1/pop/add are byte-for-byte semantically equivalent to revm originals.

Findings

  • [Minor] Redundant stack length pre-check in log_unchecked — see inline.

Follow-up (pre-existing, not blocking)

gen_call_too_deep_result builds a fresh CallOutcome without threading inputs.reservoir or inputs.charged_new_account_state_gas. Not introduced by this PR; harmless under current cfg (reservoir is 0 under Isthmus and the depth guard now runs before pre-Rex3 oracle detection where charged_new_account_state_gas matters), but worth a comment explaining the invariant so a future fork that turns reservoir non-zero does not silently drop state gas on the CallTooDeep path.

Comment thread crates/mega-evm/src/evm/instructions.rs Outdated
Generated-by: engineer-agent
@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

🔧 Pushed CI fixes.

Agent log
Committed `7afd416` as `fix CI: tighten execution mutation coverage`.

I added a focused integration test binary at `crates/mega-evm/tests/execution_mutation.rs` to fail fast on the remaining `execution.rs` mutants:
- deposit refund behavior under ISTHMUS/REGOLITH
- `inspect_frame_init` boundary and low-depth guard behavior

I also added two narrow suppressions in `mutants/suppressions.toml` for the genuinely equivalent deposit/refund mutants, with the proof tied to every `MegaSpecId` mapping to `OpSpecId::ISTHMUS`.

Verified locally with `cargo test -p mega-evm --test execution_mutation`, `cargo check`, `cargo fmt --all --check`, `cargo clippy --workspace --lib --examples --tests --benches --all-features --locked`, and `cargo sort --check --workspace --grouped --order package,workspace,lints,profile,bin,benches,dependencies,dev-dependencies,features`.

The required check-runs verification could not be completed because the GitHub CLI was not authenticated.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧭 Re-review update

  • Scope: incremental commits since 481cb55 — extended REX5 depth guard to all FrameInput::Call schemes (with matching inspector-path change), new mutation-killing tests (execution_mutation.rs, expanded opcode_wrappers.rs and call_too_deep_guard.rs), collapsed duplicate precompile spec-gate branch, and equivalent-mutant suppressions.
  • Verified: docs (docs/spec/upgrades/rex5.md, docs/spec/system-contracts/interception.md) are updated to reflect that the depth gate now covers all call schemes (not just CALL/STATICCALL), keeping spec text in sync with code.
  • Verified: mutation suppressions in mutants/suppressions.toml are justified — the MegaSpecId::REX3 → REX2/REX4 debug-assert mutants are truly equivalent under monotonic spec ordering, and the post_execution_without_eip7702_refund_work deposit-branch equivalents hold under the ISTHMUS ⊇ REGOLITH invariant (with the non-equivalent || → && mutant pinned by the new deposit-vs-regular gas equality test).
  • No new actionable findings this round.

Still open from earlier reviews:

  • [Minor] Redundant stack.len() < N pre-check in log_uncheckedthread. The code at crates/mega-evm/src/evm/instructions.rs:1686-1689 still eagerly halts before the subsequent popn::<N>(), which already returns None on underflow with an identical halt. Not a correctness bug; deletable at the author's discretion.

@RealiCZ

RealiCZ commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

@mega-putin Could you please fix the CI?

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Fixed locally and committed a follow-up that targets the remaining mutation/CI coverage gaps.

This also removes the redundant log_unchecked stack-length pre-check from the inline review.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean re-review

  • Scope: incremental commits since prior review (7afd416..cff42be) — two files touched: instructions.rs (removed the redundant stack.len() < N pre-check in log_unchecked) and execution_mutation.rs (test-tightening only).
  • log_unchecked cleanup lands the nit from the earlier round: popn::() already halts on underflow with byte-identical semantics, so the pre-check was dead work. Prior nit thread now resolved.
  • Refund test now clears REFUND_SLOTS = 4 SSTOREs so the London refund cap gets hit and asserts 0 < normal_refunded < 4 * 4800, keeping set_final_refund observable. New test_eip7702_existing_authority_records_final_refund locks in the post-execution EIP-7702 fast-path (non-zero final refund + authority nonce/code delta).
  • No new actionable findings.
  • Still open from earlier reviews: none — the one prior Claude nit was addressed in cff42be and its thread has been resolved.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

No action is needed on the latest @claude[bot] review.

It is approval-only, reports no actionable findings, and asks no question, so there is nothing to patch, no PR reply to post, and no new commit to make. The worktree is clean, and the latest local commit remains cff42be (address review feedback: tighten mutation coverage and log cleanup).

@flyq flyq left a comment

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.

1. The remaining red check: 2 inconclusive timeout mutants (not real gaps)

cargo-mutants gate reports diff score 100.0% (24/24 viable killed), 0 survivors, 2 suppressed, and 2 timed-out — the exit-1 is the gate's "no inconclusive timeouts" policy, not a coverage gap:

  • execution.rs:283:24: replace || with && in post_execution_without_eip7702_refund_work
  • execution.rs:521:37: replace == with != in run_without_catch_error

Both live in the new EIP-7702 refund fast-path.
Notably, the suppression file's own comment claims the ||→&& mutant "remains unsuppressed and is pinned by tests/execution_mutation.rs" — logically true (test_deposit_refund_matches_regular_tx_under_isthmus kills it deterministically: the mutation drops the deposit's final refund and the gas_used equality fails), but CI could not prove it: the per-mutant suite run hit the 123s timeout cap (242s/267s builds on a cold cache suggest a loaded runner, not a hang).
Same story for the ==→!= gate inversion (its non-7702 arm is a no-op by the PR's own equivalence argument; the 7702 arm loses the auth-list refund and existing 7702 tests would fail).

2. Recommended fix — collapse the vacuous branch instead of suppressing around it

The two new suppressions justify themselves by proving is_regolith is always true (every MegaSpecId maps to OpSpecId::ISTHMUS ⊇ REGOLITH), which makes !is_deposit || is_regolith at execution.rs:283 a constant true.
If that is the argument, the branch should not exist: replace the conditional (and the is_deposit/is_regolith locals) with an unconditional set_final_refund(...) plus debug_assert!(spec.is_enabled_in(OpSpecId::REGOLITH)) and a comment pointing at OpHandler::refund (op-revm-8.1.0/src/handler.rs:304–326).
This one change simultaneously: removes both timeout mutants (nothing left to mutate), removes both suppressions (and the governance question in finding 5), and makes the replica honest about the invariant instead of carrying dead deposit logic.
Alternative if the upstream-mirroring shape is preferred: raise the cargo-mutants timeout multiplier in the gate workflow — but that leaves the false "pinned by tests" comment in suppressions.toml, which should be corrected either way.
(Dropping the fast-path entirely remains defensible — see finding 3 — but unlike #346 the win is no longer negligible: the subcall_1000 rows show per-tx fixed costs matter for MegaETH's small-tx-dense workload.)

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Applied the suggested cleanup.

I collapsed the unreachable deposit/refund branch in post_execution_without_eip7702_refund_work into an unconditional set_final_refund(...), kept the invariant explicit with a debug_assert! and comment, and removed the now-obsolete suppression entries tied to that dead shape.

This matches the actual reachable-spec invariant more honestly and avoids carrying timeout-prone mutants around a vacuous condition.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: 1 finding.

Re-review after commit 042cf90 collapse of the deposit-refund branch and mutants/suppressions cleanup. Correctness pieces from prior rounds resolved:

  • Refund fast path (flyq #2): the invariant every MegaSpecId maps to OpSpecId::ISTHMUS which enables REGOLITH is tested by test_all_specs_map_to_isthmus_and_prague and re-asserted at runtime by the new debug_assert. New test_deposit_refund_matches_regular_tx_under_isthmus pins normal == deposit refund > 0 and < REFUND_SLOTS * 4800 so the collapse stays observably behavior-preserving.
  • Mutant-suppression whack-a-mole (flyq #1): is_deposit / is_regolith suppressions removed. Two new REX3 to REX2 / REX4 entries in mutants/suppressions.toml are correctly justified as equivalent under monotonic spec gates.
  • EIP-7702 final-refund path: test_eip7702_existing_authority_records_final_refund asserts gas_refunded > 0 on an existing-authority auth list, killing the == to != mutant on the auth-branch predicate.
  • Widened depth guard (frame_init line 979 / inspect_frame_init line 1252): covering all FrameInput::Call schemes is behavior-preserving; gen_call_too_deep_result matches revm synthetic result shape. Pinned by the two new inspect_frame_init tests.
  • Precompile compute-gas restructure: semantically identical to prior branch layout; new test_kzg_precompile_equivalence_does_not_record_compute_gas and test_rex5_non_kzg_precompile_error_records_forwarded_limit lock in the boundaries.
  • Inlined transact_run REX5 fast path: skip of redundant before_execution OOG check is safe because REX5 validate() already rejects those txs. Gated on spec.is_enabled(MegaSpecId::REX5) so pre-REX5 behavior is untouched.
  • log_unchecked / discard_top unsafe blocks: Log::new_unchecked safe because N <= 4 debug_asserted; set_len(len-1) safe because U256 has no drop glue and the top-of-stack precondition is preserved by the caller.

One docstring-drift finding from the branch restructure in precompiles.rs — inline comment below.

Comment thread crates/mega-evm/src/evm/precompiles.rs
@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Fixed.

I realigned the two large comment blocks in crates/mega-evm/src/evm/precompiles.rs so the halt-path compute-gas explanation sits above the early !is_ok_or_revert() return, the gas-normalization comment sits above the success/revert normalization block, and the MINI_REX+ spent() note now sits directly above the final success/revert compute-gas recording.

No behavior changed; this is just comment-anchor cleanup to match the restructured control flow.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean re-review. Incremental change (042cf90 to 0fd06a2) is the precompiles.rs comment realignment: the three commentary blocks now each sit directly above the matching branch, resolving the earlier read-order concern. No new actionable findings on the surviving 11-edit set. Still open from earlier reviews: none.

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

No action is needed on the latest @claude[bot] review.

It is approval-only, reports no actionable findings, and asks no question, so there is nothing to patch, no PR reply to post, and no new commit to make. The latest local commit remains 0fd06a2 (address review feedback: realign precompile comments).

@mega-putin

mega-putin Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

❌ I tried to fix the failing checks but the agent did not produce any changes (rc=1, duration 1518s). A human should take a look.

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

Labels

agent Generated by AI agents api:unchanged No change to the public interface or API comp:core Changes to the `mega-evm` core crate rust Pull requests that update rust code spec:stable Touches stable spec code — must not change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants