@@ -424,7 +424,8 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
424424 sortitionModule = _sortitionModule;
425425 }
426426
427- /// @notice Add a new supported dispute kit module to the court.
427+ /// @notice Add a new supported dispute kit, without enabling it.
428+ /// Use `enableDisputeKits()` to enable the dispute kit for a specific court.
428429 /// @param _disputeKitAddress The address of the dispute kit contract.
429430 function addNewDisputeKit (IDisputeKit _disputeKitAddress ) external onlyByOwner {
430431 uint256 disputeKitID = disputeKits.length ;
@@ -461,7 +462,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
461462 Court storage court = courts.push ();
462463
463464 for (uint256 i = 0 ; i < _supportedDisputeKits.length ; i++ ) {
464- if (_supportedDisputeKits[i] == 0 || _supportedDisputeKits[i] >= disputeKits.length ) {
465+ if (_supportedDisputeKits[i] == NULL_DISPUTE_KIT || _supportedDisputeKits[i] >= disputeKits.length ) {
465466 revert WrongDisputeKitIndex ();
466467 }
467468 _enableDisputeKit (uint96 (courtID), _supportedDisputeKits[i], true );
@@ -483,7 +484,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
483484 // Update the parent.
484485 courts[_parent].children.push (courtID);
485486 emit CourtCreated (
486- uint96 ( courtID) ,
487+ courtID,
487488 _parent,
488489 _hiddenVotes,
489490 _minStake,
@@ -518,7 +519,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
518519 }
519520 for (uint256 i = 0 ; i < court.children.length ; i++ ) {
520521 if (courts[court.children[i]].minStake < _minStake) {
521- revert MinStakeLowerThanParentCourt ( );
522+ revert MinStakeHigherThanChildCourt (court.children[i] );
522523 }
523524 }
524525 court.minStake = _minStake;
@@ -544,10 +545,10 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
544545 /// @param _enable Whether add or remove the dispute kits from the court.
545546 function enableDisputeKits (uint96 _courtID , uint256 [] memory _disputeKitIDs , bool _enable ) external onlyByOwner {
546547 for (uint256 i = 0 ; i < _disputeKitIDs.length ; i++ ) {
548+ if (_disputeKitIDs[i] == NULL_DISPUTE_KIT || _disputeKitIDs[i] >= disputeKits.length ) {
549+ revert WrongDisputeKitIndex ();
550+ }
547551 if (_enable) {
548- if (_disputeKitIDs[i] == 0 || _disputeKitIDs[i] >= disputeKits.length ) {
549- revert WrongDisputeKitIndex ();
550- }
551552 _enableDisputeKit (_courtID, _disputeKitIDs[i], true );
552553 } else {
553554 // Classic dispute kit must be supported by all courts.
@@ -940,7 +941,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
940941 }
941942
942943 if (pnkBalance == 0 || ! disputeKit.isVoteActive (_params.disputeID, _params.round, _params.repartition)) {
943- // The juror is inactive or their balance is can't cover penalties anymore, unstake them from all courts.
944+ // The juror is inactive or their balance can't cover penalties anymore, unstake them from all courts.
944945 sortitionModule.forcedUnstakeAllCourts (account);
945946 } else if (newCourtStake < courts[penalizedInCourtID].minStake) {
946947 // The juror's balance fell below the court minStake, unstake them from the court.
@@ -1400,6 +1401,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
14001401 error UnsuccessfulCall ();
14011402 error InvalidDisputeKitParent ();
14021403 error MinStakeLowerThanParentCourt ();
1404+ error MinStakeHigherThanChildCourt (uint256 _childCourtID );
14031405 error UnsupportedDisputeKit ();
14041406 error InvalidForkingCourtAsParent ();
14051407 error WrongDisputeKitIndex ();
0 commit comments