Skip to content

Commit 2947180

Browse files
feat(DK): add justitication to commit
1 parent 732847e commit 2947180

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence {
272272
* `n` is the number of votes.
273273
* @param _coreDisputeID The ID of the dispute in Kleros Core.
274274
* @param _voteIDs The IDs of the votes.
275-
* @param _commit The commit.
275+
* @param _commit The commit. Note that justification string is a part of the commit.
276276
*/
277277
function castCommit(
278278
uint256 _coreDisputeID,
@@ -327,7 +327,8 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence {
327327
for (uint256 i = 0; i < _voteIDs.length; i++) {
328328
require(round.votes[_voteIDs[i]].account == msg.sender, "The caller has to own the vote.");
329329
require(
330-
!hiddenVotes || round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _salt)),
330+
!hiddenVotes ||
331+
round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),
331332
"The commit must match the choice in subcourts with hidden votes."
332333
);
333334
require(!round.votes[_voteIDs[i]].voted, "Vote already cast.");

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence {
302302
* `n` is the number of votes.
303303
* @param _coreDisputeID The ID of the dispute in Kleros Core.
304304
* @param _voteIDs The IDs of the votes.
305-
* @param _commit The commit.
305+
* @param _commit The commit. Note that justification string is a part of the commit.
306306
*/
307307
function castCommit(
308308
uint256 _coreDisputeID,
@@ -357,7 +357,8 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence {
357357
for (uint256 i = 0; i < _voteIDs.length; i++) {
358358
require(round.votes[_voteIDs[i]].account == msg.sender, "The caller has to own the vote.");
359359
require(
360-
!hiddenVotes || round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _salt)),
360+
!hiddenVotes ||
361+
round.votes[_voteIDs[i]].commit == keccak256(abi.encodePacked(_choice, _justification, _salt)),
361362
"The commit must match the choice in subcourts with hidden votes."
362363
);
363364
require(!round.votes[_voteIDs[i]].voted, "Vote already cast.");

0 commit comments

Comments
 (0)