Skip to content

fix(chain): schedule Rex6 on the canonical mainnet and testnet hardfork schedules - #371

Merged
RealiCZ merged 4 commits into
mainfrom
cz/fix/schedule-rex6-canonical-hardforks
Sep 7, 2026
Merged

RealiCZ merged 4 commits into
mainfrom
cz/fix/schedule-rex6-canonical-hardforks

Conversation

@RealiCZ

@RealiCZ RealiCZ commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Schedule Rex6 on the canonical mainnet / testnet hardfork schedules in block/chain.rs, so mega-evme replay (which resolves the spec through hardfork_schedule) stops applying Rex5 rules to blocks after the activation timestamps; drop the stale "Rex6 is unscheduled" prose; and fix a wrong module-doc sentence in block/limit.rs about deposit DA accounting.

Why

Both networks have been executing Rex6 since the published timestamps — testnet 1786330800 (2026-08-10), mainnet 1787626800 (2026-08-25); the on-chain SequencerRegistry (0x6342…0006) reports version() == "2.0.0" and minRotationDelay() == 21600 on both. #364 published the timestamps in docs/, but chain.rs still pinned Rex6 as Never and a test asserted it, so every replay of a post-activation block ran the wrong spec. Consensus is unaffected (mega-reth derives forks from genesis); this is replay/tooling correctness.

Found by the Fenz.AI 2026-09-02 audit (F-016 / ME-FE-20260902-016, F-023 / ME-FE-20260902-023).

Changes

  • block/chain.rs: Rex6 entries for mainnet and testnet, each with SequencerRegistryRex6Config { rex6_min_rotation_delay: 21600 } (the governance value the operator genesis attaches; readable live via minRotationDelay()). Module doc mentions the Rex6 params.
  • Tests: test_mainnet_/test_testnet_schedule_resolves_specs_by_timestamp and test_schedule_dispatch_by_chain_id pin the Rex5→Rex6 boundary; test_canonical_schedules_do_not_activate_rex6_or_rex7 becomes test_canonical_schedules_activate_rex6_and_pin_rex7_never (Rex6 at the published timestamps with delay 21600, Rex7 still Never, Rex6 terminal).
  • AGENTS.md: Rex6 is frozen and activated; the "frozen ≠ scheduled" rule stays, without naming Rex6 as the unscheduled example.
  • block/limit.rs: module doc said deposit DA sizes are "still tracked and accumulated in block DA usage counters"; post_execution_update skips deposits, so the doc now says so.

No behaviour change for any spec; no docs/ change (already published in #364).

Verification

  • cargo test -p mega-evm --lib — 262 passed
  • cargo test -p mega-evm --test mutation -- hardfork_schedule — 2 passed
  • cargo clippy --workspace --lib --examples --tests --benches --all-features --locked, cargo fmt --all --check — clean

…rk schedules

Both networks have executed Rex6 since the published timestamps (testnet 1786330800,
mainnet 1787626800; the on-chain SequencerRegistry reports v2.0.0 with minRotationDelay 21600),
but block/chain.rs still pinned Rex6 as Never, so mega-evme replay applied Rex5 rules to every
post-activation block. Add the Rex6 entries with the governance-seeded
SequencerRegistryRex6Config, pin them in the schedule tests, and drop the stale
"Rex6 is unscheduled" prose from AGENTS.md. Also correct the block/limit.rs module doc that
claimed deposit DA sizes are accumulated into the block DA counter (they are skipped).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T09:37:50.434480Z c70e838 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mega-maxwell

mega-maxwell Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Claude review status

Living comment — rewritten in place. The review workflow keeps this single comment up to date instead of posting a new one each round, so it always describes the latest reviewed commit and the earlier text is intentionally gone. No reply is needed here; reply to a finding in its own review thread, and answer an open question in a reply on this PR. The next review round reconciles your answer.

🛠️ Review did not finish

Attempted 2b0e9754..c70e8389 · updated 2026-09-07T02:14:30+00:00

This round did not publish: PRIOR_FINDING_INVALID in phase compile. Anything listed below is from the last round that did. Re-run the workflow or push a new commit to try again.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Nothing to test — no mutants were generated on the changed lines.

@RealiCZ RealiCZ 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 labels Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.6%. Comparing base (a39bd1e) to head (c70e838).

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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

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

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

No new test gaps introduced by this change. 🎉

@codspeed

codspeed Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 15.43%

⚠️ 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

⚡ 1 improved benchmark
✅ 384 untouched benchmarks
🗄️ 44 archived benchmarks run1

Performance Changes

Benchmark BASE HEAD Efficiency
validate_schedule 16.8 µs 14.6 µs +15.43%

Tip

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


Comparing cz/fix/schedule-rex6-canonical-hardforks (c70e838) with main (a39bd1e)

Open in CodSpeed

Footnotes

  1. 44 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them.

…canonical-hardforks

# Conflicts:
#	AGENTS.md
#	crates/mega-evm/src/block/chain.rs

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

Code review — Rex6 canonical schedule entries

Reviewed at 2b0e97544671 · xhigh effort · 3 findings

Reviewed at 2b0e9754 (the merge of main at #362; the PR's own diff against the new base is unchanged at 3 files, +50/−16). Line numbers below are from the post-change files at that commit.

The schedule change is correct and should merge. Verified: the two timestamps and the 21600 delay match docs/spec/upgrades/overview.md:135,138 and the canonical fork registry; the new tests exercise the boundary rather than restating the entry (chain.rs:147-148, :162-163, :193-195); the committed replay fixture (replay_offline.cache.json, chain 4326 at 1780969472) sits between mainnet Rex5 and Rex6 and still resolves REX5, so no re-capture is needed; and the replay-only claim holds — hardfork_schedule has no callers in mega-reth. cargo test -p mega-evm --lib passes at the merge commit (288 passed, including all 6 block::chain tests).

One finding is worth fixing before merge; the other two are cleanup.

Inline findings

# Where Finding
1 crates/mega-evm/src/block/limit.rs:112 New L1-posting-cost clause is unsupported and backwards
2 crates/mega-evm/src/block/chain.rs:38 Rex6 literals unpinned; 21600 duplicated verbatim
3 AGENTS.md:67 Bullet hard-codes timestamps, overstates chain.rs

Comment thread crates/mega-evm/src/block/limit.rs Outdated
Comment thread crates/mega-evm/src/block/chain.rs
Comment thread AGENTS.md Outdated
…chedules to the published timestamps, trim doc prose

- one REX6_MIN_ROTATION_DELAY constant shared by both schedules
- new block_executor::canonical_schedule test reads docs/spec/upgrades/overview.md and asserts
  every fork's testnet/mainnet activation equals the chain.rs entry (Never for N/A / unscheduled)
- AGENTS.md: point at block/chain.rs instead of repeating the timestamps; scheduling is decided in
  the node chainspecs and mirrored here for replay tooling
- limit.rs: drop the unsupported L1-posting-cost clause

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55681e5c61

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/mega-evm/tests/block_executor/canonical_schedule.rs Outdated
docs/spec/upgrades/overview.md is not part of the published crate, so the test compares only when
the crate sits in the repository layout and skips (with a message) from a tarball or vendored copy.
@claude

claude Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Documentation Impact: This PR corrects a stale internal doc-comment in crates/mega-evm/src/block/limit.rs describing deposit-transaction DA size tracking, and the published spec page docs/spec/evm/resource-limits.md (lines 80-81) appears to say the opposite and should be checked/updated to match. resource-limits.md currently reads: Deposit transactions MUST be exempt from DA size limit checks. Their DA size MAY still be tracked for monitoring purposes. This PR's corrected comment in block/limit.rs states the opposite for the block-level counter: Deposit DA sizes are not accumulated into the block DA usage counter (post_execution_update skips them), so block_da_size_used reflects non-deposit transactions only. Verified against BlockLimiter::post_execution_update_raw, which only adds da_size when the tx is not a deposit. Since this is existing (not new) behavior, the spec's MAY still be tracked line looks like it has been inaccurate independent of this PR - worth updating for clarity, or confirming that tracked refers to something other than block_da_size_used (e.g. a separate monitoring counter) so the two descriptions are not read as contradictory. This can be addressed in this PR or a follow-up.

@RealiCZ
RealiCZ merged commit 04d5b4e into main Sep 7, 2026
33 of 35 checks passed
@RealiCZ
RealiCZ deleted the cz/fix/schedule-rex6-canonical-hardforks branch September 7, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:unchanged No change to the public interface or API comp:core Changes to the `mega-evm` core crate spec:unchanged No change to any `mega-evm`'s behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants