From 8795f8822178cc9c57d0b57e04e7bc2a768a3c24 Mon Sep 17 00:00:00 2001 From: unknownunknown1 Date: Tue, 28 Oct 2025 01:30:14 +1000 Subject: [PATCH] feat(KC): allow to pass commit period quicker --- contracts/src/arbitration/KlerosCore.sol | 6 ++++-- contracts/test/foundry/KlerosCore_Voting.t.sol | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 447579812..a3ecac170 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -708,8 +708,10 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable { if (round.drawnJurors.length != round.nbVotes) revert DisputeStillDrawing(); dispute.period = court.hiddenVotes ? Period.commit : Period.vote; } else if (dispute.period == Period.commit) { - // 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. - if (block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)]) { + if ( + block.timestamp - dispute.lastPeriodChange < court.timesPerPeriod[uint256(dispute.period)] && + !disputeKits[round.disputeKitID].areCommitsAllCast(_disputeID) + ) { revert CommitPeriodNotPassed(); } dispute.period = Period.vote; diff --git a/contracts/test/foundry/KlerosCore_Voting.t.sol b/contracts/test/foundry/KlerosCore_Voting.t.sol index 398ff4b95..61fd92c1a 100644 --- a/contracts/test/foundry/KlerosCore_Voting.t.sol +++ b/contracts/test/foundry/KlerosCore_Voting.t.sol @@ -94,6 +94,10 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase { voteIDs[0] = 1; voteIDs[1] = 2; + // Shouldn't allow to switch period yet. + vm.expectRevert(KlerosCore.CommitPeriodNotPassed.selector); + core.passPeriod(disputeID); + vm.prank(staker1); vm.expectEmit(true, true, true, true); emit DisputeKitClassicBase.CommitCast(disputeID, staker1, voteIDs, commit); @@ -109,7 +113,8 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase { } // Check reveal in the next period - vm.warp(block.timestamp + timesPerPeriod[1]); + // Should allow to switch period since all commits are cast. + //vm.warp(block.timestamp + timesPerPeriod[1]); core.passPeriod(disputeID); // Check the require with the wrong choice and then with the wrong salt