pm-v2-oo-reporter: add automatic re-request controls - #38
chrismaree merged 3 commits into
Conversation
|
Security audit notes:
Additional note: manual liveness validation looks correct. Sent from Chris Codex Agent 🤖 |
|
Follow-up after discussing intended toggle semantics:
I did not run builds or tests per repo instruction; I did run Sent from Chris Codex Agent 🤖 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7d367fead
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// @notice Whether this request has used its one automatic dispute re-request. | ||
| bool automaticDisputeRerequestUsed; |
There was a problem hiding this comment.
Preserve RequestData storage layout
When this implementation upgrades an existing proxy with registered requests, inserting automaticDisputeRerequestUsed here corrupts every stored RequestData: the old layout packed uint64 liveness + 4 bools + address requester into one full slot, so adding another bool pushes requester and all later fields into the next slots. Existing requests will then read the old oracleInitializer as requester, old priceIdentifier as oracleInitializer, etc., breaking authorization, callback lookup state, and resolution data. Add new per-request state without shifting the existing struct layout.
Useful? React with 👍 / 👎.
| uint256 previousRequestTimestamp = | ||
| _executeRerequest(request, request.reward, request.proposalBond, request.liveness, address(this)); |
There was a problem hiding this comment.
Avoid auto-rerequesting before deferred refunds are available
For a rewarded request whose OO dispute refund is deferred instead of transferred immediately, this automatic path reuses request.reward before the reporter has those tokens back. _requestPrice then reverts with InsufficientRewardBalance, which rolls back the first dispute callback rather than letting the deferred payout be claimed and the request proceed. This is a regression from the previous callback behavior, which only opened the gate and did not require the refund to have arrived during the dispute transaction.
Useful? React with 👍 / 👎.
| if (automaticRerequestsEnabled() && !request.automaticDisputeRerequestUsed) { | ||
| request.automaticDisputeRerequestUsed = true; | ||
| _executeAutomaticRerequest(requestId, request, RerequestType.AutomaticDispute); |
There was a problem hiding this comment.
Fall back when same-block disputes cannot advance time
If a newly initialized or re-requested OO request is proposed and disputed in the same block, block.timestamp is still equal to the active requestTimestamp; this automatic dispute path calls _executeRerequest, which requires the replacement timestamp to be strictly greater and reverts. Because the revert happens inside priceDisputed, the whole OO dispute fails instead of opening the manual gate, even though the OO allows proposal/dispute before liveness expires.
Useful? React with 👍 / 👎.
What Changed
OOReporter.automaticRerequestsEnabledswitch, enabled by default at initialization.automaticDisputeRerequestUsedstate so each registered request gets at most one automatic dispute re-request.rerequest(requestId, reward, proposalBond, liveness)to be owner-only and to spend the renamedmanualRerequestsRemainingbudget.RerequestTypetoRequestRerequestedso indexers can distinguishManual,AutomaticDispute, andAutomaticInvalidSettlementreplacement requests.Why
Impact
manualRerequestsRemaining.RequestRerequestAllowed.High risk Sections to review with detail
pm-v2-oo-reporter/src/OOReporter.sol: callback paths now create replacement OO requests directly frompriceDisputedand P4priceSettled.pm-v2-oo-reporter/src/OOReporter.sol: manualrerequestnow validates and stores caller-suppliedproposalBondandlivenessbefore creating the replacement request.pm-v2-oo-reporter/src/interfaces/IOOReporter.sol: ABI changes forRequestData,RequestRerequested, the automatic toggle, manual budget naming, and the expanded manualrerequestsignature.pm-v2-oo-reporter/test/OOReporter.t.sol: state-machine expectations for first dispute, later disputes, P4 automation, disabled automation, owner-only manual re-requests, and dynamic manual bond/liveness updates.Validation
git diff --check.