foundry
foundry copied to clipboard
Support EIP3860 after Shanghai upgrade
Component
Forge
Describe the feature you would like
With EIP 3860, the contract size limit should be doubled from 24KB to 48KB?
https://github.com/foundry-rs/foundry/blob/master/common/src/compile.rs#L175
- const CONTRACT_SIZE_LIMIT: usize = 24576;
+ const CONTRACT_SIZE_LIMIT: usize = 24576 * 2;
Additional context
No response
what's the current impact of this?
what's the current impact of this?
@mattsse @gakonst Not sure if I understand it correctly, but seems that EIP3860 introduce a new limit for initcode
during contract creation, instead of increasing limit for runtime bytecode
? Adding a new metric around initcode
size might make sense
Right, so prior to EIP-3860 there was no size limit on creation code (initcode), and just a 24576 byte size limit on runtime code
EIP-3860 went live in shangai so now there is both (1) a 24576 byte size limit on runtime code, AND (2) a new 24576 * 2 = 49152 byte size limit on initcode.
Not all EVM chains have this limit, however accounting for this by default in forge seems like a sensible default since that's more conservative.
My suggestion would be to update forge build --sizes
to have a second table for initcode size, and exit with an error if either creation code OR initcode is above the size limit, and add a --ignore-eip-3860
flag (or something) to turn it off for users targeting other chains
Right, so prior to EIP-3860 there was no size limit on creation code (initcode), and just a 24576 byte size limit on runtime code
EIP-3860 went live in shangai so now there is both (1) a 24576 byte size limit on runtime code, AND (2) a new 24576 * 2 = 49152 byte size limit on initcode.
Not all EVM chains have this limit, however accounting for this by default in forge seems like a sensible default since that's more conservative.
My suggestion would be to update
forge build --sizes
to have a second table for initcode size, and exit with an error if either creation code OR initcode is above the size limit, and add a--ignore-eip-3860
flag (or something) to turn it off for users targeting other chains
You definitely right, this is a desirable feature. I am facing a initcode limit issue when deploying a contract now and I have no idea how to handle it, because locally it goes right in a fork (anvil should have a flag for setting a maximum initcode size too). Meanwhile, do you know how can I know the creation code size so I can reduce it or split transactions?
Thanks!
Any updates on this? revm seems to already support EIP-3860, foundry's version of it might need to be updated tho
We're working on it - bumping to the latest.
Any updates on this? Doesn't look like it's been implemented.