Skip to content

refactor(evm): remove unused apply_curie_hard_fork dead code#101

Open
panos-xyz wants to merge 3 commits intomainfrom
chore/remove-unused-curie-hardfork-code
Open

refactor(evm): remove unused apply_curie_hard_fork dead code#101
panos-xyz wants to merge 3 commits intomainfrom
chore/remove-unused-curie-hardfork-code

Conversation

@panos-xyz
Copy link
Copy Markdown
Contributor

@panos-xyz panos-xyz commented Apr 22, 2026

Summary

  • Remove apply_curie_hard_fork and related constants — the function is unreachable in every Morph environment and has been dead code since Morph launched.
  • Keep MorphHardfork::Curie, is_curie(), curieBlock chainspec parsing, and the Curie L1-fee formula branch in L1BlockInfo::try_fetch — those are active code paths.

Why it's dead code

Every Morph chain config — mainnet, hoodi, devnet, and l2-genesis-generated configs — sets curieBlock = 0 (semantics: already on Curie). The pre-execution handler guards on:

self.spec
    .morph_fork_activation(MorphHardfork::Curie)   // ForkCondition::Block(0)
    .transitions_at_block(block_number)            // true iff block_number == 0

transitions_at_block(X) returns true only when X == curieBlock == 0. Block 0 is genesis and never flows through BlockExecutor::apply_pre_execution_changes, so the call site is unreachable. The test fixtures that use curieBlock = 200 (crates/chainspec/src/spec.rs:549/607) only exercise ForkCondition parsing and is_curie_active_at_block; they never construct a MorphBlockExecutor and so don't invoke the removed code either.

The L1GasPriceOracle's Curie slots (6/7/8/9) are in fact initialized by the contract owner via a regular transaction after launch — e.g. mainnet block 863 (tx 0x10fab2... from the oracle owner) sets slot 9 via a standard call, which already flows through commit_transaction and the normal state hook. devnet behaves the same way: the genesis generator (ops/l2-genesis/morph-chain-ops/genesis/config.go) only sets slots 0–4, and the Curie slots stay zero until an operator invokes the hardhat gasOracleEnableCurie task.

What's removed

  • crates/evm/src/block/curie.rs — the entire file (function + unit test)
  • crates/evm/src/block/mod.rs — module declaration, import, and the transition call site
  • crates/revm/src/l1block.rsCURIE_L1_GAS_PRICE_ORACLE_STORAGE plus its INITIAL_*/IS_CURIE inputs and their unit test
  • crates/revm/src/lib.rs — the five corresponding re-exports

Test plan

  • cargo check --all
  • cargo fmt --all -- --check
  • cargo clippy --all --all-targets -- -D warnings
  • cargo test --all
  • cargo test --doc --all
  • make test-e2e — 77/77 integration tests passing

Summary by CodeRabbit

  • Chores
    • Removed support for the Curie hardfork transition, including the Curie-related gas price oracle initialization and associated public constants and re-exports.
    • Updated advisory checks to ignore a specific advisory warning.
  • Tests
    • Removed Curie-related unit tests that validated oracle/storage initialization and transitions.

Every Morph chain config — mainnet, hoodi, devnet, and
l2-genesis-generated configs — sets `curieBlock = 0` ("already on Curie").
The pre-execution handler guards on
`ForkCondition::Block(0).transitions_at_block(block_number)`, which only
fires when `block_number == 0`. Block 0 is genesis and never flows
through `BlockExecutor::apply_pre_execution_changes`, so
`apply_curie_hard_fork` is unreachable in every Morph environment.

The L1GasPriceOracle Curie slots (6/7/8/9) are instead initialized by
the contract owner via regular transactions after launch (e.g. mainnet
block 863 calls the oracle's initializer via a standard tx), which
already flow through `commit_transaction` and the normal state hook.

This PR removes:
- `crates/evm/src/block/curie.rs` (the function + its unit test)
- the module declaration, import, and call site in
  `crates/evm/src/block/mod.rs`
- `CURIE_L1_GAS_PRICE_ORACLE_STORAGE` and its `INITIAL_*`/`IS_CURIE`
  inputs in `crates/revm/src/l1block.rs`, plus the associated unit test
- the re-exports in `crates/revm/src/lib.rs`

`MorphHardfork::Curie`, `is_curie()`, the chainspec `curieBlock`
parsing, and the Curie L1-fee formula branch in `L1BlockInfo::try_fetch`
are all retained — those remain active code paths.

No runtime behavior changes. Verified with `cargo check`, `cargo clippy
--all --all-targets -- -D warnings`, `cargo fmt --all -- --check`,
`cargo test --all`, `cargo test --doc --all`, and `make test-e2e` (77
integration tests passing).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4ec18a07-eb42-43f7-a1d3-912454decdbd

📥 Commits

Reviewing files that changed from the base of the PR and between 63db94d and cd6fa69.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • deny.toml
✅ Files skipped from review due to trivial changes (1)
  • deny.toml

📝 Walkthrough

Walkthrough

This PR removes the Curie hardfork transition implementation and its module declaration, deletes Curie-related constants and re-exports, and updates configuration to silence a specific advisory.

Changes

Cohort / File(s) Summary
Curie Hardfork Module
crates/evm/src/block/curie.rs, crates/evm/src/block/mod.rs
Deleted the Curie transition module and apply_curie_hard_fork function; removed module declaration and the conditional invocation from apply_pre_execution_changes.
Curie Constants & Re-exports
crates/revm/src/l1block.rs, crates/revm/src/lib.rs
Removed Curie-related constants (INITIAL_L1_BLOB_BASE_FEE, INITIAL_COMMIT_SCALAR, INITIAL_BLOB_SCALAR, IS_CURIE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE) and their public re-exports.
Configuration
deny.toml
Added an ignore rule for advisory RUSTSEC-2026-0105 to suppress the core2 advisory.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • chengwenxi
  • anylots

Poem

🐰 I hopped through code with curious cheer,
Curie's traces gently disappear,
Constants tucked away, modules gone,
The tree grows simpler at the dawn. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: removal of unused apply_curie_hard_fork dead code. It directly relates to the primary objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-unused-curie-hardfork-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…-0104

cargo-deny on this PR fails with:

  error[vulnerability]: Reachable panic in certificate revocation list parsing
  rustls-webpki 0.103.10
  ID: RUSTSEC-2026-0104

Fix shipped in 0.103.13 (2026-04-21). cargo update is a clean patch
bump (no other lockfile changes). Lets the cargo-deny CI step pass
without us having to ignore the advisory.
… yanked)

cargo-deny still failing after the rustls-webpki bump. New advisory:

  error[unmaintained]: core2 is unmaintained, all versions yanked
  ID: RUSTSEC-2026-0105

Maintainer stopped maintaining and yanked every published version, so
`cargo update -p core2` can't pick a non-yanked one. core2 is a transitive
dep we don't pull directly; the fix would be to drop whichever upstream
crate still pulls it in. Until that lands, ignore the advisory with a
note pointing at the upstream issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant