@@ -14,10 +14,16 @@ const NON_EXISTING_DISPUTE_ID = '0x0'
14
14
15
15
contract ( 'Disputes' , ( [ me , other , governor , arbitrator , indexer , fisherman , otherIndexer ] ) => {
16
16
beforeEach ( async function ( ) {
17
- // Private key for account #4
18
- this . indexerPrivKey = '0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743'
19
- // Private key for account #6
20
- this . otherIndexerPrivKey = '0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52'
17
+ // Channel keys for account #4
18
+ this . indexerChannelPrivKey =
19
+ '0xe9696cbe81b09b796be29055c8694eb422710940b44934b3a1d21c1ca0a03e9a'
20
+ this . indexerChannelPubKey =
21
+ '0x04417b6be970480e74a55182ee04279fdffa7431002af2150750d367999a59abead903fbd23c0da7bb4233fdbccd732a2f561e66460718b4c50084e736c1601555'
22
+ // Channel keys for account #6
23
+ this . otherIndexerChannelPrivKey =
24
+ '0xb560ebb22d7369c8ffeb9aec92930adfab16054542eadc76de826bc7db6390c2'
25
+ this . otherIndexerChannelPubKey =
26
+ '0x0447b5891c07679d40d6dfd3c4f8e1974e068da36ac76a6507dbaf5e432b879b3d4cd8c950b0df035e621f5a55b91a224ecdaef8cc8e6bb8cd8afff4a74c1904cd'
21
27
22
28
// Deploy epoch contract
23
29
this . epochManager = await deployment . deployEpochManagerContract ( governor , { from : me } )
@@ -210,7 +216,8 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
210
216
this . dispute = await attestation . createDispute (
211
217
receipt ,
212
218
this . disputeManager . address ,
213
- this . indexerPrivKey ,
219
+ this . indexerChannelPrivKey ,
220
+ indexer ,
214
221
)
215
222
} )
216
223
@@ -221,7 +228,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
221
228
this . disputeManager . createDispute ( this . dispute . attestation , this . fishermanDeposit , {
222
229
from : fisherman ,
223
230
} ) ,
224
- 'Dispute has no stake by the indexer ' ,
231
+ 'Indexer cannot be found with the attestation ' ,
225
232
)
226
233
} )
227
234
} )
@@ -235,7 +242,14 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
235
242
236
243
// Stake
237
244
this . indexerTokens = web3 . utils . toWei ( new BN ( '100000' ) )
238
- for ( const indexerAddress of [ indexer , otherIndexer ] ) {
245
+ this . indexerAllocatedTokens = web3 . utils . toWei ( new BN ( '10000' ) )
246
+ const indexerList = [
247
+ [ indexer , this . indexerChannelPubKey ] ,
248
+ [ otherIndexer , this . otherIndexerChannelPubKey ] ,
249
+ ]
250
+ for ( const activeIndexer of indexerList ) {
251
+ const [ indexerAddress , indexerPubKey ] = activeIndexer
252
+
239
253
// Give some funds to the indexer
240
254
await this . grt . mint ( indexerAddress , this . indexerTokens , {
241
255
from : governor ,
@@ -246,6 +260,12 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
246
260
247
261
// Indexer stake funds
248
262
await this . staking . stake ( this . indexerTokens , { from : indexerAddress } )
263
+ await this . staking . allocate (
264
+ this . dispute . receipt . subgraphID ,
265
+ this . indexerAllocatedTokens ,
266
+ indexerPubKey ,
267
+ { from : indexerAddress } ,
268
+ )
249
269
}
250
270
} )
251
271
@@ -274,7 +294,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
274
294
this . disputeManager . createDispute ( this . dispute . attestation , belowMinimumDeposit , {
275
295
from : fisherman ,
276
296
} ) ,
277
- 'Dispute deposit under minimum required' ,
297
+ 'Dispute deposit is under minimum required' ,
278
298
)
279
299
} )
280
300
@@ -313,7 +333,8 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
313
333
const newDispute = await attestation . createDispute (
314
334
this . dispute . receipt ,
315
335
this . disputeManager . address ,
316
- this . otherIndexerPrivKey ,
336
+ this . otherIndexerChannelPrivKey ,
337
+ otherIndexer ,
317
338
)
318
339
const { logs } = await this . disputeManager . createDispute (
319
340
newDispute . attestation ,
@@ -384,7 +405,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
384
405
const reward = await this . disputeManager . getTokensToReward ( indexer )
385
406
386
407
// Perform transaction (accept)
387
- const { tx } = await this . disputeManager . acceptDispute ( this . dispute . id , {
408
+ const { logs } = await this . disputeManager . acceptDispute ( this . dispute . id , {
388
409
from : arbitrator ,
389
410
} )
390
411
@@ -404,7 +425,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
404
425
expect ( totalSupplyAfter ) . to . be . bignumber . eq ( totalSupplyBefore . sub ( tokensToBurn ) )
405
426
406
427
// Event emitted
407
- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeAccepted' , {
428
+ expectEvent . inLogs ( logs , 'DisputeAccepted' , {
408
429
disputeID : this . dispute . id ,
409
430
subgraphID : this . dispute . receipt . subgraphID ,
410
431
indexer : indexer ,
@@ -438,7 +459,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
438
459
const totalSupplyBefore = await this . grt . totalSupply ( )
439
460
440
461
// Perform transaction (reject)
441
- const { tx } = await this . disputeManager . rejectDispute ( this . dispute . id , {
462
+ const { logs } = await this . disputeManager . rejectDispute ( this . dispute . id , {
442
463
from : arbitrator ,
443
464
} )
444
465
@@ -452,7 +473,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
452
473
expect ( totalSupplyAfter ) . to . be . bignumber . eq ( totalSupplyBefore . sub ( burnedTokens ) )
453
474
454
475
// Event emitted
455
- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeRejected' , {
476
+ expectEvent . inLogs ( logs , 'DisputeRejected' , {
456
477
disputeID : this . dispute . id ,
457
478
subgraphID : this . dispute . receipt . subgraphID ,
458
479
indexer : indexer ,
@@ -485,7 +506,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
485
506
const fishermanBalanceBefore = await this . grt . balanceOf ( fisherman )
486
507
487
508
// Perform transaction (draw)
488
- const { tx } = await this . disputeManager . drawDispute ( this . dispute . id , {
509
+ const { logs } = await this . disputeManager . drawDispute ( this . dispute . id , {
489
510
from : arbitrator ,
490
511
} )
491
512
@@ -496,7 +517,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
496
517
)
497
518
498
519
// Event emitted
499
- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeDrawn' , {
520
+ expectEvent . inLogs ( logs , 'DisputeDrawn' , {
500
521
disputeID : this . dispute . id ,
501
522
subgraphID : this . dispute . receipt . subgraphID ,
502
523
indexer : indexer ,
0 commit comments