Skip to content

Commit c63f049

Browse files
committed
refactor: explicit revert on invalid dispute ID
1 parent e5b670a commit c63f049

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contracts/kleros/xKlerosLiquid.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
426426
* @param _disputeID The ID of the dispute.
427427
*/
428428
function passPeriod(uint _disputeID) external {
429+
require(_disputeID < totalDisputes, "Dispute ID does not exist.");
429430
Dispute storage dispute = disputes[_disputeID];
430431
if (dispute.period == Period.evidence) {
431432
require(
@@ -494,6 +495,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
494495
uint _disputeID,
495496
uint _iterations
496497
) external onlyDuringPhase(Phase.drawing) onlyDuringPeriod(_disputeID, Period.evidence) {
498+
require(_disputeID < totalDisputes, "Dispute ID does not exist.");
497499
Dispute storage dispute = disputes[_disputeID];
498500
uint endIndex = dispute.drawsInRound + _iterations;
499501
require(endIndex >= dispute.drawsInRound);
@@ -897,7 +899,7 @@ contract xKlerosLiquid is Initializable, TokenController, Arbitrator {
897899
* In such case allow unstaking. Always allow unstaking.
898900
*/
899901
if ((totalStake - juror.stakedTokens + newTotalStake > maxTotalStakeAllowed) && (newTotalStake > juror.stakedTokens))
900-
return false; // Maximum xPNK stake reached. And
902+
return false; // Maximum PNK stake reached.
901903
// Update total stake.
902904
totalStake = totalStake - juror.stakedTokens + newTotalStake;
903905

0 commit comments

Comments
 (0)