Skip to content

Commit 6b74ebc

Browse files
fix(DK): multiple commit fix
1 parent e827f63 commit 6b74ebc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
275275
Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];
276276
Round storage round = dispute.rounds[dispute.rounds.length - 1];
277277
for (uint256 i = 0; i < _voteIDs.length; i++) {
278+
if (round.votes[_voteIDs[i]].commit != bytes32(0)) revert AlreadyCommittedThisVote();
278279
if (round.votes[_voteIDs[i]].account != msg.sender) revert JurorHasToOwnTheVote();
279280
round.votes[_voteIDs[i]].commit = _commit;
280281
}
@@ -759,4 +760,5 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
759760
error AppealFeeIsAlreadyPaid();
760761
error DisputeNotResolved();
761762
error CoreIsPaused();
763+
error AlreadyCommittedThisVote();
762764
}

contracts/test/foundry/KlerosCore_Voting.t.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase {
9797
assertEq(commitStored, keccak256(abi.encodePacked(YES, salt)), "Incorrect commit");
9898
}
9999

100+
vm.prank(staker1);
101+
vm.expectRevert(DisputeKitClassicBase.AlreadyCommittedThisVote.selector);
102+
disputeKit.castCommit(disputeID, voteIDs, commit);
103+
100104
// Check reveal in the next period
101105
vm.warp(block.timestamp + timesPerPeriod[1]);
102106
core.passPeriod(disputeID);

0 commit comments

Comments
 (0)