Skip to content

Commit 2dd02dc

Browse files
authored
Merge pull request #2196 from kleros/feat/quick-commits
feat(KC): allow to pass commit period quicker
2 parents 32fe70a + 8795f88 commit 2dd02dc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

contracts/src/arbitration/KlerosCore.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,10 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
708708
if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing();
709709
dispute.period = court.hiddenVotes ? Period.commit : Period.vote;
710710
} else if (dispute.period == Period.commit) {
711-
// Note that we do not want to pass to Voting period if all the commits are cast because it breaks the Shutter auto-reveal currently.
712-
if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) {
711+
if (
712+
block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] &&
713+
!disputeKits[round.disputeKitID].areCommitsAllCast(_disputeID)
714+
) {
713715
revert CommitPeriodNotPassed();
714716
}
715717
dispute.period = Period.vote;

contracts/test/foundry/KlerosCore_Voting.t.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase {
9494
voteIDs[0] = 1;
9595
voteIDs[1] = 2;
9696

97+
// Shouldn't allow to switch period yet.
98+
vm.expectRevert(KlerosCore.CommitPeriodNotPassed.selector);
99+
core.passPeriod(disputeID);
100+
97101
vm.prank(staker1);
98102
vm.expectEmit(true, true, true, true);
99103
emit DisputeKitClassicBase.CommitCast(disputeID, staker1, voteIDs, commit);
@@ -109,7 +113,8 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase {
109113
}
110114

111115
// Check reveal in the next period
112-
vm.warp(block.timestamp + timesPerPeriod[1]);
116+
// Should allow to switch period since all commits are cast.
117+
//vm.warp(block.timestamp + timesPerPeriod[1]);
113118
core.passPeriod(disputeID);
114119

115120
// Check the require with the wrong choice and then with the wrong salt

0 commit comments

Comments
 (0)