@@ -121,7 +121,7 @@ contract Adjudicator {
121
121
locked[s],
122
122
_channel.state
123
123
);
124
- require (Channel. areBytes32ArraysEqual ( subAlloc.ID, _state.channelID) , "invalid sub-channel id " );
124
+ require (subAlloc.ID == _state.channelID, "invalid sub-channel id " );
125
125
126
126
uint256 [] memory _outcome;
127
127
(_outcome, nextIndex) = registerRecursive (
@@ -159,10 +159,7 @@ contract Adjudicator {
159
159
}
160
160
161
161
// If registered, require newer version and refutation timeout not passed.
162
- (Dispute memory dispute , bool registered ) = getDispute (state.channelID[Channel.findBackendIndex (
163
- state.channelID,
164
- state.outcome.backends
165
- )]);
162
+ (Dispute memory dispute , bool registered ) = getDispute (state.channelID);
166
163
if (registered) {
167
164
if (dispute.stateHash == hashState (state)) {
168
165
// Skip if same state.
@@ -206,10 +203,7 @@ contract Adjudicator {
206
203
uint256 actorIdx ,
207
204
bytes memory sig
208
205
) external {
209
- Dispute storage dispute = requireGetDispute (state.channelID[Channel.findBackendIndex (
210
- state.channelID,
211
- state.outcome.backends
212
- )]);
206
+ Dispute storage dispute = requireGetDispute (state.channelID);
213
207
if (dispute.phase == uint8 (DisputePhase.DISPUTE)) {
214
208
// solhint-disable-next-line not-rely-on-time
215
209
require (block .timestamp >= dispute.timeout, "timeout not passed " );
@@ -292,10 +286,7 @@ contract Adjudicator {
292
286
Channel.validateSignatures (params, state, sigs);
293
287
294
288
// If registered, require not concluded.
295
- (Dispute storage dispute , bool registered ) = getDispute (state.channelID[Channel.findBackendIndex (
296
- state.channelID,
297
- state.outcome.backends
298
- )]);
289
+ (Dispute storage dispute , bool registered ) = getDispute (state.channelID);
299
290
if (registered) {
300
291
require (
301
292
dispute.phase != uint8 (DisputePhase.CONCLUDED),
@@ -343,10 +334,7 @@ contract Adjudicator {
343
334
Channel.Params memory params ,
344
335
Channel.State memory state
345
336
) internal pure {
346
- require (state.channelID[Channel.findBackendIndex (
347
- state.channelID,
348
- state.outcome.backends
349
- )] == channelID (params), "invalid params " );
337
+ require (state.channelID == channelID (params), "invalid params " );
350
338
}
351
339
352
340
/**
@@ -361,11 +349,7 @@ contract Adjudicator {
361
349
Channel.State memory state ,
362
350
DisputePhase disputePhase
363
351
) internal {
364
- uint256 zeroIndex = Channel.findBackendIndex (
365
- state.channelID,
366
- state.outcome.backends
367
- );
368
- (Dispute storage dispute , bool registered ) = getDispute (state.channelID[zeroIndex]);
352
+ (Dispute storage dispute , bool registered ) = getDispute (state.channelID);
369
353
370
354
dispute.challengeDuration = uint64 (params.challengeDuration);
371
355
dispute.version = state.version;
@@ -386,7 +370,7 @@ contract Adjudicator {
386
370
dispute.timeout = uint64 (block .timestamp ) + dispute.challengeDuration;
387
371
}
388
372
389
- setDispute (state.channelID[zeroIndex] , dispute);
373
+ setDispute (state.channelID, dispute);
390
374
}
391
375
392
376
/**
@@ -465,11 +449,7 @@ contract Adjudicator {
465
449
* Reverts if the channel is already concluded.
466
450
*/
467
451
function concludeSingle (Channel.State memory state ) internal {
468
- uint64 zeroIndex = Channel.findBackendIndex (
469
- state.channelID,
470
- state.outcome.backends
471
- );
472
- Dispute storage dispute = requireGetDispute (state.channelID[zeroIndex]);
452
+ Dispute storage dispute = requireGetDispute (state.channelID);
473
453
require (dispute.stateHash == hashState (state), "invalid state " );
474
454
require (
475
455
dispute.phase != uint8 (DisputePhase.CONCLUDED),
@@ -485,7 +465,7 @@ contract Adjudicator {
485
465
require (block .timestamp >= dispute.timeout, "timeout not passed yet " );
486
466
dispute.phase = uint8 (DisputePhase.CONCLUDED);
487
467
488
- setDispute (state.channelID[zeroIndex] , dispute);
468
+ setDispute (state.channelID, dispute);
489
469
}
490
470
491
471
/**
@@ -520,7 +500,7 @@ contract Adjudicator {
520
500
for (uint256 i = 0 ; i < locked.length ; ++ i) {
521
501
Channel.SubAlloc memory subAlloc = locked[i];
522
502
Channel.State memory subState = subStates[nextIndex++ ];
523
- require (Channel. areBytes32ArraysEqual ( subAlloc.ID, subState.channelID) , "invalid subchannel id " );
503
+ require (subAlloc.ID == subState.channelID, "invalid subchannel id " );
524
504
525
505
uint256 [][] memory subOutcome;
526
506
(subOutcome, nextIndex) = forceConcludeRecursive (
@@ -546,23 +526,19 @@ contract Adjudicator {
546
526
* Reverts if the channel is not registered.
547
527
*/
548
528
function forceConcludeSingle (Channel.State memory state ) internal {
549
- uint64 zeroIndex = Channel.findBackendIndex (
550
- state.channelID,
551
- state.outcome.backends
552
- );
553
- Dispute storage dispute = requireGetDispute (state.channelID[zeroIndex]);
529
+ Dispute storage dispute = requireGetDispute (state.channelID);
554
530
require (dispute.stateHash == hashState (state), "invalid state " );
555
531
if (dispute.phase != uint8 (DisputePhase.CONCLUDED)) {
556
532
dispute.phase = uint8 (DisputePhase.CONCLUDED);
557
- setDispute (state.channelID[zeroIndex] , dispute);
533
+ setDispute (state.channelID, dispute);
558
534
}
559
535
}
560
536
561
537
/**
562
538
* @dev pushOutcome sets the outcome at the asset holders.
563
539
*/
564
540
function pushOutcome (
565
- bytes32 [] memory channel ,
541
+ bytes32 channel ,
566
542
Channel.Asset[] memory assets ,
567
543
Channel.Participant[] memory participants ,
568
544
uint256 [][] memory outcome
@@ -573,7 +549,7 @@ contract Adjudicator {
573
549
if (asset.ethHolder != address (0 )) {
574
550
// solhint-disable-next-line calls-loop
575
551
AssetHolder (asset.ethHolder).setOutcome (
576
- channel[a] ,
552
+ channel,
577
553
participants,
578
554
outcome[a]
579
555
);
0 commit comments