Skip to content

Commit

Permalink
test(medusa): dispute window in prop6
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed Nov 28, 2024
1 parent 9c8dce2 commit c0ffee9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 9 additions & 9 deletions test/invariants/properties/PropertyDispute.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {HandlerParent} from '../handlers/HandlerParent.t.sol';
contract PropertyDispute is HandlerParent {
/// @custom:property-id 6
/// @custom:property Disputer can always dispute a response before the finalisation, if no previous dispute has been made.
/// @custom:property-id 13
/// @custom:property Each disputeId and responseId can only be tied to one requestId
function property_disputerCanAlwaysCreateDispute(uint256 _requestIdSeed, uint256 _responseIdSeed) public {
// Pick random Response
(bytes32 _requestId, IOracle.Request memory _requestData) = _getRandomRequest(_requestIdSeed);
Expand All @@ -30,16 +28,18 @@ contract PropertyDispute is HandlerParent {
// check if no previous dispute
assertEq(_ghost_disputes[_requestId].length, 0, 'property 6: new dispute duplicate');

// check the disputeId isn't tied to another requestId
// property 13
assertEq(_ghost_disputeData[_disputeId].requestId, bytes32(0), 'Property 13: disputeId tied to another requestId');

// add to ghost disputes
_ghost_disputes[_responseId].push(_disputeId);
_ghost_disputes[_requestId].push(_disputeId);
_ghost_disputeData[_disputeId] = _disputeData;
} catch {
// check that there was a previous dispute, or...?
assertTrue(_ghost_disputes[_responseId].length > 0, 'property 6: fails but no previous active dispute');
// check that there was a previous dispute, or
// outside of the dispute window, or
//
assertTrue(
_ghost_disputes[_responseId].length > 0
|| block.timestamp > oracle.responseCreatedAt(_responseId) + RESPONSE_DISPUTE_WINDOW,
'property 6: fails but no previous active dispute'
);
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/invariants/properties/PropertyProposer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ contract PropertyProposer is HandlerParent {
(bytes32 requestId, IOracle.Request memory requestData) = _getRandomRequest(_requestIdSeed);
if (requestId == bytes32(0) || !_ghost_validRequests[requestId]) return;

// address proposer = _pickActor(_actorSeed);

// Build response data
IOracle.Response memory responseData = IOracle.Response(msg.sender, requestId, _response); // abi.encode(_blockNumber)?

Expand Down

0 comments on commit c0ffee9

Please sign in to comment.