Skip to content

feat: add Amsterdam hardfork mapping and default to Osaka (#14683)#552

Merged
Dargon789 merged 1 commit into
Dargon789:masterfrom
foundry-rs:master
May 11, 2026
Merged

feat: add Amsterdam hardfork mapping and default to Osaka (#14683)#552
Dargon789 merged 1 commit into
Dargon789:masterfrom
foundry-rs:master

Conversation

@Dargon789
Copy link
Copy Markdown
Owner

@Dargon789 Dargon789 commented May 11, 2026

feat: add Amsterdam hardfork mapping to SpecId

Add EthereumHardfork::Amsterdam => SpecId::AMSTERDAM mapping in spec_id_from_ethereum_hardfork. Without this, Amsterdam would hit the unreachable!() catch-all arm.

The default evm_version is already set to Osaka.

Amp-Thread-ID: https://ampcode.com/threads/T-019e113f-5bda-711b-8ec5-4841042ba62c

Motivation

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Summary by Sourcery

Map the Amsterdam Ethereum hardfork to its corresponding SpecId and cover it with tests.

Bug Fixes:

  • Prevent Amsterdam hardfork lookups from triggering the unreachable catch-all in spec_id_from_ethereum_hardfork.

Tests:

  • Add a unit test asserting that the Amsterdam hardfork resolves to SpecId::AMSTERDAM.

feat: add Amsterdam hardfork mapping to SpecId

Add EthereumHardfork::Amsterdam => SpecId::AMSTERDAM mapping in
spec_id_from_ethereum_hardfork. Without this, Amsterdam would hit the
unreachable!() catch-all arm.

The default evm_version is already set to Osaka.

Amp-Thread-ID: https://ampcode.com/threads/T-019e113f-5bda-711b-8ec5-4841042ba62c

Co-authored-by: Centaur AI <ai@centaur.local>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

@decofe is attempting to deploy a commit to the Foundry development Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Maps the new Ethereum Amsterdam hardfork to its corresponding EVM SpecId and extends the hardfork-to-spec mapping test coverage to include Amsterdam, preventing the code from falling into the unreachable catch-all arm.

Class diagram for Ethereum hardfork to SpecId mapping update

classDiagram
    class EthereumHardfork {
        <<enum>>
        Frontier
        Homestead
        Byzantium
        Constantinople
        Istanbul
        Berlin
        London
        Shanghai
        Cancun
        Prague
        Osaka
        Amsterdam
        Bpo3
        Bpo4
        Bpo5
    }

    class SpecId {
        <<enum>>
        FRONTIER
        HOMESTEAD
        BYZANTIUM
        CONSTANTINOPLE
        ISTANBUL
        BERLIN
        LONDON
        SHANGHAI
        CANCUN
        PRAGUE
        OSAKA
        AMSTERDAM
    }

    class HardforkSpecMapper {
        +spec_id_from_ethereum_hardfork(hardfork: EthereumHardfork) SpecId
    }

    EthereumHardfork --> HardforkSpecMapper : input
    HardforkSpecMapper --> SpecId : output

    HardforkSpecMapper ..> SpecId : maps Amsterdam to AMSTERDAM
Loading

File-Level Changes

Change Details Files
Map EthereumHardfork::Amsterdam to SpecId::AMSTERDAM in the hardfork-to-spec resolver and update tests accordingly.
  • Extend spec_id_from_ethereum_hardfork match to return SpecId::AMSTERDAM when given EthereumHardfork::Amsterdam, instead of hitting the unreachable catch-all arm.
  • Add an assertion in the hardfork mapping tests to verify that EthereumHardfork::Amsterdam maps to SpecId::AMSTERDAM, alongside existing checks for Cancun, Prague, and Osaka.
crates/evm/hardforks/src/lib.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 11, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
🔚 Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mergify
Copy link
Copy Markdown

mergify Bot commented May 11, 2026

⚠️ The sha of the head commit of this PR conflicts with #533. Mergify cannot evaluate rules on this PR. Once #533 is merged or closed, Mergify will resume processing this PR. ⚠️

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next Ready Ready Preview, Comment May 11, 2026 4:41am

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for the Amsterdam hardfork by mapping EthereumHardfork::Amsterdam to SpecId::AMSTERDAM and adding a corresponding test case. The reviewer suggested mapping the Bpo3, Bpo4, and Bpo5 variants to SpecId::AMSTERDAM as well, rather than leaving them as unimplemented, to avoid potential runtime panics.

Comment thread crates/evm/hardforks/src/lib.rs
@Dargon789 Dargon789 merged commit 7b002db into Dargon789:master May 11, 2026
7 of 11 checks passed
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.

2 participants