@@ -785,13 +785,13 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
785785 Round storage extraRound = dispute.rounds.push ();
786786 uint256 extraRoundID = dispute.rounds.length - 1 ;
787787
788- (uint96 newCourtID , uint256 newDisputeKitID , , bool courtJump , ) = _getCourtAndDisputeKitJumps (
788+ (uint96 newCourtID , uint256 newDisputeKitID , ) = _getCompatibleNextRoundSettings (
789789 dispute,
790790 round,
791791 courts[dispute.courtID],
792792 _disputeID
793793 );
794- if (courtJump ) {
794+ if (newCourtID != dispute.courtID ) {
795795 emit CourtJump (_disputeID, extraRoundID, dispute.courtID, newCourtID);
796796 }
797797
@@ -1086,14 +1086,14 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
10861086 Round storage round = dispute.rounds[dispute.rounds.length - 1 ];
10871087 Court storage court = courts[dispute.courtID];
10881088
1089- (, , uint256 nbVotesAfterAppeal , bool courtJump , ) = _getCourtAndDisputeKitJumps (
1089+ (uint96 newCourtID , , uint256 nbVotesAfterAppeal ) = _getCompatibleNextRoundSettings (
10901090 dispute,
10911091 round,
10921092 court,
10931093 _disputeID
10941094 );
10951095
1096- if (courtJump ) {
1096+ if (newCourtID != dispute.courtID ) {
10971097 // Jump to parent court.
10981098 if (dispute.courtID == GENERAL_COURT) {
10991099 // TODO: Handle the forking when appealed in General court.
@@ -1204,12 +1204,14 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
12041204 Round storage round = dispute.rounds[dispute.rounds.length - 1 ];
12051205 Court storage court = courts[dispute.courtID];
12061206
1207- (newCourtID, newDisputeKitID, newRoundNbVotes, courtJump, disputeKitJump ) = _getCourtAndDisputeKitJumps (
1207+ (newCourtID, newDisputeKitID, newRoundNbVotes) = _getCompatibleNextRoundSettings (
12081208 dispute,
12091209 round,
12101210 court,
12111211 _disputeID
12121212 );
1213+ courtJump = (newCourtID != dispute.courtID);
1214+ disputeKitJump = (newDisputeKitID != round.disputeKitID);
12131215 }
12141216
12151217 /// @notice Returns the length of disputeKits array.
@@ -1230,48 +1232,35 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
12301232 // * Internal * //
12311233 // ************************************* //
12321234
1233- /// @notice Checks whether a dispute will jump to new court/DK and enforces a compatibility check.
1235+ /// @notice Get the next round settings for a given dispute
1236+ /// @dev Enforces a compatibility check between the next round's court and dispute kit.
12341237 /// @param _dispute Dispute data.
12351238 /// @param _round Round ID.
12361239 /// @param _court Current court ID.
12371240 /// @param _disputeID Dispute ID.
12381241 /// @return newCourtID Court ID after jump.
12391242 /// @return newDisputeKitID Dispute kit ID after jump.
12401243 /// @return newRoundNbVotes The number of votes in the new round.
1241- /// @return courtJump Whether the dispute jumps to a new court or not.
1242- /// @return disputeKitJump Whether the dispute jumps to a new dispute kit or not.
1243- function _getCourtAndDisputeKitJumps (
1244+ function _getCompatibleNextRoundSettings (
12441245 Dispute storage _dispute ,
12451246 Round storage _round ,
12461247 Court storage _court ,
12471248 uint256 _disputeID
1248- )
1249- internal
1250- view
1251- returns (
1252- uint96 newCourtID ,
1253- uint256 newDisputeKitID ,
1254- uint256 newRoundNbVotes ,
1255- bool courtJump ,
1256- bool disputeKitJump
1257- )
1258- {
1249+ ) internal view returns (uint96 newCourtID , uint256 newDisputeKitID , uint256 newRoundNbVotes ) {
12591250 uint256 disputeKitID = _round.disputeKitID;
1260- (newCourtID, newDisputeKitID, newRoundNbVotes, courtJump, disputeKitJump) = disputeKits[disputeKitID]
1261- .getCourtAndDisputeKitJumps (
1262- _disputeID,
1263- _dispute.courtID,
1264- _court.parent,
1265- _court.jurorsForCourtJump,
1266- disputeKitID,
1267- _round.nbVotes
1268- );
1251+ (newCourtID, newDisputeKitID, newRoundNbVotes) = disputeKits[disputeKitID].getNextRoundSettings (
1252+ _disputeID,
1253+ _dispute.courtID,
1254+ _court.parent,
1255+ _court.jurorsForCourtJump,
1256+ disputeKitID,
1257+ _round.nbVotes
1258+ );
12691259
12701260 // Ensure compatibility between the next round's court and dispute kit.
12711261 if (! courts[newCourtID].supportedDisputeKits[newDisputeKitID] || newDisputeKitID == NULL_DISPUTE_KIT) {
12721262 // Fall back to `DisputeKitClassic` which is always supported.
12731263 newDisputeKitID = DISPUTE_KIT_CLASSIC;
1274- disputeKitJump = (newDisputeKitID != disputeKitID);
12751264 newRoundNbVotes = (newRoundNbVotes * 2 ) + 1 ; // Reset nbVotes to the default logic.
12761265 }
12771266 }
0 commit comments