Skip to content

Commit 8ab5d63

Browse files
committed
refactor: errors rename
1 parent 57319d4 commit 8ab5d63

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
729729
bytes32 actualVoteHash = hashVote(_choice, _salt, _justification);
730730
for (uint256 i = 0; i < _voteIDs.length; i++) {
731731
if (disputes[_localDisputeID].rounds[_localRoundID].votes[_voteIDs[i]].commit != actualVoteHash)
732-
revert HashDoesNotMatchHiddenVoteCommitment();
732+
revert ChoiceCommitmentMismatch();
733733
}
734734
}
735735

@@ -773,7 +773,7 @@ abstract contract DisputeKitClassicBase is IDisputeKit, Initializable, UUPSProxi
773773
error NotVotePeriod();
774774
error EmptyVoteIDs();
775775
error ChoiceOutOfBounds();
776-
error HashDoesNotMatchHiddenVoteCommitment();
776+
error ChoiceCommitmentMismatch();
777777
error VoteAlreadyCast();
778778
error NotAppealPeriod();
779779
error NotAppealPeriodForLoser();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ contract DisputeKitGatedShutter is DisputeKitClassicBase {
226226
bytes32 actualJustificationHash = hashJustification(_salt, _justification);
227227
for (uint256 i = 0; i < _voteIDs.length; i++) {
228228
if (justificationCommitments[_localDisputeID][_localRoundID][_voteIDs[i]] != actualJustificationHash)
229-
revert WrongJustification();
229+
revert JustificationCommitmentMismatch();
230230
}
231231
}
232232

@@ -287,5 +287,5 @@ contract DisputeKitGatedShutter is DisputeKitClassicBase {
287287

288288
error TokenNotSupported(address tokenGate);
289289
error EmptyJustificationCommit();
290-
error WrongJustification();
290+
error JustificationCommitmentMismatch();
291291
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ contract DisputeKitShutter is DisputeKitClassicBase {
182182
bytes32 actualJustificationHash = hashJustification(_salt, _justification);
183183
for (uint256 i = 0; i < _voteIDs.length; i++) {
184184
if (justificationCommitments[_localDisputeID][_localRoundID][_voteIDs[i]] != actualJustificationHash)
185-
revert WrongJustification();
185+
revert JustificationCommitmentMismatch();
186186
}
187187
}
188188

@@ -191,5 +191,5 @@ contract DisputeKitShutter is DisputeKitClassicBase {
191191
// ************************************* //
192192

193193
error EmptyJustificationCommit();
194-
error WrongJustification();
194+
error JustificationCommitmentMismatch();
195195
}

contracts/test/arbitration/helpers/dispute-kit-shutter-common.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ export function testNormalFlowBotReveals(context: () => ShutterTestContext) {
502502
ctx.salt,
503503
ctx.justification
504504
)
505-
).to.be.revertedWithCustomError(ctx.disputeKit, "HashDoesNotMatchHiddenVoteCommitment");
505+
).to.be.revertedWithCustomError(ctx.disputeKit, "ChoiceCommitmentMismatch");
506506
});
507507

508508
it("Should revert if wrong salt provided", async () => {
@@ -528,7 +528,7 @@ export function testNormalFlowBotReveals(context: () => ShutterTestContext) {
528528
wrongSalt, // Wrong salt
529529
ctx.justification
530530
)
531-
).to.be.revertedWithCustomError(ctx.disputeKit, "HashDoesNotMatchHiddenVoteCommitment");
531+
).to.be.revertedWithCustomError(ctx.disputeKit, "ChoiceCommitmentMismatch");
532532
});
533533

534534
it("Should revert if wrong justification provided", async () => {
@@ -554,7 +554,7 @@ export function testNormalFlowBotReveals(context: () => ShutterTestContext) {
554554
ctx.salt,
555555
wrongJustification // Wrong justification
556556
)
557-
).to.be.revertedWithCustomError(ctx.disputeKit, "WrongJustification");
557+
).to.be.revertedWithCustomError(ctx.disputeKit, "JustificationCommitmentMismatch");
558558
});
559559

560560
it("Should revert if vote already cast", async () => {
@@ -675,7 +675,7 @@ export function testRecoveryFlowJurorReveals(context: () => ShutterTestContext)
675675
ctx.salt,
676676
""
677677
)
678-
).to.be.revertedWithCustomError(ctx.disputeKit, "HashDoesNotMatchHiddenVoteCommitment");
678+
).to.be.revertedWithCustomError(ctx.disputeKit, "ChoiceCommitmentMismatch");
679679
});
680680

681681
it("Should revert if wrong salt in recovery", async () => {
@@ -701,7 +701,7 @@ export function testRecoveryFlowJurorReveals(context: () => ShutterTestContext)
701701
wrongSalt, // Wrong salt
702702
""
703703
)
704-
).to.be.revertedWithCustomError(ctx.disputeKit, "HashDoesNotMatchHiddenVoteCommitment");
704+
).to.be.revertedWithCustomError(ctx.disputeKit, "ChoiceCommitmentMismatch");
705705
});
706706

707707
it("Should revert if non-juror tries to reveal without correct full commitment", async () => {
@@ -727,7 +727,7 @@ export function testRecoveryFlowJurorReveals(context: () => ShutterTestContext)
727727
ctx.salt,
728728
"" // No justification - would work for juror but not for others
729729
)
730-
).to.be.revertedWithCustomError(ctx.disputeKit, "WrongJustification");
730+
).to.be.revertedWithCustomError(ctx.disputeKit, "JustificationCommitmentMismatch");
731731
});
732732
});
733733
});
@@ -846,7 +846,7 @@ export function testEdgeCasesAndSecurity(context: () => ShutterTestContext) {
846846
ctx.salt,
847847
ctx.justification
848848
)
849-
).to.be.revertedWithCustomError(ctx.disputeKit, "HashDoesNotMatchHiddenVoteCommitment");
849+
).to.be.revertedWithCustomError(ctx.disputeKit, "ChoiceCommitmentMismatch");
850850
});
851851
});
852852
}

contracts/test/foundry/KlerosCore_Voting.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ contract KlerosCore_VotingTest is KlerosCore_TestBase {
114114

115115
// Check the require with the wrong choice and then with the wrong salt
116116
vm.prank(staker1);
117-
vm.expectRevert(DisputeKitClassicBase.HashDoesNotMatchHiddenVoteCommitment.selector);
117+
vm.expectRevert(DisputeKitClassicBase.ChoiceCommitmentMismatch.selector);
118118
disputeKit.castVote(disputeID, voteIDs, 2, salt, "XYZ");
119119

120120
vm.prank(staker1);
121-
vm.expectRevert(DisputeKitClassicBase.HashDoesNotMatchHiddenVoteCommitment.selector);
121+
vm.expectRevert(DisputeKitClassicBase.ChoiceCommitmentMismatch.selector);
122122
disputeKit.castVote(disputeID, voteIDs, YES, salt - 1, "XYZ");
123123

124124
vm.prank(staker1);

0 commit comments

Comments
 (0)