package tezos-baking-alpha

  1. Overview
  2. Docs
type block = {
  1. rpc_context : Environment_context.rpc_context;
  2. protocol_data : Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data;
  3. raw_protocol_data : Stdlib.Bytes.t;
  4. operations : Tezos_client_alpha.Mockup.M.Block_services.operation list list;

Representation of a block in the simulator.

type chain = block list

Chain is a list of blocks.

type propagation =
  1. | Block

    Block the operation/block, it'll never be delivered.

  2. | Pass

    Pass the operation/block as is.

  3. | Delay of float

    Delay the operation/block for the given number of seconds.


How an operation or block should propagate through the network.

type propagation_vector = propagation list

Values of this type specify to which bakers a block or operation should be delivered.

module type Hooks = sig ... end

The way to control behavior of a mockup node.

The default hook implementation.

type config = {
  1. debug : bool;

    Whether to initialize the event system in order to display information about the progress of the simulation.

  2. round0 : int64;

    Duration of the round 0 in seconds.

  3. round1 : int64;

    Duration of the round 1 in seconds.

  4. timeout : int;

    Maximal duration of the test. If the test takes longer to terminate it'll be aborted with an error.

  5. delegate_selection : (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list;

    Desired selection of delegates per level/round

  6. initial_seed : Tezos_protocol_alpha.Protocol.State_hash.t option;

    Optional initial seed for protocol (used to control delegate selection)

  7. consensus_committee_size : int;

    Size of the committee for tenderbake in number of slots

  8. consensus_threshold : int;

    Threshold, in number of slots, for the quorum to be considered reached. Should be 2 * consensus_committee_size / 3 + 1 in usual setting for tenderbake.


Simulation configuration.

val default_config : config

Default configuration.

val run : ?config:config -> (int * (module Hooks)) list -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

run spec runs a simulation according to the spec. Elements of spec describe bakers: how many delegate each baker has and how it behaves. The total number of delegates cannot exceed 5 for now (it is easy to increase this limit). The delegates are assigned in order, gradually exhausting the standard bootstrap accounts. For example, if the first baker has 3 delegates and the second one has 2 delegates, we have the following distribution of bootstrap accounts:

Baker no. 1: bootstrap1, bootstrap2, bootstrap3

Baker no. 2: bootstrap4, bootstrap5

A simulation continues till all nodes finish either with an error or successfully. If at least one node finishes with an error, it propagates to the final result.

val check_block_signature : block_hash:Tezos_crypto.Block_hash.t -> block_header:Tezos_base.Block_header.t -> public_key:Tezos_crypto.Signature.public_key -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Check if a block header is signed by a given delegate.

A shortcut type for predicates on operations.

val mempool_count_ops : mempool: (Tezos_crypto.Operation_hash.t * Tezos_client_alpha.Mockup.M.Protocol.operation) list -> predicate:op_predicate -> (int, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Count the number of operations in the mempool that satisfy the given predicate.

val mempool_has_op : mempool: (Tezos_crypto.Operation_hash.t * Tezos_client_alpha.Mockup.M.Protocol.operation) list -> predicate:op_predicate -> (bool, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Check if the mempool has at least one operation that satisfies the given predicate.

val mempool_has_op_ref : mempool: (Tezos_crypto.Operation_hash.t * Tezos_client_alpha.Mockup.M.Protocol.operation) list -> predicate:op_predicate -> var:bool Stdlib.ref -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Similar to mempool_has_op but instead of returning a bool it sets the given bool ref.

val op_is_signed_by : public_key:Tezos_crypto.Signature.public_key -> op_predicate

Check if an operation is signed by the given delegate.

val op_is_preendorsement : ?level:int32 -> ?round:int32 -> op_predicate

Check that an operation is a preendorsement.

val op_is_endorsement : ?level:int32 -> ?round:int32 -> op_predicate

Check that an operation is an endorsement.

val op_is_both : op_predicate -> op_predicate -> op_predicate

Combine two predicates.

Set the given variable to save payload hash and payload round.

val verify_payload_hash : protocol_data: Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data -> original_proposal: (Tezos_protocol_alpha.Protocol.Block_payload_hash.t * Tezos_protocol_alpha.Protocol.Alpha_context.Round.t) option Stdlib.ref -> message:string -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Check that payload hashes match, fail if it is not the case.

val parse_protocol_data : Stdlib.Bytes.t -> (Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Parse protocol data.

val get_block_round : block -> (int32, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

Get round of a block.


Innovation. Community. Security.