Skip to content

Commit 98f7eac

Browse files
committed
fix: guard against currentStake exceeding SortitionModuleNeo.maxStakePerJuror
1 parent 5e987c4 commit 98f7eac

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

contracts/src/arbitration/SortitionModuleNeo.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ contract SortitionModuleNeo is SortitionModuleBase {
8585
uint256 stakeChange = stakeIncrease ? _newStake - currentStake : currentStake - _newStake;
8686
Juror storage juror = jurors[_account];
8787
if (stakeIncrease) {
88-
if (juror.stakedPnk + stakeChange > maxStakePerJuror) {
88+
if (juror.stakedPnk + stakeChange > maxStakePerJuror || currentStake + stakeChange > maxStakePerJuror) {
8989
return (0, 0, StakingResult.CannotStakeMoreThanMaxStakePerJuror);
9090
}
9191
if (totalStaked + stakeChange > maxTotalStaked) {

contracts/src/libraries/Constants.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ uint96 constant FORKING_COURT = 0; // Index of the forking court.
99
uint96 constant GENERAL_COURT = 1; // Index of the default (general) court.
1010

1111
// Dispute Kits
12-
uint256 constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent. DEPRECATED, as its main purpose was to accommodate forest structure which is not used now.
12+
uint256 constant NULL_DISPUTE_KIT = 0; // Null pattern to indicate a top-level DK which has no parent.
1313
uint256 constant DISPUTE_KIT_CLASSIC = 1; // Index of the default DK. 0 index is skipped.
1414

1515
// Sortition Module

0 commit comments

Comments
 (0)