@@ -92,8 +92,15 @@ contract DisputeManagerTest is Test {
92
92
);
93
93
disputeManager = DisputeManager (disputeManagerProxy);
94
94
95
- subgraphService = new SubgraphService (address (controller), address (disputeManager), tapVerifier, curation);
96
- subgraphService.initialize (1000 ether, 16 );
95
+ address subgraphServiceImplementation = address (
96
+ new SubgraphService (address (controller), address (disputeManager), tapVerifier, curation)
97
+ );
98
+ address subgraphServiceProxy = UnsafeUpgrades.deployTransparentProxy (
99
+ subgraphServiceImplementation,
100
+ governor,
101
+ abi.encodeCall (SubgraphService.initialize, (1000 ether, 16 ))
102
+ );
103
+ subgraphService = SubgraphService (subgraphServiceProxy);
97
104
98
105
disputeManager.setSubgraphService (address (subgraphService));
99
106
}
@@ -108,18 +115,18 @@ contract DisputeManagerTest is Test {
108
115
bytes32 digest = subgraphService.encodeAllocationProof (indexer, _allocationID);
109
116
(uint8 v , bytes32 r , bytes32 s ) = vm.sign (allocationIDPrivateKey, digest);
110
117
111
- subgraphService.register (indexer, abi.encode ("url " , "geoHash " ));
118
+ subgraphService.register (indexer, abi.encode ("url " , "geoHash " , address ( 0 ) ));
112
119
113
120
bytes memory data = abi.encode (subgraphDeployment, tokens, _allocationID, abi.encodePacked (r, s, v));
114
121
subgraphService.startService (indexer, data);
115
122
vm.stopPrank ();
116
123
}
117
124
118
- function createIndexingDispute (address _allocationID , uint256 tokens ) private returns (bytes32 disputeID ) {
125
+ function createIndexingDispute (address _allocationID , bytes32 _poi , uint256 tokens ) private returns (bytes32 disputeID ) {
119
126
vm.startPrank (fisherman);
120
127
graphToken.mint (fisherman, tokens);
121
128
graphToken.approve (address (disputeManager), tokens);
122
- bytes32 _disputeID = disputeManager.createIndexingDispute (_allocationID, bytes32 ( " POI1234 " ) , tokens);
129
+ bytes32 _disputeID = disputeManager.createIndexingDispute (_allocationID, _poi , tokens);
123
130
vm.stopPrank ();
124
131
return _disputeID;
125
132
}
@@ -181,7 +188,7 @@ contract DisputeManagerTest is Test {
181
188
function testCreateIndexingDispute () public {
182
189
createProvisionAndAllocate (allocationID, 10000 ether);
183
190
184
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
191
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
185
192
assertTrue (disputeManager.isDisputeCreated (disputeID), "Dispute should be created. " );
186
193
}
187
194
@@ -217,7 +224,7 @@ contract DisputeManagerTest is Test {
217
224
218
225
function test_RevertWhen_DisputeAlreadyCreated () public {
219
226
createProvisionAndAllocate (allocationID, 10000 ether);
220
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
227
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
221
228
222
229
// Create another dispute with different fisherman
223
230
address otherFisherman = address (0x5 );
@@ -227,7 +234,7 @@ contract DisputeManagerTest is Test {
227
234
graphToken.approve (address (disputeManager), tokens);
228
235
bytes memory expectedError = abi.encodeWithSignature ("DisputeManagerDisputeAlreadyCreated(bytes32) " , disputeID);
229
236
vm.expectRevert (expectedError);
230
- disputeManager.createIndexingDispute (allocationID, bytes32 ("POI1234 " ), tokens);
237
+ disputeManager.createIndexingDispute (allocationID, bytes32 ("POI1 " ), tokens);
231
238
vm.stopPrank ();
232
239
}
233
240
@@ -241,7 +248,7 @@ contract DisputeManagerTest is Test {
241
248
100 ether
242
249
);
243
250
vm.expectRevert (expectedError);
244
- disputeManager.createIndexingDispute (allocationID, bytes32 ("POI1234 " ), 50 ether);
251
+ disputeManager.createIndexingDispute (allocationID, bytes32 ("POI3 " ), 50 ether);
245
252
vm.stopPrank ();
246
253
}
247
254
@@ -253,7 +260,7 @@ contract DisputeManagerTest is Test {
253
260
graphToken.approve (address (disputeManager), tokens);
254
261
bytes memory expectedError = abi.encodeWithSignature ("DisputeManagerIndexerNotFound(address) " , allocationID);
255
262
vm.expectRevert (expectedError);
256
- disputeManager.createIndexingDispute (allocationID, bytes32 ("POI1234 " ), tokens);
263
+ disputeManager.createIndexingDispute (allocationID, bytes32 ("POI4 " ), tokens);
257
264
vm.stopPrank ();
258
265
}
259
266
@@ -316,7 +323,7 @@ contract DisputeManagerTest is Test {
316
323
317
324
function testAcceptIndexingDispute () public {
318
325
createProvisionAndAllocate (allocationID, 10000 ether);
319
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
326
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
320
327
321
328
vm.prank (arbitrator);
322
329
disputeManager.acceptDispute (disputeID, 5000 ether);
@@ -371,7 +378,7 @@ contract DisputeManagerTest is Test {
371
378
function test_RevertIf_CallerIsNotArbitrator_AcceptDispute () public {
372
379
createProvisionAndAllocate (allocationID, 10000 ether);
373
380
374
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
381
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
375
382
376
383
// attempt to accept dispute as fisherman
377
384
vm.prank (fisherman);
@@ -381,11 +388,11 @@ contract DisputeManagerTest is Test {
381
388
382
389
function test_RevertIf_SlashingOverMaxSlashPercentage () public {
383
390
createProvisionAndAllocate (allocationID, 10000 ether);
384
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
391
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI101 " ), 200 ether);
385
392
386
393
// max slashing percentage is 50%
387
394
vm.prank (arbitrator);
388
- bytes memory expectedError = abi.encodeWithSignature ("DisputeManagerInvalidSlashAmount (uint256) " , 6000 ether);
395
+ bytes memory expectedError = abi.encodeWithSignature ("DisputeManagerInvalidTokensSlash (uint256) " , 6000 ether);
389
396
vm.expectRevert (expectedError);
390
397
disputeManager.acceptDispute (disputeID, 6000 ether);
391
398
}
@@ -394,7 +401,7 @@ contract DisputeManagerTest is Test {
394
401
395
402
function testCancelDispute () public {
396
403
createProvisionAndAllocate (allocationID, 10000 ether);
397
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
404
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
398
405
399
406
// skip to end of dispute period
400
407
skip (disputePeriod + 1 );
@@ -442,7 +449,7 @@ contract DisputeManagerTest is Test {
442
449
443
450
function test_RevertIf_CallerIsNotFisherman_CancelDispute () public {
444
451
createProvisionAndAllocate (allocationID, 10000 ether);
445
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
452
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI1 " ), 200 ether);
446
453
447
454
vm.prank (arbitrator);
448
455
vm.expectRevert (bytes4 (keccak256 ("DisputeManagerNotFisherman() " )));
@@ -453,7 +460,7 @@ contract DisputeManagerTest is Test {
453
460
454
461
function testDrawDispute () public {
455
462
createProvisionAndAllocate (allocationID, 10000 ether);
456
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
463
+ bytes32 disputeID = createIndexingDispute (allocationID, bytes32 ( " POI32 " ), 200 ether);
457
464
458
465
vm.prank (arbitrator);
459
466
disputeManager.drawDispute (disputeID);
@@ -495,7 +502,7 @@ contract DisputeManagerTest is Test {
495
502
496
503
function test_RevertIf_CallerIsNotArbitrator_DrawDispute () public {
497
504
createProvisionAndAllocate (allocationID, 10000 ether);
498
- bytes32 disputeID = createIndexingDispute (allocationID, 200 ether);
505
+ bytes32 disputeID = createIndexingDispute (allocationID,bytes32 ( " POI1 " ), 200 ether);
499
506
500
507
// attempt to draw dispute as fisherman
501
508
vm.prank (fisherman);
0 commit comments