package octez-protocol-017-PtNairob-libs

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

Module Tezos_017_PtNairob_test_helpers.BlockSource

Sourcetype t = {
  1. hash : Tezos_base.TzPervasives.Block_hash.t;
  2. header : Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Block_header.t;
  3. operations : Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Operation.packed list;
  4. context : Tezos_protocol_environment.Context.t;
    (*

    Resulting context

    *)
}
Sourcetype block = t
Sourceval rpc_ctxt : t Tezos_protocol_017_PtNairob.Environment.RPC_context.simple
Sourcetype baker_policy =
  1. | By_round of int
  2. | By_account of Tezos_protocol_017_PtNairob.Protocol.Alpha_context.public_key_hash
  3. | Excluding of Tezos_protocol_017_PtNairob.Protocol.Alpha_context.public_key_hash list

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

Note that bakers can have active consensus keys different from their regular delegate keys. For the By_account pkh policy, pkh refers to the baker's delegate key. However, for the Excluding pkhs policy, pkhs refer to the baker's active consensus key.

Sourcetype 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.

Sourceval get_next_baker : ?policy:baker_policy -> t -> (Tezos_protocol_017_PtNairob.Protocol.Alpha_context.public_key_hash * Tezos_protocol_017_PtNairob.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.

Sourceval get_round : block -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Round.t Tezos_base.TzPervasives.tzresult
Sourcemodule Forge : sig ... end
Sourceval check_constants_consistency : Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Constants.Parametric.t -> unit Tezos_base.TzPervasives.tzresult Lwt.t
Sourceval genesis : ?commitments: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Commitment.t list -> ?consensus_threshold:int -> ?min_proposal_quorum:int32 -> ?bootstrap_contracts: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Parameters.bootstrap_contract list -> ?level:int32 -> ?cost_per_byte:Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?liquidity_baking_subsidy: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?endorsing_reward_per_slot: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?baking_reward_bonus_per_slot: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?baking_reward_fixed_portion: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?origination_size:int -> ?blocks_per_cycle:int32 -> ?cycles_per_voting_period:int32 -> ?sc_rollup_enable:bool -> ?sc_rollup_arith_pvm_enable:bool -> ?dal_enable:bool -> ?zk_rollup_enable:bool -> ?hard_gas_limit_per_block: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Parameters.bootstrap_account 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.

Sourceval genesis_with_parameters : Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Parameters.t -> block Tezos_base.TzPervasives.tzresult Lwt.t
Sourceval alpha_context : ?commitments: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Commitment.t list -> ?min_proposal_quorum:int32 -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Parameters.bootstrap_account list -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.t 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.

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

Sourceval get_construction_vstate : ?policy:baker_policy -> ?timestamp:Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Timestamp.time -> ?protocol_data:Tezos_protocol_017_PtNairob.Protocol.block_header_data option -> block -> (Tezos_protocol_017_PtNairob.Protocol.validation_state * Tezos_protocol_017_PtNairob.Protocol.application_state) Tezos_base.TzPervasives.tzresult Lwt.t

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

Sourceval apply : Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Block_header.block_header -> ?operations: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Operation.packed list -> ?allow_manager_failures:bool -> t -> t Tezos_base.TzPervasives.tzresult Lwt.t

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

Sourceval bake : ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> ?payload_round: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Round.t option -> ?locked_round: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Round.t option -> ?policy:baker_policy -> ?timestamp:Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Timestamp.time -> ?operation: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Operation.packed -> ?operations: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Operation.packed list -> ?liquidity_baking_toggle_vote: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> ?check_size:bool -> t -> t Tezos_base.TzPervasives.tzresult Lwt.t

bake b returns a block b' which has as predecessor block b. Optional parameter policy allows to pick the next baker in several ways. If check_size is true (the default case), then the function checks that the operations passed as arguments satisfy the size limit of Tezos operations, as defined in the protocol. 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. Setting allow_manager_failures (default=false), allows baking blocks with manager operation(s) that are valid but that could fail during their application. If this is not set, the block is correctly baked but the operations' application will fail silently. For examples see seed.ml or double_baking.ml

Sourceval bake_n : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_toggle_vote: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> int -> t -> block Tezos_base.TzPervasives.tzresult Lwt.t

Bakes n blocks.

Sourceval bake_until_level : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_toggle_vote: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Raw_level.t -> t -> block Tezos_base.TzPervasives.tzresult Lwt.t

Bakes until the given level is reached.

Sourceval bake_n_with_all_balance_updates : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_toggle_vote: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> int -> t -> (block * Tezos_protocol_017_PtNairob.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. *

Sourceval bake_n_with_origination_results : ?baking_mode:baking_mode -> ?policy:baker_policy -> int -> t -> (block * Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Kind.origination Tezos_protocol_017_PtNairob.Protocol.Apply_results.successful_manager_operation_result list) Tezos_base.TzPervasives.tzresult Lwt.t

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

Sourceval bake_n_with_liquidity_baking_toggle_ema : ?baking_mode:baking_mode -> ?policy:baker_policy -> ?liquidity_baking_toggle_vote: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> int -> t -> (block * Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Liquidity_baking.Toggle_EMA.t) Tezos_base.TzPervasives.tzresult Lwt.t

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

Sourceval current_cycle : t -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Cycle.t Tezos_base.TzPervasives.tzresult Lwt.t
Sourceval 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).

Sourceval bake_until_n_cycle_end : ?policy:baker_policy -> int -> t -> t Tezos_base.TzPervasives.tzresult Lwt.t

Bakes enough blocks to end n cycles.

Sourceval bake_until_cycle : ?policy:baker_policy -> Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Cycle.t -> t -> t Tezos_base.TzPervasives.tzresult Lwt.t

Bakes enough blocks to reach the cycle.

Sourceval prepare_initial_context_params : ?consensus_threshold:int -> ?min_proposal_quorum:int32 -> ?level:int32 -> ?cost_per_byte:Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?liquidity_baking_subsidy: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?endorsing_reward_per_slot: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?baking_reward_bonus_per_slot: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?baking_reward_fixed_portion: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Tez.t -> ?origination_size:int -> ?blocks_per_cycle:int32 -> ?cycles_per_voting_period:int32 -> ?sc_rollup_enable:bool -> ?sc_rollup_arith_pvm_enable:bool -> ?dal_enable:bool -> ?zk_rollup_enable:bool -> ?hard_gas_limit_per_block: Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> unit -> (Tezos_protocol_017_PtNairob.Protocol.Alpha_context.Constants.Parametric.t * Tezos_protocol_017_PtNairob.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

OCaml

Innovation. Community. Security.