package tezos-protocol-alpha
This module handles the slashing of delegates for double signing.
It is behind the Alpha_context
abstraction: some functions are re-exported in Alpha_context.Delegate
.
This module is responsible for maintaining the Storage.Contract.Slashed_deposits
table. It also interacts heavily with Pending_denunciations_storage
.
The reward_and_burn
type embeds amounts involved when slashing a delegate for double attesting or double baking.
type punishing_amounts = {
staked : reward_and_burn;
unstaked : (Cycle_repr.t * reward_and_burn) list;
}
The punishing_amounts
type embeds amounts involved when slashing a delegate for double attesting or double baking.
val punish_double_signing :
Raw_context.t ->
operation_hash:Tezos_protocol_environment_alpha.Operation_hash.t ->
Misbehaviour_repr.t ->
Tezos_protocol_environment_alpha.Signature.Public_key_hash.t ->
Level_repr.t ->
rewarded:Tezos_protocol_environment_alpha.Signature.public_key_hash ->
Raw_context.t Tezos_protocol_environment_alpha.Error_monad.tzresult
Tezos_protocol_environment_alpha.Lwt.t
Record in the context that the given delegate is both marked for slashing for the given misbehaviour, and forbidden from taking part in the consensus process (baking/attesting).
operation_hash
corresponds to the denunciation that prompted this punishment. The level argument is the level of the duplicate blocks, or the level that the duplicate (pre)attestations point to, **not** the level of the block that contains the denunciation.
This function asserts that the delegate has not already been denounced for the same misbehaviour at the same level. Indeed, if this were the case, then the current denunciation operation should have been rejected by Validate
.
val apply_and_clear_denunciations :
Raw_context.t ->
(Raw_context.t * Receipt_repr.balance_updates)
Tezos_protocol_environment_alpha.Error_monad.tzresult
Tezos_protocol_environment_alpha.Lwt.t
Applies pending denunciations in Storage.Pending_denunciations
at the end of a cycle. The applicable denunciations are those that point to a misbehavior whose max slashable period is ending. (because max_slashable_period = 2
, the misbehavior must be in the previous cycle).
The denunciations are applied in chronological order of misbehaviour. This function slashes the misbehaving bakers, by a proportion defined in Slash_percentage
, and updates the respective Storage.Contract.Slashed_deposits
. The applied denunciations are removed from the storage.
It returns the updated context, and all the balance updates, which includes slashes for the bakers, the stakers, and the rewards for the denouncers.
module For_RPC : sig ... end