NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7k stars 1.36k forks source link

Add hardfork histories for opt and arb mainnet/sepolia #5394

Closed fvictorio closed 2 weeks ago

fvictorio commented 3 weeks ago

Fixes https://github.com/NomicFoundation/edr/issues/447.

We don't have hardfork activation histories for optimism and arbitrum. This means that if you fork one of those networks and immediately make a call, you'll get a "No known hardfork for execution on historical block..." error, because those calls are executed in the forked block, which uses the remote hardfork.

A scenario that doesn't work and is easier to understand is a call executed in a block before the forked block, for the same reason, but this is rarely done.

You might be wondering "why aren't more people complaining about this? Surely there are many users forking optimism and arbitrum", and I think the answer is that normally you send a transaction before making a call, which mines a new block and then the subsequent calls use the local, known hardfork.

The "histories" are used are obviously wrong. This basically says "use Shanghai for these chains". Finding the proper hardfork block numbers for L2s is hard, and even if you can do it there are extra problems: 1) those hardforks might not map 1-1 with ethereum mainnet hardforks, and 2) the hardforks might be specified using timestamps instead of block numbers, which makes this even harder.

So I did the lazy, conservative thing and set Shanghai to block 0 for the four chains.

changeset-bot[bot] commented 3 weeks ago

🦋 Changeset detected

Latest commit: 1ad1973595c53e57cffd7570f0444d68b6c36b80

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | hardhat | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 9:22am