Skip to content

fix(script): honour --code-size-limit CLI flag#15170

Merged
grandizzy merged 1 commit into
foundry-rs:masterfrom
shapeshed:patch-0
Jun 15, 2026
Merged

fix(script): honour --code-size-limit CLI flag#15170
grandizzy merged 1 commit into
foundry-rs:masterfrom
shapeshed:patch-0

Conversation

@shapeshed

@shapeshed shapeshed commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

check_contract_sizes() ignored the --code-size-limit CLI flag, falling back to EIP-170's 24576-byte default. This PR fixes the issue it by reading evm_opts.env.code_size_limit before config.code_size_limit.

Motivation

check_contract_sizes() built its size_limits solely from config.code_size_limit (foundry.toml). The --code-size-limit CLI flag populates evm_opts.env.code_size_limit but was never read here, so the check silently fell back to EIP-170's 24576-byte default even when the flag was explicitly set.

Solution

Chain .or(evm_opts.env.code_size_limit) before the config lookup so the CLI flag takes precedence over foundry.toml. A test asserts the flag is correctly threaded into evm_opts (the path the check now reads).

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

`check_contract_sizes()` builds its `size_limits` from
`config.code_size_limit` (foundry.toml) only. When a user passes
`--code-size-limit` on the CLI, the value lands in
`evm_opts.env.code_size_limit` but is never consulted here, so the check
silently falls back to EIP-170's 24576-byte default. Without this fix,
post-broadcast warnings fire for every factory contract despite the flag
being set correctly.

@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

@grandizzy grandizzy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, thank you!

@grandizzy grandizzy enabled auto-merge (squash) June 15, 2026 08:10
@grandizzy grandizzy merged commit daaa61b into foundry-rs:master Jun 15, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants