@@ -22,7 +22,7 @@ contract DisputeManager is Governed {
22
22
bytes32 subgraphID;
23
23
address indexNode;
24
24
address fisherman;
25
- uint256 depositAmount ;
25
+ uint256 deposit ;
26
26
}
27
27
28
28
// -- Attestation --
@@ -107,23 +107,23 @@ contract DisputeManager is Governed {
107
107
bytes32 indexed subgraphID ,
108
108
address indexed indexNode ,
109
109
address indexed fisherman ,
110
- uint256 amount
110
+ uint256 deposit
111
111
);
112
112
113
113
event DisputeRejected (
114
114
bytes32 disputeID ,
115
115
bytes32 indexed subgraphID ,
116
116
address indexed indexNode ,
117
117
address indexed fisherman ,
118
- uint256 amount
118
+ uint256 deposit
119
119
);
120
120
121
121
event DisputeIgnored (
122
122
bytes32 disputeID ,
123
123
bytes32 indexed subgraphID ,
124
124
address indexed indexNode ,
125
125
address indexed fisherman ,
126
- uint256 amount
126
+ uint256 deposit
127
127
);
128
128
129
129
modifier onlyArbitrator {
@@ -269,26 +269,26 @@ contract DisputeManager is Governed {
269
269
);
270
270
271
271
// Decode subgraphID
272
- bytes32 _subgraphID = _data.slice (0 , 32 ).toBytes32 (0 );
272
+ bytes32 subgraphID = _data.slice (0 , 32 ).toBytes32 (0 );
273
273
274
274
// Decode attestation
275
- bytes memory _attestation = _data.slice (32 , ATTESTATION_SIZE_BYTES);
275
+ bytes memory attestation = _data.slice (32 , ATTESTATION_SIZE_BYTES);
276
276
require (
277
- _attestation .length == ATTESTATION_SIZE_BYTES,
277
+ attestation .length == ATTESTATION_SIZE_BYTES,
278
278
"Signature must be 192 bytes long "
279
279
);
280
280
281
281
// Decode attestation signature
282
- bytes memory _sig = _data.slice (
282
+ bytes memory sig = _data.slice (
283
283
32 + ATTESTATION_SIZE_BYTES,
284
284
SIGNATURE_SIZE_BYTES
285
285
);
286
286
require (
287
- _sig .length == SIGNATURE_SIZE_BYTES,
287
+ sig .length == SIGNATURE_SIZE_BYTES,
288
288
"Signature must be 65 bytes long "
289
289
);
290
290
291
- createDispute (_attestation, _sig, _subgraphID , _from, _value);
291
+ createDispute (attestation, sig, subgraphID , _from, _value);
292
292
293
293
return true ;
294
294
}
@@ -308,22 +308,22 @@ contract DisputeManager is Governed {
308
308
309
309
// Have staking slash the index node and reward the fisherman
310
310
// Give the fisherman a reward equal to the slashingPercent of the indexer's stake
311
- uint256 _stake = staking.getIndexingNodeStake (
311
+ uint256 stake = staking.getIndexingNodeStake (
312
312
dispute.subgraphID,
313
313
dispute.indexNode
314
314
);
315
- uint256 _reward = getRewardForStake (_stake );
316
- assert (_reward <= _stake ); // sanity check on fixed-point math
315
+ uint256 reward = getRewardForStake (stake );
316
+ assert (reward <= stake ); // sanity check on fixed-point math
317
317
staking.slash (
318
318
dispute.subgraphID,
319
319
dispute.indexNode,
320
- _reward ,
320
+ reward ,
321
321
dispute.fisherman
322
322
);
323
323
324
324
// Give the fisherman their deposit back
325
325
require (
326
- token.transfer (dispute.fisherman, dispute.depositAmount ),
326
+ token.transfer (dispute.fisherman, dispute.deposit ),
327
327
"Error sending dispute deposit "
328
328
);
329
329
@@ -333,7 +333,7 @@ contract DisputeManager is Governed {
333
333
dispute.subgraphID,
334
334
dispute.indexNode,
335
335
dispute.fisherman,
336
- _reward
336
+ reward
337
337
);
338
338
}
339
339
@@ -351,14 +351,14 @@ contract DisputeManager is Governed {
351
351
delete disputes[_disputeID]; // Re-entrancy protection
352
352
353
353
// Burn the fisherman's deposit
354
- token.burn (dispute.depositAmount );
354
+ token.burn (dispute.deposit );
355
355
356
356
emit DisputeRejected (
357
357
_disputeID,
358
358
dispute.subgraphID,
359
359
dispute.indexNode,
360
360
dispute.fisherman,
361
- dispute.depositAmount
361
+ dispute.deposit
362
362
);
363
363
}
364
364
@@ -377,7 +377,7 @@ contract DisputeManager is Governed {
377
377
378
378
// Return deposit to the fisherman
379
379
require (
380
- token.transfer (dispute.fisherman, dispute.depositAmount ),
380
+ token.transfer (dispute.fisherman, dispute.deposit ),
381
381
"Error sending dispute deposit "
382
382
);
383
383
@@ -386,7 +386,7 @@ contract DisputeManager is Governed {
386
386
dispute.subgraphID,
387
387
dispute.indexNode,
388
388
dispute.fisherman,
389
- dispute.depositAmount
389
+ dispute.deposit
390
390
);
391
391
}
392
392
@@ -397,53 +397,53 @@ contract DisputeManager is Governed {
397
397
* @param _subgraphID <bytes32> - subgraphID that Attestation message
398
398
* contains (in request raw object at CID)
399
399
* @param _fisherman <address> - Creator of dispute
400
- * @param _amount <uint256> - Amount of tokens staked
400
+ * @param _deposit <uint256> - Amount of tokens staked as deposit
401
401
*/
402
402
function createDispute (
403
403
bytes memory _attestation ,
404
404
bytes memory _sig ,
405
405
bytes32 _subgraphID ,
406
406
address _fisherman ,
407
- uint256 _amount
407
+ uint256 _deposit
408
408
) private {
409
409
// Obtain the hash of the fully-encoded message, per EIP-712 encoding
410
- bytes32 _disputeID = getDisputeID (_attestation);
410
+ bytes32 disputeID = getDisputeID (_attestation);
411
411
412
412
// Obtain the signer of the fully-encoded EIP-712 message hash
413
413
// Note: The signer of the attestation is the indexNode that served it
414
- address _indexNode = _disputeID .recover (_sig);
414
+ address indexNode = disputeID .recover (_sig);
415
415
416
416
// Get staked amount on the served subgraph by indexer
417
- uint256 _stake = staking.getIndexingNodeStake (_subgraphID, _indexNode );
417
+ uint256 stake = staking.getIndexingNodeStake (_subgraphID, indexNode );
418
418
419
419
// This also validates that indexer node exists
420
420
require (
421
- _stake > 0 ,
421
+ stake > 0 ,
422
422
"Dispute has no stake on the subgraph by the indexer node "
423
423
);
424
424
425
425
// Ensure that fisherman has posted at least that amount
426
426
require (
427
- _amount >= getRewardForStake (_stake ),
427
+ _deposit >= getRewardForStake (stake ),
428
428
"Dispute deposit under minimum required "
429
429
);
430
430
431
431
// A fisherman can only open one dispute for a given index node / subgraphID at a time
432
- require (! isDisputeCreated (_disputeID ), "Dispute already created " ); // Must be empty
432
+ require (! isDisputeCreated (disputeID ), "Dispute already created " ); // Must be empty
433
433
434
434
// Store dispute
435
- disputes[_disputeID ] = Dispute (
435
+ disputes[disputeID ] = Dispute (
436
436
_subgraphID,
437
- _indexNode ,
437
+ indexNode ,
438
438
_fisherman,
439
- _amount
439
+ _deposit
440
440
);
441
441
442
442
// Log event that new dispute was created against IndexNode
443
443
emit DisputeCreated (
444
- _disputeID ,
444
+ disputeID ,
445
445
_subgraphID,
446
- _indexNode ,
446
+ indexNode ,
447
447
_fisherman,
448
448
_attestation
449
449
);
0 commit comments