package tezos-012-Psithaca-test-helpers

  1. Overview
  2. Docs
type t = {
  1. hash : Tezos_base__TzPervasives.Block_hash.t;
  2. header : Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Block_header.t;
  3. operations : Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Operation.packed list;
  4. context : Tezos_protocol_environment.Context.t;
    (*

    Resulting context

    *)
}
type block = t

Policies to select the next baker:

  • By_round r selects the baker at round r
  • By_account pkh selects the first slot for baker pkh
  • Excluding pkhs selects the first baker that doesn't belong to pkhs
type baking_mode =
  1. | Application
  2. | Baking

The default baking functions below is to use (blocks) Application mode. Setting baking_mode allows to switch to Full_construction mode.

val get_next_baker : ?policy:baker_policy -> t -> (Tezos_protocol_012_Psithaca.Protocol.Alpha_context.public_key_hash * int * Tezos_base__TzPervasives.Time.Protocol.t) Tezos_base__TzPervasives.tzresult Lwt.t

Returns (account, round, timestamp) of the next baker given a policy, defaults to By_round 0.

val get_round : block -> Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Round.t Tezos_base__TzPervasives.tzresult
module Forge : sig ... end
val check_constants_consistency : Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Constants.parametric -> unit Tezos_base__TzPervasives.tzresult Lwt.t
val genesis : ?commitments: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Commitment.t list -> ?consensus_threshold:int -> ?min_proposal_quorum:int32 -> ?bootstrap_contracts: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Parameters.bootstrap_contract list -> ?level:int32 -> ?cost_per_byte:Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?liquidity_baking_subsidy: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?endorsing_reward_per_slot: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?baking_reward_bonus_per_slot: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?baking_reward_fixed_portion: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?origination_size:int -> ?blocks_per_cycle:int32 -> (Account.t * Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.tez) list -> block Tezos_base__TzPervasives.tzresult Lwt.t

genesis <opts> accounts : generates an initial block with the given constants <opts> and initializes accounts with their associated amounts.

val genesis_with_parameters : Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Parameters.t -> block Tezos_base__TzPervasives.tzresult Lwt.t

alpha_context <opts> accounts : instantiates an alpha_context with the given constants <opts> and initializes accounts with their associated amounts.

val get_application_vstate : t -> Tezos_protocol_012_Psithaca.Protocol.operation list -> Tezos_protocol_012_Psithaca.Protocol.validation_state Tezos_base__TzPervasives.tzresult Lwt.t

get_application_vstate pred operations constructs a protocol validation environment for operations in application mode on top of the given block with the given operations. It's a shortcut for begin_application

get_construction_vstate ?policy ?timestamp ?protocol_data pred constructs a protocol validation environment for operations in construction mode on top of the given block. The mode is full(baking)/partial(mempool) if protocol_data given/absent. It's a shortcut for begin_construction

applies a signed header and its operations to a block and obtains a new block

bake b returns a block b' which has as predecessor block b. Optional parameter policy allows to pick the next baker in several ways. This function bundles together forge_header, sign_header and apply. These functions should be used instead of bake to craft unusual blocks for testing together with setters for properties of the headers. For examples see seed.ml or double_baking.ml

val bake_n : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_escape_vote:bool -> int -> t -> block Tezos_base__TzPervasives.tzresult Lwt.t

Bakes n blocks.

val bake_n_with_all_balance_updates : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_escape_vote:bool -> int -> t -> (block * Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Receipt.balance_updates) Tezos_base__TzPervasives.tzresult Lwt.t

Version of bake_n that returns a list of all balance updates included in the metadata of baked blocks. *

Version of bake_n that returns a list of all origination results in the metadata of baked blocks. *

val bake_n_with_liquidity_baking_escape_ema : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_escape_vote:bool -> int -> t -> (block * Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Liquidity_baking.escape_ema) Tezos_base__TzPervasives.tzresult Lwt.t

Version of bake_n that returns the liquidity baking escape EMA after n blocks. *

val current_cycle : t -> Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Cycle.t Tezos_base__TzPervasives.tzresult Lwt.t
val bake_until_cycle_end : ?policy:baker_policy -> t -> t Tezos_base__TzPervasives.tzresult Lwt.t

Given a block b at level l bakes enough blocks to complete a cycle, that is blocks_per_cycle - (l % blocks_per_cycle).

val bake_until_n_cycle_end : ?policy:baker_policy -> int -> t -> t Tezos_base__TzPervasives.tzresult Lwt.t

Bakes enough blocks to end n cycles.

val bake_until_cycle : ?policy:baker_policy -> Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Cycle.t -> t -> t Tezos_base__TzPervasives.tzresult Lwt.t

Bakes enough blocks to reach the cycle.

val prepare_initial_context_params : ?consensus_threshold:int -> ?min_proposal_quorum:int32 -> ?level:int32 -> ?cost_per_byte:Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?liquidity_baking_subsidy: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?endorsing_reward_per_slot: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?baking_reward_bonus_per_slot: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?baking_reward_fixed_portion: Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t -> ?origination_size:int -> ?blocks_per_cycle:int32 -> (Account.t * Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Tez.t) list -> (Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Constants.parametric * Tezos_protocol_012_Psithaca.Protocol.Alpha_context.Block_header.shell_header * Tezos_base__TzPervasives.Block_hash.t, Tezos_base__TzPervasives.tztrace) result Lwt.t

Common util function to create parameters for initial_context function