Skip to content

fix(forge): respect Amsterdam code size limits#15764

Open
figtracer wants to merge 1 commit into
masterfrom
fig/fix-test-code-size-limit
Open

fix(forge): respect Amsterdam code size limits#15764
figtracer wants to merge 1 commit into
masterfrom
fig/fix-test-code-size-limit

Conversation

@figtracer

@figtracer figtracer commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

  • derive default contract size-report limits from the active EVM specification
  • use revm's protocol constants for EIP-170, EIP-3860, and Amsterdam's EIP-7954 limits
  • apply the same spec-aware fallback to script deployment warnings while preserving explicit code_size_limit overrides

Motivation

Selecting evm_version = "amsterdam" still made forge build --sizes and script checks use the pre-Amsterdam 24 KiB runtime / 48 KiB initcode limits. The workaround was to set code_size_limit, but that setting also configures the test executor and can prevent oversized test contracts from deploying.

With this change, selecting Amsterdam automatically uses its 32 KiB runtime and 64 KiB initcode limits, so users do not need to change the test executor limit just to get accurate size checks.

Addresses #14761 (comment)

@figtracer
figtracer marked this pull request as ready for review July 15, 2026 14:36

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@sakulstra

sakulstra commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

With this change, selecting Amsterdam automatically uses its 32 KiB runtime and 64 KiB initcode limits, so users do not need to change the test executor limit just to get accurate size checks.

Should be Raise the maximum contract code size from 24KiB to 64KiB and initcode size from 48KiB to 128KiB., no?
https://forkcast.org/eips/7954/

Thanks for patching this <3

@mablr

mablr commented Jul 15, 2026

Copy link
Copy Markdown
Member

@sakulstra Yes, you’re right. But the revm 41.0.0 constants used here still reflect the earlier 32/64 KiB draft values; so we'll need to bump revm.

@figtracer
figtracer marked this pull request as draft July 15, 2026 15:40
@mablr mablr added the T-blocked Type: blocked label Jul 15, 2026
@mablr

mablr commented Jul 15, 2026

Copy link
Copy Markdown
Member

Marking as "blocked" until next revm bump.

@figtracer
figtracer marked this pull request as ready for review July 15, 2026 20:58
@sakulstra

Copy link
Copy Markdown
Contributor

Should code_size_limit be ignored on tests/scripts anyways though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-blocked Type: blocked

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants