Skip to content

Commit 2e2271a

Browse files
committed
fix: frozen tokens notification
1 parent c3f24c8 commit 2e2271a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

contracts/src/kleros-v1/IKlerosLiquid.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ interface IKlerosLiquid is IArbitrator {
1111
execution // Tokens are redistributed and the ruling is executed.
1212
}
1313

14+
enum Phase {
15+
staking, // Stake sum trees can be updated. Pass after `minStakingTime` passes and there is at least one dispute without jurors.
16+
generating, // Waiting for a random number. Pass as soon as it is ready.
17+
drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes.
18+
}
19+
1420
struct Dispute {
1521
// Note that appeal `0` is equivalent to the first round of the dispute.
1622
uint96 subcourtID; // The ID of the subcourt the dispute is in.
@@ -29,8 +35,12 @@ interface IKlerosLiquid is IArbitrator {
2935
uint256 lockedTokens; // The juror's total amount of tokens locked in disputes.
3036
}
3137

38+
function phase() external view returns (Phase);
39+
3240
function lockInsolventTransfers() external view returns (bool);
3341

42+
function minStakingTime() external view returns (uint256);
43+
3444
function pinakion() external view returns (address);
3545

3646
function disputes(uint256 _index) external view returns (Dispute memory);

contracts/src/kleros-v1/KlerosV1Governor.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,16 @@ contract KlerosV1Governor is IArbitrable, ITokenController {
129129
_disputeID
130130
);
131131

132+
uint256 minStakingTime = klerosLiquid.minStakingTime();
133+
IKlerosLiquid.Phase phase = klerosLiquid.phase();
134+
bool isDrawingForbidden = phase == IKlerosLiquid.Phase.staking && minStakingTime == type(uint256).max;
135+
132136
for (uint256 round = 0; round < votesLengths.length; round++) {
133137
if (isDisputeNotified[_disputeID][round]) continue;
134138

135139
for (uint256 voteID = 0; voteID < votesLengths[round]; voteID++) {
136140
(address account, , , ) = klerosLiquid.getVote(_disputeID, round, voteID);
137-
require(account != address(0x0), "Juror not drawn yet.");
141+
require(account != address(0x0) || isDrawingForbidden, "Juror not drawn yet.");
138142
frozenTokens[account] += tokensAtStakePerJuror[round];
139143
}
140144
isDisputeNotified[_disputeID][round] = true;

0 commit comments

Comments
 (0)