Skip to content

Commit 524a2dc

Browse files
committed
fix: do not call getRoundInfo from a mutating function
1 parent 01edde5 commit 524a2dc

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

contracts/src/arbitration/KlerosCoreBase.sol

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,36 @@ abstract contract KlerosCoreBase is IArbitratorV2, Initializable, UUPSProxiable
985985
return disputes[_disputeID].rounds[_round];
986986
}
987987

988+
function getRoundWithoutDrawnJurors(
989+
uint256 _disputeID,
990+
uint256 _round
991+
)
992+
external
993+
view
994+
returns (
995+
uint256 pnkAtStakePerJuror,
996+
uint256 totalFeesForJurors,
997+
uint256 nbVotes,
998+
uint256 repartitions,
999+
uint256 pnkPenalties,
1000+
uint256 sumFeeRewardPaid,
1001+
uint256 sumPnkRewardPaid,
1002+
IERC20 feeToken,
1003+
uint256 drawIterations
1004+
)
1005+
{
1006+
Round storage round = disputes[_disputeID].rounds[_round];
1007+
pnkAtStakePerJuror = round.pnkAtStakePerJuror;
1008+
totalFeesForJurors = round.totalFeesForJurors;
1009+
nbVotes = round.nbVotes;
1010+
repartitions = round.repartitions;
1011+
pnkPenalties = round.pnkPenalties;
1012+
sumFeeRewardPaid = round.sumFeeRewardPaid;
1013+
sumPnkRewardPaid = round.sumPnkRewardPaid;
1014+
feeToken = round.feeToken;
1015+
drawIterations = round.drawIterations;
1016+
}
1017+
9881018
function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) {
9891019
return disputes[_disputeID].rounds.length;
9901020
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,10 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
618618
address _juror
619619
) internal view virtual returns (bool result) {
620620
(uint96 courtID, , , , ) = core.disputes(_coreDisputeID);
621-
uint256 lockedAmountPerJuror = core
622-
.getRoundInfo(_coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1)
623-
.pnkAtStakePerJuror;
621+
(uint256 lockedAmountPerJuror, , , , , , , , ) = core.getRoundWithoutDrawnJurors(
622+
_coreDisputeID,
623+
core.getNumberOfRounds(_coreDisputeID) - 1
624+
);
624625
(uint256 totalStaked, uint256 totalLocked, , ) = core.sortitionModule().getJurorBalance(_juror, courtID);
625626
result = totalStaked >= totalLocked + lockedAmountPerJuror;
626627

0 commit comments

Comments
 (0)