Skip to content

refactor: drop the external self-call in verifyBatchInclusion - #2300

Open
0xrlawrence wants to merge 1 commit into
yetanotherco:stagingfrom
0xrlawrence:refactor/verify-batch-inclusion-self-call
Open

refactor: drop the external self-call in verifyBatchInclusion#2300
0xrlawrence wants to merge 1 commit into
yetanotherco:stagingfrom
0xrlawrence:refactor/verify-batch-inclusion-self-call

Conversation

@0xrlawrence

Copy link
Copy Markdown

Description

The seven-argument verifyBatchInclusion overload delegated to the eight-argument one through this.verifyBatchInclusion(...). That leaves the contract and re-enters via STATICCALL purely to supply address(0), paying full external call overhead plus a second onlyWhenNotPaused(2) evaluation on a view function that consumers call frequently.

The shared body moves into an internal _verifyBatchInclusion and both overloads call it directly.

The external ABI is unchanged — confirmed against the built artifact:

external verifyBatchInclusion overloads: 2
  8 args view
  7 args view
internal _verifyBatchInclusion exposed?  False

onlyWhenNotPaused(2) still guards each external entry point, so pause behaviour is identical.

Type of change

  • Refactor
  • Optimization

Checklist

  • “Hotfix” to testnet, everything else to staging
  • This change is an Optimization
    • Benchmarks added/run

No gas benchmark included — the saving is simply one avoided external call, and foundry-gas-diff in CI should show it directly. Happy to add one if you'd like it recorded.

Verified with forge build on staging.

The seven-argument overload delegated to the eight-argument one through
this.verifyBatchInclusion(...), which leaves the contract and comes back
in via a STATICCALL just to pass address(0).

Move the body into an internal _verifyBatchInclusion and have both
overloads call it directly. The external ABI is unchanged: both overloads
are still present and still view, and onlyWhenNotPaused(2) still guards
each entry point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.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