Slashing Controller
SlashingController
UNDEFINED
CREATED
REJECTED
DISMISSED
IN_REVIEW
REVIEWED
EXECUTED
REVERTED
PenaltyMode
SlashPenalty
Deposit
Proposal
_proposalIds
proposals
deposits
penalties
slashingExecutor
subjectGateway
depositAmount
slashPercentToProposer
depositToken
_transitionTable
version
MAX_EVIDENCE_LENGTH
MAX_CHAR_LENGTH
HUNDRED_PERCENT
SlashProposalUpdated
event SlashProposalUpdated(address updater, uint256 proposalId, enum StateMachines.State stateId, address proposer, uint256 subjectId, uint8 subjectType, bytes32 penaltyId)
EvidenceSubmitted
DepositAmountChanged
SlashPercentToProposerChanged
DepositSubmitted
DepositReturned
DepositSlashed
SlashPenaltyAdded
event SlashPenaltyAdded(bytes32 penaltyId, uint256 percentSlashed, enum SlashingController.PenaltyMode mode)
SlashPenaltyRemoved
event SlashPenaltyRemoved(bytes32 penaltyId, uint256 percentSlashed, enum SlashingController.PenaltyMode mode)
WrongSlashPenaltyId
NonRegisteredSubject
WrongPercentValue
onlyValidSlashPenaltyId
onlyValidPercent
constructor
initialize
function initialize(address __manager, contract ISlashingExecutor __executor, contract StakeSubjectGateway __subjectGateway, uint256 __depositAmount, uint256 __slashPercentToProposer, bytes32[] __slashPenaltyIds, struct SlashingController.SlashPenalty[] __slashPenalties) public
Initializer method, access point to initialize inheritance tree.
Name | Type | Description |
---|---|---|
__manager | address | address of AccessManager. |
__executor | contract ISlashingExecutor | |
__subjectGateway | contract StakeSubjectGateway | |
__depositAmount | uint256 | |
__slashPercentToProposer | uint256 | |
__slashPenaltyIds | bytes32[] | |
__slashPenalties | struct SlashingController.SlashPenalty[] |
proposeSlash
function proposeSlash(uint8 _subjectType, uint256 _subjectId, bytes32 _penaltyId, string[] _evidence) external returns (uint256 proposalId)
Creates a slash proposal pointing to a slashable subject. To do so, the proposer must provide a FORT deposit and present evidence.
Name | Type | Description |
---|---|---|
_subjectType | uint8 | type of the subject. |
_subjectId | uint256 | ERC721 registry id of the stake subject. |
_penaltyId | bytes32 | if of the SlashPenalty to inflict upon the subject if the proposal goes through. |
_evidence | string[] | IPFS hashes of the evidence files, proof of the subject being slash worthy. |
Name | Type | Description |
---|---|---|
proposalId | uint256 | the proposal identifier. |
dismissSlashProposal
Arbiter dismisses a slash proposal (the proposal is legitimate, but after investigation, it is not a slashable offense) The deposit is returned to the proposer, and the stake of the subject is unfrozen
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
_evidence | string[] | IPFS hashes of the evidence files, proof of the subject not being slashable. |
rejectSlashProposal
Arbiter rejects a slash proposal, slashing the deposit of the proposer (the proposal is deemed as spam, misconduct, or similar) and unfreezing the subject's stake.
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
_evidence | string[] | IPFS hashes of the evidence files, justification for slashing the proposer's deposit. |
markAsInReviewSlashProposal
Arbiter recognizes the report as valid and procceeds to investigate. The deposit is returned to proposer, stake remains frozen.
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
reviewSlashProposalParameters
function reviewSlashProposalParameters(uint256 _proposalId, uint8 _subjectType, uint256 _subjectId, bytes32 _penaltyId, string[] _evidence) external
After investigation, arbiter updates the proposal's incorrect assumptions. This can only be done if the proposal is IN_REVIEW, and presenting evidence for the changes. Changing the subject and subjectType will unfreeze the previous target and freeze the new. Changing the penalty will affect slashing amounts.
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
_subjectType | uint8 | type of the subject. |
_subjectId | uint256 | ERC721 registry id of the stake subject. |
_penaltyId | bytes32 | if of the SlashPenalty to inflict upon the subject if the proposal goes through. |
_evidence | string[] | IPFS hashes of the evidence files, proof of need for proposal changes. |
_updateProposal
function _updateProposal(uint256 _proposalId, uint8 _subjectType, uint256 _subjectId, bytes32 _penaltyId) private
markAsReviewedSlashProposal
Arbiter marks the proposal as reviewed, so the slasher can execute or revert.
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
revertSlashProposal
The slashing proposal should not be executed. Stake is unfrozen. If the proposal is IN_REVIEW, this can be executed by the SLASHING_ARBITER_ROLE. If the proposal is REVIEWED, this can be executed by the SLASHER_ROLE.
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
_evidence | string[] | IPFS hashes of the evidence files, proof of the slash being not valid. |
executeSlashProposal
The slashing proposal is executed. Subject's stake is slashed and unfrozen. The proposer gets a % of the slashed stake as defined by slashPercentToProposer. Only executable by SLASHER_ROLE
Name | Type | Description |
---|---|---|
_proposalId | uint256 | the proposal identifier. |
getSlashedStakeValue
gets the stake amount to be slashed. The amount depends on the StakePenalty. In all cases, the amount will be the minimum of the max slashable stake for the subject and: MIN_STAKE: a % of the subject's MIN_STAKE CURRENT_STAKE: a % of the subject's active + inactive stake.
getSubject
getProposer
setDepositAmount
setSlashPercentToProposer
setSlashPenalties
function setSlashPenalties(bytes32[] _slashReasons, struct SlashingController.SlashPenalty[] _slashPenalties) external
_authorizeRevertSlashProposal
_unfreeze
_freeze
_setSlashingExecutor
_setsubjectGateway
_setDepositAmount
_setSlashPercentToProposer
_setSlashPenalties
function _setSlashPenalties(bytes32[] _slashReasons, struct SlashingController.SlashPenalty[] _slashPenalties) private
_submitEvidence
function _submitEvidence(uint256 _proposalId, enum StateMachines.State _stateId, string[] _evidence) private