package tezos-protocol-014-PtKathma
val init :
Raw_context.t ->
Contract_repr.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Raw_context.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Allow to register a delegate when creating an account.
val set :
Raw_context.t ->
Contract_repr.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t option ->
Raw_context.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Updating the delegate of a contract.
When calling this function on an "implicit contract" and setting the delegate to the contract manager registers it as a delegate. One cannot unregister a delegate for now. The associate contract is now 'undeletable'.
val set_frozen_deposits_limit :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Tez_repr.t option ->
Raw_context.t Tezos_protocol_environment_014_PtKathma.Lwt.t
type Tezos_protocol_environment_014_PtKathma.Error_monad.error +=
| No_deletion of Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t
| Active_delegate
| Current_delegate
| Empty_delegate_account of Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t
| Unregistered_delegate of Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t
| Unassigned_validation_slot_for_level of Level_repr.t * int
| Cannot_find_active_stake of {
cycle : Cycle_repr.t;
delegate : Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t;
}
| Not_registered of Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t
val check_delegate :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
unit Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Check that a given implicit account is a registered delegate.
type participation_info = {
expected_cycle_activity : int;
(*The total expected slots to be endorsed in the cycle. (static)
*)minimal_cycle_activity : int;
(*The minimal endorsing slots in the cycle to get endorsing rewards. (static)
*)missed_slots : int;
(*The number of missed endorsing slots in the cycle. (dynamic)
*)missed_levels : int;
(*The number of missed endorsing levels in the cycle. (dynamic)
*)remaining_allowed_missed_slots : int;
(*Remaining amount of endorsing slots that can be missed in the cycle before forfeiting the rewards. (dynamic)
*)expected_endorsing_rewards : Tez_repr.t;
(*Endorsing rewards that will be distributed at the end of the cycle if activity at that point will be greater than the minimal required. If the activity is already known to be below the required minimum, then the rewards are zero. (dynamic)
*)
}
Participation information. We denote by:
- "static" information that does not change during the cycle
- "dynamic" information that may change during the cycle
val delegate_participation_info :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
participation_info
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Only use this function for RPC: this is expensive.
delegate_participation_info
and !val:check_delegate
forms the implementation of RPC call "/context/delegates/<pkh>/participation".
val fold :
Raw_context.t ->
order:[ `Sorted | `Undefined ] ->
init:'a ->
f:
(Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
'a ->
'a Tezos_protocol_environment_014_PtKathma.Lwt.t) ->
'a Tezos_protocol_environment_014_PtKathma.Lwt.t
Iterate on all registered delegates.
val list :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t list
Tezos_protocol_environment_014_PtKathma.Lwt.t
List all registered delegates.
val record_endorsing_participation :
Raw_context.t ->
delegate:Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
participation:level_participation ->
endorsing_power:int ->
Raw_context.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Record the participation of a delegate as a validator.
val record_baking_activity_and_pay_rewards_and_fees :
Raw_context.t ->
payload_producer:
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
block_producer:
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
baking_reward:Tez_repr.t ->
reward_bonus:Tez_repr.t option ->
(Raw_context.t * Receipt_repr.balance_updates)
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Sets the payload and block producer as active. Pays the baking reward and the fees to the payload producer and the reward bonus to the payload producer (if the reward_bonus is not None).
val cycle_end :
Raw_context.t ->
Cycle_repr.t ->
Storage.Seed.unrevealed_nonce list ->
(Raw_context.t
* Receipt_repr.balance_updates
* Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t list)
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Trigger the context maintenance at the end of cycle 'n', i.e.: unfreeze the endorsing rewards, potentially deactivate delegates. Return the corresponding balances updates and the list of deactivated delegates.
val already_slashed_for_double_baking :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Level_repr.t ->
bool Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Returns true if the given delegate has already been slashed for double baking for the given level.
val already_slashed_for_double_endorsing :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Level_repr.t ->
bool Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Returns true if the given delegate has already been slashed for double preendorsing or double endorsing for the given level.
val punish_double_endorsing :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Level_repr.t ->
(Raw_context.t * Tez_repr.t * Receipt_repr.balance_updates)
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Burn some frozen deposit for a delegate at a given level. Returns the burned amount.
val frozen_deposits :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Storage.deposits Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Returns a delegate's frozen deposits, both the current amount and the initial freezed amount.
A delegate's frozen balance is only composed of frozen deposits; rewards and fees are not frozen, but simply credited at the right moment.
val full_balance :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Tez_repr.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Returns the full 'balance' of the implicit contract associated to a given key, i.e. the sum of the spendable balance (given by balance
or Contract_storage.get_balance
) and of the frozen balance. The frozen balance is composed of all frozen bonds associated to the contract (given by Contract_storage.get_frozen_bonds
) and of the frozen deposits (given by frozen_deposits
).
Only use this function for RPCs: this is expensive.
val delegated_balance :
Raw_context.t ->
Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t ->
Tez_repr.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Only use this function for RPCs: this is expensive.
val slot_owner :
Raw_context.t ->
Level_repr.t ->
Slot_repr.t ->
(Raw_context.t
* (Tezos_protocol_environment_014_PtKathma.Signature.Public_key.t
* Tezos_protocol_environment_014_PtKathma.Signature.Public_key_hash.t))
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
Participation slots potentially associated to accounts. The accounts that didn't place a deposit will be excluded from this list. This function should only be used to compute the deposits to freeze or initialize the protocol while stitching. RPCs can use this function to predict an approximation of long term future slot allocations. It shouldn't be used in the baker.
val baking_rights_owner :
Raw_context.t ->
Level_repr.t ->
round:Round_repr.round ->
(Raw_context.t
* Slot_repr.t
* (Tezos_protocol_environment_014_PtKathma.Signature.public_key
* Tezos_protocol_environment_014_PtKathma.Signature.public_key_hash))
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
val freeze_deposits_do_not_call_except_for_migration :
Raw_context.t ->
new_cycle:Cycle_repr.t ->
balance_updates:Receipt_repr.balance_updates ->
(Raw_context.t * Receipt_repr.balance_updates)
Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
val init_first_cycles :
Raw_context.t ->
Raw_context.t Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
init_first_cycles ctxt
computes and records the distribution of the total active stake among active delegates. This concerns the total active stake involved in the calculation of baking rights for all cycles in the range 0, preserved_cycles
.
val compute_snapshot_index :
Raw_context.t ->
Cycle_repr.t ->
max_snapshot_index:int ->
int Tezos_protocol_environment_014_PtKathma.Error_monad.tzresult
Tezos_protocol_environment_014_PtKathma.Lwt.t
compute_snapshot_index ctxt cycle max_snapshot_index
Returns the index of the selected snapshot for the cycle
passed as argument, and for the max index of snapshots taken so far, max_snapshot_index
(see Stake_storage.max_snapshot_index
.