Module Tezos_dal_node_lib.Node_context

type t

A t value contains the needed information for running a DAL node. Its fields are available through accessors.

init creates a t value based on the given arguments.

val get_all_plugins : t -> (module Dal_plugin.T) list

Returns all the registered plugins

val get_plugin_and_parameters_for_level : t -> level:int32 -> ((module Dal_plugin.T) * Tezos_dal_node_services.Types.proto_parameters) Tezos_base.TzPervasives.tzresult

Returns the plugin to be used for the given (block) level together with the protocol parameters at that level.

Recall that, for a migration level L: * to retrieve the metadata of the block L, one should use the plugin for the old protocol; * to retrieve context-related information, one should use the plugin for the new protocol.

This function returns the plugin of metadata.protocols.next_protocol, so it is tailored for the second use case. To get the plugin for the first use-case, just get the plugin for the predecessor of the target level.

val get_plugin_for_level : t -> level:int32 -> (module Dal_plugin.T) Tezos_base.TzPervasives.tzresult

Returns the plugin to be used for the given (block) level. See get_plugin_and_parameters_for_level.

val may_add_plugin : t -> Rpc_context.t -> block_level:int32 -> proto_level:int -> unit Tezos_base.TzPervasives.tzresult Lwt.t

Tries to add a new plugin for the protocol with level proto_level to be used starting with the given block_level.

It returns an error if the node is not ready, if the Chain_services.Blocks.protocols RPC fails, or if the plugin is not registered.

val set_proto_plugins : t -> Proto_plugins.t -> unit

Set the protocol plugins to the given value.

val get_proto_parameters : level:[ `Last_proto | `Level of int32 ] -> t -> Tezos_dal_node_services.Types.proto_parameters Tezos_base.TzPervasives.tzresult

get_proto_parameters ~level ctxt returns the DAL node's protocol parameters. When level is `Last_proto, it returns the last known parameters. If level is `Level level, then the protocol parameters for that level are returned. The parameters returned are obtained via get_plugin_and_parameters_for_level.

val may_reconstruct : reconstruct: (Tezos_dal_node_services.Types.slot_id -> (bytes, Errors.other) Stdlib.result Lwt.t) -> Tezos_dal_node_services.Types.slot_id -> t -> (bytes, Errors.other) Stdlib.result Lwt.t

Reconstruct the given slot id by calling the reconstruct function unless a reconstruction for the given slot id is alredy ongoing in which case the ongoing promise is returned instead.

val get_l1_crawler_status : t -> L1_crawler_status.t

Returns the status of the L1 crawler currently stored in the node context.

val set_l1_crawler_status : t -> L1_crawler_status.t -> unit

Updates the status of the L1 crawler with the given value.

val get_profile_ctxt : t -> Profile_manager.t

get_profile_ctxt ctxt returns the profile context.

val load_profile_ctxt : t -> Profile_manager.t option Lwt.t

load_profile_ctxt ctxt tries to load the profile context from disk.

val set_profile_ctxt : t -> ?save:bool -> Profile_manager.t -> unit Lwt.t

set_profile_ctxt ctxt ?save pctxt sets the profile context. If save is set, which is true by default, the profile context is saved on disk.

val get_config : t -> Configuration_file.t

get_config ctxt returns the dal node configuration

val get_cryptobox : t -> Tezos_crypto_dal.Cryptobox.t

get_cryptobox ctxt returns the DAL node's cryptobox

val set_last_finalized_level : t -> int32 -> unit

Update the node's last finalized level.

val get_last_finalized_level : t -> int32

Get the node's last finalized level. This level may be equal or higher than the node's last processed level.

val is_bootstrap_node : t -> bool

Returns true if and only if the node's profile is bootstrap.

val supports_refutations : t -> bool

Returns true if and only if the node's profile supports refutation games.

val get_shards_proofs_precomputation : t -> Tezos_crypto_dal.Cryptobox.shards_proofs_precomputation option

get_shards_proofs_precomputation ctxt returns the shards proof's precomputation.

val get_store : t -> Store.t

get_store ctxt returns the dal node store.

get_gs_worker ctxt returns the Gossipsub worker state.

val get_tezos_node_cctxt : t -> Tezos_rpc.Context.generic

get_tezos_node_cctxt ctxt returns the Tezos node's client context.

val get_ongoing_amplifications : t -> Tezos_dal_node_services.Types.Slot_id.Set.t

get_ongoing_amplification ctxt returns the slot ids for which there are ongoing amplifications.

val set_ongoing_amplifications : t -> Tezos_dal_node_services.Types.Slot_id.Set.t -> unit

set_ongoing_amplification ctxt ongoing_amplifications set the slot ids for which there are ongoing amplifications.

Retrieves the set of pkhs whose messages are not propagated.

val storage_period : t -> Tezos_dal_node_services.Types.proto_parameters -> [ `Always | `Finite of int ]

storage_period ctxt proto_parameters returns for how many levels should the node store data about attested slots. This depends on the node's profile and its history mode.

val level_to_gc : t -> Tezos_dal_node_services.Types.proto_parameters -> current_level:int32 -> int32 option

level_to_gc ctxt proto_parameters ~current_level returns the oldest level that should have attested data (like shards and slots, skip list cells) stored; during current_level, such data for commitments published at the returned level will be removed. The returned level is non-negative. In case no removal is needed (either because the node is thus configured, or the current_level is not big enough), the function returns None.

val fetch_assigned_shard_indices : t -> level:int32 -> pkh:Tezos_crypto.Signature.Public_key_hash.t -> int list Tezos_base.TzPervasives.tzresult Lwt.t

fetch_assigned_shard_indices ctxt ~level ~pkh fetches from L1 the shard indices assigned to pkh at level. It internally caches the DAL committee with level as the key with FIFO strategy.

val get_fetched_assigned_shard_indices : t -> level:int32 -> pkh:Tezos_crypto.Signature.public_key_hash -> Committee_cache.shard_indexes option

get_fetched_assigned_shard_indices is a pure variant of fetch_assigned_shard_indices that doesn't fetch the committee from L1 if not found locally. The function returns None if no committee is found locally for the given level, or Some shard_indexes otherwise, where the list of shards is empty if the given pkh is not in the committee for the givel level.

val fetch_committee : t -> level:int32 -> Committee_cache.committee Tezos_base.TzPervasives.tzresult Lwt.t

fetch_committee ctxt ~level fetches from L1 the shard indices assigned to all attesters at level. It internally caches the DAL committee with level as the key with FIFO strategy.

version ctxt returns the current version of the node

val warn_if_attesters_not_delegates : t -> Tezos_dal_node_services.Controller_profiles.t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

Emit a warning for each public key hash in the given controller profiles (if any) that is not that of a L1-registered delegate.

val get_disable_shard_validation : t -> bool

get_disable_shard_validation ctxt returns whether we should disable shard validation in the DAL node.

module P2P : sig ... end

Module for P2P-related accessors.