Repository navigation
chore: upgrade Rust nightly to fix closure miscompilation - #242
Conversation
Move the pinned compiler from nightly-2026-02-03 to nightly-2026-04-23, the first nightly with the fix for a closure-call code-generation bug (rust-lang/rust#155241, fixed by rust-lang/rust#155343). With an affected compiler, a by-value argument larger than two words (a `Vec`, say) passed to a closure call can alias the caller's memory instead of a temporary copy, so the callee mutates it in place: silently wrong values on 1.77-1.90, a double free from 1.91 on, in optimized builds. nightly-2026-02-03 (1.95.0-nightly) is in that range, and every release binary, mega-evm included, is built with it. mega-evm moved to the same nightly in megaeth-labs/mega-evm#411 and mega-reth follows in megaeth-labs/mega-reth#2561; mega-evm notes that a downstream build on an affected compiler needs its own pin update. No source changes: the new nightly brings no rustfmt or clippy findings in either CI configuration. rust-version stays 1.94, since mega-reth builds the shared crates with its own pinned compiler, and they still compile on mega-reth develop's nightly-2025-12-20. coverage-replayer folds the compiler into its binary_id, so stores scanned with the old compiler do not carry over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude review status
🛠️ Review did not finish Attempted head This round did not publish: MODEL_ACTION_FAILED: The Claude review retry action failed.. Anything listed below is from the last round that did. Workflow run: https://github.com/megaeth-labs/stateless-validator/actions/runs/43386965585 |
Picks up megaeth-labs/mega-evm#411, which bumps its Rust nightly to fix the same closure-call miscompilation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vincent-k2026
left a comment
There was a problem hiding this comment.
LGTM. The conflict is only in Cargo.toml (keep both the mega-evm and salt revs); please resolve it by merging main. It is worth mentioning the mega-evm rev bump in the body.
…htly-closure-miscompile Keeps mega-evm at c671ef0 and takes main's salt abf47a4. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
Move the pinned compiler from
nightly-2026-02-03tonightly-2026-04-23, the first nightly with the fix for a closure-call code-generation bug (rust-lang/rust#155241, fixed by rust-lang/rust#155343).mega-evm moved to the same nightly in megaeth-labs/mega-evm#411, and mega-reth followed in megaeth-labs/mega-reth#2561 (merged 2026-11-13).
Why
With an affected compiler, a by-value argument larger than two words (a
Vec, say) passed to a closure call can be the caller's own memory instead of a temporary copy, so the callee mutates it in place.In optimized builds this shows as silently wrong values on 1.77–1.90 and as a double free from 1.91 on.
nightly-2026-02-03is 1.95.0-nightly, inside that range, and every release binary is built with it, mega-evm included.mega-evm#411 notes that a downstream build on an affected compiler needs its own pin update.
No impact has been observed: mega-evm replayed mainnet blocks under both compilers with byte-identical results, and mega-reth#2561 did the same through the
stateless-corevalidation path.A miscompile cannot be ruled out code path by code path, so the fix is the compiler.
Changes
rust-toolchain.toml:nightly-2026-02-03→nightly-2026-04-23(1.97.0-nightly, LLVM 22.1.2).Cargo.toml/Cargo.lock:mega-evm7574376→c671ef0(chore: bump Rust nightly to fix closure-call miscompilation mega-evm#411), the same rev mega-reth develop pins after megaeth-labs/mega-reth#2561.The only file that commit changes is mega-evm's own
rust-toolchain.toml, which Cargo ignores for a git dependency, so the compiledmega-evmsource is unchanged.AGENTS.md(and soCLAUDE.md, a symlink to it): the documented toolchain.No Rust source changes: the new nightly brings no rustfmt or Clippy findings in either CI configuration.
Compatibility
rust-versionstays1.94.mega-reth builds
stateless-common,stateless-coreandstateless-r2with its own pinned compiler, and raising it would make mega-reth's1.94.0-nightlyrefuse them.nightly-2026-04-23and the samemega-evmrev, so the compiler and the EVM pin agree between the two repos.Its pin of these three crates (
a365a65) predates this PR and is unaffected.coverage-replayerfoldsrustc -vV(release, commit hash, LLVM version) into itsbinary_id, so stores scanned with the old compiler do not carry over; carry the candidate pool across withinspect --dump-poolbefore the next scan.Tests
On
nightly-2026-04-23:cargo test --workspace: 622 passed, 0 failed, 40 ignored (the endpoint-backeddebug-trace-serverintegration tests), the same as on the old compiler; the test profile is optimized, where the bug shows.This includes
validate_block_mainnet_fixturesover all 63 mainnet fixture blocks andreplays_mainnet_fixtures_with_header_sanity.cargo fmt --all --check,cargo sort --check, and both CI Clippy configurations: clean.🤖 Generated with Claude Code