From d23b86bb225625126141ee8906c7a006ee83e5da Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Tue, 22 Feb 2022 14:42:23 +0100 Subject: [PATCH] Env v5: use Bls12_381.MinSig instead of Bls12_381.MinPk --- src/lib_protocol_environment/environment_V5.ml | 6 +++--- src/lib_protocol_environment/environment_V5.mli | 4 ++-- src/proto_alpha/lib_benchmark/michelson_samplers.ml | 2 +- .../lib_protocol/test/helpers/tx_rollup_l2_helpers.ml | 4 ++-- .../test/integration/operations/test_tx_rollup.ml | 2 +- .../lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml | 4 ++-- .../lib_protocol/test/unit/test_tx_rollup_l2_apply.ml | 2 +- tezt/tests/tx_rollup_node.ml | 8 ++++---- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index 14490fb5ef01..cc4d1f22353f 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -96,8 +96,8 @@ module type V5 = sig and type Timelock.chest_key = Timelock.chest_key and type Timelock.opening_result = Timelock.opening_result and module Sapling = Tezos_sapling.Core.Validator - and type Bls_signature.pk = Bls12_381.Signature.MinPk.pk - and type Bls_signature.signature = Bls12_381.Signature.MinPk.signature + and type Bls_signature.pk = Bls12_381.Signature.MinSig.pk + and type Bls_signature.signature = Bls12_381.Signature.MinSig.signature and type ('a, 'b) Either.t = ('a, 'b) Stdlib.Either.t type error += Ecoproto_error of Error_monad.error @@ -269,7 +269,7 @@ struct end module Bls_signature = struct - include Bls12_381.Signature.MinPk + include Bls12_381.Signature.MinSig let verify = Aug.verify diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index a744f565a28e..6edfcab12ebf 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -97,8 +97,8 @@ module type V5 = sig and type Timelock.chest_key = Timelock.chest_key and type Timelock.opening_result = Timelock.opening_result and module Sapling = Tezos_sapling.Core.Validator - and type Bls_signature.pk = Bls12_381.Signature.MinPk.pk - and type Bls_signature.signature = Bls12_381.Signature.MinPk.signature + and type Bls_signature.pk = Bls12_381.Signature.MinSig.pk + and type Bls_signature.signature = Bls12_381.Signature.MinSig.signature and type ('a, 'b) Either.t = ('a, 'b) Stdlib.Either.t (** An [Ecoproto_error e] is a shell error that carry a protocol error. diff --git a/src/proto_alpha/lib_benchmark/michelson_samplers.ml b/src/proto_alpha/lib_benchmark/michelson_samplers.ml index ad311af13012..e1cbd691480c 100644 --- a/src/proto_alpha/lib_benchmark/michelson_samplers.ml +++ b/src/proto_alpha/lib_benchmark/michelson_samplers.ml @@ -529,7 +529,7 @@ end) let secret_key = Bls12_381.Signature.generate_sk seed in Tx_rollup_l2_address.Indexable.value (Tx_rollup_l2_address.of_bls_pk - @@ Bls12_381.Signature.MinPk.derive_pk secret_key) + @@ Bls12_381.Signature.MinSig.derive_pk secret_key) let chain_id rng_state = let string = Base_samplers.uniform_string ~nbytes:4 rng_state in diff --git a/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 611a99257ef9..83fb215e3688 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml @@ -101,7 +101,7 @@ let gen_l2_address () = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255) in let secret_key = Bls12_381.Signature.generate_sk seed in - let public_key = Bls12_381.Signature.MinPk.derive_pk secret_key in + let public_key = Bls12_381.Signature.MinSig.derive_pk secret_key in (secret_key, public_key, Tx_rollup_l2_address.of_bls_pk public_key) (** [make_unit_ticket_key ctxt ticketer tx_rollup] computes the key hash of @@ -168,7 +168,7 @@ let sign_transaction : transaction in - List.map (fun sk -> Bls12_381.Signature.MinPk.Aug.sign sk buf) sks + List.map (fun sk -> Bls12_381.Signature.MinSig.Aug.sign sk buf) sks type Environment.Error_monad.error += Test_error of string diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml index 661356b058b2..00879549eb25 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -252,7 +252,7 @@ let gen_l2_account () = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255) in let secret_key = Bls12_381.Signature.generate_sk seed in - let public_key = Bls12_381.Signature.MinPk.derive_pk secret_key in + let public_key = Bls12_381.Signature.MinSig.derive_pk secret_key in (secret_key, public_key, Tx_rollup_l2_address.of_bls_pk public_key) (** [make_ticket_key ty contents ticketer tx_rollup] computes the ticket hash diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index 82b32a34616b..b3bffaa379f4 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml @@ -47,7 +47,7 @@ let bls_pk_gen = let open QCheck2.Gen in let+ seed = seed_gen in let secret_key = Bls12_381.Signature.generate_sk seed in - Bls12_381.Signature.MinPk.derive_pk secret_key + Bls12_381.Signature.MinSig.derive_pk secret_key let l2_address_gen = let open QCheck2.Gen in @@ -152,7 +152,7 @@ let v1_batch = valid bytes since the signature encoding is "safe" and accept only valid signatures. However, it should not impact the tests here as the bytes length stays the same. *) - let bytes = Bls12_381.G2.(to_compressed_bytes (random ())) in + let bytes = Bls12_381.G1.(to_compressed_bytes (random ())) in let aggregated_signature = Protocol.Environment.Bls_signature.unsafe_signature_of_bytes bytes in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml b/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index 9e603406bc1e..b2c19ba291e0 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml @@ -84,7 +84,7 @@ let expect_error_status ~msg error status cont = let aggregate_signature_exn : signature list -> signature = fun signatures -> - match Bls12_381.Signature.MinPk.aggregate_signature_opt signatures with + match Bls12_381.Signature.MinSig.aggregate_signature_opt signatures with | Some res -> res | None -> raise (Invalid_argument "aggregate_signature_exn") diff --git a/tezt/tests/tx_rollup_node.ml b/tezt/tests/tx_rollup_node.ml index d837aaf5572e..767b4672e18b 100644 --- a/tezt/tests/tx_rollup_node.ml +++ b/tezt/tests/tx_rollup_node.ml @@ -317,9 +317,9 @@ let generate_bls_addr ?alias:_ _client = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255) in let sk = Bls12_381.Signature.generate_sk seed in - let pk = Bls12_381.Signature.MinPk.derive_pk sk in + let pk = Bls12_381.Signature.MinSig.derive_pk sk in let pkh = - Bls_public_key_hash.hash_bytes [Bls12_381.Signature.MinPk.pk_to_bytes pk] + Bls_public_key_hash.hash_bytes [Bls12_381.Signature.MinSig.pk_to_bytes pk] in Log.info "A new BLS key was generated: %s" @@ -420,7 +420,7 @@ let sign_transaction sks txs = Tx_rollup_l2_batch.V1.transaction_encoding txs in - List.map (fun sk -> Bls12_381.Signature.MinPk.Aug.sign sk buf) sks + List.map (fun sk -> Bls12_381.Signature.MinSig.Aug.sign sk buf) sks let craft_tx ~counter ~signer ~dest ~ticket qty = let open Tezos_protocol_alpha.Protocol in @@ -439,7 +439,7 @@ let craft_tx ~counter ~signer ~dest ~ticket qty = Tx_rollup_l2_batch.V1.{signer; counter; contents = [content]} let aggregate_signature_exn signatures = - match Bls12_381.Signature.MinPk.aggregate_signature_opt signatures with + match Bls12_381.Signature.MinSig.aggregate_signature_opt signatures with | Some res -> res | None -> invalid_arg "aggregate_signature_exn" -- GitLab