Skip to content

Commit 1b6c98a

Browse files
committed
chore: added storage gaps to KC Court, Dispute and Round, and removed unused Court.disabled
1 parent 8032917 commit 1b6c98a

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

contracts/src/arbitration/KlerosCore.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
4343
uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.
4444
uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.
4545
mapping(uint256 disputeKitId => bool) supportedDisputeKits; // True if DK with this ID is supported by the court. Note that each court must support classic dispute kit.
46-
bool disabled; // True if the court is disabled. Unused for now, will be implemented later.
46+
uint256[10] __gap; // Reserved slots for future upgrades.
4747
}
4848

4949
struct Dispute {
@@ -53,6 +53,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
5353
bool ruled; // True if the ruling has been executed, false otherwise.
5454
uint256 lastPeriodChange; // The last time the period was changed.
5555
Round[] rounds; // Rounds of the dispute.
56+
uint256[10] __gap; // Reserved slots for future upgrades.
5657
}
5758

5859
struct Round {
@@ -68,6 +69,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable {
6869
uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.
6970
IERC20 feeToken; // The token used for paying fees in this round.
7071
uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.
72+
uint256[10] __gap; // Reserved slots for future upgrades.
7173
}
7274

7375
// Workaround "stack too deep" errors

contracts/src/arbitration/SortitionModule.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ contract SortitionModule is ISortitionModule, Initializable, UUPSProxiable {
453453
if (currentCourtID == GENERAL_COURT) {
454454
finished = true;
455455
} else {
456-
(currentCourtID, , , , , , ) = core.courts(currentCourtID); // Get the parent court.
456+
(currentCourtID, , , , , ) = core.courts(currentCourtID); // Get the parent court.
457457
}
458458
}
459459
emit StakeSet(_account, _courtID, _newStake, juror.stakedPnk);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
320320
Round storage round = dispute.rounds[localRoundID];
321321
{
322322
(uint96 courtID, , , , ) = core.disputes(_coreDisputeID);
323-
(, bool hiddenVotes, , , , , ) = core.courts(courtID);
323+
(, bool hiddenVotes, , , , ) = core.courts(courtID);
324324
bytes32 actualVoteHash = hashVote(_choice, _salt, _justification);
325325

326326
// Save the votes.
@@ -585,7 +585,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
585585
Round storage round = dispute.rounds[dispute.rounds.length - 1];
586586

587587
(uint96 courtID, , , , ) = core.disputes(_coreDisputeID);
588-
(, bool hiddenVotes, , , , , ) = core.courts(courtID);
588+
(, bool hiddenVotes, , , , ) = core.courts(courtID);
589589
uint256 expectedTotalVoted = hiddenVotes ? round.totalCommitted : round.votes.length;
590590

591591
return round.totalVoted == expectedTotalVoted;

contracts/src/arbitration/university/KlerosCoreUniversity.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable {
3939
uint256 jurorsForCourtJump; // The appeal after the one that reaches this number of jurors will go to the parent court if any.
4040
uint256[4] timesPerPeriod; // The time allotted to each dispute period in the form `timesPerPeriod[period]`.
4141
mapping(uint256 disputeKitId => bool) supportedDisputeKits; // True if DK with this ID is supported by the court. Note that each court must support classic dispute kit.
42-
bool disabled; // True if the court is disabled. Unused for now, will be implemented later.
42+
uint256[10] __gap; // Reserved slots for future upgrades.
4343
}
4444

4545
struct Dispute {
@@ -49,6 +49,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable {
4949
bool ruled; // True if the ruling has been executed, false otherwise.
5050
uint256 lastPeriodChange; // The last time the period was changed.
5151
Round[] rounds;
52+
uint256[10] __gap; // Reserved slots for future upgrades.
5253
}
5354

5455
struct Round {
@@ -64,6 +65,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable {
6465
uint256 sumPnkRewardPaid; // Total sum of PNK paid to coherent jurors as a reward in this round.
6566
IERC20 feeToken; // The token used for paying fees in this round.
6667
uint256 drawIterations; // The number of iterations passed drawing the jurors for this round.
68+
uint256[10] __gap; // Reserved slots for future upgrades.
6769
}
6870

6971
// Workaround "stack too deep" errors

contracts/src/arbitration/university/SortitionModuleUniversity.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ contract SortitionModuleUniversity is ISortitionModuleUniversity, UUPSProxiable,
280280
if (currentCourtID == GENERAL_COURT) {
281281
finished = true;
282282
} else {
283-
(currentCourtID, , , , , , ) = core.courts(currentCourtID);
283+
(currentCourtID, , , , , ) = core.courts(currentCourtID);
284284
}
285285
}
286286
emit StakeSet(_account, _courtID, _newStake, juror.stakedPnk);

contracts/test/foundry/KlerosCore_Governance.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ contract KlerosCore_GovernanceTest is KlerosCore_TestBase {
266266
supportedDK
267267
);
268268

269-
_assertCourtParameters(2, GENERAL_COURT, true, 2000, 20000, 0.04 ether, 50, false);
269+
_assertCourtParameters(2, GENERAL_COURT, true, 2000, 20000, 0.04 ether, 50);
270270

271271
uint256[] memory children = core.getCourtChildren(2);
272272
assertEq(children.length, 0, "No children");
@@ -356,7 +356,7 @@ contract KlerosCore_GovernanceTest is KlerosCore_TestBase {
356356
[uint256(10), uint256(20), uint256(30), uint256(40)] // Times per period
357357
);
358358

359-
_assertCourtParameters(GENERAL_COURT, FORKING_COURT, true, 2000, 20000, 0.04 ether, 50, false);
359+
_assertCourtParameters(GENERAL_COURT, FORKING_COURT, true, 2000, 20000, 0.04 ether, 50);
360360
_assertTimesPerPeriod(GENERAL_COURT, [uint256(10), uint256(20), uint256(30), uint256(40)]);
361361
}
362362

contracts/test/foundry/KlerosCore_Initialization.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ contract KlerosCore_InitializationTest is KlerosCore_TestBase {
2323
assertEq(address(core.sortitionModule()), address(sortitionModule), "Wrong sortitionModule address");
2424
assertEq(core.getDisputeKitsLength(), 2, "Wrong DK array length");
2525

26-
_assertCourtParameters(FORKING_COURT, FORKING_COURT, false, 0, 0, 0, 0, false);
27-
_assertCourtParameters(GENERAL_COURT, FORKING_COURT, false, 1000, 10000, 0.03 ether, 511, false);
26+
_assertCourtParameters(FORKING_COURT, FORKING_COURT, false, 0, 0, 0, 0);
27+
_assertCourtParameters(GENERAL_COURT, FORKING_COURT, false, 1000, 10000, 0.03 ether, 511);
2828

2929
uint256[] memory children = core.getCourtChildren(GENERAL_COURT);
3030
assertEq(children.length, 0, "No children");

contracts/test/foundry/KlerosCore_TestBase.sol

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,15 @@ abstract contract KlerosCore_TestBase is Test {
223223
uint256 expectedMinStake,
224224
uint256 expectedAlpha,
225225
uint256 expectedFeeForJuror,
226-
uint256 expectedJurorsForJump,
227-
bool expectedDisabled
226+
uint256 expectedJurorsForJump
228227
) internal {
229228
(
230229
uint96 courtParent,
231230
bool courtHiddenVotes,
232231
uint256 courtMinStake,
233232
uint256 courtAlpha,
234233
uint256 courtFeeForJuror,
235-
uint256 courtJurorsForCourtJump,
236-
bool courtDisabled
234+
uint256 courtJurorsForCourtJump
237235
) = core.courts(courtId);
238236

239237
assertEq(courtParent, expectedParent, "Wrong court parent");
@@ -242,7 +240,6 @@ abstract contract KlerosCore_TestBase is Test {
242240
assertEq(courtAlpha, expectedAlpha, "Wrong alpha value");
243241
assertEq(courtFeeForJuror, expectedFeeForJuror, "Wrong feeForJuror value");
244242
assertEq(courtJurorsForCourtJump, expectedJurorsForJump, "Wrong jurorsForCourtJump value");
245-
assertEq(courtDisabled, expectedDisabled, "Wrong disabled state");
246243
}
247244

248245
/// @dev Helper function to check times per period

0 commit comments

Comments
 (0)