diff --git a/test/invariants/properties/PropertyFinalize.t.sol b/test/invariants/properties/PropertyFinalize.t.sol new file mode 100644 index 0000000..370c900 --- /dev/null +++ b/test/invariants/properties/PropertyFinalize.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {IEBORequestModule, IOracle} from '../Setup.t.sol'; +import {HandlerParent} from '../handlers/HandlerParent.t.sol'; + +contract PropertyFinalize is HandlerParent { + /// @custom:property-id 10 + /// @custom:property An answer can only be finalized after the deadline + function property_finalizeAfterDeadline(uint256 _requestIdSeed, uint256 _responseIdSeed) public { + // Pick random Response + bytes32 _requestId = _getRandomRequestId(_requestIdSeed); + IOracle.Request memory _requestData = _ghost_requestData[_requestId]; + + (bytes32 _responseId, IOracle.Response memory _responseData) = _getRandomActiveResponse(_requestId, _responseIdSeed); + + vm.prank(msg.sender); + try oracle.finalize(_requestData, _responseData) { + // After deadline + // + // Update ghosts + } catch { + // Before response deadline or + // No response if there is one or + // Unresolved disputed or + // + } + } + + // TODO: consider adding property for releasing unfinazible ones? +} diff --git a/test/invariants/properties/PropertyParent.t.sol b/test/invariants/properties/PropertyParent.t.sol index beafc74..211b4d4 100644 --- a/test/invariants/properties/PropertyParent.t.sol +++ b/test/invariants/properties/PropertyParent.t.sol @@ -2,9 +2,12 @@ pragma solidity 0.8.26; import {PropertyDispute} from './PropertyDispute.t.sol'; + +import {PropertyFinalize} from './PropertyFinalize.t.sol'; import {PropertyRequester} from './PropertyRequester.t.sol'; -contract PropertyParent is PropertyRequester, PropertyDispute { - //solhint-disable no-empty-blocks - constructor() {} +contract PropertyParent is PropertyRequester, PropertyDispute, PropertyFinalize { +// | 11 | bonded token can never be used on behalf of someone else, unless allowed by the Horizon staking contract | | [ ] | +// | 12 | each bonded amount can only be tied to one requestId | | [ ] | +// | 13 | each disputeId and responseId can only be tied to one requestId }