From 24e126a9963963ba8af76a42c789ba87c45ae1db Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Tue, 27 May 2025 10:57:39 +0200 Subject: [PATCH 1/9] Proto/tests: incremental helpers with metadata --- .../lib_protocol/test/helpers/incremental.ml | 81 ++++++++++++------- .../lib_protocol/test/helpers/incremental.mli | 22 ++++- 2 files changed, 71 insertions(+), 32 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index decfedcbf6da..a8611a4da15f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -213,8 +213,8 @@ let validate_operation ?expect_failure ?check_size st op = | None, Ok validation_state -> return {st with state = (validation_state, application_state)} -let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure - ?check_size st op = +let add_operation_with_metadata ?expect_failure ?expect_apply_failure + ?allow_manager_failure ?check_size st op = let open Lwt_result_wrap_syntax in let open Apply_results in let* st = validate_operation ?expect_failure ?check_size st op in @@ -222,8 +222,8 @@ let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure | Some _ -> (* The expected failure has already been observed in [validate_operation]. *) - return st - | None -> ( + return (st, No_operation_metadata) + | None -> let validation_state, application_state = st.state in let oph = Operation.hash_packed op in let*@ application_state, metadata = @@ -237,22 +237,39 @@ let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure rev_tickets = metadata :: st.rev_tickets; } in - match allow_manager_failure with - | Some true -> return st - | None | Some false -> ( - match (expect_apply_failure, metadata) with - | None, No_operation_metadata -> return st - | None, Operation_metadata result -> - let*? () = detect_script_failure result in - return st - | Some _, No_operation_metadata -> - failwith "Error expected while adding operation" - | Some f, Operation_metadata result -> ( - match detect_script_failure result with - | Ok _ -> failwith "Error expected while adding operation" - | Error err -> - let* () = f err in - return st))) + let* st = + match allow_manager_failure with + | Some true -> return st + | None | Some false -> ( + match (expect_apply_failure, metadata) with + | None, No_operation_metadata -> return st + | None, Operation_metadata result -> + let*? () = detect_script_failure result in + return st + | Some _, No_operation_metadata -> + failwith "Error expected while adding operation" + | Some f, Operation_metadata result -> ( + match detect_script_failure result with + | Ok _ -> failwith "Error expected while adding operation" + | Error err -> + let* () = f err in + return st)) + in + return (st, metadata) + +let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure + ?check_size st op = + let open Lwt_result_wrap_syntax in + let* st, _ = + add_operation_with_metadata + ?expect_failure + ?expect_apply_failure + ?allow_manager_failure + ?check_size + st + op + in + return st let finalize_validation_and_application (validation_state, application_state) shell_header = @@ -260,7 +277,7 @@ let finalize_validation_and_application (validation_state, application_state) let* () = finalize_validation validation_state in finalize_application application_state shell_header -let finalize_block st = +let finalize_block_with_metadata st = let open Lwt_result_wrap_syntax in let operations = List.rev st.rev_operations in let operations_hash = @@ -274,7 +291,7 @@ let finalize_block st = operations_hash; } in - let*@ validation_result, _ = + let*@ validation_result, metadata = finalize_validation_and_application st.state (Some shell_header) in let operations = List.rev st.rev_operations in @@ -296,13 +313,19 @@ let finalize_block st = in let hash = Block_header.hash header in return - { - Block.hash; - header; - operations; - context = validation_result.context; - constants = st.constants; - } + ( { + Block.hash; + header; + operations; + context = validation_result.context; + constants = st.constants; + }, + metadata ) + +let finalize_block st = + let open Lwt_result_wrap_syntax in + let* st, _ = finalize_block_with_metadata st in + return st let assert_validate_operation_fails expect_failure op block = let open Lwt_result_syntax in diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli index a50718801060..285a8ac69cbd 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli @@ -82,12 +82,13 @@ val validate_operation : Operation.packed -> incremental tzresult Lwt.t -(** [add_operation ?expect_failure ?expect_apply_failure +(** [add_operation_with_metadata ?expect_failure ?expect_apply_failure ?allow_manager_failure ?check_size i op] tries to validate then apply [op] in the validation and application state of [i]. If the validation of [op] succeeds, the function returns the incremental value with a validation state updated after the application of - [op]. Otherwise raise the error from the validation of [op]. + [op], and the operation metadata associated to the operation. + Otherwise raise the error from the validation of [op]. Optional arguments allow to override defaults: @@ -109,6 +110,17 @@ val validate_operation : enable the check that an operation size should not exceed [Constants_repr.max_operation_data_length]. Enabled (set to [true]) by default. *) +val add_operation_with_metadata : + ?expect_failure:(error list -> unit tzresult Lwt.t) -> + ?expect_apply_failure:(error list -> unit tzresult Lwt.t) -> + ?allow_manager_failure:bool -> + ?check_size:bool -> + incremental -> + Operation.packed -> + (incremental * Apply_results.packed_operation_metadata) tzresult Lwt.t + +(** Same as [add_operation_with_metadata], but without returning the metadata. + The metadata is still added in the incremental state. *) val add_operation : ?expect_failure:(error list -> unit tzresult Lwt.t) -> ?expect_apply_failure:(error list -> unit tzresult Lwt.t) -> @@ -118,9 +130,13 @@ val add_operation : Operation.packed -> incremental tzresult Lwt.t -(** [finalize_block i] creates a [Block.t] based on the protocol +(** [finalize_block_with_metadata i] creates a [Block.t] based on the protocol states and the operations contained in [i]. The function calls [Main.finalize_application] to compute a new context. *) +val finalize_block_with_metadata : + incremental -> (Block.t * block_header_metadata) tzresult Lwt.t + +(** Same as [finalize_block_with_metadata], but without the metadata *) val finalize_block : incremental -> Block.t tzresult Lwt.t (** [assert_validate_operation_fails expect_failure operation block] -- GitLab From ffebd3eafa2c2be40ee063e7e2a0b5a967fa79fd Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 25 Jun 2025 11:58:33 +0200 Subject: [PATCH 2/9] Dal/Crypto/Tests: add precomputaton as optional argument --- src/lib_crypto_dal/cryptobox.ml | 8 ++++++-- src/lib_crypto_dal/cryptobox.mli | 1 + tezt/lib_tezos/dal_common.ml | 3 ++- tezt/lib_tezos/dal_common.mli | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib_crypto_dal/cryptobox.ml b/src/lib_crypto_dal/cryptobox.ml index 6079b905cf9a..e3dd8140adcb 100644 --- a/src/lib_crypto_dal/cryptobox.ml +++ b/src/lib_crypto_dal/cryptobox.ml @@ -1225,9 +1225,13 @@ module Internal_for_tests = struct let x = Random.int 26 in Char.chr (x + Char.code 'a')) - let get_commitment_and_shards_with_proofs cryptobox ~slot = + let get_commitment_and_shards_with_proofs ?precomputation cryptobox ~slot = let open Result_syntax in - let* precomputation = precompute_shards_proofs cryptobox in + let* precomputation = + match precomputation with + | None -> precompute_shards_proofs cryptobox + | Some x -> return x + in let* polynomial = polynomial_from_slot cryptobox slot in let shards = shards_from_polynomial cryptobox polynomial in let shard_proofs = diff --git a/src/lib_crypto_dal/cryptobox.mli b/src/lib_crypto_dal/cryptobox.mli index c4bb67a26db2..df89a5429615 100644 --- a/src/lib_crypto_dal/cryptobox.mli +++ b/src/lib_crypto_dal/cryptobox.mli @@ -582,6 +582,7 @@ module Internal_for_tests : sig (** Given a slot, it returns the slot's commitment, its proof, and the shards and their proof. *) val get_commitment_and_shards_with_proofs : + ?precomputation:shards_proofs_precomputation -> t -> slot:bytes -> ( commitment * commitment_proof * (shard * shard_proof) Seq.t, diff --git a/tezt/lib_tezos/dal_common.ml b/tezt/lib_tezos/dal_common.ml index 7fac1459ba68..b588f2c7d4c8 100644 --- a/tezt/lib_tezos/dal_common.ml +++ b/tezt/lib_tezos/dal_common.ml @@ -659,10 +659,11 @@ module Helpers = struct e | Ok () -> unit - let get_commitment_and_shards_with_proofs cryptobox ~slot = + let get_commitment_and_shards_with_proofs ?precomputation cryptobox ~slot = let res = Tezos_crypto_dal.Cryptobox.Internal_for_tests .get_commitment_and_shards_with_proofs + ?precomputation cryptobox ~slot in diff --git a/tezt/lib_tezos/dal_common.mli b/tezt/lib_tezos/dal_common.mli index 3da79da470be..ee0105fb5eb3 100644 --- a/tezt/lib_tezos/dal_common.mli +++ b/tezt/lib_tezos/dal_common.mli @@ -101,6 +101,7 @@ module Helpers : sig val init_prover : ?__LOC__:string -> unit -> unit Lwt.t val get_commitment_and_shards_with_proofs : + ?precomputation:Cryptobox.shards_proofs_precomputation -> Cryptobox.t -> slot:bytes -> Cryptobox.commitment -- GitLab From eb8b9ba3fee88c313b8e344e211955de03ccf2fa Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 2 Jul 2025 11:41:16 +0200 Subject: [PATCH 3/9] Proto/tests: change option option into option --- .../lib_protocol/test/helpers/block.ml | 6 ++-- .../lib_protocol/test/helpers/block.mli | 16 +++++----- .../integration/consensus/test_aggregate.ml | 32 +++++++++---------- .../integration/consensus/test_attestation.ml | 4 +-- .../test/integration/consensus/test_baking.ml | 4 +-- .../consensus/test_double_baking.ml | 4 +-- .../consensus/test_preattestation_functor.ml | 6 ++-- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 052ca8d58d6e..df34be2c2649 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -303,9 +303,9 @@ module Forge = struct let t = Array.map List.rev t in Array.to_list t - let forge_header ?(locked_round = None) ?(payload_round = None) - ?(policy = By_round 0) ?timestamp ?(operations = []) - ?liquidity_baking_toggle_vote ?adaptive_issuance_vote pred = + let forge_header ?locked_round ?payload_round ?(policy = By_round 0) + ?timestamp ?(operations = []) ?liquidity_baking_toggle_vote + ?adaptive_issuance_vote pred = let open Lwt_result_wrap_syntax in let pred_fitness = match Fitness.from_raw pred.header.shell.fitness with diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.mli b/src/proto_alpha/lib_protocol/test/helpers/block.mli index 8b385294ab6b..a703ec3ec13d 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/block.mli @@ -96,8 +96,8 @@ module Forge : sig (** Forges a correct header following the policy. The header can then be modified and applied with [apply]. *) val forge_header : - ?locked_round:Alpha_context.Round.t option -> - ?payload_round:Round.t option -> + ?locked_round:Alpha_context.Round.t -> + ?payload_round:Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operations:Operation.packed list -> @@ -221,8 +221,8 @@ val apply : val bake : ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> - ?payload_round:Round.t option -> - ?locked_round:Alpha_context.Round.t option -> + ?payload_round:Round.t -> + ?locked_round:Alpha_context.Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operation:Operation.packed -> @@ -235,12 +235,12 @@ val bake : (** Variant of [bake] that returns the block metadata of the baked block. **) val bake_with_metadata : - ?locked_round:Alpha_context.Round.t option -> + ?locked_round:Alpha_context.Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operation:Operation.packed -> ?operations:Operation.packed list -> - ?payload_round:Round.t option -> + ?payload_round:Round.t -> ?check_size:bool -> ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> @@ -308,10 +308,10 @@ val bake_n_with_liquidity_baking_toggle_ema : (** Variant of [bake_n] that returns the block metadata of the last baked block. [n] must be positive, otherwise a single block is baked. **) val bake_n_with_metadata : - ?locked_round:Round.t option -> + ?locked_round:Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> - ?payload_round:Round.t option -> + ?payload_round:Round.t -> ?check_size:bool -> ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml index 4fd506e1c658..9002020fe36e 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_aggregate.ml @@ -304,8 +304,8 @@ let test_preattestations_aggregate_with_a_single_delegate () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -366,8 +366,8 @@ let test_preattestations_aggregate_with_multiple_delegates () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -439,8 +439,8 @@ let test_preattestations_aggregate_invalid_signature () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation:aggregate_with_incorrect_signature block in @@ -489,8 +489,8 @@ let test_preattestations_aggregate_non_bls_delegate () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -587,8 +587,8 @@ let test_multiple_aggregates_per_block_forbidden () = let*! res = Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operations:aggregates block in @@ -620,8 +620,8 @@ let test_eligible_preattestation_must_be_aggregated () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -700,8 +700,8 @@ let test_empty_committee () = let*! res = Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -745,8 +745,8 @@ let test_metadata_committee_is_correctly_ordered () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operations:[attestations; preattestations] block in diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_attestation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_attestation.ml index 8a6fc0bc146c..4e96d8c7aa11 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_attestation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_attestation.ml @@ -532,8 +532,8 @@ let test_no_conflict_with_preattestation_block () = let bake_both_ops baking_mode = Block.bake ~baking_mode - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_round 1) ~operations:[op_attestation; op_preattestation] predecessor diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml index 3745668e021b..241b99a71b04 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml @@ -293,8 +293,8 @@ let test_rewards_block_and_payload_producer () = let baker_b2' = Context.get_first_different_baker baker_b2 bakers in let* b2' = Block.bake - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_account baker_b2') ~operations:(preattestations @ attestations @ [tx]) b1 diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml index 46f9e1262515..26a45df62358 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -370,8 +370,8 @@ let test_payload_producer_gets_evidence_rewards () = in let* b' = Block.bake - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_account baker1) ~operations:(preattestations @ [db_evidence]) b1 diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preattestation_functor.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preattestation_functor.ml index 61dfdf49e423..8637a9c24c9a 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preattestation_functor.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preattestation_functor.ml @@ -48,8 +48,8 @@ end = struct let bake = Block.bake ~baking_mode:Mode.baking_mode - let aux_simple_preattestation_inclusion ?(payload_round = Some Round.zero) - ?(locked_round = Some Round.zero) ?(block_round = 1) + let aux_simple_preattestation_inclusion ?(payload_round = Round.zero) + ?(locked_round = Round.zero) ?(block_round = 1) ?(preattestation_round = Round.zero) ?(preattested_block = fun _predpred _pred curr -> curr) ?(mk_ops = fun op -> [op]) @@ -236,7 +236,7 @@ end = struct in aux_simple_preattestation_inclusion ~preattestation_round:Round.zero - ~locked_round:(Some (Round.succ Round.zero)) + ~locked_round:(Round.succ Round.zero) ~block_round:2 ~loc:__LOC__ ~post_process -- GitLab From b01dbe2995464406e48b4462e796ff9e3d16b0ad Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Thu, 3 Jul 2025 10:19:09 +0200 Subject: [PATCH 4/9] Proto/tests/incremental: choose payload at begin_construction --- .../lib_protocol/test/helpers/incremental.ml | 26 +++++++++++++------ .../lib_protocol/test/helpers/incremental.mli | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index a8611a4da15f..50a5f85e6cb5 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -76,13 +76,15 @@ let begin_validation_and_application ctxt chain_id mode ~predecessor = let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) ?(policy = Block.By_round 0) ?liquidity_baking_toggle_vote - ?adaptive_issuance_vote (predecessor : Block.t) = + ?adaptive_issuance_vote ?payload_round ?(payload = []) + (predecessor : Block.t) = let open Lwt_result_wrap_syntax in let* delegate, _consensus_key, round, real_timestamp = Block.get_next_baker ~policy predecessor in let* delegate = Account.find delegate in - let*?@ payload_round = Round.of_int round in + let payload_round = Option.value ~default:round payload_round in + let*?@ payload_round = Round.of_int payload_round in let timestamp = Option.value ~default:real_timestamp timestamp in let* seed_nonce_hash = match seed_nonce_hash with @@ -108,12 +110,25 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) operations_hash = Operation_list_list_hash.zero; } in + let operations = Block.Forge.classify_operations payload in + let non_consensus_operations = + List.concat (match List.tl operations with None -> [] | Some l -> l) + in + let operations_hash = + List.map Operation.hash_packed non_consensus_operations + in + let payload_hash = + Block_payload.hash + ~predecessor_hash:shell.predecessor + ~payload_round + operations_hash + in let* contents = Block.Forge.contents ?seed_nonce_hash ?adaptive_issuance_vote ?liquidity_baking_toggle_vote - ~payload_hash:Block_payload_hash.zero + ~payload_hash ~payload_round shell in @@ -294,11 +309,6 @@ let finalize_block_with_metadata st = let*@ validation_result, metadata = finalize_validation_and_application st.state (Some shell_header) in - let operations = List.rev st.rev_operations in - let operations_hash = - Operation_list_list_hash.compute - [Operation_list_hash.compute (List.map Operation.hash_packed operations)] - in let header = { st.header with diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli index 285a8ac69cbd..02e1276fdc21 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli @@ -56,6 +56,8 @@ val begin_construction : ?policy:Block.baker_policy -> ?liquidity_baking_toggle_vote:Per_block_votes_repr.per_block_vote -> ?adaptive_issuance_vote:Per_block_votes_repr.per_block_vote -> + ?payload_round:int -> + ?payload:packed_operation list -> Block.t -> incremental tzresult Lwt.t -- GitLab From c3b2772fde6fb28ead522e05c66fcfa910ea502c Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Thu, 3 Jul 2025 16:48:46 +0200 Subject: [PATCH 5/9] Proto/tests: Incremental.rev_operations --- src/proto_alpha/lib_protocol/test/helpers/incremental.ml | 2 ++ src/proto_alpha/lib_protocol/test/helpers/incremental.mli | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index 50a5f85e6cb5..44d8ed58a0b2 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -43,6 +43,8 @@ let predecessor {predecessor; _} = predecessor let header {header; _} = header +let rev_operations {rev_operations; _} = rev_operations + let rev_tickets {rev_tickets; _} = rev_tickets let validation_state {state = vs, _; _} = vs diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli index 02e1276fdc21..301765a07215 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.mli @@ -34,6 +34,8 @@ val predecessor : incremental -> Block.t val header : incremental -> Block_header.t +val rev_operations : incremental -> Operation.packed list + val rev_tickets : incremental -> operation_receipt list val validation_state : incremental -> validation_state -- GitLab From d1887f24ddb36d787a1f2bf414e6d2ca50ea7e9d Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Mon, 7 Jul 2025 16:26:30 +0200 Subject: [PATCH 6/9] 023_PtSeouLo/Proto/tests: incremental helpers with metadata Porting to proto 023_PtSeouLo 24e126a9963963ba8af76a42c789ba87c45ae1db - Proto/tests: incremental helpers with metadata --- .../lib_protocol/test/helpers/incremental.ml | 81 ++++++++++++------- .../lib_protocol/test/helpers/incremental.mli | 22 ++++- 2 files changed, 71 insertions(+), 32 deletions(-) diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml index decfedcbf6da..a8611a4da15f 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml @@ -213,8 +213,8 @@ let validate_operation ?expect_failure ?check_size st op = | None, Ok validation_state -> return {st with state = (validation_state, application_state)} -let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure - ?check_size st op = +let add_operation_with_metadata ?expect_failure ?expect_apply_failure + ?allow_manager_failure ?check_size st op = let open Lwt_result_wrap_syntax in let open Apply_results in let* st = validate_operation ?expect_failure ?check_size st op in @@ -222,8 +222,8 @@ let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure | Some _ -> (* The expected failure has already been observed in [validate_operation]. *) - return st - | None -> ( + return (st, No_operation_metadata) + | None -> let validation_state, application_state = st.state in let oph = Operation.hash_packed op in let*@ application_state, metadata = @@ -237,22 +237,39 @@ let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure rev_tickets = metadata :: st.rev_tickets; } in - match allow_manager_failure with - | Some true -> return st - | None | Some false -> ( - match (expect_apply_failure, metadata) with - | None, No_operation_metadata -> return st - | None, Operation_metadata result -> - let*? () = detect_script_failure result in - return st - | Some _, No_operation_metadata -> - failwith "Error expected while adding operation" - | Some f, Operation_metadata result -> ( - match detect_script_failure result with - | Ok _ -> failwith "Error expected while adding operation" - | Error err -> - let* () = f err in - return st))) + let* st = + match allow_manager_failure with + | Some true -> return st + | None | Some false -> ( + match (expect_apply_failure, metadata) with + | None, No_operation_metadata -> return st + | None, Operation_metadata result -> + let*? () = detect_script_failure result in + return st + | Some _, No_operation_metadata -> + failwith "Error expected while adding operation" + | Some f, Operation_metadata result -> ( + match detect_script_failure result with + | Ok _ -> failwith "Error expected while adding operation" + | Error err -> + let* () = f err in + return st)) + in + return (st, metadata) + +let add_operation ?expect_failure ?expect_apply_failure ?allow_manager_failure + ?check_size st op = + let open Lwt_result_wrap_syntax in + let* st, _ = + add_operation_with_metadata + ?expect_failure + ?expect_apply_failure + ?allow_manager_failure + ?check_size + st + op + in + return st let finalize_validation_and_application (validation_state, application_state) shell_header = @@ -260,7 +277,7 @@ let finalize_validation_and_application (validation_state, application_state) let* () = finalize_validation validation_state in finalize_application application_state shell_header -let finalize_block st = +let finalize_block_with_metadata st = let open Lwt_result_wrap_syntax in let operations = List.rev st.rev_operations in let operations_hash = @@ -274,7 +291,7 @@ let finalize_block st = operations_hash; } in - let*@ validation_result, _ = + let*@ validation_result, metadata = finalize_validation_and_application st.state (Some shell_header) in let operations = List.rev st.rev_operations in @@ -296,13 +313,19 @@ let finalize_block st = in let hash = Block_header.hash header in return - { - Block.hash; - header; - operations; - context = validation_result.context; - constants = st.constants; - } + ( { + Block.hash; + header; + operations; + context = validation_result.context; + constants = st.constants; + }, + metadata ) + +let finalize_block st = + let open Lwt_result_wrap_syntax in + let* st, _ = finalize_block_with_metadata st in + return st let assert_validate_operation_fails expect_failure op block = let open Lwt_result_syntax in diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli index a50718801060..285a8ac69cbd 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli @@ -82,12 +82,13 @@ val validate_operation : Operation.packed -> incremental tzresult Lwt.t -(** [add_operation ?expect_failure ?expect_apply_failure +(** [add_operation_with_metadata ?expect_failure ?expect_apply_failure ?allow_manager_failure ?check_size i op] tries to validate then apply [op] in the validation and application state of [i]. If the validation of [op] succeeds, the function returns the incremental value with a validation state updated after the application of - [op]. Otherwise raise the error from the validation of [op]. + [op], and the operation metadata associated to the operation. + Otherwise raise the error from the validation of [op]. Optional arguments allow to override defaults: @@ -109,6 +110,17 @@ val validate_operation : enable the check that an operation size should not exceed [Constants_repr.max_operation_data_length]. Enabled (set to [true]) by default. *) +val add_operation_with_metadata : + ?expect_failure:(error list -> unit tzresult Lwt.t) -> + ?expect_apply_failure:(error list -> unit tzresult Lwt.t) -> + ?allow_manager_failure:bool -> + ?check_size:bool -> + incremental -> + Operation.packed -> + (incremental * Apply_results.packed_operation_metadata) tzresult Lwt.t + +(** Same as [add_operation_with_metadata], but without returning the metadata. + The metadata is still added in the incremental state. *) val add_operation : ?expect_failure:(error list -> unit tzresult Lwt.t) -> ?expect_apply_failure:(error list -> unit tzresult Lwt.t) -> @@ -118,9 +130,13 @@ val add_operation : Operation.packed -> incremental tzresult Lwt.t -(** [finalize_block i] creates a [Block.t] based on the protocol +(** [finalize_block_with_metadata i] creates a [Block.t] based on the protocol states and the operations contained in [i]. The function calls [Main.finalize_application] to compute a new context. *) +val finalize_block_with_metadata : + incremental -> (Block.t * block_header_metadata) tzresult Lwt.t + +(** Same as [finalize_block_with_metadata], but without the metadata *) val finalize_block : incremental -> Block.t tzresult Lwt.t (** [assert_validate_operation_fails expect_failure operation block] -- GitLab From 26e3c9fd16dc6f1d8696669799d47b0b8f153865 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Mon, 7 Jul 2025 16:28:30 +0200 Subject: [PATCH 7/9] 023_PtSeouLo/Proto/tests: change option option into option Porting to proto 023_PtSeouLo eb8b9ba3fee88c313b8e344e211955de03ccf2fa - Proto/tests: change option option into option --- .../lib_protocol/test/helpers/block.ml | 6 ++-- .../lib_protocol/test/helpers/block.mli | 16 +++++----- .../integration/consensus/test_aggregate.ml | 32 +++++++++---------- .../integration/consensus/test_attestation.ml | 4 +-- .../test/integration/consensus/test_baking.ml | 4 +-- .../consensus/test_double_baking.ml | 4 +-- .../consensus/test_preattestation_functor.ml | 6 ++-- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.ml b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.ml index e5bd1d9f025d..80e6286b7b35 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.ml @@ -303,9 +303,9 @@ module Forge = struct let t = Array.map List.rev t in Array.to_list t - let forge_header ?(locked_round = None) ?(payload_round = None) - ?(policy = By_round 0) ?timestamp ?(operations = []) - ?liquidity_baking_toggle_vote ?adaptive_issuance_vote pred = + let forge_header ?locked_round ?payload_round ?(policy = By_round 0) + ?timestamp ?(operations = []) ?liquidity_baking_toggle_vote + ?adaptive_issuance_vote pred = let open Lwt_result_wrap_syntax in let pred_fitness = match Fitness.from_raw pred.header.shell.fitness with diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.mli b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.mli index 8b385294ab6b..a703ec3ec13d 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.mli +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/block.mli @@ -96,8 +96,8 @@ module Forge : sig (** Forges a correct header following the policy. The header can then be modified and applied with [apply]. *) val forge_header : - ?locked_round:Alpha_context.Round.t option -> - ?payload_round:Round.t option -> + ?locked_round:Alpha_context.Round.t -> + ?payload_round:Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operations:Operation.packed list -> @@ -221,8 +221,8 @@ val apply : val bake : ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> - ?payload_round:Round.t option -> - ?locked_round:Alpha_context.Round.t option -> + ?payload_round:Round.t -> + ?locked_round:Alpha_context.Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operation:Operation.packed -> @@ -235,12 +235,12 @@ val bake : (** Variant of [bake] that returns the block metadata of the baked block. **) val bake_with_metadata : - ?locked_round:Alpha_context.Round.t option -> + ?locked_round:Alpha_context.Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> ?operation:Operation.packed -> ?operations:Operation.packed list -> - ?payload_round:Round.t option -> + ?payload_round:Round.t -> ?check_size:bool -> ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> @@ -308,10 +308,10 @@ val bake_n_with_liquidity_baking_toggle_ema : (** Variant of [bake_n] that returns the block metadata of the last baked block. [n] must be positive, otherwise a single block is baked. **) val bake_n_with_metadata : - ?locked_round:Round.t option -> + ?locked_round:Round.t -> ?policy:baker_policy -> ?timestamp:Timestamp.time -> - ?payload_round:Round.t option -> + ?payload_round:Round.t -> ?check_size:bool -> ?baking_mode:baking_mode -> ?allow_manager_failures:bool -> diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_aggregate.ml b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_aggregate.ml index fdd812ba0f11..fca1950f9f60 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_aggregate.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_aggregate.ml @@ -305,8 +305,8 @@ let test_preattestations_aggregate_with_a_single_delegate () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -367,8 +367,8 @@ let test_preattestations_aggregate_with_multiple_delegates () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -440,8 +440,8 @@ let test_preattestations_aggregate_invalid_signature () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation:aggregate_with_incorrect_signature block in @@ -490,8 +490,8 @@ let test_preattestations_aggregate_non_bls_delegate () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -588,8 +588,8 @@ let test_multiple_aggregates_per_block_forbidden () = let*! res = Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operations:aggregates block in @@ -621,8 +621,8 @@ let test_eligible_preattestation_must_be_aggregated () = let round_zero = Alpha_context.Round.zero in Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -701,8 +701,8 @@ let test_empty_committee () = let*! res = Block.bake ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operation block in @@ -746,8 +746,8 @@ let test_metadata_committee_is_correctly_ordered () = let round_zero = Alpha_context.Round.zero in Block.bake_with_metadata ~policy:(By_round 1) - ~payload_round:(Some round_zero) - ~locked_round:(Some round_zero) + ~payload_round:round_zero + ~locked_round:round_zero ~operations:[attestations; preattestations] block in diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_attestation.ml b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_attestation.ml index d6e745493a62..4bb92874260c 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_attestation.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_attestation.ml @@ -532,8 +532,8 @@ let test_no_conflict_with_preattestation_block () = let bake_both_ops baking_mode = Block.bake ~baking_mode - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_round 1) ~operations:[op_attestation; op_preattestation] predecessor diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_baking.ml b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_baking.ml index 9bc5d164e164..6f176e366bc2 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_baking.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_baking.ml @@ -293,8 +293,8 @@ let test_rewards_block_and_payload_producer () = let baker_b2' = Context.get_first_different_baker baker_b2 bakers in let* b2' = Block.bake - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_account baker_b2') ~operations:(preattestations @ attestations @ [tx]) b1 diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_double_baking.ml index f53b86a110bf..9861c08b0d94 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -370,8 +370,8 @@ let test_payload_producer_gets_evidence_rewards () = in let* b' = Block.bake - ~payload_round:(Some Round.zero) - ~locked_round:(Some Round.zero) + ~payload_round:Round.zero + ~locked_round:Round.zero ~policy:(By_account baker1) ~operations:(preattestations @ [db_evidence]) b1 diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_preattestation_functor.ml b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_preattestation_functor.ml index 61dfdf49e423..8637a9c24c9a 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_preattestation_functor.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/integration/consensus/test_preattestation_functor.ml @@ -48,8 +48,8 @@ end = struct let bake = Block.bake ~baking_mode:Mode.baking_mode - let aux_simple_preattestation_inclusion ?(payload_round = Some Round.zero) - ?(locked_round = Some Round.zero) ?(block_round = 1) + let aux_simple_preattestation_inclusion ?(payload_round = Round.zero) + ?(locked_round = Round.zero) ?(block_round = 1) ?(preattestation_round = Round.zero) ?(preattested_block = fun _predpred _pred curr -> curr) ?(mk_ops = fun op -> [op]) @@ -236,7 +236,7 @@ end = struct in aux_simple_preattestation_inclusion ~preattestation_round:Round.zero - ~locked_round:(Some (Round.succ Round.zero)) + ~locked_round:(Round.succ Round.zero) ~block_round:2 ~loc:__LOC__ ~post_process -- GitLab From 6eac76c4b7999390a5a524a1188eaa3a1d490d68 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Mon, 7 Jul 2025 16:28:40 +0200 Subject: [PATCH 8/9] 023_PtSeouLo/Proto/tests/incremental: choose payload at begin_construction Porting to proto 023_PtSeouLo b01dbe2995464406e48b4462e796ff9e3d16b0ad - Proto/tests/incremental: choose payload at begin_construction --- .../lib_protocol/test/helpers/incremental.ml | 26 +++++++++++++------ .../lib_protocol/test/helpers/incremental.mli | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml index a8611a4da15f..50a5f85e6cb5 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml @@ -76,13 +76,15 @@ let begin_validation_and_application ctxt chain_id mode ~predecessor = let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) ?(policy = Block.By_round 0) ?liquidity_baking_toggle_vote - ?adaptive_issuance_vote (predecessor : Block.t) = + ?adaptive_issuance_vote ?payload_round ?(payload = []) + (predecessor : Block.t) = let open Lwt_result_wrap_syntax in let* delegate, _consensus_key, round, real_timestamp = Block.get_next_baker ~policy predecessor in let* delegate = Account.find delegate in - let*?@ payload_round = Round.of_int round in + let payload_round = Option.value ~default:round payload_round in + let*?@ payload_round = Round.of_int payload_round in let timestamp = Option.value ~default:real_timestamp timestamp in let* seed_nonce_hash = match seed_nonce_hash with @@ -108,12 +110,25 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) operations_hash = Operation_list_list_hash.zero; } in + let operations = Block.Forge.classify_operations payload in + let non_consensus_operations = + List.concat (match List.tl operations with None -> [] | Some l -> l) + in + let operations_hash = + List.map Operation.hash_packed non_consensus_operations + in + let payload_hash = + Block_payload.hash + ~predecessor_hash:shell.predecessor + ~payload_round + operations_hash + in let* contents = Block.Forge.contents ?seed_nonce_hash ?adaptive_issuance_vote ?liquidity_baking_toggle_vote - ~payload_hash:Block_payload_hash.zero + ~payload_hash ~payload_round shell in @@ -294,11 +309,6 @@ let finalize_block_with_metadata st = let*@ validation_result, metadata = finalize_validation_and_application st.state (Some shell_header) in - let operations = List.rev st.rev_operations in - let operations_hash = - Operation_list_list_hash.compute - [Operation_list_hash.compute (List.map Operation.hash_packed operations)] - in let header = { st.header with diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli index 285a8ac69cbd..02e1276fdc21 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli @@ -56,6 +56,8 @@ val begin_construction : ?policy:Block.baker_policy -> ?liquidity_baking_toggle_vote:Per_block_votes_repr.per_block_vote -> ?adaptive_issuance_vote:Per_block_votes_repr.per_block_vote -> + ?payload_round:int -> + ?payload:packed_operation list -> Block.t -> incremental tzresult Lwt.t -- GitLab From 994d4444086e4723e2931657b49d8b6511f8b591 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Mon, 7 Jul 2025 16:28:49 +0200 Subject: [PATCH 9/9] 023_PtSeouLo/Proto/tests: Incremental.rev_operations Porting to proto 023_PtSeouLo c3b2772fde6fb28ead522e05c66fcfa910ea502c - Proto/tests: Incremental.rev_operations --- src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml | 2 ++ .../lib_protocol/test/helpers/incremental.mli | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml index 50a5f85e6cb5..44d8ed58a0b2 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.ml @@ -43,6 +43,8 @@ let predecessor {predecessor; _} = predecessor let header {header; _} = header +let rev_operations {rev_operations; _} = rev_operations + let rev_tickets {rev_tickets; _} = rev_tickets let validation_state {state = vs, _; _} = vs diff --git a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli index 02e1276fdc21..301765a07215 100644 --- a/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli +++ b/src/proto_023_PtSeouLo/lib_protocol/test/helpers/incremental.mli @@ -34,6 +34,8 @@ val predecessor : incremental -> Block.t val header : incremental -> Block_header.t +val rev_operations : incremental -> Operation.packed list + val rev_tickets : incremental -> operation_receipt list val validation_state : incremental -> validation_state -- GitLab