Skip to content

Reserve gas per reporter callback and combine settlement loops - #80

Merged
md0x merged 4 commits into
pablo/reporters-under-root-srcfrom
pablo/reporter-callback-gas-reserve
Sep 21, 2026
Merged

md0x merged 4 commits into
pablo/reporters-under-root-srcfrom
pablo/reporter-callback-gas-reserve

Conversation

@md0x

@md0x md0x commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #76. Replace the outer callback self-call and batch catch with one bounded loop that emits each resolution event before attempting its callback. OOReporter defines the shared gas reserve, applied before each Polymarket report. Earlier successful reports persist; failed or skipped reports remain permissionlessly retryable.

Retain the 150,000 reserve with a documented 135,000 completion budget plus 15,000 headroom. This covers nine remaining cold iterations, call setup, the failure event, both proxy returns and the real oracle's completion path, without crediting refunds or enclosing-frame EIP-150 gas retention. Audit confirmation remains pending; sufficient transaction gas and the documented compiler/gas schedule assumptions still apply.

Validation:

  • 69 reporter tests pass with Foundry 1.3.6, including upgrade coverage and the existing 256-run gas-exhaustion fuzz test.
  • New integration regression uses the real oracle and reporter behind ERC1967 proxies, maximum 8,139-byte rules, ten linked IDs and cold state. A callback exhausts its allowance at each position under an 8M oracle-call gas cap. Checks settlement, payout, all ten resolution events, persistence of earlier reports and permissionless recovery.
  • The regression fails against the original batch implementation. Temporary reserve variants passed at 135k and reverted settlement at 110k; the committed reserve remains 150k.
  • Changed Solidity files pass formatting and diff checks.

Storage layout is unchanged. Derived reporter hooks remain trusted to apply the inherited reserve and catch external failures. The gas breakdown and validation limits are in the reporter README under "Callback gas budget".

@chrismaree chrismaree 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.

The single-loop approach and explicit forwarded-gas limit look sound, and moving the reserve constant into OOReporter follows Jay's feedback. I am requesting validation before approving removal of the outer isolation boundary; I have not established that 150,000 gas is insufficient.

The added gas-exhaustion regression calls MockOptimisticOracleV2.settle. That mock returns immediately after priceSettled, whereas the real path returns through OptimisticOracleV2._settle's _endReentrantGuardDisabled, the nonReentrant modifier reset, and proxy/ABI return handling. With the outer callback self-call removed, exhausting the reserve during the remaining loop or enclosing return now rolls back settlement and earlier successful reports. The README and PR still describe the reserve as a candidate, and Jay's latest Slack reply explicitly leaves final validation pending.

Please add a regression using the real ManagedOptimisticOracleV2 settlement implementation and proxy arrangement, with ten linked IDs, cold state, a callback consuming its full allowance at each possible position, and bounded transaction gas. Assert settlement, all ten resolution events, persistence of earlier successful reports, and permissionless recovery. Document a conservative budget for the remaining registration writes/events/loop, measurement-to-CALL overhead, and settlement return path under the configured Polygon-compatible gas schedule; select the reserve with explicit headroom from that evidence. This can be a local real-contract integration test without a live-chain transaction.

Reviewed 69efc8d against #76 and the OZ discussion. Static code and existing-test review only; no tests or builds run.

Chris's Codex agent · automated

@md0x
md0x marked this pull request as ready for review September 15, 2026 08:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-15T08:29:11.821303Z 69efc8d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@md0x
md0x merged commit be8df29 into pablo/reporters-under-root-src Sep 21, 2026
6 checks passed
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