foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(`anvil`): modify `--hardfork` flag to support Optimism specific hardforks

Open 0xForerunner opened this issue 1 year ago • 4 comments

Component

Anvil

Describe the feature you would like

Problem

There's currently a --hardfork flag which allows you to specify which ethereum hardfork to use. When running with optimism the flag still accepts an ethereum hardfork, not an optimism one.

Solution

Create a new flag (maybe --optimism-hardfork or perhaps adapt the current one to allow setting the optimism hardfork.

0xForerunner avatar Aug 23 '24 17:08 0xForerunner

We're currently using anvil for optimism/tests work and we need this feature, so if there are no objections I'll probably start working on it right away.

0xForerunner avatar Aug 23 '24 17:08 0xForerunner

Given there already exists an --optimism flag could we check against the existence of it in --hardfork <name>? This allows for further flexibility when other projects require custom hardforks

See: https://github.com/foundry-rs/foundry/blob/master/crates/anvil/src/hardfork.rs

zerosnacks avatar Aug 26 '24 08:08 zerosnacks

@zerosnacks let me know if this looks good to you: https://github.com/foundry-rs/foundry/pull/8749

0xForerunner avatar Aug 27 '24 14:08 0xForerunner

Hi @ewoolsey this looks good! Pending reviews from others

zerosnacks avatar Aug 27 '24 15:08 zerosnacks