Skip to content

Commit bd210be

Browse files
committed
feat: only KlerosCore, no more KlerosCoreBase and KlerosCoreNeo
1 parent 262f940 commit bd210be

14 files changed

+1422
-1595
lines changed

contracts/src/arbitration/KlerosCore.sol

Lines changed: 1269 additions & 13 deletions
Large diffs are not rendered by default.

contracts/src/arbitration/KlerosCoreBase.sol

Lines changed: 0 additions & 1275 deletions
This file was deleted.

contracts/src/arbitration/KlerosCoreNeo.sol

Lines changed: 0 additions & 144 deletions
This file was deleted.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
pragma solidity ^0.8.24;
44

5-
import {KlerosCore, KlerosCoreBase, IDisputeKit, ISortitionModule} from "../KlerosCore.sol";
5+
import {KlerosCore, IDisputeKit, ISortitionModule} from "../KlerosCore.sol";
66
import {Initializable} from "../../proxy/Initializable.sol";
77
import {UUPSProxiable} from "../../proxy/UUPSProxiable.sol";
88
import {SafeSend} from "../../libraries/SafeSend.sol";
@@ -273,7 +273,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
273273
bytes32 _commit
274274
) internal notJumped(_coreDisputeID) {
275275
(, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);
276-
if (period != KlerosCoreBase.Period.commit) revert NotCommitPeriod();
276+
if (period != KlerosCore.Period.commit) revert NotCommitPeriod();
277277
if (_commit == bytes32(0)) revert EmptyCommit();
278278
if (!coreDisputeIDToActive[_coreDisputeID]) revert NotActiveForCoreDisputeID();
279279

@@ -314,7 +314,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
314314
address _juror
315315
) internal notJumped(_coreDisputeID) {
316316
(, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);
317-
if (period != KlerosCoreBase.Period.vote) revert NotVotePeriod();
317+
if (period != KlerosCore.Period.vote) revert NotVotePeriod();
318318
if (_voteIDs.length == 0) revert EmptyVoteIDs();
319319
if (!coreDisputeIDToActive[_coreDisputeID]) revert NotActiveForCoreDisputeID();
320320

@@ -517,7 +517,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
517517
ruling = tied ? 0 : round.winningChoice;
518518
(, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);
519519
// Override the final ruling if only one side funded the appeals.
520-
if (period == KlerosCoreBase.Period.execution) {
520+
if (period == KlerosCore.Period.execution) {
521521
uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);
522522
if (fundedChoices.length == 1) {
523523
ruling = fundedChoices[0];

contracts/src/proxy/KlerosProxies.sol

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import "./UUPSProxy.sol";
77
/// Workaround to get meaningful names for the proxy contracts
88
/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers
99

10-
contract DisputeKitClassicNeoProxy is UUPSProxy {
11-
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
12-
}
13-
1410
contract DisputeKitClassicUniversityProxy is UUPSProxy {
1511
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
1612
}
@@ -51,10 +47,6 @@ contract HomeGatewayToEthereumProxy is UUPSProxy {
5147
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
5248
}
5349

54-
contract KlerosCoreNeoProxy is UUPSProxy {
55-
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
56-
}
57-
5850
contract KlerosCoreRulerProxy is UUPSProxy {
5951
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
6052
}
@@ -75,10 +67,6 @@ contract RandomizerRNGProxy is UUPSProxy {
7567
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
7668
}
7769

78-
contract SortitionModuleNeoProxy is UUPSProxy {
79-
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
80-
}
81-
8270
contract SortitionModuleUniversityProxy is UUPSProxy {
8371
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
8472
}

contracts/test/foundry/KlerosCore_Appeals.t.sol

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.24;
33

44
import {KlerosCore_TestBase} from "./KlerosCore_TestBase.sol";
5-
import {KlerosCoreBase} from "../../src/arbitration/KlerosCoreBase.sol";
5+
import {KlerosCore} from "../../src/arbitration/KlerosCore.sol";
66
import {DisputeKitClassic, DisputeKitClassicBase} from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol";
77
import {UUPSProxy} from "../../src/proxy/UUPSProxy.sol";
88
import "../../src/libraries/Constants.sol";
@@ -42,34 +42,34 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
4242

4343
// Simulate the call from dispute kit to check the requires unrelated to caller
4444
vm.prank(address(disputeKit));
45-
vm.expectRevert(KlerosCoreBase.DisputeNotAppealable.selector);
45+
vm.expectRevert(KlerosCore.DisputeNotAppealable.selector);
4646
core.appeal{value: 0.21 ether}(disputeID, 2, arbitratorExtraData);
4747

4848
vm.expectEmit(true, true, true, true);
49-
emit KlerosCoreBase.AppealPossible(disputeID, arbitrable);
49+
emit KlerosCore.AppealPossible(disputeID, arbitrable);
5050
vm.expectEmit(true, true, true, true);
51-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.appeal);
51+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.appeal);
5252
core.passPeriod(disputeID);
5353

54-
(, , KlerosCoreBase.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
54+
(, , KlerosCore.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
5555
(start, end) = core.appealPeriod(0);
56-
assertEq(uint256(period), uint256(KlerosCoreBase.Period.appeal), "Wrong period");
56+
assertEq(uint256(period), uint256(KlerosCore.Period.appeal), "Wrong period");
5757
assertEq(lastPeriodChange, block.timestamp, "Wrong lastPeriodChange");
5858
assertEq(core.appealCost(0), 0.21 ether, "Wrong appealCost");
5959
assertEq(start, lastPeriodChange, "Appeal period start is incorrect");
6060
assertEq(end, lastPeriodChange + timesPerPeriod[3], "Appeal period end is incorrect");
6161

62-
vm.expectRevert(KlerosCoreBase.AppealPeriodNotPassed.selector);
62+
vm.expectRevert(KlerosCore.AppealPeriodNotPassed.selector);
6363
core.passPeriod(disputeID);
6464

6565
// Simulate the call from dispute kit to check the requires unrelated to caller
6666
vm.prank(address(disputeKit));
67-
vm.expectRevert(KlerosCoreBase.AppealFeesNotEnough.selector);
67+
vm.expectRevert(KlerosCore.AppealFeesNotEnough.selector);
6868
core.appeal{value: 0.21 ether - 1}(disputeID, 2, arbitratorExtraData);
6969
vm.deal(address(disputeKit), 0); // Nullify the balance so it doesn't get in the way.
7070

7171
vm.prank(staker1);
72-
vm.expectRevert(KlerosCoreBase.DisputeKitOnly.selector);
72+
vm.expectRevert(KlerosCore.DisputeKitOnly.selector);
7373
core.appeal{value: 0.21 ether}(disputeID, 2, arbitratorExtraData);
7474

7575
vm.prank(crowdfunder1);
@@ -177,9 +177,9 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
177177

178178
vm.prank(crowdfunder2);
179179
vm.expectEmit(true, true, true, true);
180-
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
180+
emit KlerosCore.AppealDecision(disputeID, arbitrable);
181181
vm.expectEmit(true, true, true, true);
182-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
182+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
183183
disputeKit.fundAppeal{value: 0.42 ether}(disputeID, 2);
184184

185185
assertEq((disputeKit.getFundedChoices(disputeID)).length, 0, "No funded choices in the fresh round");
@@ -194,17 +194,17 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
194194
assertEq(sortitionModule.disputesWithoutJurors(), 1, "Wrong disputesWithoutJurors count after appeal");
195195
assertEq(core.getNumberOfRounds(disputeID), 2, "Wrong number of rounds");
196196

197-
(, , KlerosCoreBase.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
198-
assertEq(uint256(period), uint256(KlerosCoreBase.Period.evidence), "Wrong period");
197+
(, , KlerosCore.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
198+
assertEq(uint256(period), uint256(KlerosCore.Period.evidence), "Wrong period");
199199
assertEq(lastPeriodChange, block.timestamp, "Wrong lastPeriodChange");
200200

201-
KlerosCoreBase.Round memory round = core.getRoundInfo(disputeID, 1); // Check the new round
201+
KlerosCore.Round memory round = core.getRoundInfo(disputeID, 1); // Check the new round
202202
assertEq(round.pnkAtStakePerJuror, 1000, "Wrong pnkAtStakePerJuror");
203203
assertEq(round.totalFeesForJurors, 0.21 ether, "Wrong totalFeesForJurors");
204204
assertEq(round.nbVotes, 7, "Wrong nbVotes");
205205

206206
core.draw(disputeID, 7);
207-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.vote); // Check that we don't have to wait for the timeout to pass the evidence period after appeal
207+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.vote); // Check that we don't have to wait for the timeout to pass the evidence period after appeal
208208
core.passPeriod(disputeID);
209209
}
210210

@@ -263,7 +263,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
263263
vm.warp(block.timestamp + rngLookahead);
264264
sortitionModule.passPhase(); // Drawing phase
265265

266-
KlerosCoreBase.Round memory round = core.getRoundInfo(disputeID, 0);
266+
KlerosCore.Round memory round = core.getRoundInfo(disputeID, 0);
267267
assertEq(round.disputeKitID, newDkID, "Wrong DK ID");
268268

269269
core.draw(disputeID, DEFAULT_NB_OF_JURORS);
@@ -286,15 +286,15 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
286286
assertEq(core.isDisputeKitJumping(disputeID), true, "Should be jumping");
287287

288288
vm.expectEmit(true, true, true, true);
289-
emit KlerosCoreBase.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
289+
emit KlerosCore.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
290290
vm.expectEmit(true, true, true, true);
291-
emit KlerosCoreBase.DisputeKitJump(disputeID, 1, newDkID, DISPUTE_KIT_CLASSIC);
291+
emit KlerosCore.DisputeKitJump(disputeID, 1, newDkID, DISPUTE_KIT_CLASSIC);
292292
vm.expectEmit(true, true, true, true);
293293
emit DisputeKitClassicBase.DisputeCreation(disputeID, 2, newExtraData);
294294
vm.expectEmit(true, true, true, true);
295-
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
295+
emit KlerosCore.AppealDecision(disputeID, arbitrable);
296296
vm.expectEmit(true, true, true, true);
297-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
297+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
298298
vm.prank(crowdfunder2);
299299
newDisputeKit.fundAppeal{value: 0.42 ether}(disputeID, 2);
300300

@@ -322,7 +322,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
322322

323323
// And check that draw in the new round works
324324
vm.expectEmit(true, true, true, true);
325-
emit KlerosCoreBase.Draw(staker1, disputeID, 1, 0); // roundID = 1 VoteID = 0
325+
emit KlerosCore.Draw(staker1, disputeID, 1, 0); // roundID = 1 VoteID = 0
326326
core.draw(disputeID, 1);
327327

328328
(address account, , , ) = disputeKit.getVoteInfo(disputeID, 1, 0);
@@ -401,7 +401,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
401401
vm.warp(block.timestamp + rngLookahead);
402402
sortitionModule.passPhase(); // Drawing phase
403403

404-
KlerosCoreBase.Round memory round = core.getRoundInfo(disputeID, 0);
404+
KlerosCore.Round memory round = core.getRoundInfo(disputeID, 0);
405405
assertEq(round.disputeKitID, dkID3, "Wrong DK ID");
406406

407407
core.draw(disputeID, DEFAULT_NB_OF_JURORS);
@@ -424,15 +424,15 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
424424
assertEq(core.isDisputeKitJumping(disputeID), true, "Should be jumping");
425425

426426
vm.expectEmit(true, true, true, true);
427-
emit KlerosCoreBase.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
427+
emit KlerosCore.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
428428
vm.expectEmit(true, true, true, true);
429-
emit KlerosCoreBase.DisputeKitJump(disputeID, 1, dkID3, dkID2);
429+
emit KlerosCore.DisputeKitJump(disputeID, 1, dkID3, dkID2);
430430
vm.expectEmit(true, true, true, true);
431431
emit DisputeKitClassicBase.DisputeCreation(disputeID, 2, newExtraData);
432432
vm.expectEmit(true, true, true, true);
433-
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
433+
emit KlerosCore.AppealDecision(disputeID, arbitrable);
434434
vm.expectEmit(true, true, true, true);
435-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
435+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
436436
vm.prank(crowdfunder2);
437437
disputeKit3.fundAppeal{value: 0.42 ether}(disputeID, 2);
438438

@@ -460,7 +460,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
460460

461461
// And check that draw in the new round works
462462
vm.expectEmit(true, true, true, true);
463-
emit KlerosCoreBase.Draw(staker1, disputeID, 1, 0); // roundID = 1 VoteID = 0
463+
emit KlerosCore.Draw(staker1, disputeID, 1, 0); // roundID = 1 VoteID = 0
464464
core.draw(disputeID, 1);
465465

466466
(address account, , , ) = disputeKit2.getVoteInfo(disputeID, 1, 0);
@@ -497,7 +497,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {
497497

498498
// Should pass to execution period without waiting for the 2nd half of the appeal.
499499
vm.expectEmit(true, true, true, true);
500-
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.execution);
500+
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.execution);
501501
core.passPeriod(disputeID);
502502
}
503503
}

0 commit comments

Comments
 (0)