Module Tezos_raw_protocol_alpha.Delegate_slashed_deposits_storage

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.

type reward_and_burn = {
  1. reward : Tez_repr.t;
  2. amount_to_burn : Tez_repr.t;
}

The reward_and_burn type embeds amounts involved when slashing a delegate for double attesting or double baking.

type punishing_amounts = {
  1. staked : reward_and_burn;
  2. 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.

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.

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