diff --git a/src/reporters/README.md b/src/reporters/README.md index b29075d..e450e25 100644 --- a/src/reporters/README.md +++ b/src/reporters/README.md @@ -43,6 +43,12 @@ register up to ten request IDs with the same tuple and liveness range. Those IDs resolution, and automatic re-request state. Registrations from another requester, with a different liveness range, or above the ten-ID limit are rejected. +Sharing is intentional, including after settlement: registering another ID immediately exposes the canonical +request's current state and any stored outcome through that ID. It does not create a fresh oracle round, reward, bond, +or challenge window. Requesters must use the same tuple only for questions with the same resolution semantics. Rules +must distinguish any different observation period or numerical outcome-to-position mapping; the reporter does not +include market IDs, event IDs, or a new request timestamp in the association key or validate that external mappings agree. + ## Responsibilities `OOReporter` owns: @@ -78,8 +84,12 @@ receives the current `defaultRerequestBudget` as its manual re-request budget. Calling `initializeRequest` for an associated duplicate request ID is an idempotent no-op after the shared Managed OO request has been initialized but remains unresolved. If the duplicate is registered after the shared request resolves, -its first initialization immediately attempts `report(requestId)` with the stored outcome; later calls are no-ops. All -request-ID reads resolve to the shared lifecycle and final outcome. +`isRequestResolved` and `getRequestResolution` expose the stored outcome as soon as registration completes. Its first +initialization additionally emits `RequestResolved` and invokes the resolution hook, which attempts `report(requestId)` +in `PolymarketOOReporter`; later initialization calls are no-ops. Initialization is not an approval checkpoint for reading +or reporting an inherited outcome: the Polymarket module's permissionless `report(requestId)` can use it once the module +has registered that ID, without another reporter initialization. A resolved shared request cannot be re-requested; a +question requiring a new oracle round must use distinct rules. Automatic re-requests are enabled by default and can be disabled or re-enabled by the owner with `setAutomaticRerequestsEnabled(...)`. The current setting is evaluated when a dispute or P4 settlement callback arrives, @@ -190,8 +200,8 @@ Each callback is wrapped in `try/catch`. If the call returns without reverting, `ReportCallbackSucceeded(requestId, reporterModule)`. If the module reverts, Managed OO settlement still succeeds and the reporter emits `ReportCallbackFailed(requestId, reporterModule)`. The module's permissionless `report(requestId)` entry point can then be retried separately. P4 settlements and stale, unknown, or repeated settlement callbacks do not -trigger reporting. A newly registered ID for an already-resolved shared request follows the initialization behavior -described above. +trigger reporting. A newly registered ID for an already-resolved shared request is immediately readable and can be +reported permissionlessly by the module; initialization provides the additional callback attempt described above. The reporter never calls market-side `finalize()`. Any reporting liveness, threshold, payout translation, and finalization logic remains enforced by the Polymarket V2 contracts. diff --git a/src/reporters/interfaces/IOOReporter.sol b/src/reporters/interfaces/IOOReporter.sol index 496a488..f774e15 100644 --- a/src/reporters/interfaces/IOOReporter.sol +++ b/src/reporters/interfaces/IOOReporter.sol @@ -269,9 +269,12 @@ interface IOOReporter { /// @return True if automatic re-requests are enabled. function automaticRerequestsEnabled() external view returns (bool); - /// @notice Registers a requester-defined request ID and its UMA request identity before OO initialization. + /// @notice Registers a requester-defined request ID and its UMA request identity. /// @dev Up to ten request IDs with matching price identifier, request rules, requester, and liveness values share one - /// Managed OO lifecycle. minimumLiveness is enforced as an onchain runtime floor, while maximumLiveness remains a + /// Managed OO lifecycle, including any existing final outcome, which is readable immediately upon registration. + /// No new oracle round or challenge window is created for a duplicate. Requesters must distinguish questions with + /// different resolution semantics in their rules, including observation periods and numerical position mappings. + /// minimumLiveness is enforced as an onchain runtime floor, while maximumLiveness remains a /// registration-time bound and offchain target that does not cap initialization or re-requests. /// @param requestId Requester-defined request ID to bind to the UMA request identity. /// @param priceIdentifier UMA price identifier to request. @@ -306,6 +309,8 @@ interface IOOReporter { /// the reward, tops it up to an unbounded approval for the trusted oracle instead of approving per request. A /// duplicate ID reuses the shared request; if registered after resolution, its first initialization triggers the /// resolution hook immediately, while subsequent initializations are no-ops. + /// The shared outcome is already readable upon registration; initialization does not gate reads or permissionless + /// reporting by a requester module that has registered the duplicate. /// @param requestId Registered request ID. /// @param reward Reward offered to a successful OO proposer. /// @param proposalBond Bond requested from OO proposers/disputers, or zero to use the OO default. The effective @@ -335,11 +340,13 @@ interface IOOReporter { function setRequestRerequestBudget(bytes32 requestId, uint256 newManualRerequestsRemaining) external; /// @notice Returns whether Managed OO settlement has produced a final reporter outcome for requestId. + /// @dev A duplicate registered after canonical resolution returns true without another initialization. /// @param requestId Registered request ID. /// @return True if the reporter has stored a final outcome. function isRequestResolved(bytes32 requestId) external view returns (bool); /// @notice Returns the final raw UMA outcome for requestId after non-P4 trusted resolver settlement. + /// @dev A duplicate registered after canonical resolution immediately inherits the stored outcome. /// @param requestId Registered request ID. /// @return Final raw UMA outcome. function getRequestResolution(bytes32 requestId) external view returns (int256); diff --git a/test/reporters/PolymarketOOReporter.t.sol b/test/reporters/PolymarketOOReporter.t.sol index d524ef2..dfa24f7 100644 --- a/test/reporters/PolymarketOOReporter.t.sol +++ b/test/reporters/PolymarketOOReporter.t.sol @@ -205,6 +205,13 @@ contract PolymarketOOReporterTest { module.registerRequest(SECOND_REQUEST_ID, BINARY_IDENTIFIER, requestRules, 0, MAXIMUM_LIVENESS); + _assertTrue(reporter.isRequestResolved(SECOND_REQUEST_ID), "late duplicate should resolve upon registration"); + _assertEq( + reporter.getRequestResolution(SECOND_REQUEST_ID), + 1 ether, + "outcome should be readable before initialization" + ); + vm.expectEmit(address(reporter)); emit RequestResolved(SECOND_REQUEST_ID, request.requestTimestamp, 1 ether); vm.expectEmit(address(reporter));