Skip to content

Commit e2daec5

Browse files
committed
feat: logic change of jumpDisputeKitIDIncompatibilityFallback into jumpDisputeKitIDOnCourtJump
1 parent d03832d commit e2daec5

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
6060

6161
struct NextRoundSettings {
6262
bool enabled; // True if the settings are enabled, false otherwise.
63-
uint96 jumpCourtID; // The ID of the court for the next round. Zero is considered as unset.
64-
uint256 jumpDisputeKitID; // The ID of the dispute kit for the next round. Zero is considered as unset.
65-
uint256 jumpDisputeKitIDIncompatibilityFallback; // The ID of the dispute kit to fallback to in case of incompatibility with the next round's court. Zero is considered as unset.
66-
uint256 nbVotes; // The number of votes for the next round. Zero is considered as unset.
63+
uint96 jumpCourtID; // The ID of the court for the next round. Zero is considered as undefined.
64+
uint256 jumpDisputeKitID; // The ID of the dispute kit for the next round. Zero is considered as undefined.
65+
uint256 jumpDisputeKitIDOnCourtJump; // The ID of the dispute kit if the court jumps and `jumpDisputeKitID` is undefined. Zero is considered as undefined.
66+
uint256 nbVotes; // The number of votes for the next round. Zero is considered as undefined.
6767
}
6868

6969
// ************************************* //
@@ -642,31 +642,30 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
642642
uint256 _currentRoundNbVotes
643643
) public view virtual override returns (uint96 newCourtID, uint256 newDisputeKitID, uint256 newRoundNbVotes) {
644644
NextRoundSettings storage nextRoundSettings = courtIDToNextRoundSettings[_currentCourtID];
645-
uint256 defaultNextRoundNbVotes = (_currentRoundNbVotes * 2) + 1;
646-
uint256 disputeKitIDIncompatibilityFallback;
645+
uint256 jumpDisputeKitIDOnCourtJump;
647646
if (nextRoundSettings.enabled) {
648647
newRoundNbVotes = nextRoundSettings.nbVotes;
649648
newCourtID = nextRoundSettings.jumpCourtID;
650-
newDisputeKitID = nextRoundSettings.jumpDisputeKitID;
651-
disputeKitIDIncompatibilityFallback = nextRoundSettings.jumpDisputeKitIDIncompatibilityFallback;
649+
newDisputeKitID = nextRoundSettings.jumpDisputeKitID; // Takes precedence over jumpDisputeKitIDOnCourtJump
650+
jumpDisputeKitIDOnCourtJump = nextRoundSettings.jumpDisputeKitIDOnCourtJump;
652651
}
653652
if (newCourtID == 0) {
654653
// Default court jump logic, unaffected by the newRoundNbVotes override
655-
newCourtID = defaultNextRoundNbVotes >= _currentCourtJurorsForJump ? _parentCourtID : _currentCourtID;
654+
newCourtID = _currentRoundNbVotes >= _currentCourtJurorsForJump ? _parentCourtID : _currentCourtID;
656655
}
657656
if (newDisputeKitID == 0) {
658-
// Default dispute kit jump logic
659-
newDisputeKitID = _currentDisputeKitID;
660-
}
661-
if (disputeKitIDIncompatibilityFallback != 0) {
662-
// Use the fallback dispute kit in case of incompatibility.
663-
if (!core.isSupported(newCourtID, newDisputeKitID)) {
664-
newDisputeKitID = disputeKitIDIncompatibilityFallback;
657+
// jumpDisputeKitID is undefined for next round
658+
if (newCourtID != _currentCourtID && jumpDisputeKitIDOnCourtJump != 0) {
659+
// Override on court jump
660+
newDisputeKitID = jumpDisputeKitIDOnCourtJump;
661+
} else {
662+
// Default dispute kit jump logic
663+
newDisputeKitID = _currentDisputeKitID;
665664
}
666665
}
667666
if (newRoundNbVotes == 0) {
668667
// Default nbVotes logic
669-
newRoundNbVotes = defaultNextRoundNbVotes;
668+
newRoundNbVotes = (_currentRoundNbVotes * 2) + 1;
670669
}
671670
}
672671

contracts/test/foundry/KlerosCore_Appeals.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
261261
enabled: true,
262262
jumpCourtID: GENERAL_COURT,
263263
jumpDisputeKitID: DISPUTE_KIT_CLASSIC,
264-
jumpDisputeKitIDIncompatibilityFallback: 0,
264+
jumpDisputeKitIDOnCourtJump: 0,
265265
nbVotes: 0
266266
})
267267
);
@@ -408,7 +408,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
408408
enabled: true,
409409
jumpCourtID: 0,
410410
jumpDisputeKitID: 0,
411-
jumpDisputeKitIDIncompatibilityFallback: dkID2,
411+
jumpDisputeKitIDOnCourtJump: dkID2,
412412
nbVotes: 0
413413
})
414414
);
@@ -530,7 +530,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
530530
enabled: true,
531531
jumpCourtID: 0,
532532
jumpDisputeKitID: 0,
533-
jumpDisputeKitIDIncompatibilityFallback: dkID3,
533+
jumpDisputeKitIDOnCourtJump: dkID3,
534534
nbVotes: 0
535535
})
536536
);
@@ -552,7 +552,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
552552
enabled: true,
553553
jumpCourtID: 0,
554554
jumpDisputeKitID: 0,
555-
jumpDisputeKitIDIncompatibilityFallback: dkID2,
555+
jumpDisputeKitIDOnCourtJump: dkID2,
556556
nbVotes: 0
557557
})
558558
);

0 commit comments

Comments
 (0)