Skip to content

build: reclaim bytecode with optimizer runs - #74

Merged
leopoldjoy merged 1 commit into
mainfrom
audit/reclaim-bytecode-with-optimizer-runs
Jul 30, 2026
Merged

build: reclaim bytecode with optimizer runs#74
leopoldjoy merged 1 commit into
mainfrom
audit/reclaim-bytecode-with-optimizer-runs

Conversation

@leopoldjoy

Copy link
Copy Markdown
Contributor

Summary

  • lower optimizer runs from 999999 to 10000 to reclaim deployable bytecode headroom
  • no Solidity code changes
  • preserves the high-run gas profile closely while giving CertManager room for audit hardening

Size measurements

Baseline (optimizer_runs = 999999, forge build --sizes src script):

  • CertManager: 24,432 bytes, 144-byte margin
  • CertManagerDemo: 24,565 bytes, 11-byte margin
  • NitroValidator: 17,275 bytes, 7,301-byte margin

This PR (optimizer_runs = 10000, forge build --sizes src script):

  • CertManager: 22,793 bytes, 1,783-byte margin
  • CertManagerDemo: 22,926 bytes, 1,650-byte margin
  • NitroValidator: 16,157 bytes, 8,419-byte margin

Gas spot checks

Baseline vs this PR:

  • test_FullColdAndWarmHintedSequence: 110,555,527 -> 110,689,524 (+0.12%)
  • test_HintedValidationRejectsInvalidFinalSignature: 94,587,893 -> 94,721,464 (+0.14%)

For comparison, optimizer_runs = 200 gave more size headroom but raised these paths by ~5-6%, so 10000 is the less disruptive bytecode/gas tradeoff.

Tests

  • forge fmt --check src test script
  • forge test (204 passed, 1 skipped)
  • forge build --sizes src script

Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
@leopoldjoy
leopoldjoy marked this pull request as ready for review July 27, 2026 13:42
@leopoldjoy
leopoldjoy merged commit 0f72a43 into main Jul 30, 2026
8 checks passed
@leopoldjoy
leopoldjoy deleted the audit/reclaim-bytecode-with-optimizer-runs branch July 30, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants