@@ -16,14 +16,14 @@ contract DisputeManager is Governed {
16
16
// Disputes contain info neccessary for the Arbitrator to verify and resolve
17
17
struct Dispute {
18
18
bytes32 subgraphID;
19
- address indexNode ;
19
+ address indexer ;
20
20
address fisherman;
21
21
uint256 deposit;
22
22
}
23
23
24
24
// -- Attestation --
25
25
26
- // Attestation sent from IndexNode in response to a request
26
+ // Attestation sent from indexer in response to a request
27
27
struct Attestation {
28
28
bytes32 requestCID;
29
29
bytes32 responseCID;
@@ -68,11 +68,11 @@ contract DisputeManager is Governed {
68
68
// Minimum deposit required to create a Dispute
69
69
uint256 public minimumDeposit;
70
70
71
- // Percentage of index node slashed funds to assign as a reward to fisherman in successful dispute
71
+ // Percentage of indexer slashed funds to assign as a reward to fisherman in successful dispute
72
72
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
73
- uint256 public rewardPercentage ;
73
+ uint256 public fishermanRewardPercentage ;
74
74
75
- // Percentage of index node stake to slash on disputes
75
+ // Percentage of indexer stake to slash on disputes
76
76
// Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
77
77
uint256 public slashingPercentage;
78
78
@@ -85,53 +85,53 @@ contract DisputeManager is Governed {
85
85
// -- Events --
86
86
87
87
/**
88
- * @dev Emitted when `disputeID` is created for `subgraphID` and `indexNode ` by `fisherman`.
88
+ * @dev Emitted when `disputeID` is created for `subgraphID` and `indexer ` by `fisherman`.
89
89
* The event emits the amount `tokens` deposited by the fisherman and `attestation` submitted.
90
90
*/
91
91
event DisputeCreated (
92
92
bytes32 disputeID ,
93
93
bytes32 indexed subgraphID ,
94
- address indexed indexNode ,
94
+ address indexed indexer ,
95
95
address indexed fisherman ,
96
96
uint256 tokens ,
97
97
bytes attestation
98
98
);
99
99
100
100
/**
101
- * @dev Emitted when arbitrator accepts a `disputeID` for `subgraphID` and `indexNode `
101
+ * @dev Emitted when arbitrator accepts a `disputeID` for `subgraphID` and `indexer `
102
102
* created by `fisherman`.
103
103
* The event emits the amount `tokens` transferred to the fisherman, the deposit plus reward.
104
104
*/
105
105
event DisputeAccepted (
106
106
bytes32 disputeID ,
107
107
bytes32 indexed subgraphID ,
108
- address indexed indexNode ,
108
+ address indexed indexer ,
109
109
address indexed fisherman ,
110
110
uint256 tokens
111
111
);
112
112
113
113
/**
114
- * @dev Emitted when arbitrator rejects a `disputeID` for `subgraphID` and `indexNode `
114
+ * @dev Emitted when arbitrator rejects a `disputeID` for `subgraphID` and `indexer `
115
115
* created by `fisherman`.
116
116
* The event emits the amount `tokens` burned from the fisherman deposit.
117
117
*/
118
118
event DisputeRejected (
119
119
bytes32 disputeID ,
120
120
bytes32 indexed subgraphID ,
121
- address indexed indexNode ,
121
+ address indexed indexer ,
122
122
address indexed fisherman ,
123
123
uint256 tokens
124
124
);
125
125
126
126
/**
127
- * @dev Emitted when arbitrator draw a `disputeID` for `subgraphID` and `indexNode `
127
+ * @dev Emitted when arbitrator draw a `disputeID` for `subgraphID` and `indexer `
128
128
* created by `fisherman`.
129
129
* The event emits the amount `tokens` used as deposit and returned to the fisherman.
130
130
*/
131
- event DisputeIgnored (
131
+ event DisputeDrawn (
132
132
bytes32 disputeID ,
133
133
bytes32 indexed subgraphID ,
134
- address indexed indexNode ,
134
+ address indexed indexer ,
135
135
address indexed fisherman ,
136
136
uint256 tokens
137
137
);
@@ -148,23 +148,23 @@ contract DisputeManager is Governed {
148
148
* @param _arbitrator Arbitrator role
149
149
* @param _staking Address of the staking contract used for slashing
150
150
* @param _minimumDeposit Minimum deposit required to create a Dispute
151
- * @param _rewardPercentage Percent of slashed funds the fisherman gets (in PPM)
152
- * @param _slashingPercentage Percentage of index node stake slashed after a dispute
151
+ * @param _fishermanRewardPercentage Percent of slashed funds the fisherman gets (in PPM)
152
+ * @param _slashingPercentage Percentage of indexer stake slashed after a dispute
153
153
*/
154
154
constructor (
155
155
address _governor ,
156
156
address _arbitrator ,
157
157
address _token ,
158
158
address _staking ,
159
159
uint256 _minimumDeposit ,
160
- uint256 _rewardPercentage ,
160
+ uint256 _fishermanRewardPercentage ,
161
161
uint256 _slashingPercentage
162
162
) public Governed (_governor) {
163
163
arbitrator = _arbitrator;
164
164
token = GraphToken (_token);
165
165
staking = Staking (_staking);
166
166
minimumDeposit = _minimumDeposit;
167
- rewardPercentage = _rewardPercentage ;
167
+ fishermanRewardPercentage = _fishermanRewardPercentage ;
168
168
slashingPercentage = _slashingPercentage;
169
169
170
170
// EIP-712 domain separator
@@ -190,24 +190,24 @@ contract DisputeManager is Governed {
190
190
}
191
191
192
192
/**
193
- * @dev Get the fisherman reward for a given index node stake
194
- * @notice Return the fisherman reward based on the `_indexNode ` stake
195
- * @param _indexNode IndexNode to be slashed
196
- * @return Reward calculated as percentage of the index node slashed funds
193
+ * @dev Get the fisherman reward for a given indexer stake
194
+ * @notice Return the fisherman reward based on the `_indexer ` stake
195
+ * @param _indexer Indexer to be slashed
196
+ * @return Reward calculated as percentage of the indexer slashed funds
197
197
*/
198
- function getTokensToReward (address _indexNode ) public view returns (uint256 ) {
199
- uint256 value = getTokensToSlash (_indexNode );
200
- return rewardPercentage .mul (value).div (MAX_PPM); // rewardPercentage is in PPM
198
+ function getTokensToReward (address _indexer ) public view returns (uint256 ) {
199
+ uint256 value = getTokensToSlash (_indexer );
200
+ return fishermanRewardPercentage .mul (value).div (MAX_PPM);
201
201
}
202
202
203
203
/**
204
- * @dev Get the amount of tokens to slash for an index node based on the stake
205
- * @param _indexNode Address of the index node
204
+ * @dev Get the amount of tokens to slash for an indexer based on the stake
205
+ * @param _indexer Address of the indexer
206
206
* @return Amount of tokens to slash
207
207
*/
208
- function getTokensToSlash (address _indexNode ) public view returns (uint256 ) {
209
- uint256 tokens = staking.getIndexNodeStakeTokens (_indexNode ); // slashable tokens
210
- return slashingPercentage.mul (tokens).div (MAX_PPM); // slashingPercentage is in PPM
208
+ function getTokensToSlash (address _indexer ) public view returns (uint256 ) {
209
+ uint256 tokens = staking.getIndexNodeStakeTokens (_indexer ); // slashable tokens
210
+ return slashingPercentage.mul (tokens).div (MAX_PPM);
211
211
}
212
212
213
213
/**
@@ -252,16 +252,16 @@ contract DisputeManager is Governed {
252
252
/**
253
253
* @dev Set the percent reward that the fisherman gets when slashing occurs
254
254
* @notice Update the reward percentage to `_percentage`
255
- * @param _percentage Reward as a percentage of index node stake
255
+ * @param _percentage Reward as a percentage of indexer stake
256
256
*/
257
- function setRewardPercentage (uint256 _percentage ) external onlyGovernor {
257
+ function setFishermanRewardPercentage (uint256 _percentage ) external onlyGovernor {
258
258
// Must be within 0% to 100% (inclusive)
259
259
require (_percentage <= MAX_PPM, "Reward percentage must be below or equal to MAX_PPM " );
260
- rewardPercentage = _percentage;
260
+ fishermanRewardPercentage = _percentage;
261
261
}
262
262
263
263
/**
264
- * @dev Set the percentage used for slashing index nodes
264
+ * @dev Set the percentage used for slashing indexers
265
265
* @param _percentage Percentage used for slashing
266
266
*/
267
267
function setSlashingPercentage (uint256 _percentage ) external onlyGovernor {
@@ -312,11 +312,11 @@ contract DisputeManager is Governed {
312
312
// Resolve dispute
313
313
delete disputes[_disputeID]; // Re-entrancy protection
314
314
315
- // Have staking contract slash the index node and reward the fisherman
316
- // Give the fisherman a reward equal to the rewardPercentage of the index node slashed amount
317
- uint256 tokensToReward = getTokensToReward (dispute.indexNode );
318
- uint256 tokensToSlash = getTokensToSlash (dispute.indexNode );
319
- staking.slash (dispute.indexNode , tokensToSlash, tokensToReward, dispute.fisherman);
315
+ // Have staking contract slash the indexer and reward the fisherman
316
+ // Give the fisherman a reward equal to the fishermanRewardPercentage of slashed amount
317
+ uint256 tokensToReward = getTokensToReward (dispute.indexer );
318
+ uint256 tokensToSlash = getTokensToSlash (dispute.indexer );
319
+ staking.slash (dispute.indexer , tokensToSlash, tokensToReward, dispute.fisherman);
320
320
321
321
// Give the fisherman their deposit back
322
322
require (
@@ -327,7 +327,7 @@ contract DisputeManager is Governed {
327
327
emit DisputeAccepted (
328
328
_disputeID,
329
329
dispute.subgraphID,
330
- dispute.indexNode ,
330
+ dispute.indexer ,
331
331
dispute.fisherman,
332
332
dispute.deposit.add (tokensToReward)
333
333
);
@@ -352,18 +352,18 @@ contract DisputeManager is Governed {
352
352
emit DisputeRejected (
353
353
_disputeID,
354
354
dispute.subgraphID,
355
- dispute.indexNode ,
355
+ dispute.indexer ,
356
356
dispute.fisherman,
357
357
dispute.deposit
358
358
);
359
359
}
360
360
361
361
/**
362
- * @dev The arbitrator can disregard a dispute
362
+ * @dev The arbitrator can draw dispute
363
363
* @notice Ignore a dispute with ID `_disputeID`
364
364
* @param _disputeID ID of the dispute to be disregarded
365
365
*/
366
- function ignoreDispute (bytes32 _disputeID ) external onlyArbitrator {
366
+ function drawDispute (bytes32 _disputeID ) external onlyArbitrator {
367
367
require (isDisputeCreated (_disputeID), "Dispute does not exist " );
368
368
369
369
Dispute memory dispute = disputes[_disputeID];
@@ -377,10 +377,10 @@ contract DisputeManager is Governed {
377
377
"Error sending dispute deposit "
378
378
);
379
379
380
- emit DisputeIgnored (
380
+ emit DisputeDrawn (
381
381
_disputeID,
382
382
dispute.subgraphID,
383
- dispute.indexNode ,
383
+ dispute.indexer ,
384
384
dispute.fisherman,
385
385
dispute.deposit
386
386
);
@@ -400,34 +400,34 @@ contract DisputeManager is Governed {
400
400
Attestation memory attestation = _parseAttestation (_attestationData);
401
401
402
402
// Get attestation signer
403
- address indexNode = _recoverAttestationSigner (attestation);
403
+ address indexer = _recoverAttestationSigner (attestation);
404
404
405
405
// Create a disputeID
406
406
bytes32 disputeID = keccak256 (
407
407
abi.encodePacked (
408
408
attestation.requestCID,
409
409
attestation.responseCID,
410
410
attestation.subgraphID,
411
- indexNode
411
+ indexer
412
412
)
413
413
);
414
414
415
- // This also validates that index node exists
416
- require (staking.hasStake (indexNode ), "Dispute has no stake by the index node " );
415
+ // This also validates that indexer exists
416
+ require (staking.hasStake (indexer ), "Dispute has no stake by the indexer " );
417
417
418
418
// Ensure that fisherman has staked at least the minimum amount
419
419
require (_deposit >= minimumDeposit, "Dispute deposit under minimum required " );
420
420
421
- // A fisherman can only open one dispute for a given index node / subgraphID at a time
421
+ // A fisherman can only open one dispute for a given indexer / subgraphID at a time
422
422
require (! isDisputeCreated (disputeID), "Dispute already created " ); // Must be empty
423
423
424
424
// Store dispute
425
- disputes[disputeID] = Dispute (attestation.subgraphID, indexNode , _fisherman, _deposit);
425
+ disputes[disputeID] = Dispute (attestation.subgraphID, indexer , _fisherman, _deposit);
426
426
427
427
emit DisputeCreated (
428
428
disputeID,
429
429
attestation.subgraphID,
430
- indexNode ,
430
+ indexer ,
431
431
_fisherman,
432
432
_deposit,
433
433
_attestationData
0 commit comments