@@ -28,6 +28,10 @@ contract DisputeManagerQueryConflictCancelDisputeTest is DisputeManagerTest {
28
28
resetPrank (users.fisherman);
29
29
(bytes32 disputeID1 , ) = _createQueryDisputeConflict (attestationData1, attestationData2);
30
30
31
+ // skip to end of dispute period
32
+ uint256 disputePeriod = disputeManager.disputePeriod ();
33
+ skip (disputePeriod + 1 );
34
+
31
35
_cancelDispute (disputeID1);
32
36
}
33
37
@@ -70,4 +74,60 @@ contract DisputeManagerQueryConflictCancelDisputeTest is DisputeManagerTest {
70
74
vm.expectRevert (abi.encodeWithSelector (IDisputeManager.DisputeManagerDisputePeriodNotFinished.selector ));
71
75
disputeManager.cancelDispute (disputeID1);
72
76
}
77
+
78
+ function test_Query_Conflict_Cancel_After_DisputePeriodIncreased (
79
+ uint256 tokens
80
+ ) public useIndexer useAllocation (tokens) {
81
+ resetPrank (users.fisherman);
82
+ (bytes memory attestationData1 , bytes memory attestationData2 ) = _createConflictingAttestations (
83
+ requestCID,
84
+ subgraphDeployment,
85
+ responseCID1,
86
+ responseCID2,
87
+ allocationIDPrivateKey,
88
+ allocationIDPrivateKey
89
+ );
90
+
91
+ resetPrank (users.fisherman);
92
+ (bytes32 disputeID1 , ) = _createQueryDisputeConflict (attestationData1, attestationData2);
93
+
94
+ // change the dispute period to a higher value
95
+ uint256 oldDisputePeriod = disputeManager.disputePeriod ();
96
+ resetPrank (users.governor);
97
+ disputeManager.setDisputePeriod (uint64 (oldDisputePeriod * 2 ));
98
+
99
+ // skip to end of old dispute period
100
+ skip (oldDisputePeriod + 1 );
101
+
102
+ // should be able to cancel
103
+ resetPrank (users.fisherman);
104
+ _cancelDispute (disputeID1);
105
+ }
106
+
107
+ function test_Query_Cancel_After_DisputePeriodDecreased (uint256 tokens ) public useIndexer useAllocation (tokens) {
108
+ (bytes memory attestationData1 , bytes memory attestationData2 ) = _createConflictingAttestations (
109
+ requestCID,
110
+ subgraphDeployment,
111
+ responseCID1,
112
+ responseCID2,
113
+ allocationIDPrivateKey,
114
+ allocationIDPrivateKey
115
+ );
116
+
117
+ resetPrank (users.fisherman);
118
+ (bytes32 disputeID1 , ) = _createQueryDisputeConflict (attestationData1, attestationData2);
119
+
120
+ // change the dispute period to a lower value
121
+ uint256 oldDisputePeriod = disputeManager.disputePeriod ();
122
+ resetPrank (users.governor);
123
+ disputeManager.setDisputePeriod (uint64 (oldDisputePeriod / 2 ));
124
+
125
+ // skip to end of new dispute period
126
+ skip (oldDisputePeriod / 2 + 1 );
127
+
128
+ // should not be able to cancel
129
+ resetPrank (users.fisherman);
130
+ vm.expectRevert (abi.encodeWithSelector (IDisputeManager.DisputeManagerDisputePeriodNotFinished.selector ));
131
+ disputeManager.cancelDispute (disputeID1);
132
+ }
73
133
}
0 commit comments