Skip to content
Prev Previous commit
Next Next commit
feat: only KlerosCore, no more KlerosCoreBase and KlerosCoreNeo
  • Loading branch information
jaybuidl committed Sep 4, 2025
commit bd210be7bd26adfa33232606ce582b699e61fc9b
1,282 changes: 1,269 additions & 13 deletions contracts/src/arbitration/KlerosCore.sol

Large diffs are not rendered by default.

1,275 changes: 0 additions & 1,275 deletions contracts/src/arbitration/KlerosCoreBase.sol

This file was deleted.

144 changes: 0 additions & 144 deletions contracts/src/arbitration/KlerosCoreNeo.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.24;

import {KlerosCore, KlerosCoreBase, IDisputeKit, ISortitionModule} from "../KlerosCore.sol";
import {KlerosCore, IDisputeKit, ISortitionModule} from "../KlerosCore.sol";
import {Initializable} from "../../proxy/Initializable.sol";
import {UUPSProxiable} from "../../proxy/UUPSProxiable.sol";
import {SafeSend} from "../../libraries/SafeSend.sol";
Expand Down Expand Up @@ -273,7 +273,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
bytes32 _commit
) internal notJumped(_coreDisputeID) {
(, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);
if (period != KlerosCoreBase.Period.commit) revert NotCommitPeriod();
if (period != KlerosCore.Period.commit) revert NotCommitPeriod();
if (_commit == bytes32(0)) revert EmptyCommit();
if (!coreDisputeIDToActive[_coreDisputeID]) revert NotActiveForCoreDisputeID();

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

Expand Down Expand Up @@ -517,7 +517,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
ruling = tied ? 0 : round.winningChoice;
(, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID);
// Override the final ruling if only one side funded the appeals.
if (period == KlerosCoreBase.Period.execution) {
if (period == KlerosCore.Period.execution) {
uint256[] memory fundedChoices = getFundedChoices(_coreDisputeID);
if (fundedChoices.length == 1) {
ruling = fundedChoices[0];
Expand Down
12 changes: 0 additions & 12 deletions contracts/src/proxy/KlerosProxies.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import "./UUPSProxy.sol";
/// Workaround to get meaningful names for the proxy contracts
/// Otherwise all the contracts are called `UUPSProxy` on the chain explorers

contract DisputeKitClassicNeoProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}

contract DisputeKitClassicUniversityProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}
Expand Down Expand Up @@ -51,10 +47,6 @@ contract HomeGatewayToEthereumProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}

contract KlerosCoreNeoProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}

contract KlerosCoreRulerProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}
Expand All @@ -75,10 +67,6 @@ contract RandomizerRNGProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}

contract SortitionModuleNeoProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}

contract SortitionModuleUniversityProxy is UUPSProxy {
constructor(address _implementation, bytes memory _data) UUPSProxy(_implementation, _data) {}
}
Expand Down
56 changes: 28 additions & 28 deletions contracts/test/foundry/KlerosCore_Appeals.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.24;

import {KlerosCore_TestBase} from "./KlerosCore_TestBase.sol";
import {KlerosCoreBase} from "../../src/arbitration/KlerosCoreBase.sol";
import {KlerosCore} from "../../src/arbitration/KlerosCore.sol";
import {DisputeKitClassic, DisputeKitClassicBase} from "../../src/arbitration/dispute-kits/DisputeKitClassic.sol";
import {UUPSProxy} from "../../src/proxy/UUPSProxy.sol";
import "../../src/libraries/Constants.sol";
Expand Down Expand Up @@ -42,34 +42,34 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {

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

vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.AppealPossible(disputeID, arbitrable);
emit KlerosCore.AppealPossible(disputeID, arbitrable);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.appeal);
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.appeal);
core.passPeriod(disputeID);

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

vm.expectRevert(KlerosCoreBase.AppealPeriodNotPassed.selector);
vm.expectRevert(KlerosCore.AppealPeriodNotPassed.selector);
core.passPeriod(disputeID);

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

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

vm.prank(crowdfunder1);
Expand Down Expand Up @@ -177,9 +177,9 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {

vm.prank(crowdfunder2);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
emit KlerosCore.AppealDecision(disputeID, arbitrable);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
disputeKit.fundAppeal{value: 0.42 ether}(disputeID, 2);

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

(, , KlerosCoreBase.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
assertEq(uint256(period), uint256(KlerosCoreBase.Period.evidence), "Wrong period");
(, , KlerosCore.Period period, , uint256 lastPeriodChange) = core.disputes(disputeID);
assertEq(uint256(period), uint256(KlerosCore.Period.evidence), "Wrong period");
assertEq(lastPeriodChange, block.timestamp, "Wrong lastPeriodChange");

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

core.draw(disputeID, 7);
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
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
core.passPeriod(disputeID);
}

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

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

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

vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
emit KlerosCore.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.DisputeKitJump(disputeID, 1, newDkID, DISPUTE_KIT_CLASSIC);
emit KlerosCore.DisputeKitJump(disputeID, 1, newDkID, DISPUTE_KIT_CLASSIC);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassicBase.DisputeCreation(disputeID, 2, newExtraData);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
emit KlerosCore.AppealDecision(disputeID, arbitrable);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
vm.prank(crowdfunder2);
newDisputeKit.fundAppeal{value: 0.42 ether}(disputeID, 2);

Expand Down Expand Up @@ -322,7 +322,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {

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

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

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

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

vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
emit KlerosCore.CourtJump(disputeID, 1, newCourtID, GENERAL_COURT);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.DisputeKitJump(disputeID, 1, dkID3, dkID2);
emit KlerosCore.DisputeKitJump(disputeID, 1, dkID3, dkID2);
vm.expectEmit(true, true, true, true);
emit DisputeKitClassicBase.DisputeCreation(disputeID, 2, newExtraData);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.AppealDecision(disputeID, arbitrable);
emit KlerosCore.AppealDecision(disputeID, arbitrable);
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.evidence);
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.evidence);
vm.prank(crowdfunder2);
disputeKit3.fundAppeal{value: 0.42 ether}(disputeID, 2);

Expand Down Expand Up @@ -460,7 +460,7 @@ contract KlerosCore_AppealsTest is KlerosCore_TestBase {

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

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

// Should pass to execution period without waiting for the 2nd half of the appeal.
vm.expectEmit(true, true, true, true);
emit KlerosCoreBase.NewPeriod(disputeID, KlerosCoreBase.Period.execution);
emit KlerosCore.NewPeriod(disputeID, KlerosCore.Period.execution);
core.passPeriod(disputeID);
}
}
Loading
Loading