Skip to content

Commit f66ab4b

Browse files
feat(KC): remove unstaking feature
1 parent 51ec1d2 commit f66ab4b

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

contracts/src/arbitration/KlerosCore.sol

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -478,57 +478,6 @@ contract KlerosCore is IArbitrator {
478478
delayedStakeReadIndex = newDelayedStakeReadIndex;
479479
}
480480

481-
/** @dev Allows an active dispute kit contract to manually unstake the ineligible juror. The main purpose of this function is to remove
482-
* jurors that might obstruct the drawing process.
483-
* @param _disputeID The ID of the dispute.
484-
* @param _account The address of the juror.
485-
* @return True if unstaking was successful.
486-
*/
487-
function unstakeByDK(uint256 _disputeID, address _account) external returns (bool) {
488-
Dispute storage dispute = disputes[_disputeID];
489-
Round storage round = dispute.rounds[dispute.rounds.length - 1];
490-
uint96 subcourtID = dispute.subcourtID;
491-
492-
require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), "Can only be called by DK");
493-
require(dispute.period == Period.evidence, "The dispute should be in Evidence period.");
494-
495-
Juror storage juror = jurors[_account];
496-
bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, subcourtID);
497-
uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(subcourtID)), stakePathID);
498-
499-
uint256 transferredAmount;
500-
transferredAmount = currentStake - juror.lockedTokens[subcourtID];
501-
if (transferredAmount > 0) {
502-
if (safeTransfer(_account, transferredAmount)) {
503-
for (uint256 i = 0; i < juror.subcourtIDs.length; i++) {
504-
if (juror.subcourtIDs[i] == subcourtID) {
505-
juror.subcourtIDs[i] = juror.subcourtIDs[juror.subcourtIDs.length - 1];
506-
juror.subcourtIDs.pop();
507-
break;
508-
}
509-
}
510-
} else {
511-
return false;
512-
}
513-
}
514-
515-
// Update juror's records.
516-
juror.stakedTokens[subcourtID] = 0;
517-
518-
// Update subcourt parents.
519-
bool finished = false;
520-
uint256 currentSubcourtID = subcourtID;
521-
while (!finished) {
522-
sortitionSumTrees.set(bytes32(currentSubcourtID), 0, stakePathID);
523-
if (currentSubcourtID == GENERAL_COURT) finished = true;
524-
else currentSubcourtID = courts[currentSubcourtID].parent;
525-
}
526-
527-
emit StakeSet(_account, subcourtID, 0, 0);
528-
529-
return true;
530-
}
531-
532481
/** @dev Creates a dispute. Must be called by the arbitrable contract.
533482
* @param _numberOfChoices Number of choices for the jurors to choose from.
534483
* @param _extraData Additional info about the dispute. We use it to pass the ID of the dispute's subcourt (first 32 bytes),

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,6 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence {
230230
emit NewPhaseDisputeKit(phase);
231231
}
232232

233-
/** @dev Allows to unstake the juror that obstructs drawing process.
234-
* @param _coreDisputeID The ID of the dispute in Kleros Core which drawing process is obstructed.
235-
* @param _juror The address of the juror to unstake.
236-
*/
237-
function unstakeJuror(uint256 _coreDisputeID, address _juror) external {
238-
require(phase == Phase.drawing, "Should be in drawing phase");
239-
require(!postDrawCheck(_coreDisputeID, _juror), "The juror is eligible to drawing");
240-
core.unstakeByDK(_coreDisputeID, _juror);
241-
}
242-
243233
/** @dev Draws the juror from the sortition tree. The drawn address is picked up by Kleros Core.
244234
* Note: Access restricted to Kleros Core only.
245235
* @param _coreDisputeID The ID of the dispute in Kleros Core.

0 commit comments

Comments
 (0)