-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(forge build
): add initcode size check
#9116
feat(forge build
): add initcode size check
#9116
Conversation
Finally! Thank you ser 🫡 Tested and worked to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! looks good, have added minor nits
forge build
): add initcode size check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, lgtm! Pending other review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good 👍
@DaniPopes Please let me know if this needs any further improvements before it can be merged. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* Adds init code size limit check & column to table. * Adds option to ignore init code size check during --size output. * Updates tests with new column for --sizes table. * Adds test helpers for forge CLI. * Implements test for init code size limit as per EIP-3860 * Adds test for --ignore-eip-3860 * Fixes for Cargo +nightly fmt warnings. * Refactors both contract size functions into one with a boolean arg. * Adds alias for --ignore-eip-3860 to --ignore-initcode-size. * Brings back the original comments. * Update compile.rs * Changes --ignore-eip-3860 to be a boolean field. * Fixes ranges in table display code and comment punctuation. * Moves testing helper to existing utils module. * Improve ranges in table display code. * Adds output assertions to initcode size check tests. * Minor change to ranges in display logic for sizes table. --------- Co-authored-by: mgiagante <251503-mgiagante@users.noreply.gitlab.com> Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Closes #4783
described in the Additional Context of this comment
Motivation
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:
Currently,
forge build --sizes
does not account for this new size limit.Solution
forge build --sizes
for the contract init code size (bytes) and the margin left counting towards the limit (bytes).--ignore-eip-3860
allows to ignore the check mentioned in the previous point. This is aimed to users deploying to chains that do not enforce this limit.Testing