package tezos-baking-alpha
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f
doc/tezos-baking-alpha.mockup-simulator/Tezos_alpha_mockup_simulator/Mockup_simulator/index.html
Module Tezos_alpha_mockup_simulator.Mockup_simulator
Source
type block = {
rpc_context : Tezos_protocol_environment.rpc_context;
protocol_data : Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data;
raw_protocol_data : Tezos_base.TzPervasives.Bytes.t;
operations : Tezos_client_alpha.Mockup.M.Block_services.operation list list;
resulting_context_hash : Tezos_base.TzPervasives.Context_hash.t;
}
Representation of a block in the simulator.
How an operation or block should propagate through the network.
Values of this type specify to which bakers a block or operation should be delivered.
The default hook implementation.
type config = {
debug : bool;
(*Whether to initialize the event system in order to display information about the progress of the simulation.
*)round0 : int64;
(*Duration of the round 0 in seconds.
*)round1 : int64;
(*Duration of the round 1 in seconds.
*)timeout : int;
(*Maximal duration of the test. If the test takes longer to terminate it'll be aborted with an error.
*)delegate_selection : (int32 * (int32 * Tezos_base.TzPervasives.Signature.public_key_hash) list) list;
(*Desired selection of delegates per level/round
*)initial_seed : Tezos_protocol_alpha.Protocol.State_hash.t option;
(*Optional initial seed for protocol (used to control delegate selection)
*)consensus_committee_size : int;
(*Size of the committee for tenderbake in number of slots
*)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 run :
?config:config ->
(int * (module Hooks)) list ->
unit Tezos_base.TzPervasives.tzresult 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_base.TzPervasives.Block_hash.t ->
block_header:Tezos_base.TzPervasives.Block_header.t ->
public_key:Tezos_base.TzPervasives.Signature.public_key ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Check if a block header is signed by a given delegate.
type op_predicate =
Tezos_base.TzPervasives.Operation_hash.t ->
Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation ->
bool Tezos_base.TzPervasives.tzresult Lwt.t
A shortcut type for predicates on operations.
val mempool_count_ops :
mempool:
(Tezos_base.TzPervasives.Operation_hash.t
* Tezos_client_alpha.Mockup.M.Protocol.operation)
list ->
predicate:op_predicate ->
int Tezos_base.TzPervasives.tzresult Lwt.t
Count the number of operations in the mempool that satisfy the given predicate.
val mempool_has_op :
mempool:
(Tezos_base.TzPervasives.Operation_hash.t
* Tezos_client_alpha.Mockup.M.Protocol.operation)
list ->
predicate:op_predicate ->
bool Tezos_base.TzPervasives.tzresult Lwt.t
Check if the mempool has at least one operation that satisfies the given predicate.
val mempool_has_op_ref :
mempool:
(Tezos_base.TzPervasives.Operation_hash.t
* Tezos_client_alpha.Mockup.M.Protocol.operation)
list ->
predicate:op_predicate ->
var:bool ref ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Similar to mempool_has_op
but instead of returning a bool
it sets the given bool ref
.
Check if an operation is signed by the given delegate.
Check that an operation is a preendorsement.
Check that an operation is an endorsement.
Combine two predicates.
val save_proposal_payload :
protocol_data:
Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data ->
var:
(Tezos_protocol_alpha.Protocol.Block_payload_hash.t
* Tezos_protocol_alpha.Protocol.Alpha_context.Round.t)
option
ref ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
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
ref ->
message:string ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
Check that payload hashes match, fail if it is not the case.
val parse_protocol_data :
Tezos_base.TzPervasives.Bytes.t ->
Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.protocol_data
Tezos_base.TzPervasives.tzresult
Lwt.t
Parse protocol data.
Get round of a block.