Skip to content

build: reclaim bytecode with optimizer runs#74

Draft
leopoldjoy wants to merge 1 commit into
mainfrom
audit/reclaim-bytecode-with-optimizer-runs
Draft

build: reclaim bytecode with optimizer runs#74
leopoldjoy wants to merge 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>
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.

1 participant