Skip to content

mega: cherry-pick the upstream EIP-8037/2780 gas core (v112..v117) - #42

Closed
RealiCZ wants to merge 18 commits into
cz/chore/fork-bringupfrom
cz/feat/upstream-gas-core
Closed

RealiCZ wants to merge 18 commits into
cz/chore/fork-bringupfrom
cz/feat/upstream-gas-core

Conversation

@RealiCZ

@RealiCZ RealiCZ commented Sep 16, 2026

Copy link
Copy Markdown

Summary

The upstream EIP-8037 / EIP-2780 gas core, cherry-picked from bluealloy/revm between v112 and v117 (16 commits, #3725 to #3857), each kept as its own mega: cherry-pick upstream <sha> — <title> commit. Nothing MegaETH-specific rides along: no hook, no price, no policy. This is the base the fork's hooks land on in the next pull requests.

What the commits bring, in order:

  • configurable max refund quotient; fallible refund; journal finalised on inspect error (#3757, #3758, #3780)
  • EIP-7702 regular-gas GasId names (#3725)
  • glamsterdam devnet-6 gas accounting (#3782), devnet-7 alignment with the EIP-2780 runtime gas phase and fixtures v7.0.0 (#3795), devnet-8 gas repricing (#3850), removal of the duplicate Amsterdam overrides and dead CPSB constants (#3857)
  • gas tracker underflow fix (#3813); state validated before gas tracking (#3815)
  • inspector fixes: stale selfdestruct journal entries (#3805), EIP-7708 transfer logs forwarded (#3816)
  • PrecompileOutput tracks spilled state gas (#3820); precompile frame gas built in the handler (#3822)
  • call depth checked in CREATE pre-access checks (#3829)
  • revme test-state refactor (#3803); EEST devnet fixtures move to [email protected]

Upstream touch points

None to register: cherry-picked upstream commits are dropped, not re-applied, when the base line moves past them (the touch-points job is exempt for mega:cherry-pick). The one conflict was Cargo.lock, where upstream bumped anyhow to 1.0.103 and this fork already carries 1.0.104.

API exceptions

Seven crates change public items; every one is registered in the "API exceptions" table of MEGAETH-FORK.md (16 rows) with the consumers it was checked against. Summary:

  • revm-primitives: five dead constants removed (CPSB constants, an EIP-7702 regular-gas constant renamed).
  • revm-interpreter: CreateOutcome and InputsImpl gain a field; InputsTr::depth added.
  • revm-context: JournalCfg swaps the EIP-7708 burn switch for the EIP-8246 clear switch; CfgEnv loses the 7708 field; two JournalInner 7708 helpers removed.
  • revm-context-interface: JournalEntry::CodeChange gains two fields; JournalEntryTr::code_changed 1 → 3 parameters; Cfg gains two methods and loses one; the initial-gas functions gain a parameter (EIP-2780 runtime phase); the EIP-7702 refund accessors are renamed; InitialAndFloorGas.state_refund removed.
  • revm-handler: validate_initial_tx_gas*, create_init_frame, Handler::execution, Handler::first_frame_input change parameter counts; Handler::refund returns a value.
  • revm-precompile: PrecompileOutput gains state_gas_spilled.
  • revm-inspector: InspectorHandler::inspect_execution 2 → 3 parameters.

Consumers checked by grep for every item: alloy-evm 0.36.0, alloy-op-evm 0.15.0, revm-inspectors 0.43.0 and mega-reth (2dc2f44a) use none of them. op-revm 20 breaks in three places and is replaced by the vendored revm 43 port in the next pull request; mega-evm adapts in its own.

Test plan

Locally on the pinned 1.95.0: clippy with -Dwarnings on all features, fmt, nextest on the three feature sets (384 / 384 / 387 tests), no_std on riscv32 and riscv64, the four revm feature sets, docs, doctests, cargo deny check all, and cargo semver-checks for the twelve crates against both the crates.io baseline and the pull request base. The EEST run on the new devnet-8 fixtures is CI's.

Labels checklist

mega:cherry-pick, api:exception.

…as accounting & EIP alignment (bluealloy#3782)

Conflict: crates/interpreter/src/instructions/host.rs, 1 hunk / 10 lines.
v112 computed skip_cold from cold_storage_additional_cost and passed it to
sstore_skip_cold_load; upstream drops that optimization because EIP-7928 BAL
records the slot access even on a certain OOG. Resolution: took upstream.
…net-7 alignment (EIP-2780 runtime gas phase, fixtures v7.0.0) (bluealloy#3795)

Conflict: MIGRATION_GUIDE.md only, 1 hunk / 24 lines. v112 has no Unreleased
preamble; took the upstream section verbatim. No source conflict.
…ile frame gas without touching the interpreter crate (bluealloy#3822)
The sixteen cherry-picked upstream commits change public items in seven
crates (constants, struct fields, trait methods and parameter counts around
the EIP-2780 runtime gas phase, EIP-7702 GasId names, EIP-7708/8246 journal
switches and the precompile frame gas). Rule 1 allows that only with a row
in the API exceptions table; these are the rows, one per item group, with
the consumers each was checked against: alloy-evm 0.36.0, alloy-op-evm
0.15.0, revm-inspectors 0.43.0 and mega-reth use none of them, op-revm is
replaced by the vendored port in the next pull request, and mega-evm adapts
in its own.
@RealiCZ RealiCZ added mega:cherry-pick Upstream commits brought in unchanged apart from recorded conflicts api:exception Registered exception to the superset rule labels Sep 16, 2026
@mega-maxwell

mega-maxwell Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

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 head 4393fa0d · updated 2026-09-16T08:58:13+00:00

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

RealiCZ added a commit that referenced this pull request Sep 16, 2026
The touch-point and semver jobs gated on the labels in the event payload,
which does not carry a label added right after the pull request opened:
#42 was opened with its labels and both jobs still saw none. Ask the API
for the labels at run time instead.
RealiCZ added a commit that referenced this pull request Sep 16, 2026
The touch-point and semver jobs gated on the labels in the event payload,
which does not carry a label added right after the pull request opened:
#42 was opened with its labels and both jobs still saw none. Ask the API
for the labels at run time instead.
@RealiCZ
RealiCZ deleted the branch cz/chore/fork-bringup September 16, 2026 09:01
@RealiCZ RealiCZ closed this Sep 16, 2026
@RealiCZ

RealiCZ commented Sep 16, 2026

Copy link
Copy Markdown
Author

Superseded by #45: rebuilt on a clean base (the previous base branch was the head of an already-merged pull request). Same sixteen cherry-picks and the same exception rows.

@RealiCZ
RealiCZ deleted the cz/feat/upstream-gas-core branch September 16, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:exception Registered exception to the superset rule mega:cherry-pick Upstream commits brought in unchanged apart from recorded conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant