Skip to content

Conversation

zerosnacks
Copy link
Member

@zerosnacks zerosnacks commented Sep 9, 2025

Motivation

In order to make it easier to figure out the supported precompiles and system contracts as a user I think it makes sense to add an eth_config-like RPC method: https://eips.ethereum.org/EIPS/eip-7910

Closes: #11433

This completes the work required to make Foundry ready for Osaka.

Closes: #11428

Solution

Adds eth_config-like endpoint inspired by the actual eth_config specification with notable exceptions:

Spec compliant:

  • Note: the activation timestamp is always 0 as the configuration is set at moment of forking.
  • Note: the next and last fields are always null as this node does not participate in any forking on the network.

Not spec compliant:

The fork_id is always 0x00000000 as this node does not participate in any forking on the network. For all intended purposes you can consider this unused by Anvil.

Another thing that may be confusing to people is that we currently do not explicitly support all effects of system contracts yet, notably: #10357

Example output:

cast rpc eth_config
{
   "current":{
      "activationTime":0,
      "blobSchedule":{
         "baseFeeUpdateFraction":5007716,
         "max":9,
         "target":6
      },
      "chainId":"0x7a69",
      "forkId":"0x00000000",
      "precompiles":{
         "BLAKE2F":"0x0000000000000000000000000000000000000009",
         "BLS12_G1ADD":"0x000000000000000000000000000000000000000b",
         "BLS12_G1MSM":"0x000000000000000000000000000000000000000c",
         "BLS12_G2ADD":"0x000000000000000000000000000000000000000d",
         "BLS12_G2MSM":"0x000000000000000000000000000000000000000e",
         "BLS12_MAP_FP2_TO_G2":"0x0000000000000000000000000000000000000011",
         "BLS12_MAP_FP_TO_G1":"0x0000000000000000000000000000000000000010",
         "BLS12_PAIRING_CHECK":"0x000000000000000000000000000000000000000f",
         "BN254_ADD":"0x0000000000000000000000000000000000000006",
         "BN254_MUL":"0x0000000000000000000000000000000000000007",
         "BN254_PAIRING":"0x0000000000000000000000000000000000000008",
         "ECREC":"0x0000000000000000000000000000000000000001",
         "ID":"0x0000000000000000000000000000000000000004",
         "KZG_POINT_EVALUATION":"0x000000000000000000000000000000000000000a",
         "MODEXP":"0x0000000000000000000000000000000000000005",
         "RIPEMD160":"0x0000000000000000000000000000000000000003",
         "SHA256":"0x0000000000000000000000000000000000000002"
      },
      "systemContracts":{
         "BEACON_ROOTS_ADDRESS":"0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
         "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":"0x0000bbddc7ce488642fb579f8b00f3a590007251",
         "DEPOSIT_CONTRACT_ADDRESS":"0x00000000219ab540356cbb839cbe05303d7705fa",
         "HISTORY_STORAGE_ADDRESS":"0x0000f90827f1c53a10cb7a02335b175320002935",
         "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":"0x00000961ef480eb55e80d19ad83579a64c007002"
      }
   },
   "next":null,
   "last":null
}

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@zerosnacks zerosnacks moved this to Ready For Review in Foundry Sep 9, 2025
@zerosnacks zerosnacks marked this pull request as ready for review September 9, 2025 15:02
@grandizzy grandizzy added this to the v1.4.0 milestone Sep 11, 2025
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

makes sense! left a comment re blobSchedule

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this is my new favorite endpoint 👍

this is likely not super helpful for the average user but nice to have

Comment on lines +863 to +881
if self.odyssey {
precompiles_map.insert(
PrecompileId::P256Verify.name().to_string(),
u64_to_address(P256VERIFY_ADDRESS),
);
}

if self.is_celo() {
precompiles_map.insert(
celo_precompile::PRECOMPILE_ID_CELO_TRANSFER.clone().name().to_string(),
CELO_TRANSFER_ADDRESS,
);
}

if let Some(factory) = &self.precompile_factory {
for (precompile, _) in &factory.precompiles() {
precompiles_map.insert(precompile.id().name().to_string(), *precompile.address());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

we need to do something about this, we have this in a few locations and maintaining this is a bit horrible

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, will have a look in a follow-up if we can have a shared helper for this to make this more maintainable as it currently is strictly tied to the EVM creation that we don't have access to in Anvil's backend

@grandizzy grandizzy self-requested a review September 12, 2025 11:58
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

lgtm!

@zerosnacks zerosnacks merged commit 3f9c45a into master Sep 12, 2025
25 checks passed
@zerosnacks zerosnacks deleted the zerosnacks/add-eth-config-anvil-rpc branch September 12, 2025 12:28
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feat(anvil): add eth_config RPC endpoint for Osaka hardfork meta: make Foundry ready for Fusaka
3 participants