Module Tezos_dal_node_services.Controller_profiles

This module deals with the different profiles of a DAL node in controller mode.

type t

An controller DAL node can play three different roles:

  • attester for some pkh: checks that the shards assigned to this pkh are published
  • operator for some slot index,
  • observer for some slot index.

Operator and observer DAL nodes can "produce" slots, that is, they split a slot into shards and publish the shards. They are therefore also called "slot producers".

Operators and observers also perform amplification: they reconstruct a slot when enough shards are seen, and republish the missing shards. They both are called "prover" profiles, because they need to generate shard proofs, needing the full SRS, while the attester profile only needs the smaller, "verifier SRS".

The difference between operators and observers is that operators can participate in refutation games (because they store slot data for the whole refutation period), while observers cannot.

A single DAL node can play several of these roles at once. We call a profile the set of roles played by a DAL node and represent it as a triple of sets.

val empty : t

The empty controller; a controller with this profile does nothing

val is_empty : t -> bool
val has_attester : t -> bool

has_attester t returns true if there is a public key in the attester field of t

val has_operator : t -> bool

has_operator t returns true if there is a slot index in the operator field of t

val has_observer : t -> bool

has_observer t returns true if there is a slot index in the observer field of t

val attester_only : t -> bool

attester_only t returns true if t has an attester role, and no operator, not observer roles.

attesters t returns the set of attesters registered within the attester profile, if any.

val operator_slot_out_of_bounds : int -> t -> int option

operator_slot_out_of_bounds n t returns the first slot index that for operator that is not between 0 and n - 1; it returns None if no slot index was outside these bounds

val observer_slot_out_of_bounds : int -> t -> int option

observer_slot_out_of_bounds n t returns the first slot index that for observer that is not between 0 and n - 1; it returns None if no slot index was outside these bounds

val is_observed_slot : int -> t -> bool

is_observed_slot i op returns true if and only if op contains an observer for slot index i

val can_publish_on_slot_index : int -> t -> bool

can_publish_on_slot_index slot_index op returns true if and only if op contains an observer or an operator for slot index slot_index

val get_all_slot_indexes : t -> int list

Returns all slot indexes used in the profile, whether they are for operator or observer

val make : ?attesters:Tezos_base.TzPervasives.Signature.Public_key_hash.t list -> ?operators:int list -> ?observers:int list -> unit -> t

make ~attesters ~operators ~observers () returns an controller mode for a node that is an attester for the public keys in attesters, a operator for each slot indexes in operators, and an observer for all slot indexes in observer. When a list is empty or not specified, no value for the corresponding role will be included in the result ; make () returns empty

val merge : ?on_new_attester: (Tezos_base.TzPervasives.Signature.Public_key_hash.t -> unit) -> t -> t -> t

merge ~on_new_attester op1 op2 returns a controller mode that contains both op1 & op2. on_new_attester is a function triggered for each public key in op2 that is not already in op1