@@ -14,10 +14,16 @@ const NON_EXISTING_DISPUTE_ID = '0x0'
1414
1515contract ( 'Disputes' , ( [ me , other , governor , arbitrator , indexer , fisherman , otherIndexer ] ) => {
1616 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'
2127
2228 // Deploy epoch contract
2329 this . epochManager = await deployment . deployEpochManagerContract ( governor , { from : me } )
@@ -210,7 +216,8 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
210216 this . dispute = await attestation . createDispute (
211217 receipt ,
212218 this . disputeManager . address ,
213- this . indexerPrivKey ,
219+ this . indexerChannelPrivKey ,
220+ indexer ,
214221 )
215222 } )
216223
@@ -221,7 +228,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
221228 this . disputeManager . createDispute ( this . dispute . attestation , this . fishermanDeposit , {
222229 from : fisherman ,
223230 } ) ,
224- 'Dispute has no stake by the indexer ' ,
231+ 'Indexer cannot be found with the attestation ' ,
225232 )
226233 } )
227234 } )
@@ -235,7 +242,14 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
235242
236243 // Stake
237244 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+
239253 // Give some funds to the indexer
240254 await this . grt . mint ( indexerAddress , this . indexerTokens , {
241255 from : governor ,
@@ -246,6 +260,12 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
246260
247261 // Indexer stake funds
248262 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+ )
249269 }
250270 } )
251271
@@ -274,7 +294,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
274294 this . disputeManager . createDispute ( this . dispute . attestation , belowMinimumDeposit , {
275295 from : fisherman ,
276296 } ) ,
277- 'Dispute deposit under minimum required' ,
297+ 'Dispute deposit is under minimum required' ,
278298 )
279299 } )
280300
@@ -313,7 +333,8 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
313333 const newDispute = await attestation . createDispute (
314334 this . dispute . receipt ,
315335 this . disputeManager . address ,
316- this . otherIndexerPrivKey ,
336+ this . otherIndexerChannelPrivKey ,
337+ otherIndexer ,
317338 )
318339 const { logs } = await this . disputeManager . createDispute (
319340 newDispute . attestation ,
@@ -384,7 +405,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
384405 const reward = await this . disputeManager . getTokensToReward ( indexer )
385406
386407 // Perform transaction (accept)
387- const { tx } = await this . disputeManager . acceptDispute ( this . dispute . id , {
408+ const { logs } = await this . disputeManager . acceptDispute ( this . dispute . id , {
388409 from : arbitrator ,
389410 } )
390411
@@ -404,7 +425,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
404425 expect ( totalSupplyAfter ) . to . be . bignumber . eq ( totalSupplyBefore . sub ( tokensToBurn ) )
405426
406427 // Event emitted
407- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeAccepted' , {
428+ expectEvent . inLogs ( logs , 'DisputeAccepted' , {
408429 disputeID : this . dispute . id ,
409430 subgraphID : this . dispute . receipt . subgraphID ,
410431 indexer : indexer ,
@@ -438,7 +459,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
438459 const totalSupplyBefore = await this . grt . totalSupply ( )
439460
440461 // Perform transaction (reject)
441- const { tx } = await this . disputeManager . rejectDispute ( this . dispute . id , {
462+ const { logs } = await this . disputeManager . rejectDispute ( this . dispute . id , {
442463 from : arbitrator ,
443464 } )
444465
@@ -452,7 +473,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
452473 expect ( totalSupplyAfter ) . to . be . bignumber . eq ( totalSupplyBefore . sub ( burnedTokens ) )
453474
454475 // Event emitted
455- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeRejected' , {
476+ expectEvent . inLogs ( logs , 'DisputeRejected' , {
456477 disputeID : this . dispute . id ,
457478 subgraphID : this . dispute . receipt . subgraphID ,
458479 indexer : indexer ,
@@ -485,7 +506,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
485506 const fishermanBalanceBefore = await this . grt . balanceOf ( fisherman )
486507
487508 // Perform transaction (draw)
488- const { tx } = await this . disputeManager . drawDispute ( this . dispute . id , {
509+ const { logs } = await this . disputeManager . drawDispute ( this . dispute . id , {
489510 from : arbitrator ,
490511 } )
491512
@@ -496,7 +517,7 @@ contract('Disputes', ([me, other, governor, arbitrator, indexer, fisherman, othe
496517 )
497518
498519 // Event emitted
499- expectEvent . inTransaction ( tx , this . disputeManager . constructor , 'DisputeDrawn' , {
520+ expectEvent . inLogs ( logs , 'DisputeDrawn' , {
500521 disputeID : this . dispute . id ,
501522 subgraphID : this . dispute . receipt . subgraphID ,
502523 indexer : indexer ,
0 commit comments