Module Tezos_alpha_test_helpers.Scenario_base

This module gathers the basic operations used in test scenarios. This includes starting a scenario, baking, checking and manipulating the state, and various wait functions

type t = Block.t * State.t

Usual threaded state for the tests. Contains the current block and the known State.t

type t_incr = Incremental.t * State.t

Threaded state when constructing a block step by step in incremental mode. The operation metadata list is built as operations are getting applied.

val log : ?level:Tezt_core.Cli.Logs.level -> ?color:Tezt_core.Log.Color.t -> ('a, Stdlib.Format.formatter, unit, ('b, 'b) Scenario_dsl.scenarios) Stdlib.format4 -> 'a
val set_baker : ?min_round:int -> string -> (t, t) Scenario_dsl.scenarios

Sets the de facto baker for all future blocks

val exclude_bakers : string list -> (t, t) Scenario_dsl.scenarios

Exclude a list of delegates from baking

val set_payload_round : int option -> (t, t) Scenario_dsl.scenarios
val set_baked_round : ?payload_round:int -> int -> (t, t) Scenario_dsl.scenarios
val unset_baking_policy : (t, t) Scenario_dsl.scenarios

Unsets the baking policy, it returns to default (By_round 0)

Creates a snapshot of the current balances for the given account names. Can be used to check that balances at point A and B in the execution of a test are the same (either nothing happened, or a succession of actions resulted in getting the same values as before

val check_snapshot_balances : ?f: (name:Tezos_base.TzPervasives.String.Map.key -> old_balance:State_account.balance -> new_balance:State_account.balance -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> Tezos_base.TzPervasives.String.Map.key -> (t, t) Scenario_dsl.scenarios

Check balances against a previously defined snapshot

val save_current_rate : (t, t) Scenario_dsl.scenarios

Save the current issuance rate for future use

val check_rate_evolution : (Q.t -> Q.t -> bool) -> (t, t) Scenario_dsl.scenarios

Check that f saved_rate current_rate is true. f is typically a comparison function

val check_failure_aux : ?loc:string -> expected_error: ('a -> Tezos_base.TzPervasives.tztrace -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> ('a -> 'b Tezos_base.TzPervasives.tzresult Lwt.t) -> 'a -> 'a Tezos_base.TzPervasives.tzresult Lwt.t
val check_fail_and_rollback : ?loc:string -> expected_error: ('a -> Tezos_base.TzPervasives.tztrace -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> ('a, 'b) Scenario_dsl.single_scenario -> 'a -> 'a Tezos_base.TzPervasives.tzresult Lwt.t
val assert_failure : ?loc:string -> expected_error: ('a -> Tezos_base.TzPervasives.tztrace -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> ('a, 'b) Scenario_dsl.scenarios -> ('a, 'a) Scenario_dsl.scenarios

Useful function to test expected failures: runs the given branch until it fails, then rollbacks to before execution. Fails if the given branch Succeeds

val assert_success : ?loc:string -> ('a, 'b) Scenario_dsl.scenarios -> ('a, 'a) Scenario_dsl.scenarios

Check a scenario does not fail, and rolls back to before the assert

val assert_failure_in_check_snapshot_balances : loc:string -> ?f: (name:Tezos_base.TzPervasives.String.Map.key -> old_balance:State_account.balance -> new_balance:State_account.balance -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> Tezos_base.TzPervasives.String.Map.key -> (t, t) Scenario_dsl.scenarios
val loop : int -> ('a, 'a) Scenario_dsl.scenarios -> ('a, 'a) Scenario_dsl.scenarios

Loop

val loop_action : int -> ('a -> 'a Tezos_base.TzPervasives.tzresult Lwt.t) -> ('a, 'a) Scenario_dsl.scenarios
val check_balance_field : ?loc:string -> Tezos_base.TzPervasives.String.Map.key -> [< `Bonds | `Liquid | `Pseudotokens | `Staked | `Total | `Unstaked_finalizable | `Unstaked_frozen_total ] -> Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t -> (t, t) Scenario_dsl.scenarios

Check a specific balance field for a specific account is equal to a specific amount

val assert_failure_in_check_balance_field : loc:string -> Tezos_base.TzPervasives.String.Map.key -> [< `Bonds | `Liquid | `Pseudotokens | `Staked | `Total | `Unstaked_finalizable | `Unstaked_frozen_total ] -> Tezos_protocol_alpha.Protocol.Alpha_context.Tez.t -> (t, t) Scenario_dsl.scenarios
val with_metadata : (Block.full_metadata -> ('a * State.t) -> 'b) -> ('a * State.t) -> 'b
val exec_metadata : (Block.full_metadata -> ('a * State.t) -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) -> ('a * State.t, 'a * State.t) Scenario_dsl.scenarios