Tezos_raw_protocol_024_PsU87LFi.Delegate_sampler
This module draws random values for a cycle based on the Seed_repr.seed
associated that cycle. These random values are only delegates associated with slots. The selection of delegates is done by sampling from a particular distribution of the stake among the active delegates.
This module is responsible for maintaining the table Storage.Delegate_sampler_state
.
type Tezos_protocol_environment_024_PsU87LFi.Error_monad.error +=
| Invalid_slot of {
level : Level_repr.t;
slot : Slot_repr.t;
}
val attestation_slot_owner :
all_bakers_attest_enabled:bool ->
Raw_context.t ->
Level_repr.t ->
Slot_repr.t ->
(Raw_context.t * Delegate_consensus_key.pk)
Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.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 * Delegate_consensus_key.pk)
Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
val load_sampler_for_cycle :
Raw_context.t ->
Cycle_repr.t ->
Raw_context.t Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
load_sampler_for_cycle ctxt cycle
caches the seeded stake sampler for cycle
in ctxt
. If the sampler was already cached, then ctxt
is returned unchanged.
This function has the same effect on ctxt
as slot_owner
and baking_rights_owner
.
val stake_info_for_cycle :
Raw_context.t ->
Cycle_repr.t ->
(Raw_context.t
* Tezos_protocol_environment_024_PsU87LFi.Int64.t
* (Delegate_consensus_key.pk
* Tezos_protocol_environment_024_PsU87LFi.Int64.t)
list)
Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
stake_info_for_cycle ctxt cycle
reads the stake info for cycle
from ctxt
if it has been previously initialized. Otherwise it initializes the sampler and caches it in ctxt
with Raw_context.set_stake_info_for_cycle
. Returns the updated context, the total staking power active for the cycle, and the list of all delegates with their respective active staking power.
val stake_info :
Raw_context.t ->
Level_repr.t ->
(Raw_context.t
* Tezos_protocol_environment_024_PsU87LFi.Int64.t
* (Delegate_consensus_key.pk
* Tezos_protocol_environment_024_PsU87LFi.Int64.t)
list)
Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
Same as stake_info_for_cycle
, but for the given level (uses the level's cycle)
val load_stake_info_for_cycle :
Raw_context.t ->
Cycle_repr.t ->
Raw_context.t Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
load_stake_info_for_cycle ctxt cycle
caches the stake info for cycle
in ctxt
. If the stake info was already cached, then ctxt
is returned unchanged.
This function has the same effect on ctxt
as stake_info
val select_new_distribution_at_cycle_end :
Raw_context.t ->
new_cycle:Cycle_repr.t ->
Raw_context.t Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
val clear_outdated_sampling_data :
Raw_context.t ->
new_cycle:Cycle_repr.t ->
Raw_context.t Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
val select_distribution_for_cycle :
Raw_context.t ->
Cycle_repr.t ->
Raw_context.t Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
val attesting_power :
all_bakers_attest_enabled:bool ->
Raw_context.t ->
Level_repr.t ->
(Raw_context.t
* int64
Tezos_protocol_environment_024_PsU87LFi.Signature.Public_key_hash.Map.t)
Tezos_protocol_environment_024_PsU87LFi.Error_monad.tzresult
Tezos_protocol_environment_024_PsU87LFi.Lwt.t
attesting_power ctxt level
returns a map of the delegates to their attesting power for the given level. Fails if the given level is in a cycle for which the seed is not in the storage
module For_RPC : sig ... end