package tezos-shell

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Data specific to a given chain (e.g. the main chain or the current test chain).

type t
type chain_state = t
val create : global_state -> ?allow_forked_chain:bool -> commit_genesis: (chain_id:Tezos_crypto.Chain_id.t -> (Tezos_crypto.Context_hash.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> Tezos_base.Genesis.t -> Tezos_crypto.Chain_id.t -> (chain_state, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Initialize a chain for a given genesis. By default, the chain does accept forking test chain. When ~allow_forked_chain:true is provided, test chain are allowed.

Look up for a chain by the hash of its genesis block.

val all : global_state -> chain_state Stdlib.Seq.t Lwt.t

Returns all the known chains.

val destroy : global_state -> chain_state -> unit Lwt.t

Destroy a chain: this completely removes from the local storage all the data associated to the chain (this includes blocks and operations).

Various accessors.

val global_state : chain_state -> global_state
val faked_genesis_hash : chain_state -> Tezos_crypto.Block_hash.t

Hash of the faked block header of the genesis block.

val expiration : chain_state -> Tezos_base.Time.Protocol.t option

Return the expiration timestamp of a test chain.

val allow_forked_chain : chain_state -> bool
val save_point : chain_state -> (Stdlib.Int32.t * Tezos_crypto.Block_hash.t) Lwt.t
val caboose : chain_state -> (Stdlib.Int32.t * Tezos_crypto.Block_hash.t) Lwt.t
val store : chain_state -> Store.t Lwt.t
val set_checkpoint : chain_state -> Tezos_base.Block_header.t -> unit Lwt.t

Update the current checkpoint. The current head should be consistent (i.e. it should either have a lower level or pass through the checkpoint). In the process all the blocks from invalid alternate heads are removed from the disk, either completely (when `level <= checkpoint`) or still tagged as invalid (when `level > checkpoint`).

val set_checkpoint_then_purge_full : chain_state -> Tezos_base.Block_header.t -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Apply set_checkpoint then purge_full (see History_mode.t).

val set_checkpoint_then_purge_rolling : chain_state -> Tezos_base.Block_header.t -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Apply set_checkpoint then purge_rolling (see History_mode.t).

val acceptable_block : chain_state -> Tezos_base.Block_header.t -> bool Lwt.t

Check that a block is compatible with the current checkpoint. This function assumes that the predecessor is known valid.

val all_indexed_protocols : chain_state -> (int * (Tezos_crypto.Protocol_hash.t * int32)) list Lwt.t

List all the indexed protocols in the chain. The resulting list contains elements of the form <proto_level>, (<proto_hash>, <activation_level>).

Get the level indexed chain protocol store for the given header.

val update_level_indexed_protocol_store : chain_state -> Tezos_crypto.Chain_id.t -> int -> Tezos_crypto.Protocol_hash.t -> Tezos_base.Block_header.t -> unit Lwt.t

Update the level indexed chain protocol store so that the block can easily access its corresponding protocol hash from the protocol level in its header. Also stores the transition block level.

OCaml

Innovation. Community. Security.