From f1dd5590ad122aa3a7dcf836eb942b61fe7c5562 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Thu, 11 Sep 2025 02:20:27 +0100 Subject: [PATCH 1/2] refactor: renamed event TokenAndEthShift into JurorRewardPenalty --- contracts/src/arbitration/KlerosCore.sol | 6 +++--- contracts/src/arbitration/devtools/KlerosCoreRuler.sol | 4 ++-- .../src/arbitration/university/KlerosCoreUniversity.sol | 6 +++--- contracts/test/arbitration/ruler.ts | 6 +++--- contracts/test/foundry/KlerosCore_Execution.t.sol | 8 ++++---- contracts/test/integration/index.ts | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 589da7c48..08653e057 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -221,7 +221,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable { /// @param _amountPnk Amount of PNK shifted. /// @param _amountFee Amount of fee shifted. /// @param _feeToken Address of the fee token. - event TokenAndETHShift( + event JurorRewardPenalty( address indexed _account, uint256 indexed _disputeID, uint256 indexed _roundID, @@ -927,7 +927,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable { ); if (availablePenalty != 0) { _params.pnkPenaltiesInRound += availablePenalty; - emit TokenAndETHShift( + emit JurorRewardPenalty( account, _params.disputeID, _params.round, @@ -1009,7 +1009,7 @@ contract KlerosCore is IArbitratorV2, Initializable, UUPSProxiable { } } if (pnkReward != 0 || feeReward != 0) { - emit TokenAndETHShift( + emit JurorRewardPenalty( account, _params.disputeID, _params.round, diff --git a/contracts/src/arbitration/devtools/KlerosCoreRuler.sol b/contracts/src/arbitration/devtools/KlerosCoreRuler.sol index 4ea1be3ee..a12a87972 100644 --- a/contracts/src/arbitration/devtools/KlerosCoreRuler.sol +++ b/contracts/src/arbitration/devtools/KlerosCoreRuler.sol @@ -126,7 +126,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable { uint96 indexed _fromCourtID, uint96 _toCourtID ); - event TokenAndETHShift( + event JurorRewardPenalty( address indexed _account, uint256 indexed _disputeID, uint256 indexed _roundID, @@ -519,7 +519,7 @@ contract KlerosCoreRuler is IArbitratorV2, UUPSProxiable, Initializable { // The dispute fees were paid in ERC20 round.feeToken.safeTransfer(account, feeReward); } - emit TokenAndETHShift( + emit JurorRewardPenalty( account, _disputeID, _round, diff --git a/contracts/src/arbitration/university/KlerosCoreUniversity.sol b/contracts/src/arbitration/university/KlerosCoreUniversity.sol index 2a29a54be..bf27dfbb2 100644 --- a/contracts/src/arbitration/university/KlerosCoreUniversity.sol +++ b/contracts/src/arbitration/university/KlerosCoreUniversity.sol @@ -144,7 +144,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable { uint256 indexed _fromDisputeKitID, uint256 _toDisputeKitID ); - event TokenAndETHShift( + event JurorRewardPenalty( address indexed _account, uint256 indexed _disputeID, uint256 indexed _roundID, @@ -782,7 +782,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable { penalty ); _params.pnkPenaltiesInRound += availablePenalty; - emit TokenAndETHShift( + emit JurorRewardPenalty( account, _params.disputeID, _params.round, @@ -872,7 +872,7 @@ contract KlerosCoreUniversity is IArbitratorV2, UUPSProxiable, Initializable { pinakion.safeTransfer(account, pnkReward); } - emit TokenAndETHShift( + emit JurorRewardPenalty( account, _params.disputeID, _params.round, diff --git a/contracts/test/arbitration/ruler.ts b/contracts/test/arbitration/ruler.ts index fef56ac8f..9defca63e 100644 --- a/contracts/test/arbitration/ruler.ts +++ b/contracts/test/arbitration/ruler.ts @@ -94,7 +94,7 @@ describe("KlerosCoreRuler", async () => { .withArgs(resolver.target, RulingMode.automaticRandom, disputeID, anyValue, anyValue, anyValue) .and.to.emit(core, "Ruling") .withArgs(resolver.target, disputeID, anyValue) - .and.to.emit(core, "TokenAndETHShift") + .and.to.emit(core, "JurorRewardPenalty") .withArgs(dev.address, disputeID, 0, 10000, 10000, 0, anyValue, ZeroAddress) .and.to.emit(resolver, "DisputeRequest") .withArgs(core.target, disputeID, localDisputeID, templateId) @@ -118,7 +118,7 @@ describe("KlerosCoreRuler", async () => { .withArgs(resolver.target, RulingMode.automaticPreset, disputeID, 2, true, false) .and.to.emit(core, "Ruling") .withArgs(resolver.target, disputeID, 2) - .and.to.emit(core, "TokenAndETHShift") + .and.to.emit(core, "JurorRewardPenalty") .withArgs(dev.address, disputeID, 0, 10000, 10000, 0, anyValue, ZeroAddress) .and.to.emit(resolver, "DisputeRequest") .withArgs(core.target, disputeID, localDisputeID, templateId) @@ -153,7 +153,7 @@ describe("KlerosCoreRuler", async () => { .withArgs(core.target, disputeID, 3); await expect(core.execute(disputeID, 0)) - .and.to.emit(core, "TokenAndETHShift") + .and.to.emit(core, "JurorRewardPenalty") .withArgs(dev.address, disputeID, 0, 10000, 10000, 0, anyValue, ZeroAddress); }); }); diff --git a/contracts/test/foundry/KlerosCore_Execution.t.sol b/contracts/test/foundry/KlerosCore_Execution.t.sol index e0677b81a..c6f03ac49 100644 --- a/contracts/test/foundry/KlerosCore_Execution.t.sol +++ b/contracts/test/foundry/KlerosCore_Execution.t.sol @@ -99,7 +99,7 @@ contract KlerosCore_ExecutionTest is KlerosCore_TestBase { vm.expectEmit(true, true, true, true); emit SortitionModule.StakeLocked(staker1, 1000, true); vm.expectEmit(true, true, true, true); - emit KlerosCore.TokenAndETHShift(staker1, disputeID, 0, 0, 0, -int256(1000), 0, IERC20(address(0))); // penalties + emit KlerosCore.JurorRewardPenalty(staker1, disputeID, 0, 0, 0, -int256(1000), 0, IERC20(address(0))); // penalties // Check iterations for the winning staker to see the shifts vm.expectEmit(true, true, true, true); emit SortitionModule.StakeLocked(staker2, 0, true); @@ -121,11 +121,11 @@ contract KlerosCore_ExecutionTest is KlerosCore_TestBase { vm.expectEmit(true, true, true, true); emit SortitionModule.StakeLocked(staker2, 1000, true); vm.expectEmit(true, true, true, true); - emit KlerosCore.TokenAndETHShift(staker2, disputeID, 0, 10000, 10000, 500, 0.045 ether, IERC20(address(0))); // rewards + emit KlerosCore.JurorRewardPenalty(staker2, disputeID, 0, 10000, 10000, 500, 0.045 ether, IERC20(address(0))); // rewards vm.expectEmit(true, true, true, true); emit SortitionModule.StakeLocked(staker2, 1000, true); vm.expectEmit(true, true, true, true); - emit KlerosCore.TokenAndETHShift(staker2, disputeID, 0, 10000, 10000, 500, 0.045 ether, IERC20(address(0))); // rewards + emit KlerosCore.JurorRewardPenalty(staker2, disputeID, 0, 10000, 10000, 500, 0.045 ether, IERC20(address(0))); // rewards core.execute(disputeID, 0, 10); // Finish the iterations. We need only 3 but check that it corrects the count. (, totalLocked, , ) = sortitionModule.getJurorBalance(staker2, GENERAL_COURT); @@ -530,7 +530,7 @@ contract KlerosCore_ExecutionTest is KlerosCore_TestBase { // Check only once per penalty and per reward vm.expectEmit(true, true, true, true); - emit KlerosCore.TokenAndETHShift(staker1, disputeID, 0, 10000, 10000, 0, 0.06 ether, feeToken); // rewards + emit KlerosCore.JurorRewardPenalty(staker1, disputeID, 0, 10000, 10000, 0, 0.06 ether, feeToken); // rewards core.execute(disputeID, 0, 6); KlerosCore.Round memory round = core.getRoundInfo(disputeID, 0); diff --git a/contracts/test/integration/index.ts b/contracts/test/integration/index.ts index 3884c9712..cc7dd2b13 100644 --- a/contracts/test/integration/index.ts +++ b/contracts/test/integration/index.ts @@ -187,7 +187,7 @@ describe("Integration tests", async () => { await core.passPeriod(0); expect((await core.disputes(0)).period).to.equal(Period.execution); await expect(core.execute(0, 0, 1000)) - .to.emit(core, "TokenAndETHShift") + .to.emit(core, "JurorRewardPenalty") .withArgs(deployer, 0, 0, 10000, 10000, 0, arbitrationCost / 3n, ethers.ZeroAddress); await expect(core.executeRuling(0, { gasLimit: 10000000, gasPrice: 5000000000 })) From fd465a43af32314c75b6712d55e45dbd01bcf770 Mon Sep 17 00:00:00 2001 From: jaybuidl Date: Thu, 11 Sep 2025 02:22:20 +0100 Subject: [PATCH 2/2] chore: changelog --- contracts/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/CHANGELOG.md b/contracts/CHANGELOG.md index 5b15e04f7..11a24ebc9 100644 --- a/contracts/CHANGELOG.md +++ b/contracts/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Common Changelog](https://common-changelog.org/). ### Changed +- **Breaking:** Rename `KlerosCore.TokenAndETHShift` into `KlerosCore.JurorRewardPenalty` ([#2136](https://github.com/kleros/kleros-v2/issues/2136)) - **Breaking:** Add event parameter `KlerosCore.TokenAndETHShift._degreeOfCoherencyFee` and renamed the other parameters to `_degreeOfCoherencyPnk`, `_amountPnk`, `_amountFee` ([#2097](https://github.com/kleros/kleros-v2/issues/2097)) - **Breaking:** Move state variable `DisputeKitClassicBase.nbVotes` to the `Round` struct ([#2097](https://github.com/kleros/kleros-v2/issues/2097)) - **Breaking:** Stake the juror's PNK rewards instead of transferring them out ([#2099](https://github.com/kleros/kleros-v2/issues/2099))