foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(`hardfork`): support EIP-7907: increase initcode and contract code size limit

Open jgresham opened this issue 6 months ago • 2 comments

Component

Forge

Describe the feature you would like

EIP: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7907.md

Some of the work could be done before it gets scheduled for inclusion (we should know in the next few weeks if it does). While EIP 7907 is being tested, devs can use --ignore-eip-3860 which allows for builds above the current limits.

Changes required (wip):

  1. forge build --sizes should be updated to show the new max sizes (yellow/red colors and margin columns)
  2. forge test --gas-report gas metering changes for contract code size > 24KB

Relevant code (wip):

  1. https://github.com/foundry-rs/foundry/blob/f86a66ea206d5e3405dce7cdfffc7c843a8b43cf/crates/common/src/constants.rs#L15

Additional context

Current forge build --sizes example output Image

jgresham avatar May 24 '25 23:05 jgresham

Happy to try to take a swing at this if no one is already. I'll open a wip PR with any progress I make, otherwise please let me know if there are any feedback/suggestions or additional changes required.

One question I have for forge maintainers: Should the max sizes be released as default in lock step with Osaka fork? Should an --eip-7907 flag be introduce to forge (would apply gas metering to forge test and new limits to forge build? or should --max-initcode-size and --max-contract-size be introduced on forge build for custom limits (better for multichain support?)

jgresham avatar May 24 '25 23:05 jgresham

Hi @jgresham I'm very excited for EIP-7907! Feel free to open a draft PR.

Regarding the max sizes, I can imagine we will default to using the new contract size limit as proposed. Based on the EVM version specified we enforce the corresponding size limits as defined by the version. This means L2s that do not yet support Osaka will use the old size limit. I imagine L2s will rapidly adopt this EIP as it has most positive impact to the developer experience on L2s.

Once confirmed to be included in Osaka we can move ahead with inclusion in Foundry.

zerosnacks avatar May 27 '25 09:05 zerosnacks

RIP. 7907 is removed from Fusaka due to time constraints on testing team and possibly going for a better code chunking eip in the future https://github.com/ethereum/EIPs/pull/10026 cc @grandizzy

jgresham avatar Jul 17 '25 19:07 jgresham