From cdb76d8d516b6b1b62e79cbe1b356b5275bc97bf Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Tue, 29 Apr 2025 14:09:19 +0200 Subject: [PATCH 1/9] proto/test_aggregate: minor tests renaming --- .../integration/consensus/test_aggregate.ml | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) 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 dca10743eded..da1356341c94 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 @@ -198,7 +198,7 @@ let test_aggregate_feature_flag_disabled () = ~mempool_error:aggregate_in_mempool_error Aggregate -let test_aggregate_attestation_with_a_single_bls_attestation () = +let test_attestations_aggregate_with_a_single_delegate () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -220,7 +220,7 @@ let test_aggregate_attestation_with_a_single_bls_attestation () = let result = find_aggregate_result receipt in check_attestations_aggregate_result ~committee:[attester] result -let test_aggregate_attestation_with_multiple_bls_attestations () = +let test_attestations_aggregate_with_multiple_delegates () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -247,7 +247,7 @@ let test_aggregate_attestation_with_multiple_bls_attestations () = let delegates = List.map fst bls_delegates_with_slots in check_attestations_aggregate_result ~committee:delegates result -let test_aggregate_attestation_invalid_signature () = +let test_attestations_aggregate_invalid_signature () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -279,7 +279,7 @@ let test_aggregate_attestation_invalid_signature () = in Assert.proto_error ~loc:__LOC__ res signature_invalid_error -let test_aggregate_attestation_non_bls_delegate () = +let test_attestations_aggregate_non_bls_delegate () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -320,7 +320,7 @@ let test_aggregate_attestation_non_bls_delegate () = let*! res = Block.bake ~operation:aggregate block in Assert.proto_error ~loc:__LOC__ res non_bls_in_aggregate -let test_multiple_aggregations_per_block_forbidden () = +let test_multiple_aggregates_per_block_forbidden () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -339,7 +339,7 @@ let test_multiple_aggregations_per_block_forbidden () = let*! res = Block.bake ~operations:aggregates block in Assert.proto_error ~loc:__LOC__ res conflicting_consensus_operation -let eligible_attestation_must_be_aggregated () = +let test_eligible_attestation_must_be_aggregated () = let open Lwt_result_syntax in let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () @@ -391,30 +391,30 @@ let tests = `Quick test_aggregate_feature_flag_disabled; Tztest.tztest - "test_aggregate_attestation_with_a_single_bls_attestation" + "test_attestations_aggregate_with_a_single_delegate" `Quick - test_aggregate_attestation_with_a_single_bls_attestation; + test_attestations_aggregate_with_a_single_delegate; Tztest.tztest - "test_aggregate_attestation_with_multiple_bls_attestations" + "test_attestations_aggregate_with_multiple_delegates" `Quick - test_aggregate_attestation_with_multiple_bls_attestations; + test_attestations_aggregate_with_multiple_delegates; Tztest.tztest - "test_aggregate_attestation_invalid_signature" + "test_attestations_aggregate_invalid_signature" `Quick - test_aggregate_attestation_invalid_signature; + test_attestations_aggregate_invalid_signature; Tztest.tztest - "test_aggregate_attestation_non_bls_delegate" + "test_attestations_aggregate_non_bls_delegate" `Quick - test_aggregate_attestation_non_bls_delegate; + test_attestations_aggregate_non_bls_delegate; Tztest.tztest - "test_multiple_aggregations_per_block_forbidden" + "test_multiple_aggregates_per_block_forbidden" `Quick - test_multiple_aggregations_per_block_forbidden; + test_multiple_aggregates_per_block_forbidden; Tztest.tztest - "eligible_attestation_must_be_aggregated" + "test_eligible_attestation_must_be_aggregated" `Quick - eligible_attestation_must_be_aggregated; - Tztest.tztest "empty committee" `Quick test_empty_committee; + test_eligible_attestation_must_be_aggregated; + Tztest.tztest "test_empty_committee" `Quick test_empty_committee; ] let () = -- GitLab From fadb61b01cd9038c612b926be1152323b3caefb8 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Sun, 27 Apr 2025 23:58:02 +0200 Subject: [PATCH 2/9] proto/test_aggregate: add helper check_preattestations_aggregate_result Refactored check_attestations_aggregate_result to be able to use the same code for boths preattestations and attestations. --- .../integration/consensus/test_aggregate.ml | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) 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 da1356341c94..13fdd15e0068 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 @@ -85,19 +85,21 @@ let find_aggregate_result receipt = | Some res -> res | None -> Test.fail "No aggregate result found" -(* [check_attestations_aggregate_result ~committee result] verifies that - [result] has the following properties: - - [balance_update] is empty; - - [voting_power] equals the sum of slots owned by attesters in [committee]; - - the public key hashes in [result] committee match those of [committee]. *) -let check_attestations_aggregate_result ~committee - (result : - Alpha_context.Kind.attestations_aggregate - Tezos_protocol_alpha__Protocol.Apply_results.contents_result) = +type 'kind aggregate = + | Preattestation : Alpha_context.Kind.preattestations_aggregate aggregate + | Attestation : Alpha_context.Kind.attestations_aggregate aggregate + +let check_aggregate_result (type kind) (kind : kind aggregate) ~committee + (result : kind Tezos_protocol_alpha__Protocol.Apply_results.contents_result) + = let open Lwt_result_syntax in - match result with - | Attestations_aggregate_result - {balance_updates; committee = resulting_committee; consensus_power} -> + match (kind, result) with + | ( Preattestation, + Preattestations_aggregate_result + {balance_updates; committee = resulting_committee; consensus_power} ) + | ( Attestation, + Attestations_aggregate_result + {balance_updates; committee = resulting_committee; consensus_power} ) -> (* Check balance updates *) let* () = match balance_updates with @@ -151,6 +153,28 @@ let check_attestations_aggregate_result ~committee pp resulting_committee_pkhs +(* [check_preattestations_aggregate_result ~committee result] verifies that + [result] has the following properties: + - [balance_update] is empty; + - [voting_power] equals the sum of slots owned by attesters in [committee]; + - the public key hashes in [result] committee match those of [committee]. *) +let check_preattestations_aggregate_result ~committee + (result : + Alpha_context.Kind.preattestations_aggregate + Tezos_protocol_alpha__Protocol.Apply_results.contents_result) = + check_aggregate_result Preattestation ~committee result + +(* [check_attestations_aggregate_result ~committee result] verifies that + [result] has the following properties: + - [balance_update] is empty; + - [voting_power] equals the sum of slots owned by attesters in [committee]; + - the public key hashes in [result] committee match those of [committee]. *) +let check_attestations_aggregate_result ~committee + (result : + Alpha_context.Kind.attestations_aggregate + Tezos_protocol_alpha__Protocol.Apply_results.contents_result) = + check_aggregate_result Attestation ~committee result + (* [find_attester_with_bls_key attesters] returns the first attester with a BLS key, if any. *) let find_attester_with_bls_key = -- GitLab From 70e2e28a5fe075fefb6959b7c12915defd1de20b Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 00:43:42 +0200 Subject: [PATCH 3/9] proto/test_aggregate: rename helper find_aggregate_result Renamed helper `find_aggregate_result` into `find_attestations_aggregate_result` to prepare the introduction of `find_preattestations_aggregate_result`. --- .../test/integration/consensus/test_aggregate.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 13fdd15e0068..70d9cb5335fa 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 @@ -68,7 +68,7 @@ let empty_aggregation_committee = function | Validate_errors.Consensus.Empty_aggregation_committee -> true | _ -> false -let find_aggregate_result receipt = +let find_attestations_aggregate_result receipt = let result_opt = List.find_map (function @@ -83,7 +83,7 @@ let find_aggregate_result receipt = in match result_opt with | Some res -> res - | None -> Test.fail "No aggregate result found" + | None -> Test.fail "No attestations aggregate result found" type 'kind aggregate = | Preattestation : Alpha_context.Kind.preattestations_aggregate aggregate @@ -241,7 +241,7 @@ let test_attestations_aggregate_with_a_single_delegate () = WithExceptions.Option.get ~loc:__LOC__ (Op.aggregate [attestation]) in let* _, (_, receipt) = Block.bake_with_metadata ~operation block in - let result = find_aggregate_result receipt in + let result = find_attestations_aggregate_result receipt in check_attestations_aggregate_result ~committee:[attester] result let test_attestations_aggregate_with_multiple_delegates () = @@ -267,7 +267,7 @@ let test_attestations_aggregate_with_multiple_delegates () = let* _, (_, receipt) = Block.bake_with_metadata ~operation:aggregation block in - let result = find_aggregate_result receipt in + let result = find_attestations_aggregate_result receipt in let delegates = List.map fst bls_delegates_with_slots in check_attestations_aggregate_result ~committee:delegates result -- GitLab From 6cb2fbfe73efbcc1b8b3262404dd4bbac6410061 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 00:45:28 +0200 Subject: [PATCH 4/9] proto/test_aggregate: add helper find_preattestations_aggregate_result --- .../integration/consensus/test_aggregate.ml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 70d9cb5335fa..5edce6db0b6d 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 @@ -68,6 +68,23 @@ let empty_aggregation_committee = function | Validate_errors.Consensus.Empty_aggregation_committee -> true | _ -> false +let find_preattestations_aggregate_result receipt = + let result_opt = + List.find_map + (function + | Tezos_protocol_alpha__Protocol.Apply_results.Operation_metadata + { + contents = + Single_result (Preattestations_aggregate_result _ as result); + } -> + Some result + | _ -> None) + receipt + in + match result_opt with + | Some res -> res + | None -> Test.fail "No preattestations aggregate result found" + let find_attestations_aggregate_result receipt = let result_opt = List.find_map -- GitLab From 9996bdaa3d234b837177dd55992c6d5f84cd932a Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Sun, 27 Apr 2025 23:25:47 +0200 Subject: [PATCH 5/9] proto/test_aggregate: add test preattestations_aggregate empty committee --- .../integration/consensus/test_aggregate.ml | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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 5edce6db0b6d..f13478cb7b57 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 @@ -404,6 +404,7 @@ let test_empty_committee () = let* _genesis, block = init_genesis_with_some_bls_accounts ~aggregate_attestation:true () in + (* Crafting an attestations_aggregate with an empty committee *) let* consensus_content = let* attestation = Op.raw_attestation block in match attestation.protocol_data with @@ -418,8 +419,36 @@ let test_empty_committee () = in let signature = Some Signature.(of_bls Signature.Bls.zero) in let operation = Op.pack_operation (B block) signature (Single contents) in + (* Baking with the attestations_aggregate and expecting an error *) let*! res = Block.bake ~operation block in - Assert.proto_error ~loc:__LOC__ res empty_aggregation_committee + let* () = Assert.proto_error ~loc:__LOC__ res empty_aggregation_committee in + (* Crafting a preattestations_aggregate with an empty committee *) + let* consensus_content = + let* block = Block.bake block in + let* preattestation = Op.raw_preattestation block in + match preattestation.protocol_data with + | {contents = Single (Preattestation consensus_content); _} -> + let Alpha_context.{level; round; block_payload_hash; slot = _} = + consensus_content + in + return Alpha_context.{level; round; block_payload_hash} + in + let contents = + Alpha_context.Preattestations_aggregate {consensus_content; committee = []} + in + let operation = Op.pack_operation (B block) signature (Single contents) in + (* Baking with the preattestations_aggregate and expecting an error *) + let round_zero = Alpha_context.Round.zero in + let*! res = + Block.bake + ~policy:(By_round 1) + ~payload_round:(Some round_zero) + ~locked_round:(Some round_zero) + ~operation + block + in + let* () = Assert.proto_error ~loc:__LOC__ res empty_aggregation_committee in + return_unit let tests = [ -- GitLab From c47b7f18e1ef55af8aea9e47afdeb2305fee6c38 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 00:46:08 +0200 Subject: [PATCH 6/9] proto/test_aggregate: add test preattestations aggregate single delegate --- .../integration/consensus/test_aggregate.ml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) 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 f13478cb7b57..bdbedf266867 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 @@ -261,6 +261,42 @@ let test_attestations_aggregate_with_a_single_delegate () = let result = find_attestations_aggregate_result receipt in check_attestations_aggregate_result ~committee:[attester] result +let test_preattestations_aggregate_with_a_single_delegate () = + let open Lwt_result_syntax in + let* _genesis, block = + init_genesis_with_some_bls_accounts ~aggregate_attestation:true () + in + let* block' = Block.bake block in + let* attesters = Context.get_attesters (B block') in + (* Find an attester with a BLS consensus key. *) + let attester, slot = + WithExceptions.Option.get + ~loc:__LOC__ + (find_attester_with_bls_key attesters) + in + let* operation = + let* preattestation = + Op.raw_preattestation + ~delegate:attester.RPC.Validators.delegate + ~slot + block' + in + return + @@ WithExceptions.Option.get ~loc:__LOC__ + @@ Op.aggregate_preattestations [preattestation] + in + let* _, (_, receipt) = + 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) + ~operation + block + in + let result = find_preattestations_aggregate_result receipt in + check_preattestations_aggregate_result ~committee:[attester] result + let test_attestations_aggregate_with_multiple_delegates () = let open Lwt_result_syntax in let* _genesis, block = @@ -460,6 +496,10 @@ let tests = "test_aggregate_feature_flag_disabled" `Quick test_aggregate_feature_flag_disabled; + Tztest.tztest + "test_preattestations_aggregate_with_a_single_delegate" + `Quick + test_preattestations_aggregate_with_a_single_delegate; Tztest.tztest "test_attestations_aggregate_with_a_single_delegate" `Quick -- GitLab From 24692a59bbb05a39c8393266186f04fd9a938e5f Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 10:31:45 +0200 Subject: [PATCH 7/9] proto/test_aggregate: add test preattestations multiple delegate --- .../integration/consensus/test_aggregate.ml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) 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 bdbedf266867..4cb4c8a8476e 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 @@ -324,6 +324,42 @@ let test_attestations_aggregate_with_multiple_delegates () = let delegates = List.map fst bls_delegates_with_slots in check_attestations_aggregate_result ~committee:delegates result +let test_preattestations_aggregate_with_multiple_delegates () = + let open Lwt_result_syntax in + let* _genesis, block = + init_genesis_with_some_bls_accounts ~aggregate_attestation:true () + in + let* block' = Block.bake block in + let* attesters = Context.get_attesters (B block') in + (* Filter delegates with BLS keys that have at least one slot *) + let bls_delegates_with_slots = filter_attesters_with_bls_key attesters in + let* preattestations = + List.map_es + (fun (delegate, slot) -> + Op.raw_preattestation + ~delegate:delegate.RPC.Validators.delegate + ~slot + block') + bls_delegates_with_slots + in + let operation = + WithExceptions.Option.get + ~loc:__LOC__ + (Op.aggregate_preattestations preattestations) + in + let* _, (_, receipt) = + 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) + ~operation + block + in + let result = find_preattestations_aggregate_result receipt in + let delegates = List.map fst bls_delegates_with_slots in + check_preattestations_aggregate_result ~committee:delegates result + let test_attestations_aggregate_invalid_signature () = let open Lwt_result_syntax in let* _genesis, block = @@ -504,6 +540,10 @@ let tests = "test_attestations_aggregate_with_a_single_delegate" `Quick test_attestations_aggregate_with_a_single_delegate; + Tztest.tztest + "test_preattestations_aggregate_with_multiple_delegates" + `Quick + test_preattestations_aggregate_with_multiple_delegates; Tztest.tztest "test_attestations_aggregate_with_multiple_delegates" `Quick -- GitLab From 4267837a240fa31e088154ccf33b734913b7eeca Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 21:23:59 +0200 Subject: [PATCH 8/9] proto/test_aggregate: add test preattestations invalid signature --- .../integration/consensus/test_aggregate.ml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) 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 4cb4c8a8476e..b4c380c0777e 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 @@ -392,6 +392,45 @@ let test_attestations_aggregate_invalid_signature () = in Assert.proto_error ~loc:__LOC__ res signature_invalid_error +let test_preattestations_aggregate_invalid_signature () = + let open Lwt_result_syntax in + let* _genesis, block = + init_genesis_with_some_bls_accounts ~aggregate_attestation:true () + in + let* block' = Block.bake block in + let* attesters = Context.get_attesters (B block) in + (* Find an attester with a BLS consensus key. *) + let attester, _ = + WithExceptions.Option.get + ~loc:__LOC__ + (find_attester_with_bls_key attesters) + in + (* Craft a preattestations_aggregate with this delegate *) + let* aggregate = + Op.preattestations_aggregate ~committee:[attester.consensus_key] block' + in + (* Swap the aggregate signature for Signature.Bls.zero *) + match aggregate.protocol_data with + | Operation_data {contents; _} -> + let aggregate_with_incorrect_signature = + { + aggregate with + protocol_data = + Operation_data {contents; signature = Some (Bls Signature.Bls.zero)}; + } + in + (* Bake a block containing this operation and expect an error *) + let*! res = + let round_zero = Alpha_context.Round.zero in + Block.bake + ~policy:(By_round 1) + ~payload_round:(Some round_zero) + ~locked_round:(Some round_zero) + ~operation:aggregate_with_incorrect_signature + block + in + Assert.proto_error ~loc:__LOC__ res signature_invalid_error + let test_attestations_aggregate_non_bls_delegate () = let open Lwt_result_syntax in let* _genesis, block = @@ -548,6 +587,10 @@ let tests = "test_attestations_aggregate_with_multiple_delegates" `Quick test_attestations_aggregate_with_multiple_delegates; + Tztest.tztest + "test_preattestations_aggregate_invalid_signature" + `Quick + test_preattestations_aggregate_invalid_signature; Tztest.tztest "test_attestations_aggregate_invalid_signature" `Quick -- GitLab From 4768711f2d56e94222e088b868265ab81c6b7331 Mon Sep 17 00:00:00 2001 From: Adam Allombert-Goget Date: Mon, 28 Apr 2025 21:36:40 +0200 Subject: [PATCH 9/9] proto/test_aggregate: add test preattestations non bls delegate --- .../integration/consensus/test_aggregate.ml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) 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 b4c380c0777e..fc1bd0542af2 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 @@ -431,6 +431,56 @@ let test_preattestations_aggregate_invalid_signature () = in Assert.proto_error ~loc:__LOC__ res signature_invalid_error +let test_preattestations_aggregate_non_bls_delegate () = + let open Lwt_result_syntax in + let* _genesis, block = + init_genesis_with_some_bls_accounts ~aggregate_attestation:true () + in + let* block' = Block.bake block in + let* attesters = Context.get_attesters (B block') in + (* Find an attester with a non-BLS consensus key. *) + let attester, slot = + WithExceptions.Option.get + ~loc:__LOC__ + (find_attester_with_non_bls_key attesters) + in + (* Craft a preattestation for this attester to retreive a signature and a + triplet {level, round, block_payload_hash} *) + let* {shell; protocol_data = {contents; signature}} = + Op.raw_preattestation + ~delegate:attester.RPC.Validators.delegate + ~slot + block' + in + match contents with + | Single (Preattestation consensus_content) -> + let {level; round; block_payload_hash; _} : + Alpha_context.consensus_content = + consensus_content + in + (* Craft an aggregate including the attester slot and signature *) + let consensus_content : Alpha_context.consensus_aggregate_content = + {level; round; block_payload_hash} + in + let contents : _ Alpha_context.contents_list = + Single + (Preattestations_aggregate {consensus_content; committee = [slot]}) + in + let operation : operation = + {shell; protocol_data = Operation_data {contents; signature}} + in + (* Bake a block containing this aggregate and expect an error *) + let*! res = + let round_zero = Alpha_context.Round.zero in + Block.bake + ~policy:(By_round 1) + ~payload_round:(Some round_zero) + ~locked_round:(Some round_zero) + ~operation + block + in + Assert.proto_error ~loc:__LOC__ res non_bls_in_aggregate + let test_attestations_aggregate_non_bls_delegate () = let open Lwt_result_syntax in let* _genesis, block = @@ -595,6 +645,10 @@ let tests = "test_attestations_aggregate_invalid_signature" `Quick test_attestations_aggregate_invalid_signature; + Tztest.tztest + "test_preattestations_aggregate_non_bls_delegate" + `Quick + test_preattestations_aggregate_non_bls_delegate; Tztest.tztest "test_attestations_aggregate_non_bls_delegate" `Quick -- GitLab