@@ -14,7 +14,7 @@ contract DisputeManager is Governed {
14
14
15
15
// Disputes contain info neccessary for the Arbitrator to verify and resolve
16
16
struct Dispute {
17
- bytes32 subgraphID ;
17
+ bytes32 subgraphDeploymentID ;
18
18
address indexer;
19
19
address fisherman;
20
20
uint256 deposit;
@@ -26,14 +26,14 @@ contract DisputeManager is Governed {
26
26
struct Receipt {
27
27
bytes32 requestCID;
28
28
bytes32 responseCID;
29
- bytes32 subgraphID ;
29
+ bytes32 subgraphDeploymentID ;
30
30
}
31
31
32
32
// Attestation sent from indexer in response to a request
33
33
struct Attestation {
34
34
bytes32 requestCID;
35
35
bytes32 responseCID;
36
- bytes32 subgraphID ;
36
+ bytes32 subgraphDeploymentID ;
37
37
uint8 v;
38
38
bytes32 r;
39
39
bytes32 s;
@@ -51,7 +51,7 @@ contract DisputeManager is Governed {
51
51
bytes32 private constant DOMAIN_VERSION_HASH = keccak256 ("0 " );
52
52
bytes32 private constant DOMAIN_SALT = 0xa070ffb1cd7409649bf77822cce74495468e06dbfaef09556838bf188679b9c2 ;
53
53
bytes32 private constant RECEIPT_TYPE_HASH = keccak256 (
54
- "Receipt(bytes32 requestCID,bytes32 responseCID,bytes32 subgraphID ) "
54
+ "Receipt(bytes32 requestCID,bytes32 responseCID,bytes32 subgraphDeploymentID ) "
55
55
);
56
56
57
57
// 100% in parts per million
@@ -88,52 +88,53 @@ contract DisputeManager is Governed {
88
88
// -- Events --
89
89
90
90
/**
91
- * @dev Emitted when `disputeID` is created for `subgraphID` and `indexer` by `fisherman`.
91
+ * @dev Emitted when `disputeID` is created for `subgraphDeploymentID` and `indexer`
92
+ * by `fisherman`.
92
93
* The event emits the amount `tokens` deposited by the fisherman and `attestation` submitted.
93
94
*/
94
95
event DisputeCreated (
95
96
bytes32 disputeID ,
96
- bytes32 indexed subgraphID ,
97
+ bytes32 indexed subgraphDeploymentID ,
97
98
address indexed indexer ,
98
99
address indexed fisherman ,
99
100
uint256 tokens ,
100
101
bytes attestation
101
102
);
102
103
103
104
/**
104
- * @dev Emitted when arbitrator accepts a `disputeID` for `subgraphID ` and `indexer`
105
+ * @dev Emitted when arbitrator accepts a `disputeID` for `subgraphDeploymentID ` and `indexer`
105
106
* created by `fisherman`.
106
107
* The event emits the amount `tokens` transferred to the fisherman, the deposit plus reward.
107
108
*/
108
109
event DisputeAccepted (
109
110
bytes32 disputeID ,
110
- bytes32 indexed subgraphID ,
111
+ bytes32 indexed subgraphDeploymentID ,
111
112
address indexed indexer ,
112
113
address indexed fisherman ,
113
114
uint256 tokens
114
115
);
115
116
116
117
/**
117
- * @dev Emitted when arbitrator rejects a `disputeID` for `subgraphID ` and `indexer`
118
+ * @dev Emitted when arbitrator rejects a `disputeID` for `subgraphDeploymentID ` and `indexer`
118
119
* created by `fisherman`.
119
120
* The event emits the amount `tokens` burned from the fisherman deposit.
120
121
*/
121
122
event DisputeRejected (
122
123
bytes32 disputeID ,
123
- bytes32 indexed subgraphID ,
124
+ bytes32 indexed subgraphDeploymentID ,
124
125
address indexed indexer ,
125
126
address indexed fisherman ,
126
127
uint256 tokens
127
128
);
128
129
129
130
/**
130
- * @dev Emitted when arbitrator draw a `disputeID` for `subgraphID ` and `indexer`
131
+ * @dev Emitted when arbitrator draw a `disputeID` for `subgraphDeploymentID ` and `indexer`
131
132
* created by `fisherman`.
132
133
* The event emits the amount `tokens` used as deposit and returned to the fisherman.
133
134
*/
134
135
event DisputeDrawn (
135
136
bytes32 disputeID ,
136
- bytes32 indexed subgraphID ,
137
+ bytes32 indexed subgraphDeploymentID ,
137
138
address indexed indexer ,
138
139
address indexed fisherman ,
139
140
uint256 tokens
@@ -232,7 +233,7 @@ contract DisputeManager is Governed {
232
233
RECEIPT_TYPE_HASH,
233
234
_receipt.requestCID,
234
235
_receipt.responseCID,
235
- _receipt.subgraphID
236
+ _receipt.subgraphDeploymentID
236
237
) // EIP 712-encoded message hash
237
238
)
238
239
)
@@ -345,7 +346,7 @@ contract DisputeManager is Governed {
345
346
346
347
emit DisputeAccepted (
347
348
_disputeID,
348
- dispute.subgraphID ,
349
+ dispute.subgraphDeploymentID ,
349
350
dispute.indexer,
350
351
dispute.fisherman,
351
352
dispute.deposit.add (tokensToReward)
@@ -370,7 +371,7 @@ contract DisputeManager is Governed {
370
371
371
372
emit DisputeRejected (
372
373
_disputeID,
373
- dispute.subgraphID ,
374
+ dispute.subgraphDeploymentID ,
374
375
dispute.indexer,
375
376
dispute.fisherman,
376
377
dispute.deposit
@@ -398,7 +399,7 @@ contract DisputeManager is Governed {
398
399
399
400
emit DisputeDrawn (
400
401
_disputeID,
401
- dispute.subgraphID ,
402
+ dispute.subgraphDeploymentID ,
402
403
dispute.indexer,
403
404
dispute.fisherman,
404
405
dispute.deposit
@@ -422,32 +423,40 @@ contract DisputeManager is Governed {
422
423
address channelID = _recoverAttestationSigner (attestation);
423
424
424
425
// Get the indexer that created the channel and signed the attestation
425
- (address indexer , bytes32 subgraphID ) = staking.channels (channelID);
426
+ (address indexer , bytes32 subgraphDeploymentID ) = staking.channels (channelID);
426
427
require (indexer != address (0 ), "Indexer cannot be found for the attestation " );
427
- require (subgraphID == attestation.subgraphID, "Channel and attestation subgraph must match " );
428
+ require (
429
+ subgraphDeploymentID == attestation.subgraphDeploymentID,
430
+ "Channel and attestation subgraphDeploymentID must match "
431
+ );
428
432
429
433
// Create a disputeID
430
434
bytes32 disputeID = keccak256 (
431
435
abi.encodePacked (
432
436
attestation.requestCID,
433
437
attestation.responseCID,
434
- attestation.subgraphID ,
438
+ attestation.subgraphDeploymentID ,
435
439
indexer
436
440
)
437
441
);
438
442
439
443
// This also validates that indexer exists
440
444
require (staking.hasStake (indexer), "Dispute has no stake by the indexer " );
441
445
442
- // A fisherman can only open one dispute for a given indexer / subgraphID at a time
446
+ // A fisherman can only open one dispute for a ( indexer, subgraphDeploymentID) at a time
443
447
require (! isDisputeCreated (disputeID), "Dispute already created " ); // Must be empty
444
448
445
449
// Store dispute
446
- disputes[disputeID] = Dispute (attestation.subgraphID, indexer, _fisherman, _deposit);
450
+ disputes[disputeID] = Dispute (
451
+ attestation.subgraphDeploymentID,
452
+ indexer,
453
+ _fisherman,
454
+ _deposit
455
+ );
447
456
448
457
emit DisputeCreated (
449
458
disputeID,
450
- attestation.subgraphID ,
459
+ attestation.subgraphDeploymentID ,
451
460
indexer,
452
461
_fisherman,
453
462
_deposit,
@@ -465,7 +474,7 @@ contract DisputeManager is Governed {
465
474
Receipt memory receipt = Receipt (
466
475
_attestation.requestCID,
467
476
_attestation.responseCID,
468
- _attestation.subgraphID
477
+ _attestation.subgraphDeploymentID
469
478
);
470
479
bytes32 messageHash = encodeHashReceipt (receipt);
471
480
@@ -492,7 +501,7 @@ contract DisputeManager is Governed {
492
501
*/
493
502
function _parseAttestation (bytes memory _data ) private pure returns (Attestation memory ) {
494
503
// Decode receipt
495
- (bytes32 requestCID , bytes32 responseCID , bytes32 subgraphID ) = abi.decode (
504
+ (bytes32 requestCID , bytes32 responseCID , bytes32 subgraphDeploymentID ) = abi.decode (
496
505
_data, (bytes32 , bytes32 , bytes32 )
497
506
);
498
507
@@ -502,7 +511,7 @@ contract DisputeManager is Governed {
502
511
bytes32 r = _toBytes32 (_data, RECEIPT_SIZE_BYTES + 1 );
503
512
bytes32 s = _toBytes32 (_data, RECEIPT_SIZE_BYTES + 33 );
504
513
505
- return Attestation (requestCID, responseCID, subgraphID , v, r, s);
514
+ return Attestation (requestCID, responseCID, subgraphDeploymentID , v, r, s);
506
515
}
507
516
508
517
/**
0 commit comments