diff --git a/CHANGES.rst b/CHANGES.rst index 7b4f7b586726a1fd20ef83235f3f5a4cdb88a469..7279a17b1fa508aca293f7b28f8f56e61202e35e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -109,3 +109,6 @@ Rollups Miscellaneous ------------- + +- Versioning of signature module for protocol specific support and future + extensibility. diff --git a/devtools/yes_wallet/get_delegates_014_PtKathma.ml b/devtools/yes_wallet/get_delegates_014_PtKathma.ml index 02c7f6dd4cc52fa2d4357aadf45421b89b5bcbae..b286751b72e0ca8a41c99a65b8a0b986f9ca8aef 100644 --- a/devtools/yes_wallet/get_delegates_014_PtKathma.ml +++ b/devtools/yes_wallet/get_delegates_014_PtKathma.ml @@ -37,6 +37,11 @@ module Get_delegates = struct let ( +? ) a b = Environment.wrap_tzresult (a +? b) end + module Signature = struct + include Tezos_crypto.Signature.V0 + module To_latest = Tezos_crypto.Signature.Of_V0 + end + module Delegate = struct open Alpha_context.Delegate diff --git a/devtools/yes_wallet/get_delegates_015_PtLimaPt.ml b/devtools/yes_wallet/get_delegates_015_PtLimaPt.ml index 1d23b24db667293ff5a1576a70a11ea97a2b3116..ebdb28f31fbeb61885a16b8d41cf861374e75603 100644 --- a/devtools/yes_wallet/get_delegates_015_PtLimaPt.ml +++ b/devtools/yes_wallet/get_delegates_015_PtLimaPt.ml @@ -37,6 +37,11 @@ module Get_delegates = struct let ( +? ) a b = Environment.wrap_tzresult (a +? b) end + module Signature = struct + include Tezos_crypto.Signature.V0 + module To_latest = Tezos_crypto.Signature.Of_V0 + end + module Delegate = struct open Alpha_context.Delegate diff --git a/devtools/yes_wallet/get_delegates_alpha.ml b/devtools/yes_wallet/get_delegates_alpha.ml index 230d17da0cd86d92a2a9af6515c6ef8549d8e29c..024904dd2a60cca176907e1b7d812f6f4af72314 100644 --- a/devtools/yes_wallet/get_delegates_alpha.ml +++ b/devtools/yes_wallet/get_delegates_alpha.ml @@ -37,6 +37,11 @@ module Get_delegates = struct let ( +? ) a b = Environment.wrap_tzresult (a +? b) end + module Signature = struct + include Tezos_crypto.Signature.V1 + module To_latest = Tezos_crypto.Signature.Of_V1 + end + module Delegate = struct open Alpha_context.Delegate diff --git a/devtools/yes_wallet/sigs.ml b/devtools/yes_wallet/sigs.ml index c2221bf854e772121786527f5e42ca2656058b5d..928383effb73dd975304cf2cbbfcc6d9bbc7bd25 100644 --- a/devtools/yes_wallet/sigs.ml +++ b/devtools/yes_wallet/sigs.ml @@ -38,24 +38,45 @@ module type PROTOCOL = sig val to_mutez : t -> int64 end + module Signature : sig + type public_key_hash + + type public_key + + type secret_key + + type signature + + module To_latest : sig + val public_key_hash : + public_key_hash -> Tezos_crypto.Signature.V_latest.public_key_hash + + val public_key : public_key -> Tezos_crypto.Signature.V_latest.public_key + + val secret_key : secret_key -> Tezos_crypto.Signature.V_latest.secret_key + + val signature : signature -> Tezos_crypto.Signature.V_latest.signature + end + end + module Delegate : sig val fold : context -> order:[`Sorted | `Undefined] -> init:'a -> - f:(Tezos_crypto.Signature.public_key_hash -> 'a -> 'a Lwt.t) -> + f:(Signature.public_key_hash -> 'a -> 'a Lwt.t) -> 'a Lwt.t val pubkey : context -> - Tezos_crypto.Signature.public_key_hash -> - Tezos_crypto.Signature.public_key tzresult Lwt.t + Signature.public_key_hash -> + Signature.public_key tzresult Lwt.t val staking_balance : - context -> Tezos_crypto.Signature.public_key_hash -> Tez.t tzresult Lwt.t + context -> Signature.public_key_hash -> Tez.t tzresult Lwt.t val deactivated : - context -> Tezos_crypto.Signature.public_key_hash -> bool tzresult Lwt.t + context -> Signature.public_key_hash -> bool tzresult Lwt.t end val hash : Tezos_crypto.Protocol_hash.t diff --git a/devtools/yes_wallet/yes_wallet_lib.ml b/devtools/yes_wallet/yes_wallet_lib.ml index bb030cab2d6c07927117724d6aaa891ee3bec0a0..026d5717a4136837c368fa8ea12bd1cbf90f8ff7 100644 --- a/devtools/yes_wallet/yes_wallet_lib.ml +++ b/devtools/yes_wallet/yes_wallet_lib.ml @@ -55,7 +55,7 @@ let pk_json (alias, _pkh, pk) = *) let sk_of_pk (pk_s : string) : string = - let open Tezos_crypto.Signature in + let open Tezos_crypto.Signature.V_latest in let pk = Public_key.of_b58check_exn pk_s in let pk_b = Data_encoding.Binary.to_bytes_exn Public_key.encoding pk in let sk_b = Bytes.sub pk_b 0 33 in @@ -203,6 +203,11 @@ let get_delegates (module P : Sigs.PROTOCOL) context let*? updated_staking_balance_acc = P.Tez.(staking_balance_acc +? staking_balance) in + let staking_balance_info = + ( P.Signature.To_latest.public_key_hash pkh, + P.Signature.To_latest.public_key pk, + staking_balance ) + in (* Filter deactivated bakers if required *) if active_bakers_only then let* b = P.Delegate.deactivated ctxt pkh in @@ -212,12 +217,11 @@ let get_delegates (module P : Sigs.PROTOCOL) context (* Consider the baker. *) | false -> return - ( (pkh, pk, staking_balance) :: key_list_acc, + ( staking_balance_info :: key_list_acc, updated_staking_balance_acc ) else return - ( (pkh, pk, staking_balance) :: key_list_acc, - updated_staking_balance_acc )) + (staking_balance_info :: key_list_acc, updated_staking_balance_acc)) in return @@ filter_up_to_staking_share staking_share_opt total_stake P.Tez.to_mutez diff --git a/src/lib_benchmark/crypto_samplers.ml b/src/lib_benchmark/crypto_samplers.ml index 13051326c24ccb473dda0a8ed587f8152958da87..c48149f5b83dc8ba0fdfc9a8548e3dfbc4db5a8c 100644 --- a/src/lib_benchmark/crypto_samplers.ml +++ b/src/lib_benchmark/crypto_samplers.ml @@ -26,26 +26,50 @@ (* Primitives for sampling crypto-related data *) module type Param_S = sig + type algo + val size : int - val algo : [`Algo of Tezos_crypto.Signature.algo | `Default] + val algo : [`Algo of algo | `Default] +end + +module type P_Finite_key_pool_S = sig + type public_key_hash + + type public_key + + type secret_key + + val pk : public_key Base_samplers.sampler + + val pkh : public_key_hash Base_samplers.sampler + + val sk : secret_key Base_samplers.sampler + + val all : (public_key_hash * public_key * secret_key) Base_samplers.sampler end -module type Finite_key_pool_S = sig - val pk : Tezos_crypto.Signature.public_key Base_samplers.sampler +module type Signature_S = sig + include Tezos_crypto.S.SIGNATURE - val pkh : Tezos_crypto.Signature.public_key_hash Base_samplers.sampler + type algo - val sk : Tezos_crypto.Signature.secret_key Base_samplers.sampler + val algos : algo list - val all : - (Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key - * Tezos_crypto.Signature.secret_key) - Base_samplers.sampler + val generate_key : + ?algo:algo -> + ?seed:Bytes.t -> + unit -> + Public_key_hash.t * Public_key.t * Secret_key.t end -module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S = struct +module Make_p_finite_key_pool + (Signature : Signature_S) + (Arg : Param_S with type algo := Signature.algo) : + P_Finite_key_pool_S + with type public_key_hash := Signature.Public_key_hash.t + and type public_key := Signature.Public_key.t + and type secret_key := Signature.Secret_key.t = struct let () = if Arg.size < 1 then invalid_arg "Make_finite_key_pool" else () (* Hardcoded bc not directly accessible through the Tezos_crypto API. *) @@ -53,12 +77,7 @@ module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S = struct let key_pool = Queue.create () - let all_algos = - [| - Tezos_crypto.Signature.Ed25519; - Tezos_crypto.Signature.Secp256k1; - Tezos_crypto.Signature.P256; - |] + let all_algos = Array.of_list Signature.algos let uniform_algo state = let i = Random.State.int state (Array.length all_algos) in @@ -74,7 +93,7 @@ module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S = struct let seed = Base_samplers.uniform_bytes ~nbytes:minimal_seed_length state in - let triple = Tezos_crypto.Signature.generate_key ~algo ~seed () in + let triple = Signature.generate_key ~algo ~seed () in Queue.add triple key_pool ; triple) else @@ -100,3 +119,39 @@ module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S = struct let all = get_next end + +module V0 = struct + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := Tezos_crypto.Signature.V0.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V0.Public_key.t + and type secret_key := Tezos_crypto.Signature.V0.Secret_key.t + + module Make_finite_key_pool = + Make_p_finite_key_pool (Tezos_crypto.Signature.V0) +end + +module V1 = struct + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := Tezos_crypto.Signature.V1.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V1.Public_key.t + and type secret_key := Tezos_crypto.Signature.V1.Secret_key.t + + module Make_finite_key_pool = + Make_p_finite_key_pool (Tezos_crypto.Signature.V1) +end + +module V_latest = struct + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := + Tezos_crypto.Signature.V_latest.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V_latest.Public_key.t + and type secret_key := Tezos_crypto.Signature.V_latest.Secret_key.t + + module Make_finite_key_pool = + Make_p_finite_key_pool (Tezos_crypto.Signature.V_latest) +end + +include V_latest diff --git a/src/lib_benchmark/crypto_samplers.mli b/src/lib_benchmark/crypto_samplers.mli index 6148a0076b896432645abb63ee36fd4de421a506..ce0910455f5d1b6c6e7c4d17175beae8650841ef 100644 --- a/src/lib_benchmark/crypto_samplers.mli +++ b/src/lib_benchmark/crypto_samplers.mli @@ -32,30 +32,73 @@ *) module type Param_S = sig + type algo + (** Maximal size of the key pool. *) val size : int (** Algorithm to use for triplet generation. *) - val algo : [`Algo of Tezos_crypto.Signature.algo | `Default] + val algo : [`Algo of algo | `Default] end -module type Finite_key_pool_S = sig +module type P_Finite_key_pool_S = sig + type public_key_hash + + type public_key + + type secret_key + (** Sample a public key from the pool. *) - val pk : Tezos_crypto.Signature.public_key Base_samplers.sampler + val pk : public_key Base_samplers.sampler (** Sample a public key hash from the pool. *) - val pkh : Tezos_crypto.Signature.public_key_hash Base_samplers.sampler + val pkh : public_key_hash Base_samplers.sampler (** Sample a secret key from the pool. *) - val sk : Tezos_crypto.Signature.secret_key Base_samplers.sampler + val sk : secret_key Base_samplers.sampler (** Sample a (pkh, pk, sk) triplet from the pool. *) - val all : - (Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key - * Tezos_crypto.Signature.secret_key) - Base_samplers.sampler + val all : (public_key_hash * public_key * secret_key) Base_samplers.sampler +end + +module V0 : sig + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := Tezos_crypto.Signature.V0.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V0.Public_key.t + and type secret_key := Tezos_crypto.Signature.V0.Secret_key.t + + (** Create a finite key pool. *) + module Make_finite_key_pool + (Arg : Param_S with type algo := Tezos_crypto.Signature.V0.algo) : + Finite_key_pool_S +end + +module V1 : sig + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := Tezos_crypto.Signature.V1.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V1.Public_key.t + and type secret_key := Tezos_crypto.Signature.V1.Secret_key.t + + (** Create a finite key pool. *) + module Make_finite_key_pool + (Arg : Param_S with type algo := Tezos_crypto.Signature.V1.algo) : + Finite_key_pool_S +end + +module V_latest : sig + module type Finite_key_pool_S = + P_Finite_key_pool_S + with type public_key_hash := + Tezos_crypto.Signature.V_latest.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V_latest.Public_key.t + and type secret_key := Tezos_crypto.Signature.V_latest.Secret_key.t + + (** Create a finite key pool. *) + module Make_finite_key_pool + (Arg : Param_S with type algo := Tezos_crypto.Signature.V_latest.algo) : + Finite_key_pool_S end -(** Create a finite key pool. *) -module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S +include module type of V_latest diff --git a/src/lib_client_base/client_keys.ml b/src/lib_client_base/client_keys.ml index cdbff93eb2f0941b3d9b20470d4dd34171a3e628..8728c888694bc97d8ccd07706946c4386376093f 100644 --- a/src/lib_client_base/client_keys.ml +++ b/src/lib_client_base/client_keys.ml @@ -64,21 +64,6 @@ let () = | Wrong_key_scheme (expected, found) -> Some (expected, found) | _ -> None) (fun (expected, found) -> Wrong_key_scheme (expected, found)) -module Public_key_hash = struct - include Client_aliases.Alias (struct - (* includes t, Compare, encoding *) - include Tezos_crypto.Signature.Public_key_hash - - let of_source s = - Lwt.return (Tezos_crypto.Signature.Public_key_hash.of_b58check s) - - let to_source p = - Lwt.return_ok (Tezos_crypto.Signature.Public_key_hash.to_b58check p) - - let name = "public key hash" - end) -end - module Logging = struct let tag = Tag.def ~doc:"Identity" "pk_alias" Format.pp_print_text end @@ -142,6 +127,24 @@ let make_sk_uri (x : Uri.t) : sk_uri tzresult = tzfail (Exn (Failure "Error while parsing URI: SK_URI needs a scheme")) | Some _ -> return x +type error += Signature_mismatch of sk_uri + +let () = + register_error_kind + `Permanent + ~id:"cli.signature_mismatch" + ~title:"Signature mismatch" + ~description:"The signer produced an invalid signature" + ~pp:(fun ppf sk -> + Format.fprintf + ppf + "The signer for %a produced an invalid signature" + Uri.pp_hum + sk) + Data_encoding.(obj1 (req "locator" uri_encoding)) + (function Signature_mismatch sk -> Some sk | _ -> None) + (fun sk -> Signature_mismatch sk) + type sapling_uri = Uri.t let make_sapling_uri (x : Uri.t) : sapling_uri tzresult = @@ -220,61 +223,6 @@ let aggregate_sk_uri_param ?name ?desc params = in Tezos_clic.param ~name ~desc (aggregate_sk_uri_parameter ()) params -module Secret_key = Client_aliases.Alias (struct - let name = "secret_key" - - type t = sk_uri - - include (CompareUri : Compare.S with type t := t) - - let of_source s = Lwt.return (make_sk_uri @@ Uri.of_string s) - - let to_source t = Lwt.return_ok (Uri.to_string t) - - let encoding = uri_encoding -end) - -module Public_key = Client_aliases.Alias (struct - let name = "public_key" - - type t = pk_uri * Tezos_crypto.Signature.Public_key.t option - - include Compare.Make (struct - type nonrec t = t - - let compare (apk, aso) (bpk, bso) = - Compare.or_else (CompareUri.compare apk bpk) (fun () -> - Option.compare Tezos_crypto.Signature.Public_key.compare aso bso) - end) - - let of_source s = - let open Lwt_result_syntax in - let*? pk_uri = make_pk_uri @@ Uri.of_string s in - return (pk_uri, None) - - let to_source (t, _) = Lwt.return_ok (Uri.to_string t) - - let encoding = - let open Data_encoding in - union - [ - case - Json_only - ~title:"Locator_only" - uri_encoding - (function uri, None -> Some uri | _, Some _ -> None) - (fun uri -> (uri, None)); - case - Json_only - ~title:"Locator_and_full_key" - (obj2 - (req "locator" uri_encoding) - (req "key" Tezos_crypto.Signature.Public_key.encoding)) - (function uri, Some key -> Some (uri, key) | _, None -> None) - (fun (uri, key) -> (uri, Some key)); - ] -end) - type sapling_key = { sk : sapling_uri; (* zip32 derivation path *) @@ -416,6 +364,54 @@ module Aggregate_alias = struct end) end +module type COMMON_SIGNER = sig + val scheme : string + + val title : string + + val description : string + + type pk_uri = private Uri.t + + type sk_uri = private Uri.t + + type public_key_hash + + type public_key + + type secret_key + + type signature + + val neuterize : sk_uri -> pk_uri tzresult Lwt.t + + val import_secret_key : + io:Client_context.io_wallet -> + pk_uri -> + (public_key_hash * public_key option) tzresult Lwt.t + + val public_key : pk_uri -> public_key tzresult Lwt.t + + val public_key_hash : + pk_uri -> (public_key_hash * public_key option) tzresult Lwt.t +end + +module type AGGREGATE_SIGNER = sig + include + COMMON_SIGNER + with type public_key_hash = + Tezos_crypto.Aggregate_signature.Public_key_hash.t + and type public_key = Tezos_crypto.Aggregate_signature.Public_key.t + and type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t + and type pk_uri = aggregate_pk_uri + and type sk_uri = aggregate_sk_uri + + val sign : + aggregate_sk_uri -> + Bytes.t -> + Tezos_crypto.Aggregate_signature.t tzresult Lwt.t +end + module Make_common_type (S : sig include Tezos_crypto.S.COMMON_SIGNATURE @@ -433,15 +429,9 @@ struct type public_key = S.Public_key.t type secret_key = S.Secret_key.t -end - -module Signature_type = Make_common_type (struct - include Tezos_crypto.Signature - type nonrec pk_uri = pk_uri - - type nonrec sk_uri = sk_uri -end) + type signature = S.t +end module Aggregate_type = Make_common_type (struct include Tezos_crypto.Aggregate_signature @@ -451,24 +441,71 @@ module Aggregate_type = Make_common_type (struct type sk_uri = aggregate_sk_uri end) -module type COMMON_SIGNER = sig - val scheme : string +module type Signature_S = sig + include + Tezos_crypto.S.SIGNATURE + with type watermark = Tezos_crypto.Signature.watermark - val title : string + val concat : Bytes.t -> t -> Bytes.t - val description : string + module Adapter : sig + val public_key_hash : + Tezos_crypto.Signature.Public_key_hash.t -> Public_key_hash.t tzresult - type pk_uri = private Uri.t + val public_key : + Tezos_crypto.Signature.Public_key.t -> Public_key.t tzresult - type sk_uri = private Uri.t + val signature : Tezos_crypto.Signature.t -> t tzresult + end +end + +module type SIMPLE_SIGNER = sig + include COMMON_SIGNER with type pk_uri = pk_uri and type sk_uri = sk_uri + + val sign : + ?watermark:Tezos_crypto.Signature.watermark -> + sk_uri -> + Bytes.t -> + signature tzresult Lwt.t + val deterministic_nonce : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t + + val deterministic_nonce_hash : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t + + val supports_deterministic_nonces : sk_uri -> bool tzresult Lwt.t +end + +module type S = sig type public_key_hash type public_key type secret_key - val neuterize : sk_uri -> pk_uri tzresult Lwt.t + type watermark + + type signature + + module Signature_type : sig + type nonrec public_key_hash = public_key_hash + + type nonrec public_key = public_key + + type nonrec secret_key = secret_key + + type nonrec signature = signature + + type nonrec pk_uri = pk_uri + + type nonrec sk_uri = sk_uri + end + + module Public_key_hash : Client_aliases.Alias with type t = public_key_hash + + module Public_key : + Client_aliases.Alias with type t = pk_uri * public_key option + + module Secret_key : Client_aliases.Alias with type t = sk_uri val import_secret_key : io:Client_context.io_wallet -> @@ -479,46 +516,83 @@ module type COMMON_SIGNER = sig val public_key_hash : pk_uri -> (public_key_hash * public_key option) tzresult Lwt.t -end -module type SIGNER = sig - include - COMMON_SIGNER - with type public_key_hash = Tezos_crypto.Signature.Public_key_hash.t - and type public_key = Tezos_crypto.Signature.Public_key.t - and type secret_key = Tezos_crypto.Signature.Secret_key.t - and type pk_uri = pk_uri - and type sk_uri = sk_uri + val neuterize : sk_uri -> pk_uri tzresult Lwt.t val sign : - ?watermark:Tezos_crypto.Signature.watermark -> + #Client_context.wallet -> + ?watermark:watermark -> + sk_uri -> + Bytes.t -> + signature tzresult Lwt.t + + val append : + #Client_context.wallet -> + ?watermark:watermark -> sk_uri -> Bytes.t -> - Tezos_crypto.Signature.t tzresult Lwt.t + Bytes.t tzresult Lwt.t + + val check : + ?watermark:watermark -> + pk_uri -> + signature -> + Bytes.t -> + bool tzresult Lwt.t val deterministic_nonce : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t val deterministic_nonce_hash : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t val supports_deterministic_nonces : sk_uri -> bool tzresult Lwt.t -end - -module type AGGREGATE_SIGNER = sig - include - COMMON_SIGNER - with type public_key_hash = - Tezos_crypto.Aggregate_signature.Public_key_hash.t - and type public_key = Tezos_crypto.Aggregate_signature.Public_key.t - and type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t - and type pk_uri = aggregate_pk_uri - and type sk_uri = aggregate_sk_uri - val sign : - aggregate_sk_uri -> - Bytes.t -> - Tezos_crypto.Aggregate_signature.t tzresult Lwt.t + val register_key : + #Client_context.wallet -> + ?force:bool -> + public_key_hash * pk_uri * sk_uri -> + ?public_key:public_key -> + string -> + unit tzresult Lwt.t + + val register_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key * pk_uri * sk_uri) list -> + unit tzresult Lwt.t + + val list_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key option * sk_uri option) list tzresult + Lwt.t + + val alias_keys : + #Client_context.wallet -> + string -> + (public_key_hash * public_key option * sk_uri option) option tzresult Lwt.t + + val get_key : + #Client_context.wallet -> + public_key_hash -> + (string * public_key * sk_uri) tzresult Lwt.t + + val get_public_key : + #Client_context.wallet -> + public_key_hash -> + (string * public_key) tzresult Lwt.t + + val get_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key * sk_uri) list tzresult Lwt.t + + val force_switch : unit -> (bool, 'ctx) Tezos_clic.arg end +module type SIGNER = + SIMPLE_SIGNER + with type public_key_hash = Tezos_crypto.Signature.Public_key_hash.t + and type public_key = Tezos_crypto.Signature.Public_key.t + and type secret_key = Tezos_crypto.Signature.Secret_key.t + and type signature = Tezos_crypto.Signature.t + type signer = | Simple of (module SIGNER) | Aggregate of (module AGGREGATE_SIGNER) @@ -533,19 +607,15 @@ let register_aggregate_signer signer = let module Signer = (val signer : AGGREGATE_SIGNER) in String.Hashtbl.replace signers_table Signer.scheme (Aggregate signer) +let registered_signers () : (string * signer) list = + String.Hashtbl.fold (fun k v acc -> (k, v) :: acc) signers_table [] + let find_signer_for_key ~scheme : signer tzresult = let open Result_syntax in match String.Hashtbl.find signers_table scheme with | None -> tzfail (Unregistered_key_scheme scheme) | Some signer -> return signer -let find_simple_signer_for_key ~scheme = - let open Result_syntax in - let* signer = find_signer_for_key ~scheme in - match signer with - | Simple signer -> return signer - | Aggregate _signer -> tzfail (Wrong_key_scheme ("simple", "aggregate")) - let find_aggregate_signer_for_key ~scheme = let open Result_syntax in let* signer = find_signer_for_key ~scheme in @@ -553,45 +623,6 @@ let find_aggregate_signer_for_key ~scheme = | Simple _signer -> tzfail (Wrong_key_scheme ("aggregate", "standard")) | Aggregate signer -> return signer -let registered_signers () : (string * signer) list = - String.Hashtbl.fold (fun k v acc -> (k, v) :: acc) signers_table [] - -type error += Signature_mismatch of sk_uri - -let () = - register_error_kind - `Permanent - ~id:"cli.signature_mismatch" - ~title:"Signature mismatch" - ~description:"The signer produced an invalid signature" - ~pp:(fun ppf sk -> - Format.fprintf - ppf - "The signer for %a produced an invalid signature" - Uri.pp_hum - sk) - Data_encoding.(obj1 (req "locator" uri_encoding)) - (function Signature_mismatch sk -> Some sk | _ -> None) - (fun sk -> Signature_mismatch sk) - -let with_scheme_signer (uri : Uri.t) (f : signer -> 'a tzresult Lwt.t) : - 'a tzresult Lwt.t = - let open Lwt_result_syntax in - match Uri.scheme uri with - | None -> tzfail @@ Unexisting_scheme uri - | Some scheme -> - let*? signer = find_signer_for_key ~scheme in - f signer - -let with_scheme_simple_signer (uri : Uri.t) - (f : (module SIGNER) -> 'a tzresult Lwt.t) : 'a tzresult Lwt.t = - let open Lwt_result_syntax in - match Uri.scheme uri with - | None -> tzfail @@ Unexisting_scheme uri - | Some scheme -> - let*? signer = find_simple_signer_for_key ~scheme in - f signer - let with_scheme_aggregate_signer (uri : Uri.t) (f : (module AGGREGATE_SIGNER) -> 'a tzresult Lwt.t) : 'a tzresult Lwt.t = let open Lwt_result_syntax in @@ -601,252 +632,6 @@ let with_scheme_aggregate_signer (uri : Uri.t) let*? signer = find_aggregate_signer_for_key ~scheme in f signer -let neuterize (sk_uri : sk_uri) : pk_uri tzresult Lwt.t = - with_scheme_simple_signer sk_uri (fun (module Signer : SIGNER) -> - Signer.neuterize sk_uri) - -let public_key pk_uri = - with_scheme_simple_signer pk_uri (fun (module Signer : SIGNER) -> - Signer.public_key pk_uri) - -let public_key_hash pk_uri = - with_scheme_simple_signer pk_uri (fun (module Signer : SIGNER) -> - Signer.public_key_hash pk_uri) - -let import_secret_key ~io pk_uri = - with_scheme_simple_signer pk_uri (fun (module Signer : SIGNER) -> - Signer.import_secret_key ~io pk_uri) - -let sign cctxt ?watermark sk_uri buf = - let open Lwt_result_syntax in - with_scheme_simple_signer sk_uri (fun (module Signer : SIGNER) -> - let* signature = Signer.sign ?watermark sk_uri buf in - let* pk_uri = Signer.neuterize sk_uri in - let* pubkey = - let* o = Secret_key.rev_find cctxt sk_uri in - match o with - | None -> public_key pk_uri - | Some name -> ( - let* r = Public_key.find cctxt name in - match r with - | _, None -> - let* pk = public_key pk_uri in - let* () = Public_key.update cctxt name (pk_uri, Some pk) in - return pk - | _, Some pubkey -> return pubkey) - in - let* () = - fail_unless - (Tezos_crypto.Signature.check ?watermark pubkey signature buf) - (Signature_mismatch sk_uri) - in - return signature) - -let append cctxt ?watermark loc buf = - let open Lwt_result_syntax in - let+ signature = sign cctxt ?watermark loc buf in - Tezos_crypto.Signature.concat buf signature - -let check ?watermark pk_uri signature buf = - let open Lwt_result_syntax in - let* pk = public_key pk_uri in - return (Tezos_crypto.Signature.check ?watermark pk signature buf) - -let deterministic_nonce sk_uri data = - with_scheme_simple_signer sk_uri (fun (module Signer : SIGNER) -> - Signer.deterministic_nonce sk_uri data) - -let deterministic_nonce_hash sk_uri data = - with_scheme_simple_signer sk_uri (fun (module Signer : SIGNER) -> - Signer.deterministic_nonce_hash sk_uri data) - -let supports_deterministic_nonces sk_uri = - let open Lwt_result_syntax in - with_scheme_signer sk_uri (function - | Simple (module Signer : SIGNER) -> - Signer.supports_deterministic_nonces sk_uri - | Aggregate _ -> return_false) - -let register_key cctxt ?(force = false) (public_key_hash, pk_uri, sk_uri) - ?public_key name = - let open Lwt_result_syntax in - let* () = Public_key.add ~force cctxt name (pk_uri, public_key) in - let* () = Secret_key.add ~force cctxt name sk_uri in - Public_key_hash.add ~force cctxt name public_key_hash - -let register_keys cctxt xs = - let open Lwt_result_syntax in - let* () = - Public_key.add_many - cctxt - (List.map (fun (name, _, pk, pk_uri, _) -> (name, (pk_uri, Some pk))) xs) - in - let* () = - Secret_key.add_many - cctxt - (List.map (fun (name, _, _, _, sk_uri) -> (name, sk_uri)) xs) - in - let* () = - Public_key_hash.add_many - cctxt - (List.map - (fun (name, public_key_hash, _, _, _) -> (name, public_key_hash)) - xs) - in - return_unit - -(* This function is used to chose between two aliases associated - to the same key hash; if we know the secret key for one of them - we take it, otherwise if we know the public key for one of them - we take it. *) -let join_keys keys1_opt keys2 = - match (keys1_opt, keys2) with - | Some (_, Some _, None), (_, None, None) -> keys1_opt - | Some (_, _, Some _), _ -> keys1_opt - | _ -> Some keys2 - -(* For efficiency, this function avoids loading the wallet, except for - the call to [Public_key.update]. Indeed the arguments [pkhs], - [pks], [sks] represent the already loaded list of public key - hashes, public keys, and secret keys. *) -let raw_get_key_aux (cctxt : #Client_context.wallet) pkhs pks sks pkh = - let open Lwt_result_syntax in - let rev_find_all list pkh = - List.filter_map - (fun (name, pkh') -> - if Tezos_crypto.Signature.Public_key_hash.equal pkh pkh' then Some name - else None) - list - in - let*! r = - let names = rev_find_all pkhs pkh in - let* o = - List.fold_left_es - (fun keys_opt name -> - let sk_uri_opt = List.assoc ~equal:String.equal name sks in - let* pk_opt = - match List.assoc ~equal:String.equal name pks with - | None -> return_none - | Some (_, Some pk) -> return_some pk - | Some (pk_uri, None) -> - let* pk = public_key pk_uri in - let* () = Public_key.update cctxt name (pk_uri, Some pk) in - return_some pk - in - return @@ join_keys keys_opt (name, pk_opt, sk_uri_opt)) - None - names - in - match o with - | None -> - failwith - "no keys for the source contract %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh - | Some keys -> return keys - in - match r with - | (Ok (_, _, None) | Error _) as initial_result -> ( - (* try to lookup for a remote key *) - let*! r = - let*? signer = find_simple_signer_for_key ~scheme:"remote" in - let module Signer = (val signer : SIGNER) in - let path = Tezos_crypto.Signature.Public_key_hash.to_b58check pkh in - let uri = Uri.make ~scheme:Signer.scheme ~path () in - let* pk = Signer.public_key uri in - return (path, Some pk, Some uri) - in - match r with - | Error _ -> Lwt.return initial_result - | Ok _ as success -> Lwt.return success) - | Ok _ as success -> Lwt.return success - -let raw_get_key (cctxt : #Client_context.wallet) pkh = - let open Lwt_result_syntax in - let* pkhs = Public_key_hash.load cctxt in - let* pks = Public_key.load cctxt in - let* sks = Secret_key.load cctxt in - raw_get_key_aux cctxt pkhs pks sks pkh - -let get_key cctxt pkh = - let open Lwt_result_syntax in - let* r = raw_get_key cctxt pkh in - match r with - | pkh, Some pk, Some sk -> return (pkh, pk, sk) - | _pkh, _pk, None -> - failwith - "Unknown secret key for %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh - | _pkh, None, _sk -> - failwith - "Unknown public key for %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh - -let get_public_key cctxt pkh = - let open Lwt_result_syntax in - let* r = raw_get_key cctxt pkh in - match r with - | pkh, Some pk, _sk -> return (pkh, pk) - | _pkh, None, _sk -> - failwith - "Unknown public key for %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh - -let get_keys (cctxt : #Client_context.wallet) = - let open Lwt_result_syntax in - let* sks = Secret_key.load cctxt in - let* pkhs = Public_key_hash.load cctxt in - let* pks = Public_key.load cctxt in - let*! keys = - List.filter_map_s - (fun (name, sk_uri) -> - let*! r = - match List.assoc ~equal:String.equal name pkhs with - | Some pkh -> - let* pk = - match List.assoc ~equal:String.equal name pks with - | Some (_, Some pk) -> return pk - | Some (pk_uri, None) -> - let* pk = public_key pk_uri in - let* () = Public_key.update cctxt name (pk_uri, Some pk) in - return pk - | None -> failwith "no public key alias named %s" name - in - return (name, pkh, pk, sk_uri) - | None -> failwith "no public key hash alias named %s" name - in - match r with Ok r -> Lwt.return_some r | Error _ -> Lwt.return_none) - sks - in - return keys - -let list_keys cctxt = - let open Lwt_result_syntax in - let* pkhs = Public_key_hash.load cctxt in - let* pks = Public_key.load cctxt in - let* sks = Secret_key.load cctxt in - List.map_es - (fun (name, pkh) -> - let*! r = raw_get_key_aux cctxt pkhs pks sks pkh in - match r with - | Ok (_name, pk, sk_uri) -> return (name, pkh, pk, sk_uri) - | Error _ -> return (name, pkh, None, None)) - pkhs - -let alias_keys cctxt name = - let open Lwt_result_syntax in - let* pkh = Public_key_hash.find cctxt name in - let*! r = raw_get_key cctxt pkh in - match r with - | Ok (_name, pk, sk_uri) -> return_some (pkh, pk, sk_uri) - | Error _ -> return_none - -let force_switch () = - Tezos_clic.switch ~long:"force" ~short:'f' ~doc:"overwrite existing keys" () - let register_aggregate_key cctxt ?(force = false) (public_key_hash, pk_uri, sk_uri) ?public_key name = let open Lwt_result_syntax in @@ -864,6 +649,16 @@ let aggregate_public_key pk_uri = with_scheme_aggregate_signer pk_uri (fun (module Signer : AGGREGATE_SIGNER) -> Signer.public_key pk_uri) +(* This function is used to chose between two aliases associated + to the same key hash; if we know the secret key for one of them + we take it, otherwise if we know the public key for one of them + we take it. *) +let join_keys keys1_opt keys2 = + match (keys1_opt, keys2) with + | Some (_, Some _, None), (_, None, None) -> keys1_opt + | Some (_, _, Some _), _ -> keys1_opt + | _ -> Some keys2 + (* For efficiency, this function avoids loading the wallet, except for the call to [Public_key.update]. Indeed the arguments [pkhs], [pks], [sks] represent the already loaded list of public key @@ -966,6 +761,476 @@ let aggregate_sign cctxt sk_uri buf = in return signature) +module Make (Signature : Signature_S) : + S + with type public_key_hash := Signature.Public_key_hash.t + and type public_key := Signature.Public_key.t + and type secret_key := Signature.Secret_key.t + and type watermark := Signature.watermark + and type signature := Signature.t = struct + module Public_key_hash = struct + include Client_aliases.Alias (struct + (* includes t, Compare, encoding *) + include Signature.Public_key_hash + + let of_source s = Lwt.return (Signature.Public_key_hash.of_b58check s) + + let to_source p = Lwt.return_ok (Signature.Public_key_hash.to_b58check p) + + let name = "public key hash" + end) + end + + module Secret_key = Client_aliases.Alias (struct + let name = "secret_key" + + type t = sk_uri + + include (CompareUri : Compare.S with type t := t) + + let of_source s = Lwt.return (make_sk_uri @@ Uri.of_string s) + + let to_source t = Lwt.return_ok (Uri.to_string t) + + let encoding = uri_encoding + end) + + module Public_key = Client_aliases.Alias (struct + let name = "public_key" + + type t = pk_uri * Signature.Public_key.t option + + include Compare.Make (struct + type nonrec t = t + + let compare (apk, aso) (bpk, bso) = + Compare.or_else (CompareUri.compare apk bpk) (fun () -> + Option.compare Signature.Public_key.compare aso bso) + end) + + let of_source s = + let open Lwt_result_syntax in + let*? pk_uri = make_pk_uri @@ Uri.of_string s in + return (pk_uri, None) + + let to_source (t, _) = Lwt.return_ok (Uri.to_string t) + + let encoding = + let open Data_encoding in + union + [ + case + Json_only + ~title:"Locator_only" + uri_encoding + (function uri, None -> Some uri | _, Some _ -> None) + (fun uri -> (uri, None)); + case + Json_only + ~title:"Locator_and_full_key" + (obj2 + (req "locator" uri_encoding) + (req "key" Signature.Public_key.encoding)) + (function uri, Some key -> Some (uri, key) | _, None -> None) + (fun (uri, key) -> (uri, Some key)); + ] + end) + + module Signature_type = Make_common_type (struct + include Signature + + type nonrec pk_uri = pk_uri + + type nonrec sk_uri = sk_uri + end) + + module type V_SIGNER = + SIMPLE_SIGNER + with type public_key_hash = Signature.Public_key_hash.t + and type public_key = Signature.Public_key.t + and type secret_key = Signature.Secret_key.t + and type signature = Signature.t + + module Adapt (S : SIGNER) : V_SIGNER = struct + let scheme = S.scheme + + let title = S.title + + let description = S.description + + type pk_uri = Uri.t + + type sk_uri = Uri.t + + type public_key_hash = Signature.Public_key_hash.t + + type public_key = Signature.Public_key.t + + type secret_key = Signature.Secret_key.t + + type signature = Signature.t + + let neuterize = S.neuterize + + let import_secret_key ~io sk = + let open Lwt_result_syntax in + let* pkh, pk = S.import_secret_key ~io sk in + let*? pkh = Signature.Adapter.public_key_hash pkh in + let*? pk = Option.map_e Signature.Adapter.public_key pk in + return (pkh, pk) + + let public_key pk = + let open Lwt_result_syntax in + let* pk = S.public_key pk in + let*? pk = Signature.Adapter.public_key pk in + return pk + + let public_key_hash pk = + let open Lwt_result_syntax in + let* pkh, pk = S.public_key_hash pk in + let*? pkh = Signature.Adapter.public_key_hash pkh in + let*? pk = Option.map_e Signature.Adapter.public_key pk in + return (pkh, pk) + + let sign ?watermark sk msg = + let open Lwt_result_syntax in + let* signature = S.sign ?watermark sk msg in + let*? signature = Signature.Adapter.signature signature in + return signature + + let deterministic_nonce = S.deterministic_nonce + + let deterministic_nonce_hash = S.deterministic_nonce_hash + + let supports_deterministic_nonces = S.supports_deterministic_nonces + end + + let adapt_signer (module Signer : SIGNER) = + let module V_Signer = Adapt (Signer) in + (module V_Signer : V_SIGNER) + + let with_scheme_signer (uri : Uri.t) (f : signer -> 'a tzresult Lwt.t) : + 'a tzresult Lwt.t = + let open Lwt_result_syntax in + match Uri.scheme uri with + | None -> tzfail @@ Unexisting_scheme uri + | Some scheme -> + let*? signer = find_signer_for_key ~scheme in + f signer + + let find_simple_signer_for_key ~scheme = + let open Result_syntax in + let* signer = find_signer_for_key ~scheme in + match signer with + | Simple signer -> return (adapt_signer signer) + | Aggregate _signer -> tzfail (Wrong_key_scheme ("simple", "aggregate")) + + let with_scheme_simple_signer (uri : Uri.t) + (f : (module V_SIGNER) -> 'a tzresult Lwt.t) : 'a tzresult Lwt.t = + let open Lwt_result_syntax in + match Uri.scheme uri with + | None -> tzfail @@ Unexisting_scheme uri + | Some scheme -> + let*? signer = find_simple_signer_for_key ~scheme in + f signer + + let neuterize (sk_uri : sk_uri) : pk_uri tzresult Lwt.t = + with_scheme_simple_signer sk_uri (fun (module Signer) -> + Signer.neuterize sk_uri) + + let public_key pk_uri = + with_scheme_simple_signer pk_uri (fun (module Signer) -> + Signer.public_key pk_uri) + + let public_key_hash pk_uri = + with_scheme_simple_signer pk_uri (fun (module Signer) -> + Signer.public_key_hash pk_uri) + + let import_secret_key ~io pk_uri = + with_scheme_simple_signer pk_uri (fun (module Signer) -> + Signer.import_secret_key ~io pk_uri) + + let sign cctxt ?watermark sk_uri buf = + let open Lwt_result_syntax in + with_scheme_simple_signer sk_uri (fun (module Signer) -> + let* signature = Signer.sign ?watermark sk_uri buf in + let* pk_uri = Signer.neuterize sk_uri in + let* pubkey = + let* o = Secret_key.rev_find cctxt sk_uri in + match o with + | None -> public_key pk_uri + | Some name -> ( + let* r = Public_key.find cctxt name in + match r with + | _, None -> + let* pk = public_key pk_uri in + let* () = Public_key.update cctxt name (pk_uri, Some pk) in + return pk + | _, Some pubkey -> return pubkey) + in + let* () = + fail_unless + (Signature.check ?watermark pubkey signature buf) + (Signature_mismatch sk_uri) + in + return signature) + + let append cctxt ?watermark loc buf = + let open Lwt_result_syntax in + let+ signature = sign cctxt ?watermark loc buf in + Signature.concat buf signature + + let check ?watermark pk_uri signature buf = + let open Lwt_result_syntax in + let* pk = public_key pk_uri in + return (Signature.check ?watermark pk signature buf) + + let deterministic_nonce sk_uri data = + with_scheme_simple_signer sk_uri (fun (module Signer) -> + Signer.deterministic_nonce sk_uri data) + + let deterministic_nonce_hash sk_uri data = + with_scheme_simple_signer sk_uri (fun (module Signer) -> + Signer.deterministic_nonce_hash sk_uri data) + + let supports_deterministic_nonces sk_uri = + let open Lwt_result_syntax in + with_scheme_signer sk_uri (function + | Simple (module Signer : SIGNER) -> + Signer.supports_deterministic_nonces sk_uri + | Aggregate _ -> return_false) + + let register_key cctxt ?(force = false) (public_key_hash, pk_uri, sk_uri) + ?public_key name = + let open Lwt_result_syntax in + let* () = Public_key.add ~force cctxt name (pk_uri, public_key) in + let* () = Secret_key.add ~force cctxt name sk_uri in + Public_key_hash.add ~force cctxt name public_key_hash + + let register_keys cctxt xs = + let open Lwt_result_syntax in + let* () = + Public_key.add_many + cctxt + (List.map + (fun (name, _, pk, pk_uri, _) -> (name, (pk_uri, Some pk))) + xs) + in + let* () = + Secret_key.add_many + cctxt + (List.map (fun (name, _, _, _, sk_uri) -> (name, sk_uri)) xs) + in + let* () = + Public_key_hash.add_many + cctxt + (List.map + (fun (name, public_key_hash, _, _, _) -> (name, public_key_hash)) + xs) + in + return_unit + + (* For efficiency, this function avoids loading the wallet, except for + the call to [Public_key.update]. Indeed the arguments [pkhs], + [pks], [sks] represent the already loaded list of public key + hashes, public keys, and secret keys. *) + let raw_get_key_aux (cctxt : #Client_context.wallet) pkhs pks sks pkh = + let open Lwt_result_syntax in + let rev_find_all list pkh = + List.filter_map + (fun (name, pkh') -> + if Signature.Public_key_hash.equal pkh pkh' then Some name else None) + list + in + let*! r = + let names = rev_find_all pkhs pkh in + let* o = + List.fold_left_es + (fun keys_opt name -> + let sk_uri_opt = List.assoc ~equal:String.equal name sks in + let* pk_opt = + match List.assoc ~equal:String.equal name pks with + | None -> return_none + | Some (_, Some pk) -> return_some pk + | Some (pk_uri, None) -> + let* pk = public_key pk_uri in + let* () = Public_key.update cctxt name (pk_uri, Some pk) in + return_some pk + in + return @@ join_keys keys_opt (name, pk_opt, sk_uri_opt)) + None + names + in + match o with + | None -> + failwith + "no keys for the source contract %a" + Signature.Public_key_hash.pp + pkh + | Some keys -> return keys + in + match r with + | (Ok (_, _, None) | Error _) as initial_result -> ( + (* try to lookup for a remote key *) + let*! r = + let*? signer = find_simple_signer_for_key ~scheme:"remote" in + let module Signer = (val signer) in + let path = Signature.Public_key_hash.to_b58check pkh in + let uri = Uri.make ~scheme:Signer.scheme ~path () in + let* pk = Signer.public_key uri in + return (path, Some pk, Some uri) + in + match r with + | Error _ -> Lwt.return initial_result + | Ok _ as success -> Lwt.return success) + | Ok _ as success -> Lwt.return success + + let raw_get_key (cctxt : #Client_context.wallet) pkh = + let open Lwt_result_syntax in + let* pkhs = Public_key_hash.load cctxt in + let* pks = Public_key.load cctxt in + let* sks = Secret_key.load cctxt in + raw_get_key_aux cctxt pkhs pks sks pkh + + let get_key cctxt pkh = + let open Lwt_result_syntax in + let* r = raw_get_key cctxt pkh in + match r with + | pkh, Some pk, Some sk -> return (pkh, pk, sk) + | _pkh, _pk, None -> + failwith "Unknown secret key for %a" Signature.Public_key_hash.pp pkh + | _pkh, None, _sk -> + failwith "Unknown public key for %a" Signature.Public_key_hash.pp pkh + + let get_public_key cctxt pkh = + let open Lwt_result_syntax in + let* r = raw_get_key cctxt pkh in + match r with + | pkh, Some pk, _sk -> return (pkh, pk) + | _pkh, None, _sk -> + failwith "Unknown public key for %a" Signature.Public_key_hash.pp pkh + + let get_keys (cctxt : #Client_context.wallet) = + let open Lwt_result_syntax in + let* sks = Secret_key.load cctxt in + let* pkhs = Public_key_hash.load cctxt in + let* pks = Public_key.load cctxt in + let*! keys = + List.filter_map_s + (fun (name, sk_uri) -> + let*! r = + match List.assoc ~equal:String.equal name pkhs with + | Some pkh -> + let* pk = + match List.assoc ~equal:String.equal name pks with + | Some (_, Some pk) -> return pk + | Some (pk_uri, None) -> + let* pk = public_key pk_uri in + let* () = + Public_key.update cctxt name (pk_uri, Some pk) + in + return pk + | None -> failwith "no public key alias named %s" name + in + return (name, pkh, pk, sk_uri) + | None -> failwith "no public key hash alias named %s" name + in + match r with Ok r -> Lwt.return_some r | Error _ -> Lwt.return_none) + sks + in + return keys + + let list_keys cctxt = + let open Lwt_result_syntax in + let* pkhs = Public_key_hash.load cctxt in + let* pks = Public_key.load cctxt in + let* sks = Secret_key.load cctxt in + List.map_es + (fun (name, pkh) -> + let*! r = raw_get_key_aux cctxt pkhs pks sks pkh in + match r with + | Ok (_name, pk, sk_uri) -> return (name, pkh, pk, sk_uri) + | Error _ -> return (name, pkh, None, None)) + pkhs + + let alias_keys cctxt name = + let open Lwt_result_syntax in + let* pkh = Public_key_hash.find cctxt name in + let*! r = raw_get_key cctxt pkh in + match r with + | Ok (_name, pk, sk_uri) -> return_some (pkh, pk, sk_uri) + | Error _ -> return_none + + let force_switch () = + Tezos_clic.switch ~long:"force" ~short:'f' ~doc:"overwrite existing keys" () +end + +module V0 = Make (struct + include Tezos_crypto.Signature.V0 + + let generate_key = generate_key ?algo:None + + module Adapter = struct + let public_key_hash : + Tezos_crypto.Signature.Public_key_hash.t -> Public_key_hash.t tzresult = + let open Result_syntax in + function + | Ed25519 k -> return (Ed25519 k : Public_key_hash.t) + | Secp256k1 k -> return (Secp256k1 k : Public_key_hash.t) + | P256 k -> return (P256 k : Public_key_hash.t) + + let public_key : + Tezos_crypto.Signature.Public_key.t -> Public_key.t tzresult = + let open Result_syntax in + function + | Ed25519 k -> return (Ed25519 k : Public_key.t) + | Secp256k1 k -> return (Secp256k1 k : Public_key.t) + | P256 k -> return (P256 k : Public_key.t) + + let signature : Tezos_crypto.Signature.t -> t tzresult = + let open Result_syntax in + function + | Ed25519 k -> return (Ed25519 k : t) + | Secp256k1 k -> return (Secp256k1 k : t) + | P256 k -> return (P256 k : t) + | Unknown k -> return (Unknown k : t) + end +end) + +module V1 = Make (struct + include Tezos_crypto.Signature.V1 + + let generate_key = generate_key ?algo:None + + module Adapter = struct + let identity x = Ok x + + let public_key_hash = identity + + let public_key = identity + + let signature = identity + end +end) + +module V_latest = Make (struct + include Tezos_crypto.Signature.V_latest + + let generate_key = generate_key ?algo:None + + module Adapter = struct + let identity x = Ok x + + let public_key_hash = identity + + let public_key = identity + + let signature = identity + end +end) + +include V_latest + module Mnemonic = struct let new_random = Bip39.of_entropy (Tezos_crypto.Hacl.Rand.gen 32) diff --git a/src/lib_client_base/client_keys.mli b/src/lib_client_base/client_keys.mli index 558ed7684a37ae968261836419ab486df1b789b3..428d0bdcc8c81f35ddc1e49c52870557a2d24c40 100644 --- a/src/lib_client_base/client_keys.mli +++ b/src/lib_client_base/client_keys.mli @@ -66,15 +66,6 @@ type error += Unregistered_key_scheme of string type error += Invalid_uri of Uri.t -module Public_key_hash : - Client_aliases.Alias with type t = Tezos_crypto.Signature.Public_key_hash.t - -module Public_key : - Client_aliases.Alias - with type t = pk_uri * Tezos_crypto.Signature.Public_key.t option - -module Secret_key : Client_aliases.Alias with type t = sk_uri - type sapling_key = { sk : sapling_uri; (* zip32 derivation path *) @@ -108,6 +99,20 @@ module Aggregate_alias : sig module Secret_key : Client_aliases.Alias with type t = aggregate_sk_uri end +module Aggregate_type : sig + type public_key_hash = Tezos_crypto.Aggregate_signature.Public_key_hash.t + + type public_key = Tezos_crypto.Aggregate_signature.Public_key.t + + type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t + + type signature = Tezos_crypto.Aggregate_signature.t + + type pk_uri = aggregate_pk_uri + + type sk_uri = aggregate_sk_uri +end + module Logging : sig val tag : string Tag.def end @@ -125,6 +130,8 @@ module type COMMON_SIGNER = sig type secret_key + type signature + (** [scheme] is the name of the scheme implemented by this signer module. *) val scheme : string @@ -161,30 +168,20 @@ module type COMMON_SIGNER = sig pk_uri -> (public_key_hash * public_key option) tzresult Lwt.t end -(** [Signature_type] is a small module to be included in signer to conform to - the module type [SIGNER] instead of rewriting all type. *) -module Signature_type : sig - type public_key_hash = Tezos_crypto.Signature.Public_key_hash.t - - type public_key = Tezos_crypto.Signature.Public_key.t - - type secret_key = Tezos_crypto.Signature.Secret_key.t - - type nonrec pk_uri = pk_uri - - type nonrec sk_uri = sk_uri -end - -module Aggregate_type : sig - type public_key_hash = Tezos_crypto.Aggregate_signature.Public_key_hash.t - - type public_key = Tezos_crypto.Aggregate_signature.Public_key.t - - type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t - - type pk_uri = aggregate_pk_uri +module type AGGREGATE_SIGNER = sig + include + COMMON_SIGNER + with type public_key_hash = + Tezos_crypto.Aggregate_signature.Public_key_hash.t + and type public_key = Tezos_crypto.Aggregate_signature.Public_key.t + and type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t + and type pk_uri = aggregate_pk_uri + and type sk_uri = aggregate_sk_uri - type sk_uri = aggregate_sk_uri + val sign : + aggregate_sk_uri -> + Bytes.t -> + Tezos_crypto.Aggregate_signature.t tzresult Lwt.t end module type SIGNER = sig @@ -193,6 +190,7 @@ module type SIGNER = sig with type public_key_hash = Tezos_crypto.Signature.Public_key_hash.t and type public_key = Tezos_crypto.Signature.Public_key.t and type secret_key = Tezos_crypto.Signature.Secret_key.t + and type signature = Tezos_crypto.Signature.t and type pk_uri = pk_uri and type sk_uri = sk_uri @@ -202,7 +200,7 @@ module type SIGNER = sig ?watermark:Tezos_crypto.Signature.watermark -> sk_uri -> Bytes.t -> - Tezos_crypto.Signature.t tzresult Lwt.t + signature tzresult Lwt.t (** [deterministic_nonce sk data] is a nonce obtained deterministically from [data] and [sk]. *) @@ -217,23 +215,6 @@ module type SIGNER = sig val supports_deterministic_nonces : sk_uri -> bool tzresult Lwt.t end -module type AGGREGATE_SIGNER = sig - include - COMMON_SIGNER - with type public_key_hash = - Tezos_crypto.Aggregate_signature.Public_key_hash.t - and type public_key = Tezos_crypto.Aggregate_signature.Public_key.t - and type secret_key = Tezos_crypto.Aggregate_signature.Secret_key.t - and type pk_uri = aggregate_pk_uri - and type sk_uri = aggregate_sk_uri - - (** [sign sk data] is signature obtained by signing [data] with [sk]. *) - val sign : - aggregate_sk_uri -> - Bytes.t -> - Tezos_crypto.Aggregate_signature.t tzresult Lwt.t -end - type signer = | Simple of (module SIGNER) | Aggregate of (module AGGREGATE_SIGNER) @@ -248,109 +229,6 @@ val registered_signers : unit -> (string * signer) list signer for keys with scheme [(val signer : AGGREGATE_SIGNER).scheme]. *) val register_aggregate_signer : (module AGGREGATE_SIGNER) -> unit -val import_secret_key : - io:Client_context.io_wallet -> - pk_uri -> - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key.t option) - tzresult - Lwt.t - -val public_key : pk_uri -> Tezos_crypto.Signature.Public_key.t tzresult Lwt.t - -val public_key_hash : - pk_uri -> - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key.t option) - tzresult - Lwt.t - -val neuterize : sk_uri -> pk_uri tzresult Lwt.t - -val sign : - #Client_context.wallet -> - ?watermark:Tezos_crypto.Signature.watermark -> - sk_uri -> - Bytes.t -> - Tezos_crypto.Signature.t tzresult Lwt.t - -val append : - #Client_context.wallet -> - ?watermark:Tezos_crypto.Signature.watermark -> - sk_uri -> - Bytes.t -> - Bytes.t tzresult Lwt.t - -val check : - ?watermark:Tezos_crypto.Signature.watermark -> - pk_uri -> - Tezos_crypto.Signature.t -> - Bytes.t -> - bool tzresult Lwt.t - -val deterministic_nonce : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t - -val deterministic_nonce_hash : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t - -val supports_deterministic_nonces : sk_uri -> bool tzresult Lwt.t - -val register_key : - #Client_context.wallet -> - ?force:bool -> - Tezos_crypto.Signature.Public_key_hash.t * pk_uri * sk_uri -> - ?public_key:Tezos_crypto.Signature.Public_key.t -> - string -> - unit tzresult Lwt.t - -(** Similar to repeated calls to [register_key], but is more efficient. - Always forces addition of new elements. *) -val register_keys : - #Client_context.wallet -> - (string - * Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.public_key - * pk_uri - * sk_uri) - list -> - unit tzresult Lwt.t - -val list_keys : - #Client_context.wallet -> - (string - * Public_key_hash.t - * Tezos_crypto.Signature.public_key option - * sk_uri option) - list - tzresult - Lwt.t - -val alias_keys : - #Client_context.wallet -> - string -> - (Public_key_hash.t * Tezos_crypto.Signature.public_key option * sk_uri option) - option - tzresult - Lwt.t - -val get_key : - #Client_context.wallet -> - Public_key_hash.t -> - (string * Tezos_crypto.Signature.Public_key.t * sk_uri) tzresult Lwt.t - -val get_public_key : - #Client_context.wallet -> - Public_key_hash.t -> - (string * Tezos_crypto.Signature.Public_key.t) tzresult Lwt.t - -val get_keys : - #Client_context.wallet -> - (string * Public_key_hash.t * Tezos_crypto.Signature.Public_key.t * sk_uri) - list - tzresult - Lwt.t - -val force_switch : unit -> (bool, 'ctx) Tezos_clic.arg - val aggregate_neuterize : aggregate_sk_uri -> aggregate_pk_uri tzresult Lwt.t val register_aggregate_key : @@ -397,6 +275,148 @@ val aggregate_sign : Bytes.t -> Tezos_crypto.Aggregate_signature.t tzresult Lwt.t +module type S = sig + type public_key_hash + + type public_key + + type secret_key + + type watermark + + type signature + + (** [Signature_type] is a small module to be included in signer to conform to + the module type [SIGNER] instead of rewriting all type. *) + module Signature_type : sig + type nonrec public_key_hash = public_key_hash + + type nonrec public_key = public_key + + type nonrec secret_key = secret_key + + type nonrec signature = signature + + type nonrec pk_uri = pk_uri + + type nonrec sk_uri = sk_uri + end + + module Public_key_hash : Client_aliases.Alias with type t = public_key_hash + + module Public_key : + Client_aliases.Alias with type t = pk_uri * public_key option + + module Secret_key : Client_aliases.Alias with type t = sk_uri + + val import_secret_key : + io:Client_context.io_wallet -> + pk_uri -> + (public_key_hash * public_key option) tzresult Lwt.t + + val public_key : pk_uri -> public_key tzresult Lwt.t + + val public_key_hash : + pk_uri -> (public_key_hash * public_key option) tzresult Lwt.t + + val neuterize : sk_uri -> pk_uri tzresult Lwt.t + + val sign : + #Client_context.wallet -> + ?watermark:watermark -> + sk_uri -> + Bytes.t -> + signature tzresult Lwt.t + + val append : + #Client_context.wallet -> + ?watermark:watermark -> + sk_uri -> + Bytes.t -> + Bytes.t tzresult Lwt.t + + val check : + ?watermark:watermark -> + pk_uri -> + signature -> + Bytes.t -> + bool tzresult Lwt.t + + val deterministic_nonce : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t + + val deterministic_nonce_hash : sk_uri -> Bytes.t -> Bytes.t tzresult Lwt.t + + val supports_deterministic_nonces : sk_uri -> bool tzresult Lwt.t + + val register_key : + #Client_context.wallet -> + ?force:bool -> + public_key_hash * pk_uri * sk_uri -> + ?public_key:public_key -> + string -> + unit tzresult Lwt.t + + (** Similar to repeated calls to [register_key], but is more efficient. + Always forces addition of new elements. *) + val register_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key * pk_uri * sk_uri) list -> + unit tzresult Lwt.t + + val list_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key option * sk_uri option) list tzresult + Lwt.t + + val alias_keys : + #Client_context.wallet -> + string -> + (public_key_hash * public_key option * sk_uri option) option tzresult Lwt.t + + val get_key : + #Client_context.wallet -> + public_key_hash -> + (string * public_key * sk_uri) tzresult Lwt.t + + val get_public_key : + #Client_context.wallet -> + public_key_hash -> + (string * public_key) tzresult Lwt.t + + val get_keys : + #Client_context.wallet -> + (string * public_key_hash * public_key * sk_uri) list tzresult Lwt.t + + val force_switch : unit -> (bool, 'ctx) Tezos_clic.arg +end + +module V0 : + S + with type public_key_hash := Tezos_crypto.Signature.V0.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V0.Public_key.t + and type secret_key := Tezos_crypto.Signature.V0.Secret_key.t + and type watermark := Tezos_crypto.Signature.V0.watermark + and type signature := Tezos_crypto.Signature.V0.t + +module V1 : + S + with type public_key_hash := Tezos_crypto.Signature.V1.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V1.Public_key.t + and type secret_key := Tezos_crypto.Signature.V1.Secret_key.t + and type watermark := Tezos_crypto.Signature.V1.watermark + and type signature := Tezos_crypto.Signature.V1.t + +module V_latest : + S + with type public_key_hash := + Tezos_crypto.Signature.V_latest.Public_key_hash.t + and type public_key := Tezos_crypto.Signature.V_latest.Public_key.t + and type secret_key := Tezos_crypto.Signature.V_latest.Secret_key.t + and type watermark := Tezos_crypto.Signature.V_latest.watermark + and type signature := Tezos_crypto.Signature.V_latest.t + +include module type of V_latest + (**/**) val make_pk_uri : Uri.t -> pk_uri tzresult diff --git a/src/lib_client_base/client_keys_v0.ml b/src/lib_client_base/client_keys_v0.ml new file mode 100644 index 0000000000000000000000000000000000000000..b012affb986b3a5f30a3ab7ee3fc7b80d29e70b5 --- /dev/null +++ b/src/lib_client_base/client_keys_v0.ml @@ -0,0 +1,29 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +(** Module to use keys over {!Tezos_crypto.Signature.V0} *) + +include Client_keys +include Client_keys.V0 diff --git a/src/lib_client_base/client_keys_v1.ml b/src/lib_client_base/client_keys_v1.ml new file mode 100644 index 0000000000000000000000000000000000000000..c789e3f78d2b165856ee0e9e945c59b0948f5223 --- /dev/null +++ b/src/lib_client_base/client_keys_v1.ml @@ -0,0 +1,29 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +(** Module to use keys over {!Tezos_crypto.Signature.V1} *) + +include Client_keys +include Client_keys.V1 diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index 6135cc85130372f1a7233a253dc39bdf622f3e23..3833bf5c21ca5a0bc924ce87423d4fffc45ec4a8 100644 --- a/src/lib_crypto/signature.ml +++ b/src/lib_crypto/signature.ml @@ -3,6 +3,7 @@ (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) (* Copyright (c) 2020 Metastate AG *) +(* Copyright (c) 2022 Nomadic Labs. *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -24,716 +25,92 @@ (* *) (*****************************************************************************) -open Error_monad +module type CONV = sig + module V_from : S.COMMON_SIGNATURE -type public_key_hash = - | Ed25519 of Ed25519.Public_key_hash.t - | Secp256k1 of Secp256k1.Public_key_hash.t - | P256 of P256.Public_key_hash.t + module V_to : S.COMMON_SIGNATURE -type public_key = - | Ed25519 of Ed25519.Public_key.t - | Secp256k1 of Secp256k1.Public_key.t - | P256 of P256.Public_key.t + val public_key_hash : V_from.Public_key_hash.t -> V_to.Public_key_hash.t -type secret_key = - | Ed25519 of Ed25519.Secret_key.t - | Secp256k1 of Secp256k1.Secret_key.t - | P256 of P256.Secret_key.t + val public_key : V_from.Public_key.t -> V_to.Public_key.t -type watermark = - | Block_header of Chain_id.t - | Endorsement of Chain_id.t - | Generic_operation - | Custom of Bytes.t + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t -module Public_key_hash = struct - type t = public_key_hash = - | Ed25519 of Ed25519.Public_key_hash.t - | Secp256k1 of Secp256k1.Public_key_hash.t - | P256 of P256.Public_key_hash.t - - let name = "Signature.Public_key_hash" - - let title = "A Ed25519, Secp256k1, or P256 public key hash" - - type Base58.data += Data of t (* unused *) - - let b58check_encoding = - (* unused *) - Base58.register_encoding - ~prefix:"\255\255" - ~length:2 - ~to_raw:(fun _ -> assert false) - ~of_raw:(fun _ -> assert false) - ~wrap:(fun x -> Data x) - - let raw_encoding = - let open Data_encoding in - def "public_key_hash" ~description:title - @@ union - [ - case - (Tag 0) - Ed25519.Public_key_hash.encoding - ~title:"Ed25519" - (function Ed25519 x -> Some x | _ -> None) - (function x -> Ed25519 x); - case - (Tag 1) - Secp256k1.Public_key_hash.encoding - ~title:"Secp256k1" - (function Secp256k1 x -> Some x | _ -> None) - (function x -> Secp256k1 x); - case - (Tag 2) - ~title:"P256" - P256.Public_key_hash.encoding - (function P256 x -> Some x | _ -> None) - (function x -> P256 x); - ] - - let to_bytes s = Data_encoding.Binary.to_bytes_exn raw_encoding s - - let of_bytes_opt s = Data_encoding.Binary.of_bytes_opt raw_encoding s - - let to_string s = Bytes.to_string (to_bytes s) - - let of_string_opt s = of_bytes_opt (Bytes.of_string s) - - let size = 1 + Ed25519.size - - let zero = Ed25519 Ed25519.Public_key_hash.zero - - include Helpers.MakeRaw (struct - type nonrec t = t - - let name = name - - let of_bytes_opt = of_bytes_opt - - let of_string_opt = of_string_opt - - let to_string = to_string - end) - - let of_b58check_opt s = - match Base58.decode s with - | Some (Ed25519.Public_key_hash.Data pkh) -> Some (Ed25519 pkh) - | Some (Secp256k1.Public_key_hash.Data pkh) -> Some (Secp256k1 pkh) - | Some (P256.Public_key_hash.Data pkh) -> Some (P256 pkh) - | _ -> None - - let of_b58check_exn s = - match of_b58check_opt s with - | Some x -> x - | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name - - let of_b58check s = - match of_b58check_opt s with - | Some x -> Ok x - | None -> - error_with "Failed to read a b58check_encoding data (%s): %S" name s - - let to_b58check = function - | Ed25519 pkh -> Ed25519.Public_key_hash.to_b58check pkh - | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_b58check pkh - | P256 pkh -> P256.Public_key_hash.to_b58check pkh - - let to_short_b58check = function - | Ed25519 pkh -> Ed25519.Public_key_hash.to_short_b58check pkh - | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_short_b58check pkh - | P256 pkh -> P256.Public_key_hash.to_short_b58check pkh - - let to_path key l = - match key with - | Ed25519 h -> "ed25519" :: Ed25519.Public_key_hash.to_path h l - | Secp256k1 h -> "secp256k1" :: Secp256k1.Public_key_hash.to_path h l - | P256 h -> "p256" :: P256.Public_key_hash.to_path h l - - let of_path = function - | "ed25519" :: q -> ( - match Ed25519.Public_key_hash.of_path q with - | Some pkh -> Some (Ed25519 pkh) - | None -> None) - | "secp256k1" :: q -> ( - match Secp256k1.Public_key_hash.of_path q with - | Some pkh -> Some (Secp256k1 pkh) - | None -> None) - | "p256" :: q -> ( - match P256.Public_key_hash.of_path q with - | Some pkh -> Some (P256 pkh) - | None -> None) - | _ -> assert false - - (* FIXME classification des erreurs *) - - let of_path_exn = function - | "ed25519" :: q -> Ed25519 (Ed25519.Public_key_hash.of_path_exn q) - | "secp256k1" :: q -> Secp256k1 (Secp256k1.Public_key_hash.of_path_exn q) - | "p256" :: q -> P256 (P256.Public_key_hash.of_path_exn q) - | _ -> assert false - - (* FIXME classification des erreurs *) - - let path_length = - let l1 = Ed25519.Public_key_hash.path_length - and l2 = Secp256k1.Public_key_hash.path_length - and l3 = P256.Public_key_hash.path_length in - assert (Compare.Int.(l1 = l2)) ; - assert (Compare.Int.(l1 = l3)) ; - 1 + l1 - - let prefix_path _ = assert false (* unused *) - - let seeded_hash = Stdlib.Hashtbl.seeded_hash - - let hash = Stdlib.Hashtbl.hash - - include Compare.Make (struct - type nonrec t = t - - let compare a b = - match (a, b) with - | Ed25519 x, Ed25519 y -> Ed25519.Public_key_hash.compare x y - | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key_hash.compare x y - | P256 x, P256 y -> P256.Public_key_hash.compare x y - | _ -> Stdlib.compare a b - end) - - include Helpers.MakeEncoder (struct - type nonrec t = t - - let name = name - - let title = title - - let raw_encoding = raw_encoding - - let of_b58check = of_b58check - - let of_b58check_opt = of_b58check_opt - - let of_b58check_exn = of_b58check_exn - - let to_b58check = to_b58check - - let to_short_b58check = to_short_b58check - end) - - include Helpers.MakeIterator (struct - type nonrec t = t + val signature : V_from.t -> V_to.t +end - let hash = hash +module type CONV_OPT = sig + module V_from : S.COMMON_SIGNATURE - let seeded_hash = seeded_hash + module V_to : S.COMMON_SIGNATURE - let compare = compare + val public_key_hash : + V_from.Public_key_hash.t -> V_to.Public_key_hash.t option - let equal = equal + val public_key : V_from.Public_key.t -> V_to.Public_key.t option - let encoding = encoding - end) + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t option - let rpc_arg = - Tezos_rpc.Arg.like - rpc_arg - ~descr:"A Secp256k1 of a Ed25519 public key hash (Base58Check-encoded)" - "pkh" + val signature : V_from.t -> V_to.t option +end - module Logging = struct - let tag = Tag.def ~doc:title name pp +module V_latest = Signature_v1 + +module V0 = struct + include Signature_v0 + + module Of_V_latest : + CONV_OPT with module V_from := V_latest and module V_to := Signature_v0 = + struct + let public_key_hash : V_latest.Public_key_hash.t -> Public_key_hash.t option + = function + | V_latest.Ed25519 k -> Some (Ed25519 k) + | V_latest.Secp256k1 k -> Some (Secp256k1 k) + | V_latest.P256 k -> Some (P256 k) + + let public_key : V_latest.Public_key.t -> Public_key.t option = function + | V_latest.Ed25519 k -> Some (Ed25519 k) + | V_latest.Secp256k1 k -> Some (Secp256k1 k) + | V_latest.P256 k -> Some (P256 k) + + let secret_key : V_latest.Secret_key.t -> Secret_key.t option = function + | V_latest.Ed25519 k -> Some (Ed25519 k) + | V_latest.Secp256k1 k -> Some (Secp256k1 k) + | V_latest.P256 k -> Some (P256 k) + + let signature : V_latest.t -> t option = function + | V_latest.Ed25519 k -> Some (Ed25519 k) + | V_latest.Secp256k1 k -> Some (Secp256k1 k) + | V_latest.P256 k -> Some (P256 k) + | V_latest.Unknown k -> Some (Unknown k) end end -module Public_key = struct - type t = public_key = - | Ed25519 of Ed25519.Public_key.t - | Secp256k1 of Secp256k1.Public_key.t - | P256 of P256.Public_key.t - - let name = "Signature.Public_key" - - let title = "A Ed25519, Secp256k1, or P256 public key" - - let hash pk = - match pk with - | Ed25519 pk -> Public_key_hash.Ed25519 (Ed25519.Public_key.hash pk) - | Secp256k1 pk -> Public_key_hash.Secp256k1 (Secp256k1.Public_key.hash pk) - | P256 pk -> Public_key_hash.P256 (P256.Public_key.hash pk) - - include Compare.Make (struct - type nonrec t = t - - let compare a b = - match (a, b) with - | Ed25519 x, Ed25519 y -> Ed25519.Public_key.compare x y - | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key.compare x y - | P256 x, P256 y -> P256.Public_key.compare x y - | Ed25519 _, (Secp256k1 _ | P256 _) -> -1 - | Secp256k1 _, P256 _ -> -1 - | P256 _, (Secp256k1 _ | Ed25519 _) -> 1 - | Secp256k1 _, Ed25519 _ -> 1 - end) - - type Base58.data += Data of t (* unused *) - - let b58check_encoding = - (* unused *) - Base58.register_encoding - ~prefix:"\255\255" - ~length:2 - ~to_raw:(fun _ -> assert false) - ~of_raw:(fun _ -> assert false) - ~wrap:(fun x -> Data x) - - let of_b58check_opt s = - match Base58.decode s with - | Some (Ed25519.Public_key.Data public_key) -> Some (Ed25519 public_key) - | Some (Secp256k1.Public_key.Data public_key) -> Some (Secp256k1 public_key) - | Some (P256.Public_key.Data public_key) -> Some (P256 public_key) - | _ -> None +module V1 = struct + include Signature_v1 - let of_b58check_exn s = - match of_b58check_opt s with - | Some x -> x - | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + module Of_V_latest : + CONV_OPT with module V_from := V_latest and module V_to := Signature_v1 = + struct + let public_key_hash = Option.some - let of_b58check s = - match of_b58check_opt s with - | Some x -> Ok x - | None -> - error_with "Failed to read a b58check_encoding data (%s): %S" name s + let public_key = Option.some - let to_b58check = function - | Ed25519 pk -> Ed25519.Public_key.to_b58check pk - | Secp256k1 pk -> Secp256k1.Public_key.to_b58check pk - | P256 pk -> P256.Public_key.to_b58check pk + let secret_key = Option.some - let to_short_b58check = function - | Ed25519 pk -> Ed25519.Public_key.to_short_b58check pk - | Secp256k1 pk -> Secp256k1.Public_key.to_short_b58check pk - | P256 pk -> P256.Public_key.to_short_b58check pk - - let of_bytes_without_validation b = - let tag = Bytes.(get_int8 b 0) in - let b = Bytes.(sub b 1 (length b - 1)) in - match tag with - | 0 -> - Option.bind - (Ed25519.Public_key.of_bytes_without_validation b) - (fun pk -> Some (Ed25519 pk)) - | 1 -> - Option.bind - (Secp256k1.Public_key.of_bytes_without_validation b) - (fun pk -> Some (Secp256k1 pk)) - | 2 -> - Option.bind (P256.Public_key.of_bytes_without_validation b) (fun pk -> - Some (P256 pk)) - | _ -> None - - include Helpers.MakeEncoder (struct - type nonrec t = t - - let name = name - - let title = title - - let raw_encoding = - let open Data_encoding in - def "public_key" ~description:title - @@ union - [ - case - (Tag 0) - Ed25519.Public_key.encoding - ~title:"Ed25519" - (function Ed25519 x -> Some x | _ -> None) - (function x -> Ed25519 x); - case - (Tag 1) - Secp256k1.Public_key.encoding - ~title:"Secp256k1" - (function Secp256k1 x -> Some x | _ -> None) - (function x -> Secp256k1 x); - case - ~title:"P256" - (Tag 2) - P256.Public_key.encoding - (function P256 x -> Some x | _ -> None) - (function x -> P256 x); - ] - - let of_b58check = of_b58check - - let of_b58check_opt = of_b58check_opt - - let of_b58check_exn = of_b58check_exn - - let to_b58check = to_b58check - - let to_short_b58check = to_short_b58check - end) - - let size pk = Data_encoding.Binary.length encoding pk - - let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) + let signature = Option.some + end end -module Secret_key = struct - type t = secret_key = - | Ed25519 of Ed25519.Secret_key.t - | Secp256k1 of Secp256k1.Secret_key.t - | P256 of P256.Secret_key.t - - let name = "Signature.Secret_key" - - let title = "A Ed25519, Secp256k1 or P256 secret key" - - let to_public_key = function - | Ed25519 sk -> Public_key.Ed25519 (Ed25519.Secret_key.to_public_key sk) - | Secp256k1 sk -> - Public_key.Secp256k1 (Secp256k1.Secret_key.to_public_key sk) - | P256 sk -> Public_key.P256 (P256.Secret_key.to_public_key sk) - - include Compare.Make (struct - type nonrec t = t +include V_latest +module Of_V_latest = V1.Of_V_latest - let compare a b = - match (a, b) with - | Ed25519 x, Ed25519 y -> Ed25519.Secret_key.compare x y - | Secp256k1 x, Secp256k1 y -> Secp256k1.Secret_key.compare x y - | P256 x, P256 y -> P256.Secret_key.compare x y - | _ -> Stdlib.compare a b - end) +module Of_V1 : CONV with module V_from := V1 and module V_to := V1 = struct + let public_key_hash = Fun.id - type Base58.data += Data of t (* unused *) + let public_key = Fun.id - let b58check_encoding = - (* unused *) - Base58.register_encoding - ~prefix:"\255\255" - ~length:2 - ~to_raw:(fun _ -> assert false) - ~of_raw:(fun _ -> assert false) - ~wrap:(fun x -> Data x) + let secret_key = Fun.id - let of_b58check_opt b = - match Base58.decode b with - | Some (Ed25519.Secret_key.Data sk) -> Some (Ed25519 sk) - | Some (Secp256k1.Secret_key.Data sk) -> Some (Secp256k1 sk) - | Some (P256.Secret_key.Data sk) -> Some (P256 sk) - | _ -> None - - let of_b58check_exn s = - match of_b58check_opt s with - | Some x -> x - | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name - - let of_b58check s = - match of_b58check_opt s with - | Some x -> Ok x - | None -> - error_with "Failed to read a b58check_encoding data (%s): %S" name s - - let to_b58check = function - | Ed25519 sk -> Ed25519.Secret_key.to_b58check sk - | Secp256k1 sk -> Secp256k1.Secret_key.to_b58check sk - | P256 sk -> P256.Secret_key.to_b58check sk - - let to_short_b58check = function - | Ed25519 sk -> Ed25519.Secret_key.to_short_b58check sk - | Secp256k1 sk -> Secp256k1.Secret_key.to_short_b58check sk - | P256 sk -> P256.Secret_key.to_short_b58check sk - - include Helpers.MakeEncoder (struct - type nonrec t = t - - let name = name - - let title = title - - let raw_encoding = - let open Data_encoding in - def "secret_key" ~description:title - @@ union - [ - case - (Tag 0) - Ed25519.Secret_key.encoding - ~title:"Ed25519" - (function Ed25519 x -> Some x | _ -> None) - (function x -> Ed25519 x); - case - (Tag 1) - Secp256k1.Secret_key.encoding - ~title:"Secp256k1" - (function Secp256k1 x -> Some x | _ -> None) - (function x -> Secp256k1 x); - case - (Tag 2) - ~title:"P256" - P256.Secret_key.encoding - (function P256 x -> Some x | _ -> None) - (function x -> P256 x); - ] - - let of_b58check = of_b58check - - let of_b58check_opt = of_b58check_opt - - let of_b58check_exn = of_b58check_exn - - let to_b58check = to_b58check - - let to_short_b58check = to_short_b58check - end) - - let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) + let signature = Fun.id end - -type t = - | Ed25519 of Ed25519.t - | Secp256k1 of Secp256k1.t - | P256 of P256.t - | Unknown of Bytes.t - -let name = "Signature" - -let title = "A Ed25519, Secp256k1 or P256 signature" - -let size = - assert (Ed25519.size = Secp256k1.size && Secp256k1.size = P256.size) ; - Ed25519.size - -let to_bytes = function - | Ed25519 b -> Ed25519.to_bytes b - | Secp256k1 b -> Secp256k1.to_bytes b - | P256 b -> P256.to_bytes b - | Unknown b -> b - -let of_bytes_opt s = if Bytes.length s = size then Some (Unknown s) else None - -let to_string s = Bytes.to_string (to_bytes s) - -let of_string_opt s = of_bytes_opt (Bytes.of_string s) - -type Base58.data += Data of t - -let b58check_encoding = - Base58.register_encoding - ~prefix:Base58.Prefix.generic_signature - ~length:Ed25519.size - ~to_raw:to_string - ~of_raw:of_string_opt - ~wrap:(fun x -> Data x) - -let () = Base58.check_encoded_prefix b58check_encoding "sig" 96 - -include Helpers.MakeRaw (struct - type nonrec t = t - - let name = name - - let of_bytes_opt = of_bytes_opt - - let of_string_opt = of_string_opt - - let to_string = to_string -end) - -include Compare.Make (struct - type nonrec t = t - - let compare a b = - let a = to_bytes a and b = to_bytes b in - Bytes.compare a b -end) - -let of_b58check_opt s = - if TzString.has_prefix ~prefix:Ed25519.b58check_encoding.encoded_prefix s then - Option.map (fun x -> Ed25519 x) (Ed25519.of_b58check_opt s) - else if - TzString.has_prefix ~prefix:Secp256k1.b58check_encoding.encoded_prefix s - then Option.map (fun x -> Secp256k1 x) (Secp256k1.of_b58check_opt s) - else if TzString.has_prefix ~prefix:P256.b58check_encoding.encoded_prefix s - then Option.map (fun x -> P256 x) (P256.of_b58check_opt s) - else Base58.simple_decode b58check_encoding s - -let of_b58check_exn s = - match of_b58check_opt s with - | Some x -> x - | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name - -let of_b58check s = - match of_b58check_opt s with - | Some x -> Ok x - | None -> error_with "Failed to read a b58check_encoding data (%s): %S" name s - -let to_b58check = function - | Ed25519 b -> Ed25519.to_b58check b - | Secp256k1 b -> Secp256k1.to_b58check b - | P256 b -> P256.to_b58check b - | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) - -let to_short_b58check = function - | Ed25519 b -> Ed25519.to_short_b58check b - | Secp256k1 b -> Secp256k1.to_short_b58check b - | P256 b -> P256.to_short_b58check b - | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) - -include Helpers.MakeEncoder (struct - type nonrec t = t - - let name = name - - let title = title - - let raw_encoding = - Data_encoding.conv to_bytes of_bytes_exn (Data_encoding.Fixed.bytes size) - - let of_b58check = of_b58check - - let of_b58check_opt = of_b58check_opt - - let of_b58check_exn = of_b58check_exn - - let to_b58check = to_b58check - - let to_short_b58check = to_short_b58check -end) - -let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) - -let of_ed25519 s = Ed25519 s - -let of_secp256k1 s = Secp256k1 s - -let of_p256 s = P256 s - -let zero = of_ed25519 Ed25519.zero - -let bytes_of_watermark = function - | Block_header chain_id -> - Bytes.cat (Bytes.of_string "\x01") (Chain_id.to_bytes chain_id) - | Endorsement chain_id -> - Bytes.cat (Bytes.of_string "\x02") (Chain_id.to_bytes chain_id) - | Generic_operation -> Bytes.of_string "\x03" - | Custom bytes -> bytes - -let pp_watermark ppf = - let open Format in - function - | Block_header chain_id -> fprintf ppf "Block-header: %a" Chain_id.pp chain_id - | Endorsement chain_id -> fprintf ppf "Endorsement: %a" Chain_id.pp chain_id - | Generic_operation -> pp_print_string ppf "Generic-operation" - | Custom bytes -> - let hexed = Hex.of_bytes bytes |> Hex.show in - fprintf - ppf - "Custom: 0x%s" - (try String.sub hexed 0 10 ^ "..." with Invalid_argument _ -> hexed) - -let sign ?watermark secret_key message = - let watermark = Option.map bytes_of_watermark watermark in - match secret_key with - | Secret_key.Ed25519 sk -> of_ed25519 (Ed25519.sign ?watermark sk message) - | Secp256k1 sk -> of_secp256k1 (Secp256k1.sign ?watermark sk message) - | P256 sk -> of_p256 (P256.sign ?watermark sk message) - -let check ?watermark public_key signature message = - let watermark = Option.map bytes_of_watermark watermark in - match (public_key, signature) with - | Public_key.Ed25519 pk, Unknown signature -> ( - match Ed25519.of_bytes_opt signature with - | Some s -> Ed25519.check ?watermark pk s message - | None -> false) - | Public_key.Secp256k1 pk, Unknown signature -> ( - match Secp256k1.of_bytes_opt signature with - | Some s -> Secp256k1.check ?watermark pk s message - | None -> false) - | Public_key.P256 pk, Unknown signature -> ( - match P256.of_bytes_opt signature with - | Some s -> P256.check ?watermark pk s message - | None -> false) - | Public_key.Ed25519 pk, Ed25519 signature -> - Ed25519.check ?watermark pk signature message - | Public_key.Secp256k1 pk, Secp256k1 signature -> - Secp256k1.check ?watermark pk signature message - | Public_key.P256 pk, P256 signature -> - P256.check ?watermark pk signature message - | _ -> false - -(* The following cache is a hack to work around a quadratic algorithm - in Tezos Mainnet protocols up to Edo. *) - -module type ENDORSEMENT_CACHE_MAKER = functor (H : Stdlib.Hashtbl.HashedType) -> - Aches.Vache.MAP with type key = H.t - -let make_endorsement_cache : (module ENDORSEMENT_CACHE_MAKER) = - match Sys.getenv_opt "TEZOS_DISABLE_ENDORSEMENT_SIGNATURE_CACHE" with - | Some _ -> (module Aches.Vache.EmptyMap) - | None -> - (module Aches.Vache.Map (Aches.Vache.FIFO_Sloppy) (Aches.Vache.Strong)) - -module Endorsement_cache = - (val make_endorsement_cache) - (struct - type nonrec t = t - - let equal = equal - - let hash = Hashtbl.hash - end) - -let endorsement_cache = Endorsement_cache.create 300 - -let check ?watermark public_key signature message = - match watermark with - | Some (Endorsement _) -> ( - (* signature check cache only applies to endorsements *) - match Endorsement_cache.find_opt endorsement_cache signature with - | Some (key, msg) -> - (* we rely on this property : signature_1 = signature_2 => key_1 = key_2 /\ message_1 = message_2 *) - Public_key.equal public_key key && Bytes.equal msg message - | None -> - let res = check ?watermark public_key signature message in - if res then - Endorsement_cache.replace - endorsement_cache - signature - (public_key, message) ; - res) - | _ -> check ?watermark public_key signature message - -let append ?watermark sk msg = Bytes.cat msg (to_bytes (sign ?watermark sk msg)) - -let concat msg signature = Bytes.cat msg (to_bytes signature) - -type algo = Ed25519 | Secp256k1 | P256 - -let generate_key ?(algo = Ed25519) ?seed () = - match algo with - | Ed25519 -> - let pkh, pk, sk = Ed25519.generate_key ?seed () in - (Public_key_hash.Ed25519 pkh, Public_key.Ed25519 pk, Secret_key.Ed25519 sk) - | Secp256k1 -> - let pkh, pk, sk = Secp256k1.generate_key ?seed () in - ( Public_key_hash.Secp256k1 pkh, - Public_key.Secp256k1 pk, - Secret_key.Secp256k1 sk ) - | P256 -> - let pkh, pk, sk = P256.generate_key ?seed () in - (Public_key_hash.P256 pkh, Public_key.P256 pk, Secret_key.P256 sk) - -let deterministic_nonce sk msg = - match sk with - | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce sk msg - | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce sk msg - | Secret_key.P256 sk -> P256.deterministic_nonce sk msg - -let deterministic_nonce_hash sk msg = - match sk with - | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce_hash sk msg - | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce_hash sk msg - | Secret_key.P256 sk -> P256.deterministic_nonce_hash sk msg diff --git a/src/lib_crypto/signature.mli b/src/lib_crypto/signature.mli index c5653e9f2e6986493776b2ba3be08dbfe2df474d..555b24672859e5a7e7aad6475e9d456c532026ff 100644 --- a/src/lib_crypto/signature.mli +++ b/src/lib_crypto/signature.mli @@ -2,6 +2,8 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2020 Metastate AG *) +(* Copyright (c) 2022 Nomadic Labs. *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -23,58 +25,74 @@ (* *) (*****************************************************************************) -type public_key_hash = - | Ed25519 of Ed25519.Public_key_hash.t - | Secp256k1 of Secp256k1.Public_key_hash.t - | P256 of P256.Public_key_hash.t +(** Cryptographic signatures are versioned to expose different versions to + different protocols, depending on the support. *) -type public_key = - | Ed25519 of Ed25519.Public_key.t - | Secp256k1 of Secp256k1.Public_key.t - | P256 of P256.Public_key.t +(** The type of conversion modules from one version to another. *) +module type CONV = sig + module V_from : S.COMMON_SIGNATURE -type secret_key = - | Ed25519 of Ed25519.Secret_key.t - | Secp256k1 of Secp256k1.Secret_key.t - | P256 of P256.Secret_key.t + module V_to : S.COMMON_SIGNATURE -type watermark = - | Block_header of Chain_id.t - | Endorsement of Chain_id.t - | Generic_operation - | Custom of Bytes.t + val public_key_hash : V_from.Public_key_hash.t -> V_to.Public_key_hash.t -val bytes_of_watermark : watermark -> Bytes.t + val public_key : V_from.Public_key.t -> V_to.Public_key.t -val pp_watermark : Format.formatter -> watermark -> unit + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t -include - S.SIGNATURE - with type Public_key_hash.t = public_key_hash - and type Public_key.t = public_key - and type Secret_key.t = secret_key - and type watermark := watermark + val signature : V_from.t -> V_to.t +end -(** [append sk buf] is the concatenation of [buf] and the - serialization of the signature of [buf] signed by [sk]. *) -val append : ?watermark:watermark -> secret_key -> Bytes.t -> Bytes.t +(** The type of {e partial} conversion modules from one version to another. *) +module type CONV_OPT = sig + module V_from : S.COMMON_SIGNATURE -(** [concat buf t] is the concatenation of [buf] and the serialization - of [t]. *) -val concat : Bytes.t -> t -> Bytes.t + module V_to : S.COMMON_SIGNATURE -include S.RAW_DATA with type t := t + val public_key_hash : + V_from.Public_key_hash.t -> V_to.Public_key_hash.t option -val of_secp256k1 : Secp256k1.t -> t + val public_key : V_from.Public_key.t -> V_to.Public_key.t option -val of_ed25519 : Ed25519.t -> t + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t option -val of_p256 : P256.t -> t + val signature : V_from.t -> V_to.t option +end -type algo = Ed25519 | Secp256k1 | P256 +(** The module [V_latest] is to be used by the shell and points to the latest + available version of signatures. *) +module V_latest : module type of Signature_v1 -val generate_key : - ?algo:algo -> - ?seed:Bytes.t -> - unit -> - public_key_hash * public_key * secret_key +(** [V0] supports Ed25519, Secp256k1, and P256. *) +module V0 : sig + include module type of Signature_v0 + + (** Converting from signatures of {!V_latest} to {!V0}. *) + module Of_V_latest : + CONV_OPT with module V_from := V_latest and module V_to := Signature_v0 +end + +(** [V1] supports Ed25519, Secp256k1, P256. It is a copy of {!V0} without type + equalities. *) +module V1 : sig + include module type of Signature_v1 + + (** Converting from signatures of {!V_latest} to {!V1}. *) + module Of_V_latest : + CONV_OPT with module V_from := V_latest and module V_to := Signature_v1 +end + +include module type of V_latest + +(** Converting from signatures of {!V_latest} to {!V_latest}. This module + implements conversions which are the identity, so total, but we keep the + signature as {!CONV_OPT} for compatibility with {!V0.Of_V_latest} and + {!V1.Of_V_latest} and to ease snapshotting. *) +module Of_V_latest : + CONV_OPT with module V_from := V_latest and module V_to := V_latest + +(** Converting from signatures of {!V0} to {!V_latest}. *) +module Of_V0 : CONV with module V_from := V0 and module V_to := V_latest + +(** Converting from signatures of {!V1} to {!V_latest}. *) +module Of_V1 : CONV with module V_from := V1 and module V_to := V_latest diff --git a/src/lib_crypto/signature_v0.ml b/src/lib_crypto/signature_v0.ml new file mode 100644 index 0000000000000000000000000000000000000000..1827f52ef661fe627001feb1549e098256cf99a8 --- /dev/null +++ b/src/lib_crypto/signature_v0.ml @@ -0,0 +1,744 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2020 Metastate AG *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +open Error_monad + +type public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + +type public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + +type secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + +type watermark = + | Block_header of Chain_id.t + | Endorsement of Chain_id.t + | Generic_operation + | Custom of Bytes.t + +module Public_key_hash = struct + type t = public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + + let name = "Signature.V0.Public_key_hash" + + let title = "A Ed25519, Secp256k1, or P256 public key hash" + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let raw_encoding = + let open Data_encoding in + def "public_key_hash" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Public_key_hash.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Public_key_hash.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + (Tag 2) + ~title:"P256" + P256.Public_key_hash.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let to_bytes s = Data_encoding.Binary.to_bytes_exn raw_encoding s + + let of_bytes_opt s = Data_encoding.Binary.of_bytes_opt raw_encoding s + + let to_string s = Bytes.to_string (to_bytes s) + + let of_string_opt s = of_bytes_opt (Bytes.of_string s) + + let size = 1 + Ed25519.size + + let zero = Ed25519 Ed25519.Public_key_hash.zero + + include Helpers.MakeRaw (struct + type nonrec t = t + + let name = name + + let of_bytes_opt = of_bytes_opt + + let of_string_opt = of_string_opt + + let to_string = to_string + end) + + let of_b58check_opt s = + match Base58.decode s with + | Some (Ed25519.Public_key_hash.Data pkh) -> Some (Ed25519 pkh) + | Some (Secp256k1.Public_key_hash.Data pkh) -> Some (Secp256k1 pkh) + | Some (P256.Public_key_hash.Data pkh) -> Some (P256 pkh) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 pkh -> Ed25519.Public_key_hash.to_b58check pkh + | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_b58check pkh + | P256 pkh -> P256.Public_key_hash.to_b58check pkh + + let to_short_b58check = function + | Ed25519 pkh -> Ed25519.Public_key_hash.to_short_b58check pkh + | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_short_b58check pkh + | P256 pkh -> P256.Public_key_hash.to_short_b58check pkh + + let to_path key l = + match key with + | Ed25519 h -> "ed25519" :: Ed25519.Public_key_hash.to_path h l + | Secp256k1 h -> "secp256k1" :: Secp256k1.Public_key_hash.to_path h l + | P256 h -> "p256" :: P256.Public_key_hash.to_path h l + + let of_path = function + | "ed25519" :: q -> ( + match Ed25519.Public_key_hash.of_path q with + | Some pkh -> Some (Ed25519 pkh) + | None -> None) + | "secp256k1" :: q -> ( + match Secp256k1.Public_key_hash.of_path q with + | Some pkh -> Some (Secp256k1 pkh) + | None -> None) + | "p256" :: q -> ( + match P256.Public_key_hash.of_path q with + | Some pkh -> Some (P256 pkh) + | None -> None) + | _ -> assert false + + (* FIXME classification des erreurs *) + + let of_path_exn = function + | "ed25519" :: q -> Ed25519 (Ed25519.Public_key_hash.of_path_exn q) + | "secp256k1" :: q -> Secp256k1 (Secp256k1.Public_key_hash.of_path_exn q) + | "p256" :: q -> P256 (P256.Public_key_hash.of_path_exn q) + | _ -> assert false + + (* FIXME classification des erreurs *) + + let path_length = + let l1 = Ed25519.Public_key_hash.path_length + and l2 = Secp256k1.Public_key_hash.path_length + and l3 = P256.Public_key_hash.path_length in + assert (Compare.Int.(l1 = l2)) ; + assert (Compare.Int.(l1 = l3)) ; + 1 + l1 + + let prefix_path _ = assert false (* unused *) + + let seeded_hash = Stdlib.Hashtbl.seeded_hash + + let hash = Stdlib.Hashtbl.hash + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Public_key_hash.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key_hash.compare x y + | P256 x, P256 y -> P256.Public_key_hash.compare x y + | _ -> Stdlib.compare a b + end) + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = raw_encoding + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + include Helpers.MakeIterator (struct + type nonrec t = t + + let hash = hash + + let seeded_hash = seeded_hash + + let compare = compare + + let equal = equal + + let encoding = encoding + end) + + let rpc_arg = + Tezos_rpc.Arg.like + rpc_arg + ~descr:"A Secp256k1 of a Ed25519 public key hash (Base58Check-encoded)" + "pkh" + + module Logging = struct + let tag = Tag.def ~doc:title name pp + end +end + +module Public_key = struct + type t = public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + + let name = "Signature.V0.Public_key" + + let title = "A Ed25519, Secp256k1, or P256 public key" + + let hash pk = + match pk with + | Ed25519 pk -> Public_key_hash.Ed25519 (Ed25519.Public_key.hash pk) + | Secp256k1 pk -> Public_key_hash.Secp256k1 (Secp256k1.Public_key.hash pk) + | P256 pk -> Public_key_hash.P256 (P256.Public_key.hash pk) + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Public_key.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key.compare x y + | P256 x, P256 y -> P256.Public_key.compare x y + | Ed25519 _, (Secp256k1 _ | P256 _) -> -1 + | Secp256k1 _, P256 _ -> -1 + | P256 _, (Secp256k1 _ | Ed25519 _) -> 1 + | Secp256k1 _, Ed25519 _ -> 1 + end) + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let of_b58check_opt s = + match Base58.decode s with + | Some (Ed25519.Public_key.Data public_key) -> Some (Ed25519 public_key) + | Some (Secp256k1.Public_key.Data public_key) -> Some (Secp256k1 public_key) + | Some (P256.Public_key.Data public_key) -> Some (P256 public_key) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 pk -> Ed25519.Public_key.to_b58check pk + | Secp256k1 pk -> Secp256k1.Public_key.to_b58check pk + | P256 pk -> P256.Public_key.to_b58check pk + + let to_short_b58check = function + | Ed25519 pk -> Ed25519.Public_key.to_short_b58check pk + | Secp256k1 pk -> Secp256k1.Public_key.to_short_b58check pk + | P256 pk -> P256.Public_key.to_short_b58check pk + + let of_bytes_without_validation b = + let tag = Bytes.(get_int8 b 0) in + let b = Bytes.(sub b 1 (length b - 1)) in + match tag with + | 0 -> + Option.bind + (Ed25519.Public_key.of_bytes_without_validation b) + (fun pk -> Some (Ed25519 pk)) + | 1 -> + Option.bind + (Secp256k1.Public_key.of_bytes_without_validation b) + (fun pk -> Some (Secp256k1 pk)) + | 2 -> + Option.bind (P256.Public_key.of_bytes_without_validation b) (fun pk -> + Some (P256 pk)) + | _ -> None + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + let open Data_encoding in + def "public_key" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Public_key.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Public_key.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + ~title:"P256" + (Tag 2) + P256.Public_key.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + let size pk = Data_encoding.Binary.length encoding pk + + let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) +end + +module Secret_key = struct + type t = secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + + let name = "Signature.V0.Secret_key" + + let title = "A Ed25519, Secp256k1 or P256 secret key" + + let to_public_key = function + | Ed25519 sk -> Public_key.Ed25519 (Ed25519.Secret_key.to_public_key sk) + | Secp256k1 sk -> + Public_key.Secp256k1 (Secp256k1.Secret_key.to_public_key sk) + | P256 sk -> Public_key.P256 (P256.Secret_key.to_public_key sk) + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Secret_key.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Secret_key.compare x y + | P256 x, P256 y -> P256.Secret_key.compare x y + | _ -> Stdlib.compare a b + end) + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let of_b58check_opt b = + match Base58.decode b with + | Some (Ed25519.Secret_key.Data sk) -> Some (Ed25519 sk) + | Some (Secp256k1.Secret_key.Data sk) -> Some (Secp256k1 sk) + | Some (P256.Secret_key.Data sk) -> Some (P256 sk) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 sk -> Ed25519.Secret_key.to_b58check sk + | Secp256k1 sk -> Secp256k1.Secret_key.to_b58check sk + | P256 sk -> P256.Secret_key.to_b58check sk + + let to_short_b58check = function + | Ed25519 sk -> Ed25519.Secret_key.to_short_b58check sk + | Secp256k1 sk -> Secp256k1.Secret_key.to_short_b58check sk + | P256 sk -> P256.Secret_key.to_short_b58check sk + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + let open Data_encoding in + def "secret_key" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Secret_key.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Secret_key.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + (Tag 2) + ~title:"P256" + P256.Secret_key.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) +end + +type signature = + | Ed25519 of Ed25519.t + | Secp256k1 of Secp256k1.t + | P256 of P256.t + | Unknown of Bytes.t + +type t = signature + +let name = "Signature.V0" + +let title = "A Ed25519, Secp256k1 or P256 signature" + +let size = + assert (Ed25519.size = Secp256k1.size && Secp256k1.size = P256.size) ; + Ed25519.size + +let to_bytes = function + | Ed25519 b -> Ed25519.to_bytes b + | Secp256k1 b -> Secp256k1.to_bytes b + | P256 b -> P256.to_bytes b + | Unknown b -> b + +let of_bytes_opt s = if Bytes.length s = size then Some (Unknown s) else None + +let to_string s = Bytes.to_string (to_bytes s) + +let of_string_opt s = of_bytes_opt (Bytes.of_string s) + +type Base58.data += Data of t + +let b58check_encoding = + Base58.register_encoding + ~prefix:Base58.Prefix.generic_signature + ~length:Ed25519.size + ~to_raw:to_string + ~of_raw:of_string_opt + ~wrap:(fun x -> Data x) + +let () = Base58.check_encoded_prefix b58check_encoding "sig" 96 + +include Helpers.MakeRaw (struct + type nonrec t = t + + let name = name + + let of_bytes_opt = of_bytes_opt + + let of_string_opt = of_string_opt + + let to_string = to_string +end) + +include Compare.Make (struct + type nonrec t = t + + let compare a b = + let a = to_bytes a and b = to_bytes b in + Bytes.compare a b +end) + +let of_b58check_opt s = + if TzString.has_prefix ~prefix:Ed25519.b58check_encoding.encoded_prefix s then + Option.map (fun x -> Ed25519 x) (Ed25519.of_b58check_opt s) + else if + TzString.has_prefix ~prefix:Secp256k1.b58check_encoding.encoded_prefix s + then Option.map (fun x -> Secp256k1 x) (Secp256k1.of_b58check_opt s) + else if TzString.has_prefix ~prefix:P256.b58check_encoding.encoded_prefix s + then Option.map (fun x -> P256 x) (P256.of_b58check_opt s) + else Base58.simple_decode b58check_encoding s + +let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + +let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> error_with "Failed to read a b58check_encoding data (%s): %S" name s + +let to_b58check = function + | Ed25519 b -> Ed25519.to_b58check b + | Secp256k1 b -> Secp256k1.to_b58check b + | P256 b -> P256.to_b58check b + | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) + +let to_short_b58check = function + | Ed25519 b -> Ed25519.to_short_b58check b + | Secp256k1 b -> Secp256k1.to_short_b58check b + | P256 b -> P256.to_short_b58check b + | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) + +include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + Data_encoding.conv to_bytes of_bytes_exn (Data_encoding.Fixed.bytes size) + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check +end) + +let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) + +let of_ed25519 s = Ed25519 s + +let of_secp256k1 s = Secp256k1 s + +let of_p256 s = P256 s + +let zero = of_ed25519 Ed25519.zero + +let bytes_of_watermark = function + | Block_header chain_id -> + Bytes.cat (Bytes.of_string "\x01") (Chain_id.to_bytes chain_id) + | Endorsement chain_id -> + Bytes.cat (Bytes.of_string "\x02") (Chain_id.to_bytes chain_id) + | Generic_operation -> Bytes.of_string "\x03" + | Custom bytes -> bytes + +let pp_watermark ppf = + let open Format in + function + | Block_header chain_id -> fprintf ppf "Block-header: %a" Chain_id.pp chain_id + | Endorsement chain_id -> fprintf ppf "Endorsement: %a" Chain_id.pp chain_id + | Generic_operation -> pp_print_string ppf "Generic-operation" + | Custom bytes -> + let hexed = Hex.of_bytes bytes |> Hex.show in + fprintf + ppf + "Custom: 0x%s" + (try String.sub hexed 0 10 ^ "..." with Invalid_argument _ -> hexed) + +let sign ?watermark secret_key message = + let watermark = Option.map bytes_of_watermark watermark in + match secret_key with + | Secret_key.Ed25519 sk -> of_ed25519 (Ed25519.sign ?watermark sk message) + | Secp256k1 sk -> of_secp256k1 (Secp256k1.sign ?watermark sk message) + | P256 sk -> of_p256 (P256.sign ?watermark sk message) + +let check ?watermark public_key signature message = + let watermark = Option.map bytes_of_watermark watermark in + match (public_key, signature) with + | Public_key.Ed25519 pk, Unknown signature -> ( + match Ed25519.of_bytes_opt signature with + | Some s -> Ed25519.check ?watermark pk s message + | None -> false) + | Public_key.Secp256k1 pk, Unknown signature -> ( + match Secp256k1.of_bytes_opt signature with + | Some s -> Secp256k1.check ?watermark pk s message + | None -> false) + | Public_key.P256 pk, Unknown signature -> ( + match P256.of_bytes_opt signature with + | Some s -> P256.check ?watermark pk s message + | None -> false) + | Public_key.Ed25519 pk, Ed25519 signature -> + Ed25519.check ?watermark pk signature message + | Public_key.Secp256k1 pk, Secp256k1 signature -> + Secp256k1.check ?watermark pk signature message + | Public_key.P256 pk, P256 signature -> + P256.check ?watermark pk signature message + | _ -> false + +(* The following cache is a hack to work around a quadratic algorithm + in Tezos Mainnet protocols up to Edo. *) + +module type ENDORSEMENT_CACHE_MAKER = functor (H : Stdlib.Hashtbl.HashedType) -> + Aches.Vache.MAP with type key = H.t + +let make_endorsement_cache : (module ENDORSEMENT_CACHE_MAKER) = + match Sys.getenv_opt "TEZOS_DISABLE_ENDORSEMENT_SIGNATURE_CACHE" with + | Some _ -> (module Aches.Vache.EmptyMap) + | None -> + (module Aches.Vache.Map (Aches.Vache.FIFO_Sloppy) (Aches.Vache.Strong)) + +module Endorsement_cache = + (val make_endorsement_cache) + (struct + type nonrec t = t + + let equal = equal + + let hash = Hashtbl.hash + end) + +let endorsement_cache = Endorsement_cache.create 300 + +let check ?watermark public_key signature message = + match watermark with + | Some (Endorsement _) -> ( + (* signature check cache only applies to endorsements *) + match Endorsement_cache.find_opt endorsement_cache signature with + | Some (key, msg) -> + (* we rely on this property : signature_1 = signature_2 => key_1 = key_2 /\ message_1 = message_2 *) + Public_key.equal public_key key && Bytes.equal msg message + | None -> + let res = check ?watermark public_key signature message in + if res then + Endorsement_cache.replace + endorsement_cache + signature + (public_key, message) ; + res) + | _ -> check ?watermark public_key signature message + +let append ?watermark sk msg = Bytes.cat msg (to_bytes (sign ?watermark sk msg)) + +let concat msg signature = Bytes.cat msg (to_bytes signature) + +type algo = Ed25519 | Secp256k1 | P256 + +let algos = [Ed25519; Secp256k1; P256] + +let generate_key ?(algo = Ed25519) ?seed () = + match algo with + | Ed25519 -> + let pkh, pk, sk = Ed25519.generate_key ?seed () in + (Public_key_hash.Ed25519 pkh, Public_key.Ed25519 pk, Secret_key.Ed25519 sk) + | Secp256k1 -> + let pkh, pk, sk = Secp256k1.generate_key ?seed () in + ( Public_key_hash.Secp256k1 pkh, + Public_key.Secp256k1 pk, + Secret_key.Secp256k1 sk ) + | P256 -> + let pkh, pk, sk = P256.generate_key ?seed () in + (Public_key_hash.P256 pkh, Public_key.P256 pk, Secret_key.P256 sk) + +let deterministic_nonce sk msg = + match sk with + | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce sk msg + | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce sk msg + | Secret_key.P256 sk -> P256.deterministic_nonce sk msg + +let deterministic_nonce_hash sk msg = + match sk with + | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce_hash sk msg + | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce_hash sk msg + | Secret_key.P256 sk -> P256.deterministic_nonce_hash sk msg diff --git a/src/lib_crypto/signature_v0.mli b/src/lib_crypto/signature_v0.mli new file mode 100644 index 0000000000000000000000000000000000000000..88769a465b61158a0fb89e34172306f038197d42 --- /dev/null +++ b/src/lib_crypto/signature_v0.mli @@ -0,0 +1,92 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +type public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + +type public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + +type secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + +type watermark = + | Block_header of Chain_id.t + | Endorsement of Chain_id.t + | Generic_operation + | Custom of Bytes.t + +val bytes_of_watermark : watermark -> Bytes.t + +val pp_watermark : Format.formatter -> watermark -> unit + +type signature = + | Ed25519 of Ed25519.t + | Secp256k1 of Secp256k1.t + | P256 of P256.t + | Unknown of Bytes.t + +include + S.SIGNATURE + with type Public_key_hash.t = public_key_hash + and type Public_key.t = public_key + and type Secret_key.t = secret_key + and type watermark := watermark + and type t = signature + +(** [append sk buf] is the concatenation of [buf] and the + serialization of the signature of [buf] signed by [sk]. *) +val append : ?watermark:watermark -> secret_key -> Bytes.t -> Bytes.t + +(** [concat buf t] is the concatenation of [buf] and the serialization + of [t]. *) +val concat : Bytes.t -> t -> Bytes.t + +include S.RAW_DATA with type t := t + +val of_secp256k1 : Secp256k1.t -> t + +val of_ed25519 : Ed25519.t -> t + +val of_p256 : P256.t -> t + +type algo = Ed25519 | Secp256k1 | P256 + +(** The list of signing algorithm supported, i.e. all constructors of type + {!algo{}. *) +val algos : algo list + +val generate_key : + ?algo:algo -> + ?seed:Bytes.t -> + unit -> + public_key_hash * public_key * secret_key diff --git a/src/lib_crypto/signature_v1.ml b/src/lib_crypto/signature_v1.ml new file mode 100644 index 0000000000000000000000000000000000000000..91184800cc9adad27d9cdf5168ad6d35e59d2eff --- /dev/null +++ b/src/lib_crypto/signature_v1.ml @@ -0,0 +1,768 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2020 Metastate AG *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +open Error_monad + +type public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + +type public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + +type secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + +type watermark = Signature_v0.watermark = + | Block_header of Chain_id.t + | Endorsement of Chain_id.t + | Generic_operation + | Custom of Bytes.t + +module Public_key_hash = struct + type t = public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + + let name = "Signature.Public_key_hash" + + let title = "A Ed25519, Secp256k1, or P256 public key hash" + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let raw_encoding = + let open Data_encoding in + def "public_key_hash" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Public_key_hash.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Public_key_hash.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + (Tag 2) + ~title:"P256" + P256.Public_key_hash.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let to_bytes s = Data_encoding.Binary.to_bytes_exn raw_encoding s + + let of_bytes_opt s = Data_encoding.Binary.of_bytes_opt raw_encoding s + + let to_string s = Bytes.to_string (to_bytes s) + + let of_string_opt s = of_bytes_opt (Bytes.of_string s) + + let size = 1 + Ed25519.size + + let zero = Ed25519 Ed25519.Public_key_hash.zero + + include Helpers.MakeRaw (struct + type nonrec t = t + + let name = name + + let of_bytes_opt = of_bytes_opt + + let of_string_opt = of_string_opt + + let to_string = to_string + end) + + let of_b58check_opt s = + match Base58.decode s with + | Some (Ed25519.Public_key_hash.Data pkh) -> Some (Ed25519 pkh) + | Some (Secp256k1.Public_key_hash.Data pkh) -> Some (Secp256k1 pkh) + | Some (P256.Public_key_hash.Data pkh) -> Some (P256 pkh) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 pkh -> Ed25519.Public_key_hash.to_b58check pkh + | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_b58check pkh + | P256 pkh -> P256.Public_key_hash.to_b58check pkh + + let to_short_b58check = function + | Ed25519 pkh -> Ed25519.Public_key_hash.to_short_b58check pkh + | Secp256k1 pkh -> Secp256k1.Public_key_hash.to_short_b58check pkh + | P256 pkh -> P256.Public_key_hash.to_short_b58check pkh + + let to_path key l = + match key with + | Ed25519 h -> "ed25519" :: Ed25519.Public_key_hash.to_path h l + | Secp256k1 h -> "secp256k1" :: Secp256k1.Public_key_hash.to_path h l + | P256 h -> "p256" :: P256.Public_key_hash.to_path h l + + let of_path = function + | "ed25519" :: q -> ( + match Ed25519.Public_key_hash.of_path q with + | Some pkh -> Some (Ed25519 pkh) + | None -> None) + | "secp256k1" :: q -> ( + match Secp256k1.Public_key_hash.of_path q with + | Some pkh -> Some (Secp256k1 pkh) + | None -> None) + | "p256" :: q -> ( + match P256.Public_key_hash.of_path q with + | Some pkh -> Some (P256 pkh) + | None -> None) + | _ -> assert false + + (* FIXME classification des erreurs *) + + let of_path_exn = function + | "ed25519" :: q -> Ed25519 (Ed25519.Public_key_hash.of_path_exn q) + | "secp256k1" :: q -> Secp256k1 (Secp256k1.Public_key_hash.of_path_exn q) + | "p256" :: q -> P256 (P256.Public_key_hash.of_path_exn q) + | _ -> assert false + + (* FIXME classification des erreurs *) + + let path_length = + let l1 = Ed25519.Public_key_hash.path_length + and l2 = Secp256k1.Public_key_hash.path_length + and l3 = P256.Public_key_hash.path_length in + assert (Compare.Int.(l1 = l2)) ; + assert (Compare.Int.(l1 = l3)) ; + 1 + l1 + + let prefix_path _ = assert false (* unused *) + + let seeded_hash = Stdlib.Hashtbl.seeded_hash + + let hash = Stdlib.Hashtbl.hash + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Public_key_hash.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key_hash.compare x y + | P256 x, P256 y -> P256.Public_key_hash.compare x y + | _ -> Stdlib.compare a b + end) + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = raw_encoding + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + include Helpers.MakeIterator (struct + type nonrec t = t + + let hash = hash + + let seeded_hash = seeded_hash + + let compare = compare + + let equal = equal + + let encoding = encoding + end) + + let rpc_arg = + Tezos_rpc.Arg.like + rpc_arg + ~descr:"A Secp256k1 of a Ed25519 public key hash (Base58Check-encoded)" + "pkh" + + module Logging = struct + let tag = Tag.def ~doc:title name pp + end +end + +module Public_key = struct + type t = public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + + let name = "Signature.Public_key" + + let title = "A Ed25519, Secp256k1, or P256 public key" + + let hash pk = + match pk with + | Ed25519 pk -> Public_key_hash.Ed25519 (Ed25519.Public_key.hash pk) + | Secp256k1 pk -> Public_key_hash.Secp256k1 (Secp256k1.Public_key.hash pk) + | P256 pk -> Public_key_hash.P256 (P256.Public_key.hash pk) + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Public_key.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Public_key.compare x y + | P256 x, P256 y -> P256.Public_key.compare x y + | Ed25519 _, (Secp256k1 _ | P256 _) -> -1 + | Secp256k1 _, P256 _ -> -1 + | P256 _, (Secp256k1 _ | Ed25519 _) -> 1 + | Secp256k1 _, Ed25519 _ -> 1 + end) + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let of_b58check_opt s = + match Base58.decode s with + | Some (Ed25519.Public_key.Data public_key) -> Some (Ed25519 public_key) + | Some (Secp256k1.Public_key.Data public_key) -> Some (Secp256k1 public_key) + | Some (P256.Public_key.Data public_key) -> Some (P256 public_key) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 pk -> Ed25519.Public_key.to_b58check pk + | Secp256k1 pk -> Secp256k1.Public_key.to_b58check pk + | P256 pk -> P256.Public_key.to_b58check pk + + let to_short_b58check = function + | Ed25519 pk -> Ed25519.Public_key.to_short_b58check pk + | Secp256k1 pk -> Secp256k1.Public_key.to_short_b58check pk + | P256 pk -> P256.Public_key.to_short_b58check pk + + let of_bytes_without_validation b = + let tag = Bytes.(get_int8 b 0) in + let b = Bytes.(sub b 1 (length b - 1)) in + match tag with + | 0 -> + Option.bind + (Ed25519.Public_key.of_bytes_without_validation b) + (fun pk -> Some (Ed25519 pk)) + | 1 -> + Option.bind + (Secp256k1.Public_key.of_bytes_without_validation b) + (fun pk -> Some (Secp256k1 pk)) + | 2 -> + Option.bind (P256.Public_key.of_bytes_without_validation b) (fun pk -> + Some (P256 pk)) + | _ -> None + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + let open Data_encoding in + def "public_key" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Public_key.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Public_key.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + ~title:"P256" + (Tag 2) + P256.Public_key.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + let size pk = Data_encoding.Binary.length encoding pk + + let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) +end + +module Secret_key = struct + type t = secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + + let name = "Signature.Secret_key" + + let title = "A Ed25519, Secp256k1 or P256 secret key" + + let to_public_key = function + | Ed25519 sk -> Public_key.Ed25519 (Ed25519.Secret_key.to_public_key sk) + | Secp256k1 sk -> + Public_key.Secp256k1 (Secp256k1.Secret_key.to_public_key sk) + | P256 sk -> Public_key.P256 (P256.Secret_key.to_public_key sk) + + include Compare.Make (struct + type nonrec t = t + + let compare a b = + match (a, b) with + | Ed25519 x, Ed25519 y -> Ed25519.Secret_key.compare x y + | Secp256k1 x, Secp256k1 y -> Secp256k1.Secret_key.compare x y + | P256 x, P256 y -> P256.Secret_key.compare x y + | _ -> Stdlib.compare a b + end) + + type Base58.data += Data of t (* unused *) + + let b58check_encoding = + (* unused *) + Base58.register_encoding + ~prefix:"\255\255" + ~length:2 + ~to_raw:(fun _ -> assert false) + ~of_raw:(fun _ -> assert false) + ~wrap:(fun x -> Data x) + + let of_b58check_opt b = + match Base58.decode b with + | Some (Ed25519.Secret_key.Data sk) -> Some (Ed25519 sk) + | Some (Secp256k1.Secret_key.Data sk) -> Some (Secp256k1 sk) + | Some (P256.Secret_key.Data sk) -> Some (P256 sk) + | _ -> None + + let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + + let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> + error_with "Failed to read a b58check_encoding data (%s): %S" name s + + let to_b58check = function + | Ed25519 sk -> Ed25519.Secret_key.to_b58check sk + | Secp256k1 sk -> Secp256k1.Secret_key.to_b58check sk + | P256 sk -> P256.Secret_key.to_b58check sk + + let to_short_b58check = function + | Ed25519 sk -> Ed25519.Secret_key.to_short_b58check sk + | Secp256k1 sk -> Secp256k1.Secret_key.to_short_b58check sk + | P256 sk -> P256.Secret_key.to_short_b58check sk + + include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + let open Data_encoding in + def "secret_key" ~description:title + @@ union + [ + case + (Tag 0) + Ed25519.Secret_key.encoding + ~title:"Ed25519" + (function Ed25519 x -> Some x | _ -> None) + (function x -> Ed25519 x); + case + (Tag 1) + Secp256k1.Secret_key.encoding + ~title:"Secp256k1" + (function Secp256k1 x -> Some x | _ -> None) + (function x -> Secp256k1 x); + case + (Tag 2) + ~title:"P256" + P256.Secret_key.encoding + (function P256 x -> Some x | _ -> None) + (function x -> P256 x); + ] + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check + end) + + let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) +end + +type signature = + | Ed25519 of Ed25519.t + | Secp256k1 of Secp256k1.t + | P256 of P256.t + | Unknown of Bytes.t + +type t = signature + +let name = "Signature.V1" + +let title = "A Ed25519, Secp256k1 or P256 signature" + +let size = + assert (Ed25519.size = Secp256k1.size && Secp256k1.size = P256.size) ; + Ed25519.size + +let to_bytes = function + | Ed25519 b -> Ed25519.to_bytes b + | Secp256k1 b -> Secp256k1.to_bytes b + | P256 b -> P256.to_bytes b + | Unknown b -> b + +let of_bytes_opt s = if Bytes.length s = size then Some (Unknown s) else None + +let to_string s = Bytes.to_string (to_bytes s) + +let of_string_opt s = of_bytes_opt (Bytes.of_string s) + +type Base58.data += Data of t + +let b58check_encoding = + Base58.register_encoding + ~prefix:Base58.Prefix.generic_signature + ~length:Ed25519.size + ~to_raw:to_string + ~of_raw:of_string_opt + ~wrap:(fun x -> Data x) + +let () = Base58.check_encoded_prefix b58check_encoding "sig" 96 + +include Helpers.MakeRaw (struct + type nonrec t = t + + let name = name + + let of_bytes_opt = of_bytes_opt + + let of_string_opt = of_string_opt + + let to_string = to_string +end) + +include Compare.Make (struct + type nonrec t = t + + let compare a b = + let a = to_bytes a and b = to_bytes b in + Bytes.compare a b +end) + +let of_b58check_opt s = + if TzString.has_prefix ~prefix:Ed25519.b58check_encoding.encoded_prefix s then + Option.map (fun x -> Ed25519 x) (Ed25519.of_b58check_opt s) + else if + TzString.has_prefix ~prefix:Secp256k1.b58check_encoding.encoded_prefix s + then Option.map (fun x -> Secp256k1 x) (Secp256k1.of_b58check_opt s) + else if TzString.has_prefix ~prefix:P256.b58check_encoding.encoded_prefix s + then Option.map (fun x -> P256 x) (P256.of_b58check_opt s) + else Base58.simple_decode b58check_encoding s + +let of_b58check_exn s = + match of_b58check_opt s with + | Some x -> x + | None -> Format.kasprintf Stdlib.failwith "Unexpected data (%s)" name + +let of_b58check s = + match of_b58check_opt s with + | Some x -> Ok x + | None -> error_with "Failed to read a b58check_encoding data (%s): %S" name s + +let to_b58check = function + | Ed25519 b -> Ed25519.to_b58check b + | Secp256k1 b -> Secp256k1.to_b58check b + | P256 b -> P256.to_b58check b + | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) + +let to_short_b58check = function + | Ed25519 b -> Ed25519.to_short_b58check b + | Secp256k1 b -> Secp256k1.to_short_b58check b + | P256 b -> P256.to_short_b58check b + | Unknown b -> Base58.simple_encode b58check_encoding (Unknown b) + +include Helpers.MakeEncoder (struct + type nonrec t = t + + let name = name + + let title = title + + let raw_encoding = + Data_encoding.conv to_bytes of_bytes_exn (Data_encoding.Fixed.bytes size) + + let of_b58check = of_b58check + + let of_b58check_opt = of_b58check_opt + + let of_b58check_exn = of_b58check_exn + + let to_b58check = to_b58check + + let to_short_b58check = to_short_b58check +end) + +let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) + +let of_ed25519 s = Ed25519 s + +let of_secp256k1 s = Secp256k1 s + +let of_p256 s = P256 s + +let zero = of_ed25519 Ed25519.zero + +let bytes_of_watermark = function + | Block_header chain_id -> + Bytes.cat (Bytes.of_string "\x01") (Chain_id.to_bytes chain_id) + | Endorsement chain_id -> + Bytes.cat (Bytes.of_string "\x02") (Chain_id.to_bytes chain_id) + | Generic_operation -> Bytes.of_string "\x03" + | Custom bytes -> bytes + +let pp_watermark ppf = + let open Format in + function + | Block_header chain_id -> fprintf ppf "Block-header: %a" Chain_id.pp chain_id + | Endorsement chain_id -> fprintf ppf "Endorsement: %a" Chain_id.pp chain_id + | Generic_operation -> pp_print_string ppf "Generic-operation" + | Custom bytes -> + let hexed = Hex.of_bytes bytes |> Hex.show in + fprintf + ppf + "Custom: 0x%s" + (try String.sub hexed 0 10 ^ "..." with Invalid_argument _ -> hexed) + +let sign ?watermark secret_key message = + let watermark = Option.map bytes_of_watermark watermark in + match secret_key with + | Secret_key.Ed25519 sk -> of_ed25519 (Ed25519.sign ?watermark sk message) + | Secp256k1 sk -> of_secp256k1 (Secp256k1.sign ?watermark sk message) + | P256 sk -> of_p256 (P256.sign ?watermark sk message) + +let check ?watermark public_key signature message = + let watermark = Option.map bytes_of_watermark watermark in + match (public_key, signature) with + | Public_key.Ed25519 pk, Unknown signature -> ( + match Ed25519.of_bytes_opt signature with + | Some s -> Ed25519.check ?watermark pk s message + | None -> false) + | Public_key.Secp256k1 pk, Unknown signature -> ( + match Secp256k1.of_bytes_opt signature with + | Some s -> Secp256k1.check ?watermark pk s message + | None -> false) + | Public_key.P256 pk, Unknown signature -> ( + match P256.of_bytes_opt signature with + | Some s -> P256.check ?watermark pk s message + | None -> false) + | Public_key.Ed25519 pk, Ed25519 signature -> + Ed25519.check ?watermark pk signature message + | Public_key.Secp256k1 pk, Secp256k1 signature -> + Secp256k1.check ?watermark pk signature message + | Public_key.P256 pk, P256 signature -> + P256.check ?watermark pk signature message + | _ -> false + +(* The following cache is a hack to work around a quadratic algorithm + in Tezos Mainnet protocols up to Edo. *) + +module type ENDORSEMENT_CACHE_MAKER = functor (H : Stdlib.Hashtbl.HashedType) -> + Aches.Vache.MAP with type key = H.t + +let make_endorsement_cache : (module ENDORSEMENT_CACHE_MAKER) = + match Sys.getenv_opt "TEZOS_DISABLE_ENDORSEMENT_SIGNATURE_CACHE" with + | Some _ -> (module Aches.Vache.EmptyMap) + | None -> + (module Aches.Vache.Map (Aches.Vache.FIFO_Sloppy) (Aches.Vache.Strong)) + +module Endorsement_cache = + (val make_endorsement_cache) + (struct + type nonrec t = t + + let equal = equal + + let hash = Hashtbl.hash + end) + +let endorsement_cache = Endorsement_cache.create 300 + +let check ?watermark public_key signature message = + match watermark with + | Some (Endorsement _) -> ( + (* signature check cache only applies to endorsements *) + match Endorsement_cache.find_opt endorsement_cache signature with + | Some (key, msg) -> + (* we rely on this property : signature_1 = signature_2 => key_1 = key_2 /\ message_1 = message_2 *) + Public_key.equal public_key key && Bytes.equal msg message + | None -> + let res = check ?watermark public_key signature message in + if res then + Endorsement_cache.replace + endorsement_cache + signature + (public_key, message) ; + res) + | _ -> check ?watermark public_key signature message + +let append ?watermark sk msg = Bytes.cat msg (to_bytes (sign ?watermark sk msg)) + +let concat msg signature = Bytes.cat msg (to_bytes signature) + +type algo = Ed25519 | Secp256k1 | P256 + +let algos = [Ed25519; Secp256k1; P256] + +let generate_key ?(algo = Ed25519) ?seed () = + match algo with + | Ed25519 -> + let pkh, pk, sk = Ed25519.generate_key ?seed () in + (Public_key_hash.Ed25519 pkh, Public_key.Ed25519 pk, Secret_key.Ed25519 sk) + | Secp256k1 -> + let pkh, pk, sk = Secp256k1.generate_key ?seed () in + ( Public_key_hash.Secp256k1 pkh, + Public_key.Secp256k1 pk, + Secret_key.Secp256k1 sk ) + | P256 -> + let pkh, pk, sk = P256.generate_key ?seed () in + (Public_key_hash.P256 pkh, Public_key.P256 pk, Secret_key.P256 sk) + +let deterministic_nonce sk msg = + match sk with + | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce sk msg + | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce sk msg + | Secret_key.P256 sk -> P256.deterministic_nonce sk msg + +let deterministic_nonce_hash sk msg = + match sk with + | Secret_key.Ed25519 sk -> Ed25519.deterministic_nonce_hash sk msg + | Secret_key.Secp256k1 sk -> Secp256k1.deterministic_nonce_hash sk msg + | Secret_key.P256 sk -> P256.deterministic_nonce_hash sk msg + +module Of_V0 = struct + let public_key_hash : Signature_v0.Public_key_hash.t -> Public_key_hash.t = + function + | Signature_v0.Ed25519 k -> Ed25519 k + | Signature_v0.Secp256k1 k -> Secp256k1 k + | Signature_v0.P256 k -> P256 k + + let public_key : Signature_v0.Public_key.t -> Public_key.t = function + | Signature_v0.Ed25519 k -> Ed25519 k + | Signature_v0.Secp256k1 k -> Secp256k1 k + | Signature_v0.P256 k -> P256 k + + let secret_key : Signature_v0.Secret_key.t -> Secret_key.t = function + | Signature_v0.Ed25519 k -> Ed25519 k + | Signature_v0.Secp256k1 k -> Secp256k1 k + | Signature_v0.P256 k -> P256 k + + let signature : Signature_v0.t -> t = function + | Signature_v0.Ed25519 k -> Ed25519 k + | Signature_v0.Secp256k1 k -> Secp256k1 k + | Signature_v0.P256 k -> P256 k + | Signature_v0.Unknown k -> Unknown k +end diff --git a/src/lib_crypto/signature_v1.mli b/src/lib_crypto/signature_v1.mli new file mode 100644 index 0000000000000000000000000000000000000000..dd16298c50508bc06843c882b6ad3b78e826b71f --- /dev/null +++ b/src/lib_crypto/signature_v1.mli @@ -0,0 +1,110 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2022 Nomadic Labs *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +type public_key_hash = + | Ed25519 of Ed25519.Public_key_hash.t + | Secp256k1 of Secp256k1.Public_key_hash.t + | P256 of P256.Public_key_hash.t + +type public_key = + | Ed25519 of Ed25519.Public_key.t + | Secp256k1 of Secp256k1.Public_key.t + | P256 of P256.Public_key.t + +type secret_key = + | Ed25519 of Ed25519.Secret_key.t + | Secp256k1 of Secp256k1.Secret_key.t + | P256 of P256.Secret_key.t + +type watermark = Signature_v0.watermark = + | Block_header of Chain_id.t + | Endorsement of Chain_id.t + | Generic_operation + | Custom of Bytes.t + +val bytes_of_watermark : watermark -> Bytes.t + +val pp_watermark : Format.formatter -> watermark -> unit + +type signature = + | Ed25519 of Ed25519.t + | Secp256k1 of Secp256k1.t + | P256 of P256.t + | Unknown of Bytes.t + +include + S.SIGNATURE + with type Public_key_hash.t = public_key_hash + and type Public_key.t = public_key + and type Secret_key.t = secret_key + and type watermark := watermark + and type t = signature + +(** [append sk buf] is the concatenation of [buf] and the + serialization of the signature of [buf] signed by [sk]. *) +val append : ?watermark:watermark -> secret_key -> Bytes.t -> Bytes.t + +(** [concat buf t] is the concatenation of [buf] and the serialization + of [t]. *) +val concat : Bytes.t -> t -> Bytes.t + +include S.RAW_DATA with type t := t + +val of_secp256k1 : Secp256k1.t -> t + +val of_ed25519 : Ed25519.t -> t + +val of_p256 : P256.t -> t + +type algo = Ed25519 | Secp256k1 | P256 + +(** The list of signing algorithm supported, i.e. all constructors of type + {!algo}. *) +val algos : algo list + +val generate_key : + ?algo:algo -> + ?seed:Bytes.t -> + unit -> + public_key_hash * public_key * secret_key + +(** This module provides conversion functions for values (of keys and + signatures) of the module {!Signature_V0}. Note that these functions are + total because [Signature_v1] supports more signature kinds than + {!Signature_v0}. *) +module Of_V0 : sig + (** Convert a public key hash from V0 to V1. *) + val public_key_hash : Signature_v0.Public_key_hash.t -> Public_key_hash.t + + (** Convert a public key from V0 to V1. *) + val public_key : Signature_v0.Public_key.t -> Public_key.t + + (** Convert a secret key from V0 to V1. *) + val secret_key : Signature_v0.Secret_key.t -> Secret_key.t + + (** Convert a signature from V0 to V1. *) + val signature : Signature_v0.t -> t +end diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index 9f3e857eeccc68e38cf23ac2f961a63f2fb4c0a2..e5003dab2401d09d0cb5d877c07b70220a47ce06 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -63,10 +63,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index 5e31b35740977302b842b9394d9c5b05d3397f2e..2d66950b8e1b15306ea3620f28c7e750d5563084 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -63,10 +63,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index 1b40214ac9666455dfb2dc2780861a5fe5353c73..5edfb7f2b71f5e78a270e2ff832bdc88ccf3ba9b 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -63,10 +63,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index 560a57cf0d86398ef30c1926c937a24b5b1f73e0..715250ce08a5e45ba1739a3a4569487a1b56e473 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -62,10 +62,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index 9c60fee46ad74894636de66626d68c9b165855a9..fa29c2c4cec58bd0ba0e0e25b64a3bca47065570 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -63,10 +63,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index a4b1e9d41736cba88e3c94fea9c0e55a31597c6f..5607402867b64aaa266992eede6d8198c1970f11 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -62,10 +62,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index 9905a5b8c1f640cda152710618768c029c39cf8a..62257eb31735eaf0d8fedced21328219ebc15e3e 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -66,10 +66,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node @@ -274,7 +274,7 @@ struct module Ed25519 = Tezos_crypto.Ed25519 module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock module S = struct diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index 1e1ed5e2b3aa7d89a55cc957ae86036a0596fb99..ef96e8b967a120a8f222c90d4c98d27026917724 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -65,10 +65,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index c883b5052f5ccebb14f935b7f8702c1eb9c02f4d..67f641baf7b13fd8a89d223fc0afae020e633b72 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -70,10 +70,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t @@ -308,7 +308,7 @@ struct module Ed25519 = Tezos_crypto.Ed25519 module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock module S = struct diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index 771f5ddbea367641462ce51676c5a902cb90757f..482b7d7dff37ac5dc75f3531bf592b84b996b4c4 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -65,10 +65,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index 8da55b05f4523f895ab09cf78b5ac4260922bbe2..f80ed466cf1530b9cb1d3b9cecd2be7166f5d145 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -75,10 +75,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t @@ -273,7 +273,7 @@ struct module Ed25519 = Tezos_crypto.Ed25519 module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock module S = struct diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index 5bb9c81581d1fcb2bf437b84547642da670cdf10..2e6239a7b24b647467911bd84be42633c007f8c0 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -76,10 +76,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index e835c768610cf6e2c3bfd1c66969335226eaf792..329598f1357b05c58350f40be1c91ee060629ba4 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -75,10 +75,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t @@ -279,7 +279,7 @@ struct module Ed25519 = Tezos_crypto.Ed25519 module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock module Vdf = Class_group_vdf.Vdf_self_contained diff --git a/src/lib_protocol_environment/environment_V6.mli b/src/lib_protocol_environment/environment_V6.mli index 15a1bc7e9dbc7d93063075e6ec42d3a48d179782..88ec5f31074a42ae36bed75b9657b53428f03ac8 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -76,10 +76,10 @@ module type T = sig and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t and type P256.t = Tezos_crypto.P256.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 4ffe74e9d44013f8fc4656532c5dfb4c2184fa5a..b454bf6f362d562ce80b779ee56103a03605f069 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -78,10 +78,10 @@ module type T = sig and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t and type Bls.t = Tezos_crypto.Bls.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t @@ -274,7 +274,7 @@ struct module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 module Bls = Tezos_crypto.Bls - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock module Vdf = Class_group_vdf.Vdf_self_contained diff --git a/src/lib_protocol_environment/environment_V7.mli b/src/lib_protocol_environment/environment_V7.mli index a0149fa22f08c3fd3ca7fef467a048c3403fc93f..c966ad82461184321394241202704d5c086596b8 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -78,10 +78,10 @@ module type T = sig and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t and type Bls.t = Tezos_crypto.Bls.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V0.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V0.public_key + and type Signature.t = Tezos_crypto.Signature.V0.t + and type Signature.watermark = Tezos_crypto.Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index 0aa570ec59419b7b6ec31dcab6c6300eab962005..f7be6c3705b02cf1777b4eafa568238b2a61e9b6 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -78,10 +78,10 @@ module type T = sig and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t and type Bls.t = Tezos_crypto.Bls.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V1.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V1.public_key + and type Signature.t = Tezos_crypto.Signature.V1.t + and type Signature.watermark = Tezos_crypto.Signature.V1.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t @@ -281,7 +281,7 @@ struct module Secp256k1 = Tezos_crypto.Secp256k1 module P256 = Tezos_crypto.P256 module Bls = Tezos_crypto.Bls - module Signature = Tezos_crypto.Signature + module Signature = Tezos_crypto.Signature.V1 module Timelock = Tezos_crypto.Timelock module Vdf = Class_group_vdf.Vdf_self_contained diff --git a/src/lib_protocol_environment/environment_V8.mli b/src/lib_protocol_environment/environment_V8.mli index f44710bb601a63506c252c120474253d95ebcb82..c3c15f69fd7dc344a00869d9ef88ba3e72c44dd3 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -78,10 +78,10 @@ module type T = sig and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t and type Bls.t = Tezos_crypto.Bls.t and type Signature.public_key_hash = - Tezos_crypto.Signature.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.public_key - and type Signature.t = Tezos_crypto.Signature.t - and type Signature.watermark = Tezos_crypto.Signature.watermark + Tezos_crypto.Signature.V1.public_key_hash + and type Signature.public_key = Tezos_crypto.Signature.V1.public_key + and type Signature.t = Tezos_crypto.Signature.V1.t + and type Signature.watermark = Tezos_crypto.Signature.V1.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/structs/v0_signature.ml b/src/lib_protocol_environment/structs/v0_signature.ml index 582923932c057ab453227df63c478c322dbe937e..338914cda0a3733cb4dba4b6a3114210601b6cdf 100644 --- a/src/lib_protocol_environment/structs/v0_signature.ml +++ b/src/lib_protocol_environment/structs/v0_signature.ml @@ -23,23 +23,23 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Signature +include Tezos_crypto.Signature.V0 module Public_key_hash = struct - include Tezos_crypto.Signature.Public_key_hash + include Tezos_crypto.Signature.V0.Public_key_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Signature.Public_key_hash) + include Stdlib.Set.Make (Tezos_crypto.Signature.V0.Public_key_hash) let encoding = Data_encoding.conv elements (fun l -> List.fold_left (fun m x -> add x m) empty l) - Data_encoding.(list Tezos_crypto.Signature.Public_key_hash.encoding) + Data_encoding.(list Tezos_crypto.Signature.V0.Public_key_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Signature.Public_key_hash) + include Stdlib.Map.Make (Tezos_crypto.Signature.V0.Public_key_hash) let encoding arg_encoding = Data_encoding.conv @@ -47,12 +47,14 @@ module Public_key_hash = struct (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( list - (tup2 Tezos_crypto.Signature.Public_key_hash.encoding arg_encoding)) + (tup2 + Tezos_crypto.Signature.V0.Public_key_hash.encoding + arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Signature.Public_key_hash + include Tezos_crypto.Signature.V0.Public_key_hash let hash = Stdlib.Hashtbl.seeded_hash end) @@ -66,6 +68,8 @@ module Public_key_hash = struct h) Data_encoding.( list - (tup2 Tezos_crypto.Signature.Public_key_hash.encoding arg_encoding)) + (tup2 + Tezos_crypto.Signature.V0.Public_key_hash.encoding + arg_encoding)) end end diff --git a/src/lib_signer_backends/unencrypted.ml b/src/lib_signer_backends/unencrypted.ml index 1d84f31e8dc4bce738f563437ecfc6a73951d020..b91d3656545af0092e6c43cb8c4a5b65627d1ae4 100644 --- a/src/lib_signer_backends/unencrypted.ml +++ b/src/lib_signer_backends/unencrypted.ml @@ -53,6 +53,8 @@ module Make_common (S : sig type secret_key = Secret_key.t + type signature = t + type sk_uri = private Uri.t type pk_uri = private Uri.t diff --git a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml index f79e82fafe07b6fb3bc2abd632f6396f3510f44e..f919ddc635ae7bfc4652362268e76e660d7f2673 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml +++ b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml @@ -36,7 +36,7 @@ let bake cctxt ?timestamp block command sk = | Some t -> t | None -> Time.System.(to_protocol (Tezos_base.Time.System.now ())) in - let protocol_data = {command; signature = Tezos_crypto.Signature.zero} in + let protocol_data = {command; signature = Tezos_crypto.Signature.V0.zero} in Genesis_block_services.Helpers.Preapply.block cctxt ~block @@ -46,7 +46,7 @@ let bake cctxt ?timestamp block command sk = >>=? fun (shell_header, _) -> let blk = Data.Command.forge shell_header command in Shell_services.Chain.chain_id cctxt ~chain:`Main () >>=? fun chain_id -> - Client_keys.append cctxt sk ~watermark:(Block_header chain_id) blk + Client_keys_v0.append cctxt sk ~watermark:(Block_header chain_id) blk >>=? fun signed_blk -> Shell_services.Injection.block cctxt signed_blk [] let int64_parameter = @@ -114,7 +114,7 @@ let commands () = ~desc:"Hardcoded fitness of the first block (integer)" int64_parameter @@ prefixes ["and"; "key"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"password" ~desc:"Activator's key" @@ prefixes ["and"; "parameters"] @@ -150,7 +150,7 @@ let commands () = (prefixes ["fork"; "test"; "protocol"] @@ proto_param ~name:"version" ~desc:"Protocol version (b58check)" @@ prefixes ["with"; "key"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"password" ~desc:"Activator's key" @@ stop) diff --git a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli index 902704cb10644b2e091334fd8b115cc7d144adb2..d2a08cabec07563b29b0e126fa7ab0f2bb556530 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli +++ b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli @@ -30,5 +30,5 @@ val bake : ?timestamp:Time.Protocol.t -> Shell_services.block -> Data.Command.t -> - Client_keys.sk_uri -> + Client_keys_v0.sk_uri -> Tezos_crypto.Block_hash.t tzresult Lwt.t diff --git a/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.ml b/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.ml index f11409f17b65abe8e0679ed4e7b39cb31aaabd7f..975db40813c8a93112f597d75009f44bfa78e6bd 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.ml @@ -26,7 +26,7 @@ open Protocol open Alpha_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #Alpha_client_context.rpc_context) ~chain ~block contract = @@ -67,5 +67,5 @@ let list_contract_labels (cctxt : #Alpha_client_context.full) ~chain ~block = let get_manager (cctxt : #Alpha_client_context.full) ~chain ~block source = Client_proto_contracts.get_manager cctxt ~chain ~block source >>=? fun src_pkh -> - Client_keys.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> return (src_name, src_pkh, src_pk, src_sk) diff --git a/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.mli b/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.mli index e980e8d7cb99a60f33182448e82090f7aa37ee49..9c7b21cd42cf755cdb81f37926656e61676cde23 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.mli +++ b/src/proto_001_PtCJ7pwo/lib_client/client_proto_context.mli @@ -51,7 +51,7 @@ val get_manager : chain:Shell_services.chain -> block:Shell_services.block -> Contract.t -> - (string * public_key_hash * public_key * Client_keys.sk_uri) tzresult Lwt.t + (string * public_key_hash * public_key * Client_keys_v0.sk_uri) tzresult Lwt.t val get_balance : #Alpha_client_context.rpc_context -> diff --git a/src/proto_001_PtCJ7pwo/lib_client/client_proto_contracts.ml b/src/proto_001_PtCJ7pwo/lib_client/client_proto_contracts.ml index ed13d42a31d7519f9723e5171b431fbd0fe11b2a..682c8d83f0c603697286af2a1a7058f05679aef4 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/client_proto_contracts.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -104,13 +104,13 @@ module ContractAlias = struct (parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -131,7 +131,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml index 09cb02c3d4ef7f29b25798896751020696fe379d..afe05faed866da0059103374f7b9e69564a49671 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml @@ -66,7 +66,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal origination" else "Origination") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp manager Client_proto_args.tez_sym Tez.pp @@ -96,7 +96,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; if spendable then Format.fprintf ppf "@,Spendable by the manager" ; if delegatable then @@ -110,7 +110,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -130,7 +130,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -149,21 +149,21 @@ let pp_balance_updates ppf = function | Rewards (pkh, l) -> Format.asprintf "rewards(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -434,7 +434,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -443,7 +443,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -454,7 +454,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %s@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_context_commands.ml b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_context_commands.ml index 8a4762f1c77547b4d9380574bde520ab71ca797b..5193a638f7ca44d14d2b423595aedaef142fd3d5 100644 --- a/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_context_commands.ml @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let report_michelson_errors ?(no_print_source = false) ~msg (cctxt : #Client_context.printer) = function diff --git a/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_programs_commands.ml b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_programs_commands.ml index 542fe771f71162464ce7c2ce15a871ef428204cc..71f0ac521b7297f5523c649a34f92acefe3f3c34 100644 --- a/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_programs_commands.ml @@ -103,7 +103,7 @@ let commands () = in let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -303,10 +303,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -317,7 +317,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ Tezos_clic.param ~name:"signature" @@ -329,7 +329,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Alpha_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml index bd01313f559839e5037dfa9410cb8cd54f8b0479..41581ac0d854e584ba8b8a426806c69f101c10ec 100644 --- a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml +++ b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Alpha_client_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #Alpha_client_context.rpc_context) ~chain ~block contract = @@ -72,7 +72,7 @@ let list_contract_labels (cctxt : #Alpha_client_context.full) ~chain ~block = let get_manager (cctxt : #Alpha_client_context.full) ~chain ~block source = Client_proto_contracts.get_manager cctxt ~chain ~block source >>=? fun src_pkh -> - Client_keys.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> return (src_name, src_pkh, src_pk, src_sk) let pp_operation formatter (a : Alpha_block_services.operation) = diff --git a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli index 910080f482971c18a56fdaa4046e69c48447f4b7..e751b37023ae0473d897caac00828d9dedac4f05 100644 --- a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli +++ b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli @@ -59,7 +59,7 @@ val get_manager : chain:Shell_services.chain -> block:Shell_services.block -> Contract.t -> - (string * public_key_hash * public_key * Client_keys.sk_uri) tzresult Lwt.t + (string * public_key_hash * public_key * Client_keys_v0.sk_uri) tzresult Lwt.t val get_balance : #Alpha_client_context.rpc_context -> diff --git a/src/proto_002_PsYLVpVv/lib_client/client_proto_contracts.ml b/src/proto_002_PsYLVpVv/lib_client/client_proto_contracts.ml index ed13d42a31d7519f9723e5171b431fbd0fe11b2a..682c8d83f0c603697286af2a1a7058f05679aef4 100644 --- a/src/proto_002_PsYLVpVv/lib_client/client_proto_contracts.ml +++ b/src/proto_002_PsYLVpVv/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -104,13 +104,13 @@ module ContractAlias = struct (parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -131,7 +131,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml index 74667c650b16ea0ddf0307070f36522de2ad575a..237e6b7892ea7d5872e2c7e87866ed8145d2dccf 100644 --- a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml +++ b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml @@ -66,7 +66,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal origination" else "Origination") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp manager Client_proto_args.tez_sym Tez.pp @@ -99,7 +99,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; if spendable then Format.fprintf ppf "@,Spendable by the manager" ; if delegatable then @@ -113,7 +113,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -133,7 +133,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -152,21 +152,21 @@ let pp_balance_updates ppf = function | Rewards (pkh, l) -> Format.asprintf "rewards(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -438,7 +438,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -447,7 +447,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -458,7 +458,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %s@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_context_commands.ml b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_context_commands.ml index 8072548a515f941e3f0444d62a559fd79fb352d3..3d30e237fb6e00640a49c73d57525f7fa7d6140f 100644 --- a/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_context_commands.ml @@ -28,7 +28,7 @@ open Alpha_context open Tezos_micheline open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let report_michelson_errors ?(no_print_source = false) ~msg (cctxt : #Client_context.printer) = function diff --git a/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_programs_commands.ml b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_programs_commands.ml index 47a7ff377bca7292c3b5acb0b2c6eb48e9c40fd4..6cc8b85a27f9d3051762f435110f521c5d4711f5 100644 --- a/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_programs_commands.ml @@ -103,7 +103,7 @@ let commands () = in let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -351,10 +351,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -365,7 +365,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ Tezos_clic.param ~name:"signature" @@ -377,7 +377,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Alpha_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml b/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml index 3708813784a18f2b9092588a4bcc208a5cade3bb..6d62e5b5dafc473e2bb3b4a3ba77e3b599d2803b 100644 --- a/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml +++ b/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Alpha_client_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #Alpha_client_context.rpc_context) ~chain ~block contract = @@ -72,7 +72,7 @@ let list_contract_labels (cctxt : #Alpha_client_context.full) ~chain ~block = let get_manager (cctxt : #Alpha_client_context.full) ~chain ~block source = Client_proto_contracts.get_manager cctxt ~chain ~block source >>=? fun src_pkh -> - Client_keys.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> return (src_name, src_pkh, src_pk, src_sk) type period_info = { diff --git a/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli b/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli index dbdb8260bd1898b0b21e956b6654a499386416ac..604e83f4438325d4c64b47df03f1f620ce0cf5c3 100644 --- a/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli +++ b/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli @@ -59,7 +59,7 @@ val get_manager : chain:Shell_services.chain -> block:Shell_services.block -> Contract.t -> - (string * public_key_hash * public_key * Client_keys.sk_uri) tzresult Lwt.t + (string * public_key_hash * public_key * Client_keys_v0.sk_uri) tzresult Lwt.t val get_balance : #Alpha_client_context.rpc_context -> diff --git a/src/proto_003_PsddFKi3/lib_client/client_proto_contracts.ml b/src/proto_003_PsddFKi3/lib_client/client_proto_contracts.ml index ed13d42a31d7519f9723e5171b431fbd0fe11b2a..682c8d83f0c603697286af2a1a7058f05679aef4 100644 --- a/src/proto_003_PsddFKi3/lib_client/client_proto_contracts.ml +++ b/src/proto_003_PsddFKi3/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -104,13 +104,13 @@ module ContractAlias = struct (parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -131,7 +131,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_003_PsddFKi3/lib_client/operation_result.ml b/src/proto_003_PsddFKi3/lib_client/operation_result.ml index a85ac41a753373c8105b83035947ee7509227c47..1bcf19505aa25904351dd527f77e1282a4c31949 100644 --- a/src/proto_003_PsddFKi3/lib_client/operation_result.ml +++ b/src/proto_003_PsddFKi3/lib_client/operation_result.ml @@ -74,7 +74,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal origination" else "Origination") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp manager Client_proto_args.tez_sym Tez.pp @@ -107,7 +107,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; if spendable then Format.fprintf ppf "@,Spendable by the manager" ; if delegatable then @@ -121,7 +121,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -141,7 +141,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -160,21 +160,21 @@ let pp_balance_updates ppf = function | Rewards (pkh, l) -> Format.asprintf "rewards(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -449,7 +449,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -458,7 +458,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -469,7 +469,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_003_PsddFKi3/lib_client_commands/client_proto_context_commands.ml b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_context_commands.ml index 29d12e45609c459bedb718cae2623041f979b0a3..81393dd717c2166cbafffab301a10187059b5969 100644 --- a/src/proto_003_PsddFKi3/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_context_commands.ml @@ -28,7 +28,7 @@ open Alpha_context open Tezos_micheline open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let report_michelson_errors ?(no_print_source = false) ~msg (cctxt : #Client_context.printer) = function diff --git a/src/proto_003_PsddFKi3/lib_client_commands/client_proto_programs_commands.ml b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_programs_commands.ml index bc5068d7be210b53037ef77780d3101e45f7e267..4819e938679685b14fb8f44e1ab272bfa4eaf071 100644 --- a/src/proto_003_PsddFKi3/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_programs_commands.ml @@ -92,7 +92,7 @@ let commands () = in let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -340,10 +340,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -354,7 +354,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ Tezos_clic.param ~name:"signature" @@ -366,7 +366,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Alpha_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml index a22995c833334d1618e9f992db02a289f9235d2c..dbacb43060eb4928ab2eeed61456d30cc979b5ed 100644 --- a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml +++ b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Alpha_client_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #Alpha_client_context.rpc_context) ~chain ~block contract = @@ -73,7 +73,7 @@ let list_contract_labels (cctxt : #Alpha_client_context.full) ~chain ~block = let get_manager (cctxt : #Alpha_client_context.full) ~chain ~block source = Client_proto_contracts.get_manager cctxt ~chain ~block source >>=? fun src_pkh -> - Client_keys.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, src_pk, src_sk) -> return (src_name, src_pkh, src_pk, src_sk) type period_info = { diff --git a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli index 85d929df8040f3779117856474f3795ca80847be..73fd63e7fb3b3e3c8138f007bbf522c51f5090c4 100644 --- a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli +++ b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli @@ -59,7 +59,7 @@ val get_manager : chain:Shell_services.chain -> block:Shell_services.block -> Contract.t -> - (string * public_key_hash * public_key * Client_keys.sk_uri) tzresult Lwt.t + (string * public_key_hash * public_key * Client_keys_v0.sk_uri) tzresult Lwt.t val get_balance : #Alpha_client_context.rpc_context -> diff --git a/src/proto_004_Pt24m4xi/lib_client/client_proto_contracts.ml b/src/proto_004_Pt24m4xi/lib_client/client_proto_contracts.ml index e94bf67bc1128bf33f7a629ce31b36004d0d772e..e7b43241555acbf841969081842d6a9791c4ae0c 100644 --- a/src/proto_004_Pt24m4xi/lib_client/client_proto_contracts.ml +++ b/src/proto_004_Pt24m4xi/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -95,13 +95,13 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -145,7 +145,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml index a85ac41a753373c8105b83035947ee7509227c47..1bcf19505aa25904351dd527f77e1282a4c31949 100644 --- a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml +++ b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml @@ -74,7 +74,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal origination" else "Origination") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp manager Client_proto_args.tez_sym Tez.pp @@ -107,7 +107,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; if spendable then Format.fprintf ppf "@,Spendable by the manager" ; if delegatable then @@ -121,7 +121,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -141,7 +141,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -160,21 +160,21 @@ let pp_balance_updates ppf = function | Rewards (pkh, l) -> Format.asprintf "rewards(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -449,7 +449,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -458,7 +458,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -469,7 +469,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_context_commands.ml b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_context_commands.ml index 29d12e45609c459bedb718cae2623041f979b0a3..81393dd717c2166cbafffab301a10187059b5969 100644 --- a/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_context_commands.ml @@ -28,7 +28,7 @@ open Alpha_context open Tezos_micheline open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let report_michelson_errors ?(no_print_source = false) ~msg (cctxt : #Client_context.printer) = function diff --git a/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_programs_commands.ml b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_programs_commands.ml index 52ad7b6e8738991e930222a14fe7e61aecb5eb76..7cffe49be7805ce165454ee3c7a256d13eeb3bdd 100644 --- a/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_programs_commands.ml @@ -105,7 +105,7 @@ let commands () = in let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -374,10 +374,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -388,7 +388,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ Tezos_clic.param ~name:"signature" @@ -400,7 +400,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Alpha_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml b/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml index 1811f0814377636f4750bb8105baf996d6a0f15a..70a862de2a5cf015fc6d3bff7fdfa4c5aa3958c2 100644 --- a/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml +++ b/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Protocol_client_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract diff --git a/src/proto_005_PsBabyM1/lib_client/client_proto_contracts.ml b/src/proto_005_PsBabyM1/lib_client/client_proto_contracts.ml index edcc1f0d886d958788a9414bd6deea12f16ed0a9..b6ba7b9fe5fd1ea5849b6bcf9d7e6dc74f9e4733 100644 --- a/src/proto_005_PsBabyM1/lib_client/client_proto_contracts.ml +++ b/src/proto_005_PsBabyM1/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -95,13 +95,13 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -145,7 +145,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_005_PsBabyM1/lib_client/injection.ml b/src/proto_005_PsBabyM1/lib_client/injection.ml index 53820125e3e35d8b05750d66f14414e07c2c2b26..9a773c603ca2fa63b9b2b1e60042122080c67623 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.ml +++ b/src/proto_005_PsBabyM1/lib_client/injection.ml @@ -188,9 +188,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -214,7 +214,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -240,8 +240,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -249,14 +249,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -496,7 +496,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_005_PsBabyM1/lib_client/injection.mli b/src/proto_005_PsBabyM1/lib_client/injection.mli index 743274890217ad0407a065b244ce2a2e00298241..73cb9d7b4e7276f4526c88a2738dcfc2796fd1a0 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.mli +++ b/src/proto_005_PsBabyM1/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -64,7 +64,7 @@ val inject_operation : ?confirmations:int -> ?dry_run:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> ?compute_fee:bool -> @@ -82,9 +82,9 @@ val inject_manager_operation : ?confirmations:int -> ?dry_run:bool -> ?verbose_signing:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> ?gas_limit:Z.t -> ?storage_limit:Z.t -> diff --git a/src/proto_005_PsBabyM1/lib_client/managed_contract.ml b/src/proto_005_PsBabyM1/lib_client/managed_contract.ml index d13d47d2fb98829a521df813b43f16c8bc67aa06..fbf52c602697761009ce21acb2875f75e2f1e0d2 100644 --- a/src/proto_005_PsBabyM1/lib_client/managed_contract.ml +++ b/src/proto_005_PsBabyM1/lib_client/managed_contract.ml @@ -38,7 +38,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, [Bytes (_, bytes); _], _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -50,7 +50,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, [String (_, value); _], _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -78,7 +78,7 @@ let parse code = let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -93,7 +93,7 @@ let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; \ @@ -119,7 +119,7 @@ let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" diff --git a/src/proto_005_PsBabyM1/lib_client/managed_contract.mli b/src/proto_005_PsBabyM1/lib_client/managed_contract.mli index 4752d3da8213294623c8b63c6f4a198ea2c05bbd..665ebf89f30defc4b40bb6fe603c44c4ad97dc67 100644 --- a/src/proto_005_PsBabyM1/lib_client/managed_contract.mli +++ b/src/proto_005_PsBabyM1/lib_client/managed_contract.mli @@ -48,7 +48,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -68,7 +68,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_005_PsBabyM1/lib_client/operation_result.ml b/src/proto_005_PsBabyM1/lib_client/operation_result.ml index 85811df298d53d1dd91da6fd31d7f8c2a83ee684..cdedc77f8c1f9327482ac4b484111a42fc75acd8 100644 --- a/src/proto_005_PsBabyM1/lib_client/operation_result.ml +++ b/src/proto_005_PsBabyM1/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -145,21 +145,21 @@ let pp_balance_updates ppf = function | Rewards (pkh, l) -> Format.asprintf "rewards(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -339,7 +339,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %s@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -454,7 +454,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -463,7 +463,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -474,7 +474,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_005_PsBabyM1/lib_client_commands/client_proto_context_commands.ml b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_context_commands.ml index 023df86945ccc2217d044e595be19941b2f1038b..443f6f27b3fa3f0922998a2919f0f72d4a38f038 100644 --- a/src/proto_005_PsBabyM1/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_context_commands.ml @@ -29,7 +29,7 @@ open Alpha_context open Tezos_micheline open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 open Client_proto_args let report_michelson_errors ?(no_print_source = false) ~msg diff --git a/src/proto_005_PsBabyM1/lib_client_commands/client_proto_programs_commands.ml b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_programs_commands.ml index 775aca6922338fa75a9f7005a10f1e6d0f5c2141..549d0002afbcdb4796750c468ebb0e7ac9c220db 100644 --- a/src/proto_005_PsBabyM1/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_programs_commands.ml @@ -128,7 +128,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -437,10 +437,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -451,7 +451,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -463,7 +463,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml b/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml index fc492598ad75d5a5a55bffed7ad2c513955acb05..fc16fd006666386b5e47cd694c3f449bbdb4a35c 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml @@ -156,7 +156,7 @@ let arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -408,7 +408,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_args.mli b/src/proto_006_PsCARTHA/lib_client/client_proto_args.mli index eb2dce1cd4c39c0b4c197616055720e663c7b7b8..56351bd7588b0f04987c937bf398dd366666f5fb 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_args.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_args.mli @@ -47,7 +47,7 @@ val source_arg : (string option, full) Tezos_clic.arg val entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -91,7 +91,8 @@ val tez_param : ('a, full) Tezos_clic.params -> (Tez.t -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml index fb3555dee8ba771a39036d8d289ba88f39c0bf34..2f45b33b519c151f5d906402ba44e5e0640fc74a 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -196,7 +196,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -323,14 +323,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -371,21 +371,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -399,7 +401,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli index 32ce52d9c69865498670167b4970424e9c230b6b..1b18732eac64ef1535786b8e1eafd1f20ecbbbdc 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli @@ -79,7 +79,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -92,7 +92,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -120,7 +120,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -136,7 +136,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -160,7 +160,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -238,7 +238,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -250,7 +250,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_contracts.ml b/src/proto_006_PsCARTHA/lib_client/client_proto_contracts.ml index edcc1f0d886d958788a9414bd6deea12f16ed0a9..b6ba7b9fe5fd1ea5849b6bcf9d7e6dc74f9e4733 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_contracts.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -95,13 +95,13 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) (fun cctxt s -> match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -145,7 +145,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml index 20e130fa5779f201781179873665c52154b80072..28013b4f34f96e80caf2935ebb74c08263151ac0 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml @@ -134,9 +134,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -473,7 +473,7 @@ let action_to_expr ~loc = function (bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding delegate)))) | Change_keys (threshold, keys) -> right @@ -490,7 +490,7 @@ let action_to_expr ~loc = function bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding k)) keys)))) @@ -554,7 +554,7 @@ let action_of_expr e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -581,14 +581,14 @@ let action_of_expr e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes >>=? fun keys -> return @@ Change_keys (threshold, keys) | _ -> fail () -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -618,7 +618,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -630,7 +631,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -654,7 +655,7 @@ let multisig_create_param ~counter ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> return @@ strip_locations @@ -762,7 +763,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli index ff80be2dcc7b0fbf8b66a6b23602a6f87b1963f8..31147781f2bf7ce939beb5f94ba1c4183afc5830 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli @@ -58,7 +58,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -82,10 +82,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Z.t -> @@ -106,10 +106,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Z.t -> diff --git a/src/proto_006_PsCARTHA/lib_client/injection.ml b/src/proto_006_PsCARTHA/lib_client/injection.ml index 53820125e3e35d8b05750d66f14414e07c2c2b26..9a773c603ca2fa63b9b2b1e60042122080c67623 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.ml +++ b/src/proto_006_PsCARTHA/lib_client/injection.ml @@ -188,9 +188,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -214,7 +214,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -240,8 +240,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -249,14 +249,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -496,7 +496,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_006_PsCARTHA/lib_client/injection.mli b/src/proto_006_PsCARTHA/lib_client/injection.mli index 743274890217ad0407a065b244ce2a2e00298241..73cb9d7b4e7276f4526c88a2738dcfc2796fd1a0 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.mli +++ b/src/proto_006_PsCARTHA/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -64,7 +64,7 @@ val inject_operation : ?confirmations:int -> ?dry_run:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> ?compute_fee:bool -> @@ -82,9 +82,9 @@ val inject_manager_operation : ?confirmations:int -> ?dry_run:bool -> ?verbose_signing:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> ?gas_limit:Z.t -> ?storage_limit:Z.t -> diff --git a/src/proto_006_PsCARTHA/lib_client/managed_contract.ml b/src/proto_006_PsCARTHA/lib_client/managed_contract.ml index 98e198c78648ce489bbf1d5bba7a3600058e9e23..4adca59f12300cde99f76c43d25abed04606293e 100644 --- a/src/proto_006_PsCARTHA/lib_client/managed_contract.ml +++ b/src/proto_006_PsCARTHA/lib_client/managed_contract.ml @@ -38,7 +38,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, [Bytes (_, bytes); _], _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -50,7 +50,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, [String (_, value); _], _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -78,7 +78,7 @@ let parse code = let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -93,7 +93,7 @@ let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; \ @@ -123,7 +123,7 @@ let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -162,7 +162,7 @@ let t_unit = let build_lambda_for_implicit ~delegate ~amount = let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_006_PsCARTHA/lib_client/managed_contract.mli b/src/proto_006_PsCARTHA/lib_client/managed_contract.mli index 4752d3da8213294623c8b63c6f4a198ea2c05bbd..665ebf89f30defc4b40bb6fe603c44c4ad97dc67 100644 --- a/src/proto_006_PsCARTHA/lib_client/managed_contract.mli +++ b/src/proto_006_PsCARTHA/lib_client/managed_contract.mli @@ -48,7 +48,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -68,7 +68,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_006_PsCARTHA/lib_client/operation_result.ml b/src/proto_006_PsCARTHA/lib_client/operation_result.ml index ba40e717f8ce9b5dcaf0ae1e139589f36258bb1e..6edf2fc4ab3e03e7b635fdb199988689ae23121c 100644 --- a/src/proto_006_PsCARTHA/lib_client/operation_result.ml +++ b/src/proto_006_PsCARTHA/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -141,11 +141,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -335,7 +335,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %s@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -450,7 +450,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -459,7 +459,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -470,7 +470,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_context_commands.ml b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_context_commands.ml index ae33de83a659e410ccffa2bee5a7ae9f7777420c..1bee6defcd5e86f4cb7eb8274949c73a31937173 100644 --- a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Tezos_micheline open Client_proto_context open Client_proto_contracts open Client_proto_programs -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -133,7 +133,7 @@ let transfer_command amount source destination cctxt | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -156,7 +156,7 @@ let transfer_command amount source destination cctxt ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -442,7 +442,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -465,7 +465,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -521,7 +521,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -544,7 +544,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -569,7 +569,7 @@ let commands network () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -623,7 +623,7 @@ let commands network () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -834,7 +834,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -887,7 +887,7 @@ let commands network () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1119,7 +1119,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info ~chain:cctxt#chain ~block:cctxt#block cctxt >>=? fun info -> @@ -1184,7 +1184,7 @@ let commands network () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal pkh src_pkh) listings) @@ -1192,7 +1192,7 @@ let commands network () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1288,7 +1288,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info ~chain:cctxt#chain ~block:cctxt#block cctxt >>=? fun info -> diff --git a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_multisig_commands.ml index b4bf5a4503d7b7a88a5f7818763efae238ddb7c2..5f75d64e8b2fde045d716d144b71b99ec3e3bc82 100644 --- a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_multisig_commands.ml @@ -39,12 +39,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -112,7 +112,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let commands () : #Protocol_client_context.full Tezos_clic.command list = @@ -127,7 +127,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.minimal_fees_arg Client_proto_args.minimal_nanotez_per_byte_arg @@ -182,7 +182,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -194,7 +195,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = } in List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys >>=? fun keys -> Client_proto_multisig.originate_multisig @@ -277,7 +278,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -338,7 +339,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -383,8 +384,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Transfer (amount, destination)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -394,7 +396,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -412,8 +414,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -437,8 +440,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -461,7 +465,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -473,8 +477,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." @@ -521,7 +526,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -568,7 +574,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -600,7 +606,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -674,7 +681,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -752,9 +760,10 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> let fee_parameter = @@ -844,7 +853,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; diff --git a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_programs_commands.ml b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_programs_commands.ml index 775aca6922338fa75a9f7005a10f1e6d0f5c2141..549d0002afbcdb4796750c468ebb0e7ac9c220db 100644 --- a/src/proto_006_PsCARTHA/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_programs_commands.ml @@ -128,7 +128,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -437,10 +437,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -451,7 +451,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -463,7 +463,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml b/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml index a2c681933d6e0ac89d55b69d244a2f8d61cfb6d3..99609ee752085e2b7e360ab16a3bbb39944db039 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml @@ -163,7 +163,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -455,7 +455,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_007_PsDELPH1/lib_client/client_proto_args.mli b/src/proto_007_PsDELPH1/lib_client/client_proto_args.mli index 4a6b0ac4e82444cddf045eaab3a0205e0c24169d..435a4578cdf6b45b81dd7603957b34d123839c6b 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_args.mli +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_args.mli @@ -57,7 +57,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -101,7 +101,8 @@ val tez_param : ('a, full) Tezos_clic.params -> (Tez.t -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml b/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml index 2122688a9a8701cd015ae5eb1adccfd03dbdaa5f..fe730a5950f3e7f0275e4835f8d4fbfe2bb1265e 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract diff --git a/src/proto_007_PsDELPH1/lib_client/client_proto_contracts.ml b/src/proto_007_PsDELPH1/lib_client/client_proto_contracts.ml index 5d05ed46df886f785c266e37fd276320c45d9fd9..53f132bcae049955c469035e3e15a3105881cf25 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_contracts.ml +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -95,7 +95,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -109,7 +109,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -147,7 +147,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_007_PsDELPH1/lib_client/managed_contract.ml b/src/proto_007_PsDELPH1/lib_client/managed_contract.ml index dcabb8ecffa74696d321fedf4c20aa198fb6b8b1..eb072f91b0e95a3fa69270dff263e0498a809044 100644 --- a/src/proto_007_PsDELPH1/lib_client/managed_contract.ml +++ b/src/proto_007_PsDELPH1/lib_client/managed_contract.ml @@ -41,7 +41,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, [Bytes (_, bytes); _], _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -53,7 +53,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, [String (_, value); _], _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> diff --git a/src/proto_007_PsDELPH1/lib_client/operation_result.ml b/src/proto_007_PsDELPH1/lib_client/operation_result.ml index 38f3973b8f4ccb60cc42a5c5e9a71acaa83071b9..e55afc20088a4aa479a2e2234a5d7338d0e5709f 100644 --- a/src/proto_007_PsDELPH1/lib_client/operation_result.ml +++ b/src/proto_007_PsDELPH1/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -141,11 +141,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -330,7 +330,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -446,7 +446,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -455,7 +455,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %a@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period @@ -466,7 +466,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_007_PsDELPH1/lib_client_commands/client_proto_context_commands.ml b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_context_commands.ml index abe19f89fd3b1d70f074ecf88346af155b877e63..beb4c7a2461b3b3bc15099a1b6a4e15e662ec326 100644 --- a/src/proto_007_PsDELPH1/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_context_commands.ml @@ -29,7 +29,7 @@ open Alpha_context open Tezos_micheline open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 open Client_proto_args let data_parameter = diff --git a/src/proto_007_PsDELPH1/lib_client_commands/client_proto_programs_commands.ml b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_programs_commands.ml index 3cfbb87ccaafa5e62f9c45985bf776142e0cc8db..0fe9bb4846937311c29993b23b2b006ffa417e87 100644 --- a/src/proto_007_PsDELPH1/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_programs_commands.ml @@ -79,7 +79,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -194,7 +194,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -206,7 +206,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml b/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml index b5c0b6b81850edb78f25d792d9b5abd5647432f3..8a633615c8c56743fe10d51a2e3d03754577fbc2 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml @@ -163,7 +163,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -455,7 +455,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.mli b/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.mli index 0710270a285149421273746200a381f3eadf1b6e..ea3c91d65cf7e187051b3e151b536e3bc44de565 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.mli @@ -57,7 +57,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -101,7 +101,8 @@ val tez_param : ('a, full) Tezos_clic.params -> (Tez.t -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml index 1a9f8531274b4d95198fe456e123918432b2a7cd..37b6d9c4913a4c05cbccf6b034f010673cdfbcd5 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -222,7 +222,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -398,14 +398,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -446,21 +446,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -474,7 +476,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli index ceaa531aa598135e7bcf1ddadb64d900f6d3d087..9563d549881770517818438f29e5c31913428c62 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli @@ -88,7 +88,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -101,7 +101,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -129,7 +129,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -158,7 +158,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -189,7 +189,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -280,7 +280,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -292,7 +292,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_contracts.ml b/src/proto_008_PtEdo2Zk/lib_client/client_proto_contracts.ml index 5d05ed46df886f785c266e37fd276320c45d9fd9..53f132bcae049955c469035e3e15a3105881cf25 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_contracts.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_contracts.ml @@ -52,18 +52,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -74,7 +74,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -95,7 +95,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -109,7 +109,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -147,7 +147,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/client_proto_fa12.mli b/src/proto_008_PtEdo2Zk/lib_client/client_proto_fa12.mli index c712af89a2dd38954ac4274dab0170c72fa0b9e1..2b7ebe21055c1accfe3868a75ec28718f2334abd 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_fa12.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_fa12.mli @@ -95,7 +95,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -132,7 +132,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.ml b/src/proto_008_PtEdo2Zk/lib_client/injection.ml index eabb0c8c9b98a69247c96e13729b814e2a1472e8..15bd3a52a821b1874e05bc78661773b6859cce13 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.ml @@ -230,9 +230,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -256,7 +256,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -282,8 +282,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -291,14 +291,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -546,7 +546,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.mli b/src/proto_008_PtEdo2Zk/lib_client/injection.mli index a90879d8db8739c613bb47e8c109e8736ebedb8c..70f5dc785fbc20af585b44c9c3e39c75fba88bed 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.mli @@ -88,7 +88,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -105,7 +105,7 @@ val inject_operation : ?dry_run:bool -> ?simulation:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> ?compute_fee:bool -> @@ -131,9 +131,9 @@ val inject_manager_operation : ?dry_run:bool -> ?verbose_signing:bool -> ?simulation:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml index 8d43b2e2086753b0867bf6c710cbc41926142ebd..1fc69930e869ad3395448718d0c0abc1390817b5 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml @@ -48,7 +48,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -60,7 +60,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -89,7 +89,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -99,7 +99,7 @@ let build_lambda_for_set_delegate ~delegate = let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -132,7 +132,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -153,7 +153,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Injection.Single_manager operation in @@ -183,7 +183,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_008_PtEdo2Zk/lib_client/managed_contract.mli b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.mli index 411faba27475dbdcb7312b0ae0133ba1b1bb5cd3..9e6076fdb192c542a2e094583935c7b7ec0252a4 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/managed_contract.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -96,7 +96,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml index 8c68db9d29a0e2ad26925d56fa68df51a0f61a7e..aa3387c18cbcb555a719083ecda08b85e1e94ab2 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -141,11 +141,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -337,7 +337,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -453,7 +453,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -462,7 +462,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -472,7 +472,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_context_commands.ml b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_context_commands.ml index 88a88173999ba8005ea4b26da83e19c1c96e2193..81f3851ec0f2b45f80b13c12549cdd20e0df0830 100644 --- a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Tezos_micheline open Client_proto_context open Client_proto_contracts open Client_proto_programs -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -141,7 +141,7 @@ let transfer_command amount source destination cctxt | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -165,7 +165,7 @@ let transfer_command amount source destination cctxt ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -543,7 +543,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -567,7 +567,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -624,7 +624,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -647,7 +647,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -672,7 +672,7 @@ let commands network () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -726,7 +726,7 @@ let commands network () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -859,11 +859,11 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = Injection.manager_of_list contents in @@ -1089,7 +1089,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1142,7 +1142,7 @@ let commands network () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1374,7 +1374,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1445,7 +1445,7 @@ let commands network () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal pkh src_pkh) listings) @@ -1453,7 +1453,7 @@ let commands network () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1549,7 +1549,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will diff --git a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_fa12_commands.ml index f0aff0b960dc796e604c771bc968974f1b6f1d70..6d30c11cd93ba3f58fe92a862adea121c6abcb9b 100644 --- a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_fa12_commands.ml @@ -135,7 +135,7 @@ let originate_options = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -152,14 +152,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_programs_commands.ml b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_programs_commands.ml index 60fa9c450033aaa69b91d7680b692e59e44817d5..8273edbfe8492b1de6b69371514e4c8e26a7a5e7 100644 --- a/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_programs_commands.ml @@ -140,7 +140,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -613,10 +613,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -627,7 +627,7 @@ let commands () = (prefixes ["check"; "that"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -639,7 +639,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_args.ml b/src/proto_009_PsFLoren/lib_client/client_proto_args.ml index 9ea0c27b9240372344640f10c84baa614815cda8..7ca86b823c1c2468a279c0287a228d9166d50dcf 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_args.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_args.ml @@ -163,7 +163,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -454,7 +454,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_args.mli b/src/proto_009_PsFLoren/lib_client/client_proto_args.mli index 0710270a285149421273746200a381f3eadf1b6e..ea3c91d65cf7e187051b3e151b536e3bc44de565 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_args.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_args.mli @@ -57,7 +57,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -101,7 +101,8 @@ val tez_param : ('a, full) Tezos_clic.params -> (Tez.t -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml index d54ed0f295b8435a5222625cbaf4f32a1b4323b1..5b3e70e8593c81785ca8ff37ecd9a0c38ec51869 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -232,7 +232,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -408,14 +408,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -456,21 +456,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -484,7 +486,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_context.mli b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli index e9f5701d078a29b1220d0b7971c62390667f57ad..c0119412a5e9a66907a113258dc6c3cc1716c112 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli @@ -88,7 +88,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -101,7 +101,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -129,7 +129,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -158,7 +158,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -189,7 +189,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -280,7 +280,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -292,7 +292,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_contracts.ml b/src/proto_009_PsFLoren/lib_client/client_proto_contracts.ml index 5c3552ee8ff07de7affebfb56728d06d0aa4830f..e3f7111035407269eea69e2cb1ea9e50385f61bd 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_contracts.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_contracts.ml @@ -50,18 +50,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -72,7 +72,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -93,7 +93,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -107,7 +107,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -145,7 +145,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_fa12.mli b/src/proto_009_PsFLoren/lib_client/client_proto_fa12.mli index c712af89a2dd38954ac4274dab0170c72fa0b9e1..2b7ebe21055c1accfe3868a75ec28718f2334abd 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_fa12.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_fa12.mli @@ -95,7 +95,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -132,7 +132,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml b/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli b/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_009_PsFLoren/lib_client/injection.ml b/src/proto_009_PsFLoren/lib_client/injection.ml index fef6f26ad2df05fed0208d2889ee7555ca467252..71e263a0c28bab818c2f5e099d1f1aff01b7dadd 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.ml +++ b/src/proto_009_PsFLoren/lib_client/injection.ml @@ -191,9 +191,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -217,7 +217,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -243,8 +243,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -252,14 +252,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -533,7 +533,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_009_PsFLoren/lib_client/injection.mli b/src/proto_009_PsFLoren/lib_client/injection.mli index 8ced153432db6f4f3a01a4d533d383fc2dda4aba..721a0cec81bb7ddb6271cddda92b1c2b523b7c07 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.mli +++ b/src/proto_009_PsFLoren/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -68,7 +68,7 @@ val inject_operation : ?dry_run:bool -> ?simulation:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> 'kind contents_list -> @@ -93,9 +93,9 @@ val inject_manager_operation : ?dry_run:bool -> ?verbose_signing:bool -> ?simulation:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_009_PsFLoren/lib_client/managed_contract.ml b/src/proto_009_PsFLoren/lib_client/managed_contract.ml index 67057a96c7df45ac848eddc0cfb8638f82debc74..e3766988d1a13de5c926c70eb87802d7e8162e40 100644 --- a/src/proto_009_PsFLoren/lib_client/managed_contract.ml +++ b/src/proto_009_PsFLoren/lib_client/managed_contract.ml @@ -48,7 +48,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -60,7 +60,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -89,7 +89,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -99,7 +99,7 @@ let build_lambda_for_set_delegate ~delegate = let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -132,7 +132,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -153,7 +153,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -184,7 +184,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_009_PsFLoren/lib_client/managed_contract.mli b/src/proto_009_PsFLoren/lib_client/managed_contract.mli index ae532c986987df213f6d52e2c90e45c69dbf1f81..3ae3789e5de74352c19b7775ed3936846ff30e35 100644 --- a/src/proto_009_PsFLoren/lib_client/managed_contract.mli +++ b/src/proto_009_PsFLoren/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -96,7 +96,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_009_PsFLoren/lib_client/operation_result.ml b/src/proto_009_PsFLoren/lib_client/operation_result.ml index 44adaa93f969cc0bf3043351ca247d336f84684b..53793a4626904e0f0fd44d027c92161d898f3330 100644 --- a/src/proto_009_PsFLoren/lib_client/operation_result.ml +++ b/src/proto_009_PsFLoren/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -141,11 +141,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -342,7 +342,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -467,7 +467,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -476,7 +476,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -486,7 +486,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_009_PsFLoren/lib_client_commands/client_proto_context_commands.ml b/src/proto_009_PsFLoren/lib_client_commands/client_proto_context_commands.ml index 7ce830c6022474866d506c6bd745f74b6f61f393..99d65369a1f33e3e24b7e1f35122d7c182d45261 100644 --- a/src/proto_009_PsFLoren/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_009_PsFLoren/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Tezos_micheline open Client_proto_context open Client_proto_contracts open Client_proto_programs -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -141,7 +141,7 @@ let transfer_command amount source destination cctxt | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -165,7 +165,7 @@ let transfer_command amount source destination cctxt ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -534,7 +534,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -558,7 +558,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -615,7 +615,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -638,7 +638,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -663,7 +663,7 @@ let commands network () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -717,7 +717,7 @@ let commands network () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -850,11 +850,11 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1082,7 +1082,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1135,7 +1135,7 @@ let commands network () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1367,7 +1367,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1438,7 +1438,7 @@ let commands network () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal pkh src_pkh) listings) @@ -1446,7 +1446,7 @@ let commands network () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1542,7 +1542,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will diff --git a/src/proto_009_PsFLoren/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_009_PsFLoren/lib_client_commands/client_proto_fa12_commands.ml index 9f6f65741853a721e84f61e456b3dee68e2d10d9..426e2fca38c8562f95d3ba582659971acc14f31b 100644 --- a/src/proto_009_PsFLoren/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_009_PsFLoren/lib_client_commands/client_proto_fa12_commands.ml @@ -135,7 +135,7 @@ let originate_options = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -152,14 +152,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_009_PsFLoren/lib_client_commands/client_proto_programs_commands.ml b/src/proto_009_PsFLoren/lib_client_commands/client_proto_programs_commands.ml index 4d302ba4f83d2eb4dbfcfe5ee96e8d64d037a193..c2a43f20cac1c6fe13ef6037bade1b6891402109 100644 --- a/src/proto_009_PsFLoren/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_009_PsFLoren/lib_client_commands/client_proto_programs_commands.ml @@ -140,7 +140,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -630,10 +630,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -644,7 +644,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -656,7 +656,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_009_PsFLoren/lib_client_commands/client_proto_utils_commands.ml b/src/proto_009_PsFLoren/lib_client_commands/client_proto_utils_commands.ml index 9cb7b75ca7657a38bf3ed520411b7009619abca1..9a07c6cbe8a7baf55817b86c9fa6a69b1d206fb7 100644 --- a/src/proto_009_PsFLoren/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_009_PsFLoren/lib_client_commands/client_proto_utils_commands.ml @@ -56,7 +56,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -64,7 +64,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -78,7 +78,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml b/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml index 3f4b1b84576dbb110ee1179e63e99a2751ec0a8b..cf424164afa46572ff6e4c32e6183ecd58f7f005 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml @@ -163,7 +163,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -454,7 +454,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_args.mli b/src/proto_010_PtGRANAD/lib_client/client_proto_args.mli index 0710270a285149421273746200a381f3eadf1b6e..ea3c91d65cf7e187051b3e151b536e3bc44de565 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_args.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_args.mli @@ -57,7 +57,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -101,7 +101,8 @@ val tez_param : ('a, full) Tezos_clic.params -> (Tez.t -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml index b785f0923f45f1a6d78364fed6175d3005ea3baf..d0c9373f64915e40f709362de0e600d387c25344 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -259,7 +259,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -435,14 +435,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -483,21 +483,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -511,7 +513,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli index 86cddd6cab2c083b31ee81b7c3f2599a2c10261b..eb5f6b84f688c120df65240250eb9efe35903146 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli @@ -97,7 +97,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -110,7 +110,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -138,7 +138,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -167,7 +167,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -198,7 +198,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -289,7 +289,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -301,7 +301,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_contracts.ml b/src/proto_010_PtGRANAD/lib_client/client_proto_contracts.ml index 4c5b1b62fcc077b835266bcdf240924423c458ef..d5e731034c10942cc273071c6921f79440c2d21f 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_contracts.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_contracts.ml @@ -46,18 +46,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -68,7 +68,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -89,7 +89,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -103,7 +103,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -141,7 +141,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_fa12.mli b/src/proto_010_PtGRANAD/lib_client/client_proto_fa12.mli index c712af89a2dd38954ac4274dab0170c72fa0b9e1..2b7ebe21055c1accfe3868a75ec28718f2334abd 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_fa12.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_fa12.mli @@ -95,7 +95,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -132,7 +132,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_010_PtGRANAD/lib_client/injection.ml b/src/proto_010_PtGRANAD/lib_client/injection.ml index 40a7e67137dadcb563142b5bab363beabd30c894..1acf3ac2cee55ad33593466fc88f4d208326c197 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.ml +++ b/src/proto_010_PtGRANAD/lib_client/injection.ml @@ -197,9 +197,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -223,7 +223,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -249,8 +249,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -258,14 +258,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -607,7 +607,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_010_PtGRANAD/lib_client/injection.mli b/src/proto_010_PtGRANAD/lib_client/injection.mli index 8ced153432db6f4f3a01a4d533d383fc2dda4aba..721a0cec81bb7ddb6271cddda92b1c2b523b7c07 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.mli +++ b/src/proto_010_PtGRANAD/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -68,7 +68,7 @@ val inject_operation : ?dry_run:bool -> ?simulation:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> 'kind contents_list -> @@ -93,9 +93,9 @@ val inject_manager_operation : ?dry_run:bool -> ?verbose_signing:bool -> ?simulation:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_010_PtGRANAD/lib_client/managed_contract.ml b/src/proto_010_PtGRANAD/lib_client/managed_contract.ml index ebd1099a41976f1ea4b45dc8ac6fcc023875c8c4..08ff4d07ab244a119dc205d290721c5c1dcbe8ab 100644 --- a/src/proto_010_PtGRANAD/lib_client/managed_contract.ml +++ b/src/proto_010_PtGRANAD/lib_client/managed_contract.ml @@ -49,7 +49,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -61,7 +61,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -100,7 +100,7 @@ let build_lambda_for_set_delegate ~delegate = let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -133,7 +133,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -154,7 +154,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -185,7 +185,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_010_PtGRANAD/lib_client/managed_contract.mli b/src/proto_010_PtGRANAD/lib_client/managed_contract.mli index ae532c986987df213f6d52e2c90e45c69dbf1f81..3ae3789e5de74352c19b7775ed3936846ff30e35 100644 --- a/src/proto_010_PtGRANAD/lib_client/managed_contract.mli +++ b/src/proto_010_PtGRANAD/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -96,7 +96,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_010_PtGRANAD/lib_client/operation_result.ml b/src/proto_010_PtGRANAD/lib_client/operation_result.ml index 0c3d78bd22f9ef22485b3bace6b9e7cebdd29117..d523d820b06d3cc72d505df9f4cd05f487899d12 100644 --- a/src/proto_010_PtGRANAD/lib_client/operation_result.ml +++ b/src/proto_010_PtGRANAD/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result) ; @@ -141,11 +141,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -343,7 +343,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -468,7 +468,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -477,7 +477,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -487,7 +487,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_context_commands.ml b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_context_commands.ml index 33a19d20aba4ca877ac8832e5583257963cfe47a..73e71ce22ba85067db24002164904268aef9d88d 100644 --- a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Tezos_micheline open Client_proto_context open Client_proto_contracts open Client_proto_programs -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -141,7 +141,7 @@ let transfer_command amount source destination cctxt | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -165,7 +165,7 @@ let transfer_command amount source destination cctxt ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -528,7 +528,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -552,7 +552,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -609,7 +609,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -632,7 +632,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -657,7 +657,7 @@ let commands network () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -711,7 +711,7 @@ let commands network () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -844,11 +844,11 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1076,7 +1076,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1129,7 +1129,7 @@ let commands network () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1361,7 +1361,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1432,7 +1432,7 @@ let commands network () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal pkh src_pkh) listings) @@ -1440,7 +1440,7 @@ let commands network () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1536,7 +1536,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will diff --git a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_fa12_commands.ml index 83ba1bd3e6075a95f0d721129a7ffaf0cda53ac2..0be1e98751b7253045df5bfaa1c3b4f8295c250d 100644 --- a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_fa12_commands.ml @@ -129,7 +129,7 @@ let originate_options = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -146,14 +146,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_programs_commands.ml b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_programs_commands.ml index 387618cbb9fad4952420787974af4ba37d951559..b58089951a3ed67befab1a035c9f82ef7bf6a7f7 100644 --- a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_programs_commands.ml @@ -140,7 +140,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -630,10 +630,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -644,7 +644,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -656,7 +656,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_utils_commands.ml b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_utils_commands.ml index 9cb7b75ca7657a38bf3ed520411b7009619abca1..9a07c6cbe8a7baf55817b86c9fa6a69b1d206fb7 100644 --- a/src/proto_010_PtGRANAD/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_utils_commands.ml @@ -56,7 +56,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -64,7 +64,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -78,7 +78,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] diff --git a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml index 66e18b5dfa8ea15372c46533a3b1eb4e00f4d7e5..8156bd8acae5844abe5573b9cab330a6173b62c5 100644 --- a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml +++ b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml @@ -1151,7 +1151,7 @@ module RPC = struct let operation : _ operation = {shell; protocol_data} in let hash = Operation.hash {shell; protocol_data} in let ctxt = Contract.init_origination_nonce ctxt hash in - let baker = Tezos_crypto.Signature.Public_key_hash.zero in + let baker = Tezos_crypto.Signature.V0.Public_key_hash.zero in match protocol_data.contents with | Single (Manager_operation _) as op -> partial_precheck_manager_contents_list ctxt op >>=? fun ctxt -> diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_args.ml b/src/proto_011_PtHangz2/lib_client/client_proto_args.ml index 9fac18b4bdd3abcd37d0d019bb916e49607b4a3b..d998aa6f9fed81af3b6f254d98c734efc2c95f0e 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_args.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_args.ml @@ -185,7 +185,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -484,7 +484,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_args.mli b/src/proto_011_PtHangz2/lib_client/client_proto_args.mli index a50d6d7664e7ac984c393d2af85ac05c07569114..14a33dff197bcf8c43e44320b77b7c4de55d97ee 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_args.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_args.mli @@ -59,7 +59,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -109,7 +109,8 @@ val global_constant_param : ('a, full) Tezos_clic.params -> (string -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml index 83488d49040b51d87592791a58f6ba049dcc7072..27b93db0aaa65f75bd700b15486f1d6d6a3b2fac 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -261,7 +261,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -479,14 +479,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -527,21 +527,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Lwt.return @@ Tezos_signer_backends.Unencrypted.make_sk sk) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -555,7 +557,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli index 1a25d50c68f1f4938e8bc86c233142112fa4f5d5..d69f8508bae74e539b1551534de499a9ee31283d 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli @@ -60,9 +60,9 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -118,7 +118,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -131,7 +131,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -159,7 +159,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -189,7 +189,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -220,7 +220,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -311,7 +311,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -323,7 +323,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_contracts.ml b/src/proto_011_PtHangz2/lib_client/client_proto_contracts.ml index 4c5b1b62fcc077b835266bcdf240924423c458ef..d5e731034c10942cc273071c6921f79440c2d21f 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_contracts.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_contracts.ml @@ -46,18 +46,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -68,7 +68,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -89,7 +89,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | _ -> ( find cctxt s >>= function @@ -103,7 +103,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -141,7 +141,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_fa12.mli b/src/proto_011_PtHangz2/lib_client/client_proto_fa12.mli index c712af89a2dd38954ac4274dab0170c72fa0b9e1..2b7ebe21055c1accfe3868a75ec28718f2334abd 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_fa12.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_fa12.mli @@ -95,7 +95,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -132,7 +132,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml index 0c667664248a6ca358d0b02b829f884372a4578f..a81da970aa4946f338469cb1a23595e41e93a50d 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml @@ -139,9 +139,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -580,11 +580,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) let mutez ~loc (amount : Tez.t) = int ~loc (Z.of_int64 (Tez.to_mutez amount)) let optimized_key_hash ~loc - (key_hash : Tezos_crypto.Signature.Public_key_hash.t) = + (key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : string) = @@ -595,11 +595,11 @@ let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : string) = Data_encoding.(tup2 Contract.encoding Variable.string) (address, entrypoint)) -let optimized_key ~loc (key : Tezos_crypto.Signature.Public_key.t) = +let optimized_key ~loc (key : Tezos_crypto.Signature.V0.Public_key.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding key) (** * Actions *) @@ -705,7 +705,7 @@ let action_of_expr_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -781,7 +781,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -808,7 +808,7 @@ let action_of_expr_not_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -818,7 +818,7 @@ let action_of_expr_not_generic e = let action_of_expr ~generic = if generic then action_of_expr_generic else action_of_expr_not_generic -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -846,7 +846,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -858,7 +859,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -882,7 +883,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc:0 ~generic action >>=? fun expr -> @@ -1051,7 +1052,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli index 5a9d0ca664ffc31eb205fe5243fa79bf302eca6b..5b5217eb52e3fe41a331b58d5f88434abbfddce9 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli @@ -83,7 +83,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -109,10 +109,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> @@ -135,10 +135,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml b/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_011_PtHangz2/lib_client/injection.ml b/src/proto_011_PtHangz2/lib_client/injection.ml index c88ead2806430e7edd6c78ffdf394b1868f1db78..a908d99be6b79edb9df0837573528b68a8374d7f 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.ml +++ b/src/proto_011_PtHangz2/lib_client/injection.ml @@ -197,9 +197,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -223,7 +223,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -249,8 +249,8 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with | Single (Endorsement _) -> - Tezos_crypto.Signature.(Endorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation + Tezos_crypto.Signature.V0.(Endorsement chain_id) + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -258,14 +258,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -619,7 +619,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_011_PtHangz2/lib_client/injection.mli b/src/proto_011_PtHangz2/lib_client/injection.mli index 9c93d9f174fa349bcb81a05a4717b6ae720e5638..c2d4543ad3f17cbb152a3db31eca2d1f13beb47f 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.mli +++ b/src/proto_011_PtHangz2/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -68,7 +68,7 @@ val inject_operation : ?dry_run:bool -> ?simulation:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> 'kind contents_list -> @@ -94,9 +94,9 @@ val inject_manager_operation : ?verbose_signing:bool -> ?simulation:bool -> ?force:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_011_PtHangz2/lib_client/managed_contract.ml b/src/proto_011_PtHangz2/lib_client/managed_contract.ml index 99809742245f9fa8ab3fbe1868e32bc77de2d951..2b1dee90be72bac7e7b73962f2abeb61d3f1fff9 100644 --- a/src/proto_011_PtHangz2/lib_client/managed_contract.ml +++ b/src/proto_011_PtHangz2/lib_client/managed_contract.ml @@ -49,7 +49,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -61,7 +61,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -100,7 +100,7 @@ let build_lambda_for_set_delegate ~delegate = let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -133,7 +133,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -154,7 +154,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -185,7 +185,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_011_PtHangz2/lib_client/managed_contract.mli b/src/proto_011_PtHangz2/lib_client/managed_contract.mli index bb467b5482e8315151cb9602112cf8b66b09cb99..4d44330fdcac7d32f000bf51cf7fe9600bb344c5 100644 --- a/src/proto_011_PtHangz2/lib_client/managed_contract.mli +++ b/src/proto_011_PtHangz2/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -97,7 +97,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_011_PtHangz2/lib_client/mockup.ml b/src/proto_011_PtHangz2/lib_client/mockup.ml index 44df8927b420f4e6a6e1e58515cf5a41a64dfdd7..4f50d6bf929530a4f54bace10ba502c4847d4186 100644 --- a/src/proto_011_PtHangz2/lib_client/mockup.ml +++ b/src/proto_011_PtHangz2/lib_client/mockup.ml @@ -592,7 +592,7 @@ module Protocol_constants_overrides = struct end module Parsed_account = struct - type t = {name : string; sk_uri : Client_keys.sk_uri; amount : Tez.t} + type t = {name : string; sk_uri : Client_keys_v0.sk_uri; amount : Tez.t} let pp ppf account = let open Format in @@ -612,13 +612,15 @@ module Parsed_account = struct (fun (name, sk_uri, amount) -> {name; sk_uri; amount}) (obj3 (req "name" string) - (req "sk_uri" Client_keys.Secret_key.encoding) + (req "sk_uri" Client_keys_v0.Secret_key.encoding) (req "amount" Tez.encoding)) let to_bootstrap_account repr = - Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + Client_keys_v0.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys_v0.public_key pk_uri >>=? fun public_key -> + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. {public_key_hash; public_key = Some public_key; amount = repr.amount} @@ -629,7 +631,7 @@ module Parsed_account = struct let wallet = (cctxt :> Client_context.wallet) in let parsed_account_reprs = ref [] in let errors = ref [] in - Client_keys.list_keys wallet >>=? fun all_keys -> + Client_keys_v0.list_keys wallet >>=? fun all_keys -> List.iter_s (function | name, pkh, _pk_opt, Some sk_uri -> ( @@ -678,8 +680,10 @@ module Bootstrap_account = struct (fun (public_key_hash, public_key, amount) -> {public_key_hash; public_key; amount}) (obj3 - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding)) end @@ -691,7 +695,7 @@ module Bootstrap_contract = struct (fun {delegate; amount; script} -> (delegate, amount, script)) (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -752,10 +756,10 @@ let lib_parameters_json_encoding = (fun (pk, amount) -> { Parameters.public_key = Some pk; - public_key_hash = Tezos_crypto.Signature.Public_key.hash pk; + public_key_hash = Tezos_crypto.Signature.V0.Public_key.hash pk; amount; }) - (tup2 Tezos_crypto.Signature.Public_key.encoding Tez.encoding) + (tup2 Tezos_crypto.Signature.V0.Public_key.encoding Tez.encoding) in Data_encoding.( merge_objs diff --git a/src/proto_011_PtHangz2/lib_client/operation_result.ml b/src/proto_011_PtHangz2/lib_client/operation_result.ml index c741e72d07e5a4dda25e86b0cdbbe9ed1f1a41de..a12e60c070fbf24b1c467472f412bf7985b1f064 100644 --- a/src/proto_011_PtHangz2/lib_client/operation_result.ml +++ b/src/proto_011_PtHangz2/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result @@ -154,11 +154,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -385,7 +385,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -510,7 +510,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate (Format.pp_print_list ~pp_sep:Format.pp_print_space Format.pp_print_int) slots @@ -519,7 +519,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -529,7 +529,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_context_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_context_commands.ml index 3d54d6e767d2c70f06c5ba2e08bafec58a047a38..1d391b6ea0e025d989e4ca257c9002355f964258 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Tezos_micheline open Client_proto_context open Client_proto_contracts open Client_proto_programs -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -160,7 +160,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -185,7 +185,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -598,7 +598,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -622,7 +622,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -679,7 +679,7 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -702,7 +702,7 @@ let commands network () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -727,7 +727,7 @@ let commands network () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -781,7 +781,7 @@ let commands network () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -914,11 +914,11 @@ let commands network () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1093,7 +1093,7 @@ let commands network () = | None -> failwith "Only implicit accounts can register global constants" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1233,7 +1233,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1286,7 +1286,7 @@ let commands network () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1518,7 +1518,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1589,7 +1589,7 @@ let commands network () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal pkh src_pkh) listings) @@ -1597,7 +1597,7 @@ let commands network () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1693,7 +1693,7 @@ let commands network () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_fa12_commands.ml index cd19030b504cfca2b5b73c282464ae3421dccb5b..7730f35813252a631db7079e4aca787117e3b93a 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_fa12_commands.ml @@ -120,14 +120,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_multisig_commands.ml index c8ac0b0e4f5962fbe78df0933a6cd176fa207f2e..016d67a17767faeb2050b0b9ea6fce42436e588d 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_multisig_commands.ml @@ -41,12 +41,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -138,7 +138,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let get_parameter_type (cctxt : #Protocol_client_context.full) ~destination @@ -175,7 +175,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.minimal_fees_arg Client_proto_args.minimal_nanotez_per_byte_arg @@ -230,7 +230,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -242,7 +243,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = } in List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys >>=? fun keys -> Client_proto_multisig.originate_multisig @@ -362,7 +363,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -423,7 +424,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -477,8 +478,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = {amount; destination; entrypoint; parameter_type; parameter}) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -507,8 +509,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Lambda lambda) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -518,7 +521,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -536,8 +539,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -561,8 +565,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -585,7 +590,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -597,8 +602,9 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." @@ -654,7 +660,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -739,7 +746,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -789,7 +797,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -821,7 +829,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -895,7 +904,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -973,9 +983,10 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> let fee_parameter = @@ -1065,7 +1076,8 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_programs_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_programs_commands.ml index fb0ee4a5ce17bac8c7070cb1c2893df4bad427ff..bf097d068e5ee7628265f336684324237942a1dc 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_programs_commands.ml @@ -126,7 +126,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -652,10 +652,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -666,7 +666,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -678,7 +678,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_stresstest_commands.ml index c5b1f3d6eab94ef0ac7b2ded4447ba3d38921132..f3f792dcd88d41ace000de4d80e980826f73964b 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_stresstest_commands.ml @@ -63,7 +63,7 @@ type origin = Explicit | Wallet_pkh | Wallet_alias of string type source = { pkh : public_key_hash; pk : public_key; - sk : Tezos_crypto.Signature.secret_key; + sk : Tezos_crypto.Signature.V0.secret_key; } type input_source = @@ -86,12 +86,12 @@ type state = { current_head_on_start : Tezos_crypto.Block_hash.t; counters : (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.Public_key_hash.Table.t; + Tezos_crypto.Signature.V0.Public_key_hash.Table.t; mutable pool : source_origin list; mutable pool_size : int; (** [Some l] if [single_op_per_pkh_per_block] is true *) mutable shuffled_pool : source list option; - mutable revealed : Tezos_crypto.Signature.Public_key_hash.Set.t; + mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; mutable last_block : Tezos_crypto.Block_hash.t; mutable last_level : int; new_block_condition : unit Lwt_condition.t; @@ -134,9 +134,9 @@ let input_source_encoding = ~title:"explicit" (Tag 0) (obj3 - (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "pk" Tezos_crypto.Signature.Public_key.encoding) - (req "sk" Tezos_crypto.Signature.Secret_key.encoding)) + (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (req "pk" Tezos_crypto.Signature.V0.Public_key.encoding) + (req "sk" Tezos_crypto.Signature.V0.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -148,7 +148,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -199,20 +199,20 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + Tezos_crypto.Signature.V0.Secret_key.of_b58check + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( - Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >>= function - | Error _ -> Lwt.return_none - | Ok sk -> Lwt.return_some sk) + Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function + | Error _ -> None + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = cctxt#warning msg alias >>= fun () -> Lwt.return_none in - (Client_keys.alias_keys cctxt alias >>= function + (Client_keys_v0.alias_keys cctxt alias >>= function | Error _ | Ok None -> warning "Alias \"%s\" not found in the wallet" alias | Ok (Some (_, None, _)) | Ok (Some (_, _, None)) -> warning @@ -235,10 +235,10 @@ let normalize_source cctxt = in let key_from_wallet pkh = let warning msg pkh = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh + cctxt#warning msg Tezos_crypto.Signature.V0.Public_key_hash.pp pkh >>= fun () -> Lwt.return_none in - (Client_keys.get_key cctxt pkh >>= function + (Client_keys_v0.get_key cctxt pkh >>= function | Error _ -> warning "Pkh \"%a\" not found in the wallet" pkh | Ok (alias, pk, sk_uri) -> ( sk_of_sk_uri sk_uri >>= function @@ -246,7 +246,7 @@ let normalize_source cctxt = cctxt#warning "Cannot extract the secret key form the pkh \"%a\" (alias: \ \"%s\") of the wallet" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh alias >>= fun () -> Lwt.return_none @@ -308,7 +308,7 @@ let random_seed rng = let generate_fresh_source pool rng = let seed = random_seed rng in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~seed () in + let pkh, pk, sk = Tezos_crypto.Signature.V0.generate_key ~seed () in let fresh = {source = {pkh; pk; sk}; origin = Explicit} in pool.pool <- fresh :: pool.pool ; pool.pool_size <- pool.pool_size + 1 ; @@ -396,7 +396,7 @@ let rec sample_transfer (cctxt : Protocol_client_context.full) chain block debug_msg (fun () -> cctxt#message "sample_transfer: invalid balance %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src.pkh) >>= fun () -> (* Sampled source has zero balance: the transfer that created that @@ -431,8 +431,8 @@ let inject_contents (cctxt : Protocol_client_context.full) chain branch sk in let signature = Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation + (Tezos_crypto.Signature.V0.sign + ~watermark:Tezos_crypto.Signature.V0.Generic_operation sk bytes) in @@ -489,7 +489,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng (List.map (fun src_org -> src_org.source) state.pool))) ; let freshest_counter = match - Tezos_crypto.Signature.Public_key_hash.Table.find + Tezos_crypto.Signature.V0.Public_key_hash.Table.find state.counters transfer.src.pkh with @@ -509,7 +509,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng pcounter in (if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem transfer.src.pkh state.revealed then return true @@ -518,7 +518,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng revealed, or we immediately inject a reveal operation: in any case the key is revealed in the end. *) state.revealed <- - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add transfer.src.pkh state.revealed ; Alpha_services.Contract.manager_key cctxt (chain, block) transfer.src.pkh @@ -544,23 +544,23 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Cons (reveal, Single manager_op) in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting reveal+transfer from %a (counters=%a,%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print reveal_counter Z.pp_print transf_counter - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.dst else Lwt.return_unit) >>= fun () -> @@ -577,21 +577,21 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Single manager_op in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting transfer from %a (counter=%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print transf_counter - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.dst else Lwt.return_unit) >>= fun () -> @@ -1092,7 +1092,7 @@ let generate_random_transactions = else Lwt.return_unit) >>= fun () -> let counters = - Tezos_crypto.Signature.Public_key_hash.Table.create 1023 + Tezos_crypto.Signature.V0.Public_key_hash.Table.create 1023 in let rng = Random.State.make [|parameters.seed|] in Protocol_client_context.Alpha_block_services.header cctxt () @@ -1111,7 +1111,7 @@ let generate_random_transactions = ~rng (List.map (fun src_org -> src_org.source) sources)) else None); - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.shell.level; new_block_condition = Lwt_condition.create (); diff --git a/src/proto_011_PtHangz2/lib_client_commands/client_proto_utils_commands.ml b/src/proto_011_PtHangz2/lib_client_commands/client_proto_utils_commands.ml index 9cb7b75ca7657a38bf3ed520411b7009619abca1..9a07c6cbe8a7baf55817b86c9fa6a69b1d206fb7 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_commands/client_proto_utils_commands.ml @@ -56,7 +56,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -64,7 +64,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -78,7 +78,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] diff --git a/src/proto_011_PtHangz2/lib_client_sapling/client_sapling_commands.ml b/src/proto_011_PtHangz2/lib_client_sapling/client_sapling_commands.ml index 176cea283c2d4f8dd1172e6f20518eff2b1f2da3..83d70508ebab99a106b3588a926c37d9849e850d 100644 --- a/src/proto_011_PtHangz2/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_011_PtHangz2/lib_client_sapling/client_sapling_commands.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client let json_switch = Tezos_clic.switch ~long:"json" ~doc:"Use JSON format" () @@ -45,7 +45,8 @@ let keys_of_implicit_account cctxt source = match Protocol.Alpha_context.Contract.is_implicit source with | None -> assert false | Some src -> - Client_keys.get_key cctxt src >>=? fun (_, pk, sk) -> return (src, pk, sk) + Client_keys_v0.get_key cctxt src >>=? fun (_, pk, sk) -> + return (src, pk, sk) let viewing_key_of_string s = let exception Unknown_sapling_address in diff --git a/src/proto_011_PtHangz2/lib_client_sapling/context.ml b/src/proto_011_PtHangz2/lib_client_sapling/context.ml index 56d4f76d4921f5e053eb834353c3c84834aa2666..3c0a05ff830dde83cf31452d1fd117af56f55168 100644 --- a/src/proto_011_PtHangz2/lib_client_sapling/context.ml +++ b/src/proto_011_PtHangz2/lib_client_sapling/context.ml @@ -62,7 +62,7 @@ end = struct end module Shielded_tez_contract_input = struct - type t = UTXO.transaction * Tezos_crypto.Signature.public_key_hash option + type t = UTXO.transaction * Tezos_crypto.Signature.V0.public_key_hash option let create ?pkh tr = (tr, pkh) @@ -70,7 +70,7 @@ module Shielded_tez_contract_input = struct let open Data_encoding in obj2 (req "transaction" UTXO.transaction_encoding) - (opt "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) let pp ppf t = let open Data_encoding in @@ -92,7 +92,7 @@ module Shielded_tez_contract_input = struct Micheline.Bytes ( 0, Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding v ) in Micheline.Prim (0, Script.D_Some, [value], []) diff --git a/src/proto_011_PtHangz2/lib_client_sapling/context.mli b/src/proto_011_PtHangz2/lib_client_sapling/context.mli index 1b3fd9c3e0f173f66947a114b453fc397118fc1a..152ff122cd409618a09557a37681699808836e2f 100644 --- a/src/proto_011_PtHangz2/lib_client_sapling/context.mli +++ b/src/proto_011_PtHangz2/lib_client_sapling/context.mli @@ -60,7 +60,7 @@ module Shielded_tez_contract_input : sig type t val create : - ?pkh:Tezos_crypto.Signature.Public_key_hash.t -> UTXO.transaction -> t + ?pkh:Tezos_crypto.Signature.V0.Public_key_hash.t -> UTXO.transaction -> t val encoding : t Data_encoding.t @@ -135,7 +135,7 @@ val shield : *) val unshield : src:Spending_key.t -> - dst:Tezos_crypto.Signature.public_key_hash -> + dst:Tezos_crypto.Signature.V0.public_key_hash -> backdst:Viewing_key.address -> Shielded_tez.t -> Contract_state.t -> diff --git a/src/proto_011_PtHangz2/lib_client_sapling/wallet.ml b/src/proto_011_PtHangz2/lib_client_sapling/wallet.ml index 00eb130e87049c4a83add559d22293783fd354b5..ca45a2863589e5a5fd7b7d88ffba52545762fceb 100644 --- a/src/proto_011_PtHangz2/lib_client_sapling/wallet.ml +++ b/src/proto_011_PtHangz2/lib_client_sapling/wallet.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client module Mnemonic = struct diff --git a/src/proto_011_PtHangz2/lib_parameters/default_parameters.ml b/src/proto_011_PtHangz2/lib_parameters/default_parameters.ml index 39666be7fbeb8941e820f4098c455a4208d8a37e..28abde3796eeefbdc7c1206ae0359dcc1f539146 100644 --- a/src/proto_011_PtHangz2/lib_parameters/default_parameters.ml +++ b/src/proto_011_PtHangz2/lib_parameters/default_parameters.ml @@ -112,8 +112,10 @@ let bootstrap_balance = Tez.of_mutez_exn 4_000_000_000_000L let bootstrap_accounts = List.map (fun s -> - let public_key = Tezos_crypto.Signature.Public_key.of_b58check_exn s in - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key = Tezos_crypto.Signature.V0.Public_key.of_b58check_exn s in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in Parameters. { public_key_hash; diff --git a/src/proto_011_PtHangz2/lib_parameters/default_parameters.mli b/src/proto_011_PtHangz2/lib_parameters/default_parameters.mli index b4b31838cdc26afdc5d156021786a71b56dd1f3c..f12dcc7a49c913e721f7c912fcba4d9f989a3253 100644 --- a/src/proto_011_PtHangz2/lib_parameters/default_parameters.mli +++ b/src/proto_011_PtHangz2/lib_parameters/default_parameters.mli @@ -32,8 +32,8 @@ val constants_sandbox : Constants.parametric val constants_test : Constants.parametric val make_bootstrap_account : - Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key + Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key * Tez.t -> Parameters.bootstrap_account diff --git a/src/proto_011_PtHangz2/lib_plugin/plugin.ml b/src/proto_011_PtHangz2/lib_plugin/plugin.ml index 62761d2383602de024b6a356c4432cc3c4219089..2aff412d886fd50b62a751858fcc6003369db2fb 100644 --- a/src/proto_011_PtHangz2/lib_plugin/plugin.ml +++ b/src/proto_011_PtHangz2/lib_plugin/plugin.ml @@ -908,7 +908,7 @@ module RPC = struct let operation : _ operation = {shell; protocol_data} in let hash = Operation.hash {shell; protocol_data} in let ctxt = Contract.init_origination_nonce ctxt hash in - let baker = Tezos_crypto.Signature.Public_key_hash.zero in + let baker = Tezos_crypto.Signature.V0.Public_key_hash.zero in match protocol_data.contents with | Single (Manager_operation _) as op -> partial_precheck_manager_contents_list ctxt op >>=? fun ctxt -> @@ -1899,7 +1899,7 @@ module RPC = struct module Baking_rights = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; priority : int; timestamp : Timestamp.t option; } @@ -1913,7 +1913,7 @@ module RPC = struct {level; delegate; priority; timestamp}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "priority" uint16) (opt "estimated_time" Timestamp.encoding)) @@ -1925,7 +1925,7 @@ module RPC = struct type baking_rights_query = { levels : Raw_level.t list; cycles : Cycle.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; max_priority : int option; all : bool; } @@ -1973,7 +1973,7 @@ module RPC = struct if Compare.Int.(priority > max_prio) then return (List.rev acc) else let (Misc.LCons (pk, next)) = l in - let delegate = Tezos_crypto.Signature.Public_key.hash pk in + let delegate = Tezos_crypto.Signature.V0.Public_key.hash pk in (match pred_timestamp with | None -> ok_none | Some pred_timestamp -> @@ -2004,7 +2004,7 @@ module RPC = struct match List.partition (fun (pk', _) -> - Tezos_crypto.Signature.Public_key.equal pk pk') + Tezos_crypto.Signature.V0.Public_key.equal pk pk') delegates with | [], _ -> loop l acc (priority + 1) delegates @@ -2031,16 +2031,16 @@ module RPC = struct @@ List.fold_left (fun (acc, previous) r -> if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem r.delegate previous then (acc, previous) else ( r :: acc, - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add r.delegate previous )) - ([], Tezos_crypto.Signature.Public_key_hash.Set.empty) + ([], Tezos_crypto.Signature.V0.Public_key_hash.Set.empty) rights let register () = @@ -2097,7 +2097,7 @@ module RPC = struct module Endorsing_rights = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; slots : int list; estimated_time : Time.t option; } @@ -2111,7 +2111,7 @@ module RPC = struct {level; delegate; slots; estimated_time}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "slots" (list uint16)) (opt "estimated_time" Timestamp.encoding)) @@ -2123,7 +2123,7 @@ module RPC = struct type endorsing_rights_query = { levels : Raw_level.t list; cycles : Cycle.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let endorsing_rights_query = @@ -2178,7 +2178,7 @@ module RPC = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) diff --git a/src/proto_012_Psithaca/lib_client/client_proto_args.ml b/src/proto_012_Psithaca/lib_client/client_proto_args.ml index 869ea564290bdcc39c75110a057fed5aebab6b45..a747f22e8bb3fe9eb0f1042a52d84b9564189cf9 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_args.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_args.ml @@ -184,7 +184,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -492,7 +492,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_012_Psithaca/lib_client/client_proto_args.mli b/src/proto_012_Psithaca/lib_client/client_proto_args.mli index 92467e9a060fd6156f6e239ccc008fde4ceaced3..cae4467fc1dd1e7997ff939d9ac1ff8dfe7d28e7 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_args.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_args.mli @@ -59,7 +59,7 @@ val entrypoint_arg : (string option, full) Tezos_clic.arg val default_entrypoint_arg : (string option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -105,7 +105,8 @@ val global_constant_param : ('a, full) Tezos_clic.params -> (string -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_012_Psithaca/lib_client/client_proto_context.ml b/src/proto_012_Psithaca/lib_client/client_proto_context.ml index cc1f45d722054bb547e4bf72aedd1465c1c1e7dd..3521d905700b3a230a0a8573bd9dc52005d83726 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -264,7 +264,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -515,14 +515,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -563,21 +563,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -591,7 +593,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_012_Psithaca/lib_client/client_proto_context.mli b/src/proto_012_Psithaca/lib_client/client_proto_context.mli index 74a28b56f5e52d6563689e746ca99b3e6795208a..9a7f82db020c06fbe4cf65cf878518c8c7cd348b 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.mli @@ -60,9 +60,9 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -104,7 +104,7 @@ val get_frozen_deposits_limit : #Protocol_client_context.rpc_context -> chain:Shell_services.chain -> block:Shell_services.block -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -125,7 +125,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -141,7 +141,7 @@ val set_deposits_limit : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> Tez.t option -> Kind.set_deposits_limit Kind.manager Injection.result tzresult Lwt.t @@ -154,7 +154,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -182,7 +182,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -212,7 +212,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:string -> ?arg:string -> @@ -243,7 +243,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -334,7 +334,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -346,7 +346,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> diff --git a/src/proto_012_Psithaca/lib_client/client_proto_contracts.ml b/src/proto_012_Psithaca/lib_client/client_proto_contracts.ml index cfd1006bd2a17afee40fdaadcb63f0c3ea603f10..0a96cc79775d71d3ec5dc5919953933bd454d834 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_contracts.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_contracts.ml @@ -46,18 +46,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -68,7 +68,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -89,7 +89,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | ["text"; text] -> ContractEntity.of_source text >|=? fun v -> (s, v) | _ -> ( @@ -104,7 +104,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -142,7 +142,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_012_Psithaca/lib_client/client_proto_fa12.mli b/src/proto_012_Psithaca/lib_client/client_proto_fa12.mli index 8022bd2d79860fbbf872c395160ca8c6fab566c3..dbeba43c7878144a875afdf46fe3fe214762153d 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_fa12.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_fa12.mli @@ -99,7 +99,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -136,7 +136,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml b/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml index b5ffcea2b111471b67fe6152931ba68e7887f954..17bb493cf1d6a67b0a6a4a3b287941b8cc2ad6a8 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml @@ -139,9 +139,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -580,11 +580,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) let mutez ~loc (amount : Tez.t) = int ~loc (Z.of_int64 (Tez.to_mutez amount)) let optimized_key_hash ~loc - (key_hash : Tezos_crypto.Signature.Public_key_hash.t) = + (key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : string) = @@ -595,11 +595,11 @@ let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : string) = Data_encoding.(tup2 Contract.encoding Variable.string) (address, entrypoint)) -let optimized_key ~loc (key : Tezos_crypto.Signature.Public_key.t) = +let optimized_key ~loc (key : Tezos_crypto.Signature.V0.Public_key.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding key) (** * Actions *) @@ -705,7 +705,7 @@ let action_of_expr_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -781,7 +781,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -808,7 +808,7 @@ let action_of_expr_not_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -818,7 +818,7 @@ let action_of_expr_not_generic e = let action_of_expr ~generic = if generic then action_of_expr_generic else action_of_expr_not_generic -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -846,7 +846,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -858,7 +859,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -882,7 +883,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc ~generic action >>=? fun expr -> @@ -1051,7 +1052,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli b/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli index 5a9d0ca664ffc31eb205fe5243fa79bf302eca6b..5b5217eb52e3fe41a331b58d5f88434abbfddce9 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli @@ -83,7 +83,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -109,10 +109,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> @@ -135,10 +135,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_012_Psithaca/lib_client/client_proto_utils.ml b/src/proto_012_Psithaca/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_012_Psithaca/lib_client/client_proto_utils.mli b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_012_Psithaca/lib_client/injection.ml b/src/proto_012_Psithaca/lib_client/injection.ml index 6dd4ac16ee21d7e97caa6c5c28fdecf047750a65..bb6ecffd90e819597d2d8176778600121117ef40 100644 --- a/src/proto_012_Psithaca/lib_client/injection.ml +++ b/src/proto_012_Psithaca/lib_client/injection.ml @@ -201,9 +201,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -227,7 +227,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -253,7 +253,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with (* TODO-TB sign endosrement? *) - | _ -> Tezos_crypto.Signature.Generic_operation + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -261,14 +261,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -625,7 +625,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding diff --git a/src/proto_012_Psithaca/lib_client/injection.mli b/src/proto_012_Psithaca/lib_client/injection.mli index 9c93d9f174fa349bcb81a05a4717b6ae720e5638..c2d4543ad3f17cbb152a3db31eca2d1f13beb47f 100644 --- a/src/proto_012_Psithaca/lib_client/injection.mli +++ b/src/proto_012_Psithaca/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -68,7 +68,7 @@ val inject_operation : ?dry_run:bool -> ?simulation:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> 'kind contents_list -> @@ -94,9 +94,9 @@ val inject_manager_operation : ?verbose_signing:bool -> ?simulation:bool -> ?force:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_012_Psithaca/lib_client/managed_contract.ml b/src/proto_012_Psithaca/lib_client/managed_contract.ml index 99809742245f9fa8ab3fbe1868e32bc77de2d951..2b1dee90be72bac7e7b73962f2abeb61d3f1fff9 100644 --- a/src/proto_012_Psithaca/lib_client/managed_contract.ml +++ b/src/proto_012_Psithaca/lib_client/managed_contract.ml @@ -49,7 +49,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -61,7 +61,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -100,7 +100,7 @@ let build_lambda_for_set_delegate ~delegate = let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = "do" in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -133,7 +133,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -154,7 +154,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -185,7 +185,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_012_Psithaca/lib_client/managed_contract.mli b/src/proto_012_Psithaca/lib_client/managed_contract.mli index bb467b5482e8315151cb9602112cf8b66b09cb99..4d44330fdcac7d32f000bf51cf7fe9600bb344c5 100644 --- a/src/proto_012_Psithaca/lib_client/managed_contract.mli +++ b/src/proto_012_Psithaca/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -97,7 +97,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:string -> diff --git a/src/proto_012_Psithaca/lib_client/mockup.ml b/src/proto_012_Psithaca/lib_client/mockup.ml index b47dd3ded3175a2f11147a5da332031caeea6865..aa36f7fcf0e8506ba6b13c7100100d2cebbbf752 100644 --- a/src/proto_012_Psithaca/lib_client/mockup.ml +++ b/src/proto_012_Psithaca/lib_client/mockup.ml @@ -682,7 +682,7 @@ module Protocol_constants_overrides = struct end module Parsed_account = struct - type t = {name : string; sk_uri : Client_keys.sk_uri; amount : Tez.t} + type t = {name : string; sk_uri : Client_keys_v0.sk_uri; amount : Tez.t} let pp ppf account = let open Format in @@ -702,13 +702,15 @@ module Parsed_account = struct (fun (name, sk_uri, amount) -> {name; sk_uri; amount}) (obj3 (req "name" string) - (req "sk_uri" Client_keys.Secret_key.encoding) + (req "sk_uri" Client_keys_v0.Secret_key.encoding) (req "amount" Tez.encoding)) let to_bootstrap_account repr = - Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + Client_keys_v0.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys_v0.public_key pk_uri >>=? fun public_key -> + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. {public_key_hash; public_key = Some public_key; amount = repr.amount} @@ -719,7 +721,7 @@ module Parsed_account = struct let wallet = (cctxt :> Client_context.wallet) in let parsed_account_reprs = ref [] in let errors = ref [] in - Client_keys.list_keys wallet >>=? fun all_keys -> + Client_keys_v0.list_keys wallet >>=? fun all_keys -> List.iter_s (function | name, pkh, _pk_opt, Some sk_uri -> ( @@ -768,8 +770,10 @@ module Bootstrap_account = struct (fun (public_key_hash, public_key, amount) -> {public_key_hash; public_key; amount}) (obj3 - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding)) end @@ -781,7 +785,7 @@ module Bootstrap_contract = struct (fun {delegate; amount; script} -> (delegate, amount, script)) (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 - (opt "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -842,10 +846,10 @@ let lib_parameters_json_encoding = (fun (pk, amount) -> { Parameters.public_key = Some pk; - public_key_hash = Tezos_crypto.Signature.Public_key.hash pk; + public_key_hash = Tezos_crypto.Signature.V0.Public_key.hash pk; amount; }) - (tup2 Tezos_crypto.Signature.Public_key.encoding Tez.encoding) + (tup2 Tezos_crypto.Signature.V0.Public_key.encoding Tez.encoding) in Data_encoding.( merge_objs @@ -1066,7 +1070,7 @@ let mem_init : ] in let open Protocol.Alpha_context.Block_header in - let _, _, sk = Tezos_crypto.Signature.generate_key () in + let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -1086,7 +1090,7 @@ let mem_init : (shell_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Protocol.Alpha_context.Block_header.( to_watermark (Block_header chain_id)) diff --git a/src/proto_012_Psithaca/lib_client/operation_result.ml b/src/proto_012_Psithaca/lib_client/operation_result.ml index ce6a9664edba790c5b503587bd3c04a394aadd1e..287e33a26296a3b9fedf8748ce07246b68dd19c9 100644 --- a/src/proto_012_Psithaca/lib_client/operation_result.ml +++ b/src/proto_012_Psithaca/lib_client/operation_result.ml @@ -95,7 +95,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -106,7 +106,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -126,7 +126,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result @@ -176,11 +176,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -460,7 +460,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -550,7 +550,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate preendorsement_power | Single_and_result @@ -567,7 +567,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate endorsement_power | Single_and_result @@ -618,7 +618,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -628,7 +628,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_context_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_context_commands.ml index 055f9ec80035c57b445835103c377b82c709890c..2035e0217ef00d014e979e778532584fd66b95a9 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_context_commands.ml @@ -28,7 +28,7 @@ open Protocol open Alpha_context open Client_proto_context open Client_proto_contracts -open Client_keys +open Client_keys_v0 open Client_proto_args let encrypted_switch = @@ -654,7 +654,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -679,7 +679,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -878,7 +878,7 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -902,7 +902,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -959,7 +959,7 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -982,7 +982,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -1007,7 +1007,7 @@ let commands_rw () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -1061,7 +1061,7 @@ let commands_rw () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1194,11 +1194,11 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1373,7 +1373,7 @@ let commands_rw () = | None -> failwith "Only implicit accounts can register global constants" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1513,7 +1513,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1566,7 +1566,7 @@ let commands_rw () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1670,7 +1670,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1745,13 +1745,15 @@ let commands_rw () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal pkh src_pkh) + Tezos_crypto.Signature.V0.Public_key_hash.equal + pkh + src_pkh) listings) then error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1852,7 +1854,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1945,7 +1947,7 @@ let commands_rw () = Contract.pp contract | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain @@ -2009,7 +2011,7 @@ let commands_rw () = Contract.pp contract | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_fa12_commands.ml index b49050a23b18d4713e5a8549fcdbd5463c8323be..043565b65f0d924bcb561ae2700422b034883839 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_fa12_commands.ml @@ -120,14 +120,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands_ro () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_multisig_commands.ml index a607ab4401bdf7a4d94343fec16555769df1bab4..d03ce7e8fb56e73cc4a2e2c6b5c5046cf78db1b2 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_multisig_commands.ml @@ -41,12 +41,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -138,7 +138,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let get_parameter_type (cctxt : #Protocol_client_context.full) ~destination @@ -203,7 +203,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.minimal_fees_arg Client_proto_args.minimal_nanotez_per_byte_arg @@ -258,7 +258,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -270,7 +271,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = } in List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys >>=? fun keys -> Client_proto_multisig.originate_multisig @@ -350,8 +351,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = {amount; destination; entrypoint; parameter_type; parameter}) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -380,8 +382,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Lambda lambda) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -391,7 +394,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -409,8 +412,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -434,8 +438,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -458,7 +463,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -470,8 +475,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." @@ -527,7 +533,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -612,7 +619,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -662,7 +670,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -694,7 +702,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -768,7 +777,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -846,9 +856,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> let fee_parameter = @@ -938,7 +949,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1057,7 +1069,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -1118,7 +1130,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_programs_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_programs_commands.ml index 320a467c8bfc61e4158ba2f9141bdd1a4536da16..aae3b5b23d8e9081f29a3dfcead60bd033928bf5 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_programs_commands.ml @@ -128,7 +128,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -655,10 +655,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -669,7 +669,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -681,7 +681,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_stresstest_commands.ml index b6c1ac6419d5ce2bdc1cbcaa2562111f7dc2b692..5ac220ef57280aad81bf39191fdafc933a07a941 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_stresstest_commands.ml @@ -63,7 +63,7 @@ type origin = Explicit | Wallet_pkh | Wallet_alias of string type source = { pkh : public_key_hash; pk : public_key; - sk : Tezos_crypto.Signature.secret_key; + sk : Tezos_crypto.Signature.V0.secret_key; } type input_source = @@ -86,12 +86,12 @@ type state = { current_head_on_start : Tezos_crypto.Block_hash.t; counters : (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.Public_key_hash.Table.t; + Tezos_crypto.Signature.V0.Public_key_hash.Table.t; mutable pool : source_origin list; mutable pool_size : int; (** [Some l] if [single_op_per_pkh_per_block] is true *) mutable shuffled_pool : source list option; - mutable revealed : Tezos_crypto.Signature.Public_key_hash.Set.t; + mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; mutable last_block : Tezos_crypto.Block_hash.t; mutable last_level : int; new_block_condition : unit Lwt_condition.t; @@ -134,9 +134,9 @@ let input_source_encoding = ~title:"explicit" (Tag 0) (obj3 - (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "pk" Tezos_crypto.Signature.Public_key.encoding) - (req "sk" Tezos_crypto.Signature.Secret_key.encoding)) + (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (req "pk" Tezos_crypto.Signature.V0.Public_key.encoding) + (req "sk" Tezos_crypto.Signature.V0.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -148,7 +148,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -199,20 +199,20 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + Tezos_crypto.Signature.V0.Secret_key.of_b58check + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( - Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >>= function - | Error _ -> Lwt.return_none - | Ok sk -> Lwt.return_some sk) + Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function + | Error _ -> None + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = cctxt#warning msg alias >>= fun () -> Lwt.return_none in - (Client_keys.alias_keys cctxt alias >>= function + (Client_keys_v0.alias_keys cctxt alias >>= function | Error _ | Ok None -> warning "Alias \"%s\" not found in the wallet" alias | Ok (Some (_, None, _)) | Ok (Some (_, _, None)) -> warning @@ -235,10 +235,10 @@ let normalize_source cctxt = in let key_from_wallet pkh = let warning msg pkh = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh + cctxt#warning msg Tezos_crypto.Signature.V0.Public_key_hash.pp pkh >>= fun () -> Lwt.return_none in - (Client_keys.get_key cctxt pkh >>= function + (Client_keys_v0.get_key cctxt pkh >>= function | Error _ -> warning "Pkh \"%a\" not found in the wallet" pkh | Ok (alias, pk, sk_uri) -> ( sk_of_sk_uri sk_uri >>= function @@ -246,7 +246,7 @@ let normalize_source cctxt = cctxt#warning "Cannot extract the secret key form the pkh \"%a\" (alias: \ \"%s\") of the wallet" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh alias >>= fun () -> Lwt.return_none @@ -308,7 +308,7 @@ let random_seed rng = let generate_fresh_source pool rng = let seed = random_seed rng in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~seed () in + let pkh, pk, sk = Tezos_crypto.Signature.V0.generate_key ~seed () in let fresh = {source = {pkh; pk; sk}; origin = Explicit} in pool.pool <- fresh :: pool.pool ; pool.pool_size <- pool.pool_size + 1 ; @@ -396,7 +396,7 @@ let rec sample_transfer (cctxt : Protocol_client_context.full) chain block debug_msg (fun () -> cctxt#message "sample_transfer: invalid balance %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src.pkh) >>= fun () -> (* Sampled source has zero balance: the transfer that created that @@ -431,8 +431,8 @@ let inject_contents (cctxt : Protocol_client_context.full) chain branch sk in let signature = Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation + (Tezos_crypto.Signature.V0.sign + ~watermark:Tezos_crypto.Signature.V0.Generic_operation sk bytes) in @@ -489,7 +489,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng (List.map (fun src_org -> src_org.source) state.pool))) ; let freshest_counter = match - Tezos_crypto.Signature.Public_key_hash.Table.find + Tezos_crypto.Signature.V0.Public_key_hash.Table.find state.counters transfer.src.pkh with @@ -509,7 +509,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng pcounter in (if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem transfer.src.pkh state.revealed then return true @@ -518,7 +518,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng revealed, or we immediately inject a reveal operation: in any case the key is revealed in the end. *) state.revealed <- - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add transfer.src.pkh state.revealed ; Alpha_services.Contract.manager_key cctxt (chain, block) transfer.src.pkh @@ -544,23 +544,23 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Cons (reveal, Single manager_op) in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting reveal+transfer from %a (counters=%a,%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print reveal_counter Z.pp_print transf_counter - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.dst else Lwt.return_unit) >>= fun () -> @@ -577,21 +577,21 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Single manager_op in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting transfer from %a (counter=%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print transf_counter - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.dst else Lwt.return_unit) >>= fun () -> @@ -1086,7 +1086,7 @@ let generate_random_transactions = | sources -> List.filter_map_p (normalize_source cctxt) sources >>= fun sources -> let counters = - Tezos_crypto.Signature.Public_key_hash.Table.create 1023 + Tezos_crypto.Signature.V0.Public_key_hash.Table.create 1023 in let rng = Random.State.make [|parameters.seed|] in Protocol_client_context.Alpha_block_services.header cctxt () @@ -1105,7 +1105,7 @@ let generate_random_transactions = ~rng (List.map (fun src_org -> src_org.source) sources)) else None); - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.shell.level; new_block_condition = Lwt_condition.create (); diff --git a/src/proto_012_Psithaca/lib_client_commands/client_proto_utils_commands.ml b/src/proto_012_Psithaca/lib_client_commands/client_proto_utils_commands.ml index cd8c924cfff6b697a2a3ffc115ead8c973084188..d4a22b0e8ea96336511e65777c1bb2054d49e02e 100644 --- a/src/proto_012_Psithaca/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_012_Psithaca/lib_client_commands/client_proto_utils_commands.ml @@ -80,7 +80,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -88,7 +88,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -102,7 +102,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] @@ -134,7 +134,7 @@ let commands () = no_options (prefixes ["sign"; "block"] @@ unsigned_block_header_param @@ prefixes ["for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"signing delegate" @@ stop) @@ -149,8 +149,8 @@ let commands () = in Shell_services.Chain.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> - Client_keys.get_key cctxt delegate >>=? fun (_, _, sk) -> - Client_keys.sign + Client_keys_v0.get_key cctxt delegate >>=? fun (_, _, sk) -> + Client_keys_v0.sign cctxt ~watermark: (Protocol.Alpha_context.Block_header.to_watermark @@ -158,5 +158,6 @@ let commands () = sk unsigned_header >>=? fun s -> - cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.to_hex s) >>= return); + cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.V0.to_hex s) + >>= return); ] diff --git a/src/proto_012_Psithaca/lib_client_sapling/client_sapling_commands.ml b/src/proto_012_Psithaca/lib_client_sapling/client_sapling_commands.ml index 176cea283c2d4f8dd1172e6f20518eff2b1f2da3..83d70508ebab99a106b3588a926c37d9849e850d 100644 --- a/src/proto_012_Psithaca/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_012_Psithaca/lib_client_sapling/client_sapling_commands.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client let json_switch = Tezos_clic.switch ~long:"json" ~doc:"Use JSON format" () @@ -45,7 +45,8 @@ let keys_of_implicit_account cctxt source = match Protocol.Alpha_context.Contract.is_implicit source with | None -> assert false | Some src -> - Client_keys.get_key cctxt src >>=? fun (_, pk, sk) -> return (src, pk, sk) + Client_keys_v0.get_key cctxt src >>=? fun (_, pk, sk) -> + return (src, pk, sk) let viewing_key_of_string s = let exception Unknown_sapling_address in diff --git a/src/proto_012_Psithaca/lib_client_sapling/context.ml b/src/proto_012_Psithaca/lib_client_sapling/context.ml index 56d4f76d4921f5e053eb834353c3c84834aa2666..3c0a05ff830dde83cf31452d1fd117af56f55168 100644 --- a/src/proto_012_Psithaca/lib_client_sapling/context.ml +++ b/src/proto_012_Psithaca/lib_client_sapling/context.ml @@ -62,7 +62,7 @@ end = struct end module Shielded_tez_contract_input = struct - type t = UTXO.transaction * Tezos_crypto.Signature.public_key_hash option + type t = UTXO.transaction * Tezos_crypto.Signature.V0.public_key_hash option let create ?pkh tr = (tr, pkh) @@ -70,7 +70,7 @@ module Shielded_tez_contract_input = struct let open Data_encoding in obj2 (req "transaction" UTXO.transaction_encoding) - (opt "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) let pp ppf t = let open Data_encoding in @@ -92,7 +92,7 @@ module Shielded_tez_contract_input = struct Micheline.Bytes ( 0, Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding v ) in Micheline.Prim (0, Script.D_Some, [value], []) diff --git a/src/proto_012_Psithaca/lib_client_sapling/context.mli b/src/proto_012_Psithaca/lib_client_sapling/context.mli index 1b3fd9c3e0f173f66947a114b453fc397118fc1a..152ff122cd409618a09557a37681699808836e2f 100644 --- a/src/proto_012_Psithaca/lib_client_sapling/context.mli +++ b/src/proto_012_Psithaca/lib_client_sapling/context.mli @@ -60,7 +60,7 @@ module Shielded_tez_contract_input : sig type t val create : - ?pkh:Tezos_crypto.Signature.Public_key_hash.t -> UTXO.transaction -> t + ?pkh:Tezos_crypto.Signature.V0.Public_key_hash.t -> UTXO.transaction -> t val encoding : t Data_encoding.t @@ -135,7 +135,7 @@ val shield : *) val unshield : src:Spending_key.t -> - dst:Tezos_crypto.Signature.public_key_hash -> + dst:Tezos_crypto.Signature.V0.public_key_hash -> backdst:Viewing_key.address -> Shielded_tez.t -> Contract_state.t -> diff --git a/src/proto_012_Psithaca/lib_client_sapling/wallet.ml b/src/proto_012_Psithaca/lib_client_sapling/wallet.ml index 412619eec4b8cfb9bd22a1191f072032df0ef528..74be47fede07eea4facb50d4703ade957b01f650 100644 --- a/src/proto_012_Psithaca/lib_client_sapling/wallet.ml +++ b/src/proto_012_Psithaca/lib_client_sapling/wallet.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client module Mnemonic = struct diff --git a/src/proto_012_Psithaca/lib_delegate/delegate_events.ml b/src/proto_012_Psithaca/lib_delegate/delegate_events.ml index 80aaebac4174bec021981aecf8af176b6be46771..011f0e04eee13448263e2e76c463ae77bdbbd2b4 100644 --- a/src/proto_012_Psithaca/lib_delegate/delegate_events.ml +++ b/src/proto_012_Psithaca/lib_delegate/delegate_events.ml @@ -498,7 +498,7 @@ module Baking_forge = struct ("fitness", Fitness.encoding) ("client", Data_encoding.string) ("predecessor", Tezos_crypto.Block_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let injected_block = declare_7 @@ -550,7 +550,7 @@ module Baking_forge = struct ("timestamp", Time.System.encoding) ("client", Data_encoding.string) ("predecessor", Tezos_crypto.Block_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let read_nonce_fail = declare_1 @@ -693,7 +693,7 @@ module Endorsement = struct ("level", Alpha_context.Raw_level.encoding) ("client", Data_encoding.string) ("op_hash", Tezos_crypto.Operation_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let endorsing = declare_3 @@ -782,6 +782,6 @@ module Endorsement = struct ~name:"error_while_endorsing" ~msg:"error while injecting endorsement for baker {baker}: {errors}" ~pp2:pp_print_top_error_of_trace - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end diff --git a/src/proto_012_Psithaca/lib_parameters/default_parameters.ml b/src/proto_012_Psithaca/lib_parameters/default_parameters.ml index 4b3e6185bf504077909b9df8caadf9ae9e521692..ef1f9e4787ee61d21425d793ad8162bd1679d72d 100644 --- a/src/proto_012_Psithaca/lib_parameters/default_parameters.ml +++ b/src/proto_012_Psithaca/lib_parameters/default_parameters.ml @@ -194,8 +194,10 @@ let bootstrap_balance = Tez.of_mutez_exn 4_000_000_000_000L let compute_accounts = List.map (fun s -> - let public_key = Tezos_crypto.Signature.Public_key.of_b58check_exn s in - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key = Tezos_crypto.Signature.V0.Public_key.of_b58check_exn s in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in Parameters. { public_key_hash; diff --git a/src/proto_012_Psithaca/lib_parameters/default_parameters.mli b/src/proto_012_Psithaca/lib_parameters/default_parameters.mli index 3bc1b8edff7024783a0f8db1508c5d0aac1d4644..d4cd8df549216faf6882e632f529037664ede7df 100644 --- a/src/proto_012_Psithaca/lib_parameters/default_parameters.mli +++ b/src/proto_012_Psithaca/lib_parameters/default_parameters.mli @@ -35,8 +35,8 @@ val constants_test : Constants.parametric val test_commitments : Commitment.t list lazy_t val make_bootstrap_account : - Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key + Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key * Tez.t -> Parameters.bootstrap_account diff --git a/src/proto_012_Psithaca/lib_plugin/plugin.ml b/src/proto_012_Psithaca/lib_plugin/plugin.ml index ee6833a317dacc97e5c3c4f285a33ef5758ccb82..486e104b4fe32e2da63323eedca2f069efbb3d01 100644 --- a/src/proto_012_Psithaca/lib_plugin/plugin.ml +++ b/src/proto_012_Psithaca/lib_plugin/plugin.ml @@ -77,7 +77,9 @@ let () = "If the balance is empty after precheck, the operation is invalid." Data_encoding.( obj1 - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding)) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Balance_is_empty {source} -> Some source | _ -> None) (fun source -> Balance_is_empty {source}) @@ -265,14 +267,15 @@ module Mempool = struct grandparent_level_start : Alpha_context.Timestamp.t option; round_zero_duration : Period.t option; op_prechecked_managers : - manager_op_info Tezos_crypto.Signature.Public_key_hash.Map.t; + manager_op_info Tezos_crypto.Signature.V0.Public_key_hash.Map.t; (** All managers that are the source of manager operations prechecked in the mempool. Each manager in the map is associated to a record of type [manager_op_info] (See for record details above). Each manager in the map should be accessible with an operation hash in [operation_hash_to_manager]. *) operation_hash_to_manager : - Tezos_crypto.Signature.Public_key_hash.t Tezos_crypto.Operation_hash.Map.t; + Tezos_crypto.Signature.V0.Public_key_hash.t + Tezos_crypto.Operation_hash.Map.t; (** Map of operation hash to manager used to remove a manager from [op_prechecked_managers] with an operation hash. Each manager in the map should also be in [op_prechecked_managers]. *) @@ -294,7 +297,8 @@ module Mempool = struct { grandparent_level_start = None; round_zero_duration = None; - op_prechecked_managers = Tezos_crypto.Signature.Public_key_hash.Map.empty; + op_prechecked_managers = + Tezos_crypto.Signature.V0.Public_key_hash.Map.empty; operation_hash_to_manager = Tezos_crypto.Operation_hash.Map.empty; prechecked_operations_count = 0; ops_prechecked = ManagerOpWeightSet.empty; @@ -374,7 +378,7 @@ module Mempool = struct in let removed_op = ref None in let op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.update + Tezos_crypto.Signature.V0.Public_key_hash.Map.update source (function | None -> None @@ -561,7 +565,7 @@ module Mempool = struct let check_manager_restriction config filter_state source ~fee ~gas_limit = match - Tezos_crypto.Signature.Public_key_hash.Map.find + Tezos_crypto.Signature.V0.Public_key_hash.Map.find source filter_state.op_prechecked_managers with @@ -1161,7 +1165,7 @@ module Mempool = struct filter_state with op_prechecked_managers = (* Manager not seen yet, record it for next ops *) - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add source info filter_state.op_prechecked_managers; @@ -2130,7 +2134,7 @@ module RPC = struct let operation : _ operation = {shell; protocol_data} in let hash = Operation.hash {shell; protocol_data} in let ctxt = Contract.init_origination_nonce ctxt hash in - let payload_producer = Tezos_crypto.Signature.Public_key_hash.zero in + let payload_producer = Tezos_crypto.Signature.V0.Public_key_hash.zero in match protocol_data.contents with | Single (Manager_operation _) as op -> Apply.precheck_manager_contents_list ctxt op ~mempool_mode:true @@ -3287,7 +3291,7 @@ module RPC = struct module Baking_rights = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; round : int; timestamp : Timestamp.t option; } @@ -3301,7 +3305,7 @@ module RPC = struct {level; delegate; round; timestamp}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "round" uint16) (opt "estimated_time" Timestamp.encoding)) @@ -3315,7 +3319,7 @@ module RPC = struct type baking_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; max_round : int option; all : bool; } @@ -3370,7 +3374,7 @@ module RPC = struct if Compare.Int.(round > max_round) then return (List.rev acc) else let (Misc.LCons (pk, next)) = l in - let delegate = Tezos_crypto.Signature.Public_key.hash pk in + let delegate = Tezos_crypto.Signature.V0.Public_key.hash pk in estimated_time round_durations ~current_level @@ -3389,16 +3393,16 @@ module RPC = struct @@ List.fold_left (fun (acc, previous) r -> if - Tezos_crypto.Signature.Public_key_hash.Set.exists - (Tezos_crypto.Signature.Public_key_hash.equal r.delegate) + Tezos_crypto.Signature.V0.Public_key_hash.Set.exists + (Tezos_crypto.Signature.V0.Public_key_hash.equal r.delegate) previous then (acc, previous) else ( r :: acc, - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add r.delegate previous )) - ([], Tezos_crypto.Signature.Public_key_hash.Set.empty) + ([], Tezos_crypto.Signature.V0.Public_key_hash.Set.empty) rights let register () = @@ -3432,7 +3436,7 @@ module RPC = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) @@ -3449,7 +3453,7 @@ module RPC = struct module Endorsing_rights = struct type delegate_rights = { - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; first_slot : Slot.t; endorsing_power : int; } @@ -3468,7 +3472,7 @@ module RPC = struct (fun (delegate, first_slot, endorsing_power) -> {delegate; first_slot; endorsing_power}) (obj3 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "first_slot" Slot.encoding) (req "endorsing_power" uint16)) @@ -3492,7 +3496,7 @@ module RPC = struct type endorsing_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let endorsing_rights_query = @@ -3570,7 +3574,8 @@ module RPC = struct (fun rights_at_level -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal + p.delegate) delegates in match @@ -3593,7 +3598,7 @@ module RPC = struct module Validators = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; slots : Slot.t list; } @@ -3604,7 +3609,7 @@ module RPC = struct (fun (level, delegate, slots) -> {level; delegate; slots}) (obj3 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "slots" (list Slot.encoding))) module S = struct @@ -3614,7 +3619,7 @@ module RPC = struct type validators_query = { levels : Raw_level.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let validators_query = @@ -3664,7 +3669,7 @@ module RPC = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) diff --git a/src/proto_013_PtJakart/lib_client/client_proto_args.ml b/src/proto_013_PtJakart/lib_client/client_proto_args.ml index eeb6e2cc739ed34cb0b4eeba0a2fa33249b01299..cde3d18f0432f9ac2852d23c1d00d7565e211b52 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_args.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_args.ml @@ -205,7 +205,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -548,7 +548,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_013_PtJakart/lib_client/client_proto_args.mli b/src/proto_013_PtJakart/lib_client/client_proto_args.mli index 463d9f2a4f413cf7514a8e016b3e25e7b57738cc..8834918aa8ec5f942eaa44241061ebfdf6f4ae57 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_args.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_args.mli @@ -63,7 +63,7 @@ val entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val default_entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -124,7 +124,8 @@ val global_constant_param : ('a, full) Tezos_clic.params -> (string -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_013_PtJakart/lib_client/client_proto_context.ml b/src/proto_013_PtJakart/lib_client/client_proto_context.ml index 8efd4e7e46bf55a14c3ca716b5c49d281c7cf615..3f8c2eb0741dc9fbc96784be106a2451dfd68f43 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -300,7 +300,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -562,14 +562,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -610,21 +610,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -638,7 +640,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_013_PtJakart/lib_client/client_proto_context.mli b/src/proto_013_PtJakart/lib_client/client_proto_context.mli index fe22473d14d1a755297f82a4c0b68365898d9916..5f86e0f29fd073546dd761609a6a3674de4daf02 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.mli @@ -60,9 +60,9 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -105,7 +105,7 @@ val get_frozen_deposits_limit : #Protocol_client_context.rpc_context -> chain:Shell_services.chain -> block:Shell_services.block -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -126,7 +126,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -142,7 +142,7 @@ val set_deposits_limit : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> Tez.t option -> Kind.set_deposits_limit Kind.manager Injection.result tzresult Lwt.t @@ -155,7 +155,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -183,7 +183,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -217,7 +217,7 @@ val transfer_with_script : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Destination.t -> ?entrypoint:Entrypoint.t -> parameters:Script.lazy_expr -> @@ -245,7 +245,7 @@ val transfer : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Destination.t -> ?entrypoint:Entrypoint.t -> ?arg:string -> @@ -277,7 +277,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -368,7 +368,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -380,7 +380,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> @@ -432,9 +432,9 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -456,9 +456,9 @@ val submit_tx_rollup_batch : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -481,9 +481,9 @@ val submit_tx_rollup_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> inbox_merkle_root:Tx_rollup_inbox.Merkle.root -> @@ -509,9 +509,9 @@ val submit_tx_rollup_finalize_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -534,9 +534,9 @@ val submit_tx_rollup_remove_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -558,9 +558,9 @@ val submit_tx_rollup_rejection : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -592,9 +592,9 @@ val submit_tx_rollup_return_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -616,9 +616,9 @@ val tx_rollup_dispatch_tickets : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -645,9 +645,9 @@ val transfer_ticket : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> ty:string -> @@ -678,7 +678,7 @@ val sc_rollup_originate : kind:Sc_rollup.Kind.t -> boot_sector:string -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> ( Tezos_crypto.Operation_hash.t @@ -704,7 +704,7 @@ val sc_rollup_add_messages : rollup:Alpha_context.Sc_rollup.t -> messages:string list -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -729,7 +729,7 @@ val sc_rollup_cement : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment_hash.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -754,7 +754,7 @@ val sc_rollup_publish : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t diff --git a/src/proto_013_PtJakart/lib_client/client_proto_contracts.ml b/src/proto_013_PtJakart/lib_client/client_proto_contracts.ml index cfd1006bd2a17afee40fdaadcb63f0c3ea603f10..0a96cc79775d71d3ec5dc5919953933bd454d834 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_contracts.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_contracts.ml @@ -46,18 +46,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return (s, v) | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (s, Contract.implicit_contract v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (name, Contract.implicit_contract v) let rev_find cctxt c = match Contract.is_implicit c with | Some hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | None -> RawContractAlias.rev_find cctxt c @@ -68,7 +68,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -89,7 +89,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (s, Contract.implicit_contract v) | ["text"; text] -> ContractEntity.of_source text >|=? fun v -> (s, v) | _ -> ( @@ -104,7 +104,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -142,7 +142,7 @@ let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> List.map_s (fun (n, v) -> Lwt.return ("", n, v)) raw_contracts >>= fun contracts -> - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_013_PtJakart/lib_client/client_proto_fa12.mli b/src/proto_013_PtJakart/lib_client/client_proto_fa12.mli index 8022bd2d79860fbbf872c395160ca8c6fab566c3..dbeba43c7878144a875afdf46fe3fe214762153d 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_fa12.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_fa12.mli @@ -99,7 +99,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> action:action -> tez_amount:Tez.t -> @@ -136,7 +136,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml b/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml index f6db6b82d6dc46a932c9d414975363c5c43c39f6..268dabfc214b26c4e654c4cff828ede2d55d45c1 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml @@ -139,9 +139,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -583,11 +583,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) let mutez ~loc (amount : Tez.t) = int ~loc (Z.of_int64 (Tez.to_mutez amount)) let optimized_key_hash ~loc - (key_hash : Tezos_crypto.Signature.Public_key_hash.t) = + (key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) @@ -598,11 +598,11 @@ let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) Data_encoding.(tup2 Contract.encoding Entrypoint.value_encoding) (address, entrypoint)) -let optimized_key ~loc (key : Tezos_crypto.Signature.Public_key.t) = +let optimized_key ~loc (key : Tezos_crypto.Signature.V0.Public_key.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding key) (** * Actions *) @@ -708,7 +708,7 @@ let action_of_expr_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -784,7 +784,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -811,7 +811,7 @@ let action_of_expr_not_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -821,7 +821,7 @@ let action_of_expr_not_generic e = let action_of_expr ~generic = if generic then action_of_expr_generic else action_of_expr_not_generic -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -849,7 +849,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -861,7 +862,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -885,7 +886,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc ~generic action >>=? fun expr -> @@ -1053,7 +1054,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli b/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli index 609d0c37e66f94c6fb16605760064254676b4d3a..cc27aae9630fe3ecb17a09092873ff09088fa09e 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli @@ -83,7 +83,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -109,10 +109,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> @@ -135,10 +135,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_013_PtJakart/lib_client/client_proto_utils.ml b/src/proto_013_PtJakart/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_013_PtJakart/lib_client/client_proto_utils.mli b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_013_PtJakart/lib_client/injection.ml b/src/proto_013_PtJakart/lib_client/injection.ml index 42f0090655d73b53197f9d475e54dcbc92b0712c..ae3b812b3e49fa8341e246fa00f122354b53b388 100644 --- a/src/proto_013_PtJakart/lib_client/injection.ml +++ b/src/proto_013_PtJakart/lib_client/injection.ml @@ -200,9 +200,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -226,7 +226,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -252,7 +252,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with (* TODO-TB sign endosrement? *) - | _ -> Tezos_crypto.Signature.Generic_operation + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -260,14 +260,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -706,7 +706,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding @@ -1129,10 +1129,12 @@ let pending_applied_operations_of_source (cctxt : #full) chain src : (fun acc (_oph, {protocol_data = Operation_data {contents; _}; _}) -> match contents with | Single (Manager_operation {source; _} as _op) - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | Cons (Manager_operation {source; _}, _rest) as _op - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | _ -> acc) [] @@ -1255,14 +1257,14 @@ let replace_operation (type kind) (cctxt : #full) chain source cctxt#error "Cannot replace! No applied manager operation found for %a in \ mempool@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source >>= fun () -> exit 1 | _ :: _ :: _ as l -> cctxt#error "More than one applied manager operation found for %a in mempool. \ Found %d operations. Are you sure the node is in precheck mode?@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source (List.length l) >>= fun () -> exit 1 diff --git a/src/proto_013_PtJakart/lib_client/injection.mli b/src/proto_013_PtJakart/lib_client/injection.mli index 15ce22884d6d9ef0c454577801519ec7b57cba9b..0aee0eef507f8131654297e679ce06bb968a29a3 100644 --- a/src/proto_013_PtJakart/lib_client/injection.mli +++ b/src/proto_013_PtJakart/lib_client/injection.mli @@ -48,7 +48,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -81,7 +81,7 @@ val inject_operation : ?simulation:bool -> ?successor_level:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> fee_parameter:fee_parameter -> 'kind contents_list -> @@ -108,9 +108,9 @@ val inject_manager_operation : ?verbose_signing:bool -> ?simulation:bool -> ?force:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_013_PtJakart/lib_client/managed_contract.ml b/src/proto_013_PtJakart/lib_client/managed_contract.ml index 22a34731523686b518e1864a93f67666de9b50db..5d3b881d454f95bbf8e63f64f008391335107e97 100644 --- a/src/proto_013_PtJakart/lib_client/managed_contract.ml +++ b/src/proto_013_PtJakart/lib_client/managed_contract.ml @@ -49,7 +49,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -61,7 +61,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -106,7 +106,7 @@ let entrypoint_remove_delegate = Entrypoint.remove_delegate let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = entrypoint_do in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -141,7 +141,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -162,7 +162,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -193,7 +193,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_013_PtJakart/lib_client/managed_contract.mli b/src/proto_013_PtJakart/lib_client/managed_contract.mli index cc40c9caa8ff51cc5d88f9a6da31fa6854e6cdb2..c6c1af587ef76764821a66331eb686be382dbe65 100644 --- a/src/proto_013_PtJakart/lib_client/managed_contract.mli +++ b/src/proto_013_PtJakart/lib_client/managed_contract.mli @@ -59,7 +59,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -97,7 +97,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> diff --git a/src/proto_013_PtJakart/lib_client/mockup.ml b/src/proto_013_PtJakart/lib_client/mockup.ml index ead4324731ddb8b429595115eb77ec0a61b7481c..fc7086309623ee99db24606fb59b372652fb2a61 100644 --- a/src/proto_013_PtJakart/lib_client/mockup.ml +++ b/src/proto_013_PtJakart/lib_client/mockup.ml @@ -1007,7 +1007,7 @@ module Protocol_constants_overrides = struct end module Parsed_account = struct - type t = {name : string; sk_uri : Client_keys.sk_uri; amount : Tez.t} + type t = {name : string; sk_uri : Client_keys_v0.sk_uri; amount : Tez.t} let pp ppf account = let open Format in @@ -1027,13 +1027,15 @@ module Parsed_account = struct (fun (name, sk_uri, amount) -> {name; sk_uri; amount}) (obj3 (req "name" string) - (req "sk_uri" Client_keys.Secret_key.encoding) + (req "sk_uri" Client_keys_v0.Secret_key.encoding) (req "amount" Tez.encoding)) let to_bootstrap_account repr = - Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + Client_keys_v0.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys_v0.public_key pk_uri >>=? fun public_key -> + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. {public_key_hash; public_key = Some public_key; amount = repr.amount} @@ -1044,7 +1046,7 @@ module Parsed_account = struct let wallet = (cctxt :> Client_context.wallet) in let parsed_account_reprs = ref [] in let errors = ref [] in - Client_keys.list_keys wallet >>=? fun all_keys -> + Client_keys_v0.list_keys wallet >>=? fun all_keys -> List.iter_s (function | name, pkh, _pk_opt, Some sk_uri -> ( @@ -1093,8 +1095,10 @@ module Bootstrap_account = struct (fun (public_key_hash, public_key, amount) -> {public_key_hash; public_key; amount}) (obj3 - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding)) end @@ -1106,7 +1110,7 @@ module Bootstrap_contract = struct (fun {delegate; amount; script} -> (delegate, amount, script)) (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 - (opt "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -1167,10 +1171,10 @@ let lib_parameters_json_encoding = (fun (pk, amount) -> { Parameters.public_key = Some pk; - public_key_hash = Tezos_crypto.Signature.Public_key.hash pk; + public_key_hash = Tezos_crypto.Signature.V0.Public_key.hash pk; amount; }) - (tup2 Tezos_crypto.Signature.Public_key.encoding Tez.encoding) + (tup2 Tezos_crypto.Signature.V0.Public_key.encoding Tez.encoding) in Data_encoding.( merge_objs @@ -1391,7 +1395,7 @@ let mem_init : ] in let open Protocol.Alpha_context.Block_header in - let _, _, sk = Tezos_crypto.Signature.generate_key () in + let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -1411,7 +1415,7 @@ let mem_init : (shell_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Protocol.Alpha_context.Block_header.( to_watermark (Block_header chain_id)) diff --git a/src/proto_013_PtJakart/lib_client/operation_result.ml b/src/proto_013_PtJakart/lib_client/operation_result.ml index 79c3e8ddd4e6cfc42df6e4d955a500fee5348043..1f9e41f109037c771e429f52e1bdce81c22c2b91 100644 --- a/src/proto_013_PtJakart/lib_client/operation_result.ml +++ b/src/proto_013_PtJakart/lib_client/operation_result.ml @@ -93,7 +93,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) ; pp_result ppf result ; Format.fprintf ppf "@]" @@ -104,7 +104,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal revelation" else "Revelation") Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key pp_result result @@ -124,7 +124,7 @@ let pp_manager_operation_content (type kind) source internal pp_result ppf (if internal then "Internal Delegation" else "Delegation") Contract.pp source - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate pp_result result @@ -324,11 +324,11 @@ let pp_balance_updates ppf = function key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -889,7 +889,7 @@ let pp_manager_operation_contents_and_result ppf Expected counter: %s@,\ Gas limit: %a@,\ Storage limit: %s bytes" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -976,7 +976,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate preendorsement_power | Single_and_result @@ -993,7 +993,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate endorsement_power | Single_and_result @@ -1044,7 +1044,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -1054,7 +1054,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_context_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_context_commands.ml index eb61382be7acebd957ddd6dbc925393124f23e25..029cc38069d7a428020ba01c43bf38c13028b4d7 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Alpha_context open Client_proto_context open Client_proto_contracts open Client_proto_rollups -open Client_keys +open Client_keys_v0 open Client_proto_args let save_tx_rollup ~force (cctxt : #Client_context.full) alias_name rollup @@ -751,7 +751,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) | None -> let contract = source in Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -776,7 +776,7 @@ let transfer_command amount source destination (cctxt : #Client_context.printer) ?counter () | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let destination : Alpha_context.Destination.t = Contract destination in transfer cctxt @@ -978,7 +978,7 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -1002,7 +1002,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -1059,7 +1059,7 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -1082,7 +1082,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -1107,7 +1107,7 @@ let commands_rw () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag minimal_fees_arg @@ -1161,7 +1161,7 @@ let commands_rw () = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1314,11 +1314,11 @@ let commands_rw () = | None -> Managed_contract.get_contract_manager cctxt source >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1501,7 +1501,7 @@ let commands_rw () = | None -> failwith "Only implicit accounts can register global constants" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1647,7 +1647,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can be revealed" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1700,7 +1700,7 @@ let commands_rw () = burn_cap ) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1804,7 +1804,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit proposals" | Some src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1879,13 +1879,15 @@ let commands_rw () = not (List.exists (fun (pkh, _) -> - Tezos_crypto.Signature.Public_key_hash.equal pkh src_pkh) + Tezos_crypto.Signature.V0.Public_key_hash.equal + pkh + src_pkh) listings) then error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1986,7 +1988,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "only implicit accounts can submit ballot" | Some src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -2079,7 +2081,7 @@ let commands_rw () = Contract.pp contract | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain @@ -2143,7 +2145,7 @@ let commands_rw () = Contract.pp contract | Some mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain @@ -2205,7 +2207,7 @@ let commands_rw () = | None -> failwith "Only implicit accounts can originate transaction rollups" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2308,7 +2310,7 @@ let commands_rw () = failwith "Only implicit accounts can submit transaction rollup batches" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2403,7 +2405,7 @@ let commands_rw () = failwith "Only implicit accounts can submit transaction rollup commitments" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2478,7 +2480,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "Only implicit accounts can finalize commitments" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2548,7 +2550,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "Only implicit accounts can deposit/recover bonds" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2619,7 +2621,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "Only implicit accounts can remove commitments." | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2747,7 +2749,7 @@ let commands_rw () = "Only implicit accounts can reject transaction rollup \ commitments." | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2865,7 +2867,7 @@ let commands_rw () = "Only implicit account can dispatch tickets for a transaction \ rollup." | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -2968,7 +2970,7 @@ let commands_rw () = match Contract.is_implicit source with | None -> failwith "Only implicit accounts can transfer tickets." | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -3054,7 +3056,7 @@ let commands_rw () = failwith "Only implicit accounts can originate smart-contract rollups" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -3149,7 +3151,7 @@ let commands_rw () = "Could not read list of messages (expected list of bytes)" | messages -> return (List.map Bytes.to_string messages))) >>=? fun messages -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_fa12_commands.ml index b49050a23b18d4713e5a8549fcdbd5463c8323be..043565b65f0d924bcb561ae2700422b034883839 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_fa12_commands.ml @@ -120,14 +120,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.implicit_contract Tezos_crypto.Signature.Public_key_hash.zero + Contract.implicit_contract Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt caller = match Contract.is_implicit caller with | None -> failwith "only implicit accounts can be the source of a contract call" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands_ro () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_multisig_commands.ml index ac73d803e088191fd725c43c008f01fcd2b81c7a..b7426789cdb7eb23f5925b3ff37287c968d9b9af 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_multisig_commands.ml @@ -41,12 +41,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -138,7 +138,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let get_parameter_type (cctxt : #Protocol_client_context.full) ~destination @@ -205,7 +205,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.minimal_fees_arg Client_proto_args.minimal_nanotez_per_byte_arg @@ -260,7 +260,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -272,7 +273,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = } in List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys >>=? fun keys -> Client_proto_multisig.originate_multisig @@ -354,8 +355,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = {amount; destination; entrypoint; parameter_type; parameter}) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -384,8 +386,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Lambda lambda) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -395,7 +398,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -413,8 +416,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -438,8 +442,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -462,7 +467,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -474,8 +479,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." @@ -533,7 +539,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -618,7 +625,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -668,7 +676,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -700,7 +708,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -774,7 +783,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -852,9 +862,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> let fee_parameter = @@ -944,7 +955,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Some source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> let fee_parameter = { Injection.minimal_fees; @@ -1065,7 +1077,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -1126,7 +1138,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_programs_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_programs_commands.ml index bec4370d9ac369368f24b1dc5efd97ab2b814cb4..699025255b86f3b664c806fffdd9b8dfa72025bc 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_programs_commands.ml @@ -133,7 +133,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -665,10 +665,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -679,7 +679,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -691,7 +691,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_commands.ml index 4d2a53e1a80a574ee79fd3f01db206a2418ec26e..ddbb4a024c97ff6019efd552d86f6f352a4c745e 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_commands.ml @@ -68,7 +68,7 @@ type origin = Explicit | Wallet_pkh | Wallet_alias of string type source = { pkh : public_key_hash; pk : public_key; - sk : Tezos_crypto.Signature.secret_key; + sk : Tezos_crypto.Signature.V0.secret_key; } type input_source = @@ -81,7 +81,7 @@ type source_origin = {source : source; origin : origin} (** Destination of a call: either an implicit contract or an originated one with all the necessary data (entrypoint and the argument). *) type destination = - | Implicit of Tezos_crypto.Signature.Public_key_hash.t + | Implicit of Tezos_crypto.Signature.V0.Public_key_hash.t | Originated of Smart_contracts.invocation_parameters type transfer = { @@ -98,12 +98,12 @@ type state = { current_head_on_start : Tezos_crypto.Block_hash.t; counters : (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.Public_key_hash.Table.t; + Tezos_crypto.Signature.V0.Public_key_hash.Table.t; mutable pool : source_origin list; mutable pool_size : int; (** [Some l] if [single_op_per_pkh_per_block] is true *) mutable shuffled_pool : source list option; - mutable revealed : Tezos_crypto.Signature.Public_key_hash.Set.t; + mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; mutable last_block : Tezos_crypto.Block_hash.t; mutable last_level : int; mutable target_block : Tezos_crypto.Block_hash.t; @@ -157,9 +157,9 @@ let input_source_encoding = ~title:"explicit" (Tag 0) (obj3 - (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "pk" Tezos_crypto.Signature.Public_key.encoding) - (req "sk" Tezos_crypto.Signature.Secret_key.encoding)) + (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (req "pk" Tezos_crypto.Signature.V0.Public_key.encoding) + (req "sk" Tezos_crypto.Signature.V0.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -171,7 +171,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -236,20 +236,20 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + Tezos_crypto.Signature.V0.Secret_key.of_b58check + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( - Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >>= function - | Error _ -> Lwt.return_none - | Ok sk -> Lwt.return_some sk) + Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function + | Error _ -> None + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = cctxt#warning msg alias >>= fun () -> Lwt.return_none in - (Client_keys.alias_keys cctxt alias >>= function + (Client_keys_v0.alias_keys cctxt alias >>= function | Error _ | Ok None -> warning "Alias \"%s\" not found in the wallet" alias | Ok (Some (_, None, _)) | Ok (Some (_, _, None)) -> warning @@ -272,10 +272,10 @@ let normalize_source cctxt = in let key_from_wallet pkh = let warning msg pkh = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh + cctxt#warning msg Tezos_crypto.Signature.V0.Public_key_hash.pp pkh >>= fun () -> Lwt.return_none in - (Client_keys.get_key cctxt pkh >>= function + (Client_keys_v0.get_key cctxt pkh >>= function | Error _ -> warning "Pkh \"%a\" not found in the wallet" pkh | Ok (alias, pk, sk_uri) -> ( sk_of_sk_uri sk_uri >>= function @@ -283,7 +283,7 @@ let normalize_source cctxt = cctxt#warning "Cannot extract the secret key form the pkh \"%a\" (alias: \ \"%s\") of the wallet" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh alias >>= fun () -> Lwt.return_none @@ -345,7 +345,7 @@ let random_seed rng = let generate_fresh_source pool rng = let seed = random_seed rng in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~seed () in + let pkh, pk, sk = Tezos_crypto.Signature.V0.generate_key ~seed () in let fresh = {source = {pkh; pk; sk}; origin = Explicit} in pool.pool <- fresh :: pool.pool ; pool.pool_size <- pool.pool_size + 1 ; @@ -373,7 +373,7 @@ let rec sample_transfer (cctxt : Protocol_client_context.full) chain block debug_msg (fun () -> cctxt#message "sample_transfer: invalid balance %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src.pkh) >>= fun () -> (* Sampled source has zero balance: the transfer that created that @@ -423,8 +423,8 @@ let inject_contents (cctxt : Protocol_client_context.full) chain branch sk in let signature = Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation + (Tezos_crypto.Signature.V0.sign + ~watermark:Tezos_crypto.Signature.V0.Generic_operation sk bytes) in @@ -496,7 +496,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng return () >>=? fun () -> let freshest_counter = match - Tezos_crypto.Signature.Public_key_hash.Table.find + Tezos_crypto.Signature.V0.Public_key_hash.Table.find state.counters transfer.src.pkh with @@ -516,7 +516,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng pcounter in (if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem transfer.src.pkh state.revealed then return true @@ -525,7 +525,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng revealed, or we immediately inject a reveal operation: in any case the key is revealed in the end. *) state.revealed <- - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add transfer.src.pkh state.revealed ; Alpha_services.Contract.manager_key cctxt (chain, block) transfer.src.pkh @@ -551,17 +551,17 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Cons (reveal, Single manager_op) in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting reveal+transfer from %a (counters=%a,%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print reveal_counter @@ -584,17 +584,17 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng {transfer with counter = Some transf_counter} in let list = Single manager_op in - Tezos_crypto.Signature.Public_key_hash.Table.remove + Tezos_crypto.Signature.V0.Public_key_hash.Table.remove state.counters transfer.src.pkh ; - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add state.counters transfer.src.pkh (branch, transf_counter) ; (if !verbose then cctxt#message "injecting transfer from %a (counter=%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print transf_counter @@ -1132,7 +1132,7 @@ let generate_random_transactions = else Lwt.return_unit) >>= fun () -> let counters = - Tezos_crypto.Signature.Public_key_hash.Table.create 1023 + Tezos_crypto.Signature.V0.Public_key_hash.Table.create 1023 in let rng = Random.State.make [|parameters.seed|] in Shell_services.Blocks.hash cctxt () >>=? fun current_head_on_start -> @@ -1153,7 +1153,7 @@ let generate_random_transactions = ~rng (List.map (fun src_org -> src_org.source) sources)) else None); - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.level; target_block = current_target_block; @@ -1212,7 +1212,9 @@ let estimate_transaction_cost parameters (cctxt : Protocol_client_context.full) Protocol_client_context.Alpha_block_services.header cctxt () >>=? fun header_on_start -> let current_head_on_start = header_on_start.hash in - let counters = Tezos_crypto.Signature.Public_key_hash.Table.create 1023 in + let counters = + Tezos_crypto.Signature.V0.Public_key_hash.Table.create 1023 + in Shell_services.Blocks.hash cctxt ~block:(`Head 2) () >>=? fun current_target_block -> let state = @@ -1222,7 +1224,7 @@ let estimate_transaction_cost parameters (cctxt : Protocol_client_context.full) pool = sources; pool_size = List.length sources; shuffled_pool = None; - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.shell.level; target_block = current_target_block; diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_contracts.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_contracts.ml index c75e9118d7c2b5d95ed76c08597e4ce52c5808d9..421a2bd12b7d4423df07355c115336bbcd3a862d 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_contracts.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_stresstest_contracts.ml @@ -179,7 +179,7 @@ let originate_command = | None -> failwith "only implicit accounts can be the source of an origination" | Some source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let originate_one (scontract : smart_contract) = let fee_parameter = { diff --git a/src/proto_013_PtJakart/lib_client_commands/client_proto_utils_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_utils_commands.ml index cd8c924cfff6b697a2a3ffc115ead8c973084188..d4a22b0e8ea96336511e65777c1bb2054d49e02e 100644 --- a/src/proto_013_PtJakart/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_013_PtJakart/lib_client_commands/client_proto_utils_commands.ml @@ -80,7 +80,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -88,7 +88,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -102,7 +102,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] @@ -134,7 +134,7 @@ let commands () = no_options (prefixes ["sign"; "block"] @@ unsigned_block_header_param @@ prefixes ["for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"signing delegate" @@ stop) @@ -149,8 +149,8 @@ let commands () = in Shell_services.Chain.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> - Client_keys.get_key cctxt delegate >>=? fun (_, _, sk) -> - Client_keys.sign + Client_keys_v0.get_key cctxt delegate >>=? fun (_, _, sk) -> + Client_keys_v0.sign cctxt ~watermark: (Protocol.Alpha_context.Block_header.to_watermark @@ -158,5 +158,6 @@ let commands () = sk unsigned_header >>=? fun s -> - cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.to_hex s) >>= return); + cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.V0.to_hex s) + >>= return); ] diff --git a/src/proto_013_PtJakart/lib_client_sapling/client_sapling_commands.ml b/src/proto_013_PtJakart/lib_client_sapling/client_sapling_commands.ml index 761cb6cb4f1b01a8712cc4bb757d0b035562be03..a2be98a4ddbe1ab7c0bb39541823b27e92a10adc 100644 --- a/src/proto_013_PtJakart/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_013_PtJakart/lib_client_sapling/client_sapling_commands.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client let json_switch = Tezos_clic.switch ~long:"json" ~doc:"Use JSON format" () @@ -45,7 +45,8 @@ let keys_of_implicit_account cctxt source = match Protocol.Alpha_context.Contract.is_implicit source with | None -> assert false | Some src -> - Client_keys.get_key cctxt src >>=? fun (_, pk, sk) -> return (src, pk, sk) + Client_keys_v0.get_key cctxt src >>=? fun (_, pk, sk) -> + return (src, pk, sk) let viewing_key_of_string s = let exception Unknown_sapling_address in @@ -70,7 +71,7 @@ let bound_data_of_public_key_hash cctxt dst = let open Protocol.Michelson_v1_primitives in let pkh_bytes = Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding dst in let micheline_bytes = Micheline.(Bytes (0, pkh_bytes) |> strip_locations) in diff --git a/src/proto_013_PtJakart/lib_client_sapling/wallet.ml b/src/proto_013_PtJakart/lib_client_sapling/wallet.ml index 412619eec4b8cfb9bd22a1191f072032df0ef528..74be47fede07eea4facb50d4703ade957b01f650 100644 --- a/src/proto_013_PtJakart/lib_client_sapling/wallet.ml +++ b/src/proto_013_PtJakart/lib_client_sapling/wallet.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client module Mnemonic = struct diff --git a/src/proto_013_PtJakart/lib_delegate/delegate_events.ml b/src/proto_013_PtJakart/lib_delegate/delegate_events.ml index 912bad034cf07ba3e14e1fde00a67c8764870666..274e77d9c8f65f95bc7b13bf9ac555e16cd37319 100644 --- a/src/proto_013_PtJakart/lib_delegate/delegate_events.ml +++ b/src/proto_013_PtJakart/lib_delegate/delegate_events.ml @@ -498,7 +498,7 @@ module Baking_forge = struct ("fitness", Fitness.encoding) ("client", Data_encoding.string) ("predecessor", Tezos_crypto.Block_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let injected_block = declare_7 @@ -550,7 +550,7 @@ module Baking_forge = struct ("timestamp", Time.System.encoding) ("client", Data_encoding.string) ("predecessor", Tezos_crypto.Block_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let read_nonce_fail = declare_1 @@ -693,7 +693,7 @@ module Endorsement = struct ("level", Alpha_context.Raw_level.encoding) ("client", Data_encoding.string) ("op_hash", Tezos_crypto.Operation_hash.encoding) - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) let endorsing = declare_3 @@ -782,6 +782,6 @@ module Endorsement = struct ~name:"error_while_endorsing" ~msg:"error while injecting endorsement for baker {baker}: {errors}" ~pp2:pp_print_top_error_of_trace - ("baker", Client_keys.Public_key_hash.encoding) + ("baker", Client_keys_v0.Public_key_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end diff --git a/src/proto_013_PtJakart/lib_injector/common.ml b/src/proto_013_PtJakart/lib_injector/common.ml index 3612ecfafb28b1d375c5866ae6713f69597ceecb..69c4376cd88d904ea99de9f74aa0ab4321c28e65 100644 --- a/src/proto_013_PtJakart/lib_injector/common.ml +++ b/src/proto_013_PtJakart/lib_injector/common.ml @@ -27,14 +27,14 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } let get_signer cctxt pkh = let open Lwt_result_syntax in - let* alias, pk, sk = Client_keys.get_key cctxt pkh in + let* alias, pk, sk = Client_keys_v0.get_key cctxt pkh in return {alias; pkh; pk; sk} type 'block reorg = {old_chain : 'block list; new_chain : 'block list} diff --git a/src/proto_013_PtJakart/lib_injector/common.mli b/src/proto_013_PtJakart/lib_injector/common.mli index bff16a3f72e1563bf4f825bcdf6c97a63d7b0000..6e9cbff0c20db099af25f65cf15d2c2500846250 100644 --- a/src/proto_013_PtJakart/lib_injector/common.mli +++ b/src/proto_013_PtJakart/lib_injector/common.mli @@ -28,9 +28,9 @@ open Protocol_client_context (** The type of signers for operations injected by the injector *) type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) @@ -45,7 +45,7 @@ type 'block reorg = { (** Retrieve a signer from the client wallet. *) val get_signer : #Client_context.wallet -> - Tezos_crypto.Signature.public_key_hash -> + Tezos_crypto.Signature.V0.public_key_hash -> signer tzresult Lwt.t val no_reorg : 'a reorg diff --git a/src/proto_013_PtJakart/lib_injector/injector_errors.ml b/src/proto_013_PtJakart/lib_injector/injector_errors.ml index e638807b51541636fd77adb9df362e9e3cb821e1..b0e69ff4f6dab1b602eb8e5b0124a6d02ffdf274 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_errors.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_errors.ml @@ -23,7 +23,8 @@ (* *) (*****************************************************************************) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t let () = register_error_kind @@ -35,11 +36,11 @@ let () = Format.fprintf ppf "No worker for source %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp s) `Permanent Data_encoding.( - obj1 (req "source" Tezos_crypto.Signature.Public_key_hash.encoding)) + obj1 (req "source" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function No_worker_for_source s -> Some s | _ -> None) (fun s -> No_worker_for_source s) diff --git a/src/proto_013_PtJakart/lib_injector/injector_errors.mli b/src/proto_013_PtJakart/lib_injector/injector_errors.mli index ac6a0727965735282124f40140d48bce07460072..4676461a00af0dee365c7c1461c0b7a15b234334 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_errors.mli +++ b/src/proto_013_PtJakart/lib_injector/injector_errors.mli @@ -25,7 +25,8 @@ (** Error when the injector has no worker for the source which must inject an operation. *) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t (** Error when the injector has no worker for the tag of the operation to be injected. *) diff --git a/src/proto_013_PtJakart/lib_injector/injector_events.ml b/src/proto_013_PtJakart/lib_injector/injector_events.ml index 7fbfdd1fd99b8f764a190d912aee935f09a7b4bf..7789fe3352a6f366237925e0d21f99d82d5579c7 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_events.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_events.ml @@ -37,10 +37,10 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 @@ -50,11 +50,11 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 @@ -65,12 +65,12 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 enc3 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 diff --git a/src/proto_013_PtJakart/lib_injector/injector_functor.ml b/src/proto_013_PtJakart/lib_injector/injector_functor.ml index e5244531d41cc4ecc142db7b8f66d7d9dab68e2a..dbb2eb77887a54a78fa141d435f41d698049fe7b 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_functor.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_functor.ml @@ -507,9 +507,9 @@ module Make (Rollup : PARAMETERS) = struct Data_encoding.Binary.to_bytes_exn Operation.unsigned_encoding unsigned_op in let* signature = - Client_keys.sign + Client_keys_v0.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -619,14 +619,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = - match state.signer.pkh with - | Tezos_crypto.Signature.Ed25519 _ -> - Tezos_crypto.Signature.of_ed25519 Tezos_crypto.Ed25519.zero - | Secp256k1 _ -> - Tezos_crypto.Signature.of_secp256k1 Tezos_crypto.Secp256k1.zero - | P256 _ -> Tezos_crypto.Signature.of_p256 Tezos_crypto.P256.zero - in + let signature = Tezos_crypto.Signature.V0.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { @@ -924,7 +917,7 @@ module Make (Rollup : PARAMETERS) = struct let tags = Tags.of_list tags in let strategy, tags = match - Tezos_crypto.Signature.Public_key_hash.Map.find_opt signer acc + Tezos_crypto.Signature.V0.Public_key_hash.Map.find_opt signer acc with | None -> (strategy, tags) | Some (other_strategy, other_tags) -> @@ -939,14 +932,14 @@ module Make (Rollup : PARAMETERS) = struct in (strategy, Tags.union other_tags tags) in - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add signer (strategy, tags) acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty + Tezos_crypto.Signature.V0.Public_key_hash.Map.empty signers in - Tezos_crypto.Signature.Public_key_hash.Map.iter_es + Tezos_crypto.Signature.V0.Public_key_hash.Map.iter_es (fun signer (strategy, tags) -> let+ worker = Worker.launch diff --git a/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml b/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml index 2f0afaeb7f17aac76a006518b04a408a741e4068..3633c6397c61ea58f3091815bb1012ae63c63a8f 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml @@ -98,11 +98,11 @@ end module Name = struct type t = public_key_hash - let encoding = Tezos_crypto.Signature.Public_key_hash.encoding + let encoding = Tezos_crypto.Signature.V0.Public_key_hash.encoding let base = ["tx_rollup_injector"] - let pp = Tezos_crypto.Signature.Public_key_hash.pp_short + let pp = Tezos_crypto.Signature.V0.Public_key_hash.pp_short - let equal = Tezos_crypto.Signature.Public_key_hash.equal + let equal = Tezos_crypto.Signature.V0.Public_key_hash.equal end diff --git a/src/proto_013_PtJakart/lib_injector/l1_operation.ml b/src/proto_013_PtJakart/lib_injector/l1_operation.ml index d3de083f15253f16033350fd7a2361c7fac15628..920e15484c4284f622a17aa32f0c2b331a34bdd8 100644 --- a/src/proto_013_PtJakart/lib_injector/l1_operation.ml +++ b/src/proto_013_PtJakart/lib_injector/l1_operation.ml @@ -132,7 +132,7 @@ module Manager_operation = struct ty pp_lazy_expr contents - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp claimer in Format.fprintf diff --git a/src/proto_013_PtJakart/lib_parameters/default_parameters.ml b/src/proto_013_PtJakart/lib_parameters/default_parameters.ml index 8698a322b85ad7b13f2f3fb228d93b19520f614b..d60794b19fea3325f5178af71095168f41a6fea2 100644 --- a/src/proto_013_PtJakart/lib_parameters/default_parameters.ml +++ b/src/proto_013_PtJakart/lib_parameters/default_parameters.ml @@ -262,8 +262,10 @@ let bootstrap_balance = Tez.of_mutez_exn 4_000_000_000_000L let compute_accounts = List.map (fun s -> - let public_key = Tezos_crypto.Signature.Public_key.of_b58check_exn s in - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key = Tezos_crypto.Signature.V0.Public_key.of_b58check_exn s in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in Parameters. { public_key_hash; diff --git a/src/proto_013_PtJakart/lib_parameters/default_parameters.mli b/src/proto_013_PtJakart/lib_parameters/default_parameters.mli index 3bc1b8edff7024783a0f8db1508c5d0aac1d4644..d4cd8df549216faf6882e632f529037664ede7df 100644 --- a/src/proto_013_PtJakart/lib_parameters/default_parameters.mli +++ b/src/proto_013_PtJakart/lib_parameters/default_parameters.mli @@ -35,8 +35,8 @@ val constants_test : Constants.parametric val test_commitments : Commitment.t list lazy_t val make_bootstrap_account : - Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key + Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key * Tez.t -> Parameters.bootstrap_account diff --git a/src/proto_013_PtJakart/lib_plugin/plugin.ml b/src/proto_013_PtJakart/lib_plugin/plugin.ml index 3cc674bbcd371cba190a6e6babc5ce90f36b3531..886bea1d5f55e18e76b6876f138a8439d21ec34b 100644 --- a/src/proto_013_PtJakart/lib_plugin/plugin.ml +++ b/src/proto_013_PtJakart/lib_plugin/plugin.ml @@ -250,14 +250,15 @@ module Mempool = struct grandparent_level_start : Alpha_context.Timestamp.t option; round_zero_duration : Period.t option; op_prechecked_managers : - manager_op_info Tezos_crypto.Signature.Public_key_hash.Map.t; + manager_op_info Tezos_crypto.Signature.V0.Public_key_hash.Map.t; (** All managers that are the source of manager operations prechecked in the mempool. Each manager in the map is associated to a record of type [manager_op_info] (See for record details above). Each manager in the map should be accessible with an operation hash in [operation_hash_to_manager]. *) operation_hash_to_manager : - Tezos_crypto.Signature.Public_key_hash.t Tezos_crypto.Operation_hash.Map.t; + Tezos_crypto.Signature.V0.Public_key_hash.t + Tezos_crypto.Operation_hash.Map.t; (** Map of operation hash to manager used to remove a manager from [op_prechecked_managers] with an operation hash. Each manager in the map should also be in [op_prechecked_managers]. *) @@ -279,7 +280,8 @@ module Mempool = struct { grandparent_level_start = None; round_zero_duration = None; - op_prechecked_managers = Tezos_crypto.Signature.Public_key_hash.Map.empty; + op_prechecked_managers = + Tezos_crypto.Signature.V0.Public_key_hash.Map.empty; operation_hash_to_manager = Tezos_crypto.Operation_hash.Map.empty; prechecked_operations_count = 0; ops_prechecked = ManagerOpWeightSet.empty; @@ -359,7 +361,7 @@ module Mempool = struct in let removed_op = ref None in let op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.update + Tezos_crypto.Signature.V0.Public_key_hash.Map.update source (function | None -> None @@ -546,7 +548,7 @@ module Mempool = struct let check_manager_restriction config filter_state source ~fee ~gas_limit = match - Tezos_crypto.Signature.Public_key_hash.Map.find + Tezos_crypto.Signature.V0.Public_key_hash.Map.find source filter_state.op_prechecked_managers with @@ -1142,7 +1144,7 @@ module Mempool = struct filter_state with op_prechecked_managers = (* Manager not seen yet, record it for next ops *) - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add source info filter_state.op_prechecked_managers; @@ -2236,7 +2238,7 @@ module RPC = struct let operation : _ operation = {shell; protocol_data} in let hash = Operation.hash {shell; protocol_data} in let ctxt = Origination_nonce.init ctxt hash in - let payload_producer = Tezos_crypto.Signature.Public_key_hash.zero in + let payload_producer = Tezos_crypto.Signature.V0.Public_key_hash.zero in match protocol_data.contents with | Single (Manager_operation _) as op -> Apply.precheck_manager_contents_list ctxt op ~mempool_mode:true @@ -3778,7 +3780,7 @@ module RPC = struct module Baking_rights = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; round : int; timestamp : Timestamp.t option; } @@ -3792,7 +3794,7 @@ module RPC = struct {level; delegate; round; timestamp}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "round" uint16) (opt "estimated_time" Timestamp.encoding)) @@ -3806,7 +3808,7 @@ module RPC = struct type baking_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; max_round : int option; all : bool; } @@ -3861,7 +3863,7 @@ module RPC = struct if Compare.Int.(round > max_round) then return (List.rev acc) else let (Misc.LCons (pk, next)) = l in - let delegate = Tezos_crypto.Signature.Public_key.hash pk in + let delegate = Tezos_crypto.Signature.V0.Public_key.hash pk in estimated_time round_durations ~current_level @@ -3880,16 +3882,16 @@ module RPC = struct @@ List.fold_left (fun (acc, previous) r -> if - Tezos_crypto.Signature.Public_key_hash.Set.exists - (Tezos_crypto.Signature.Public_key_hash.equal r.delegate) + Tezos_crypto.Signature.V0.Public_key_hash.Set.exists + (Tezos_crypto.Signature.V0.Public_key_hash.equal r.delegate) previous then (acc, previous) else ( r :: acc, - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add r.delegate previous )) - ([], Tezos_crypto.Signature.Public_key_hash.Set.empty) + ([], Tezos_crypto.Signature.V0.Public_key_hash.Set.empty) rights let register () = @@ -3923,7 +3925,7 @@ module RPC = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) @@ -3940,7 +3942,7 @@ module RPC = struct module Endorsing_rights = struct type delegate_rights = { - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; first_slot : Slot.t; endorsing_power : int; } @@ -3959,7 +3961,7 @@ module RPC = struct (fun (delegate, first_slot, endorsing_power) -> {delegate; first_slot; endorsing_power}) (obj3 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "first_slot" Slot.encoding) (req "endorsing_power" uint16)) @@ -3983,7 +3985,7 @@ module RPC = struct type endorsing_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let endorsing_rights_query = @@ -4061,7 +4063,8 @@ module RPC = struct (fun rights_at_level -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal + p.delegate) delegates in match @@ -4084,7 +4087,7 @@ module RPC = struct module Validators = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; slots : Slot.t list; } @@ -4095,7 +4098,7 @@ module RPC = struct (fun (level, delegate, slots) -> {level; delegate; slots}) (obj3 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "slots" (list Slot.encoding))) module S = struct @@ -4105,7 +4108,7 @@ module RPC = struct type validators_query = { levels : Raw_level.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let validators_query = @@ -4155,7 +4158,7 @@ module RPC = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) diff --git a/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml b/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml index 585463b9b0ad9b26b343164cac55be7b8e041a42..7c7bfe4a2dc7afe377544e786935e9c055566dc9 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml @@ -27,7 +27,7 @@ open Tezos_client_base let l1_destination_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Signature.Public_key_hash.of_b58check_opt s with + match Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt s with | Some addr -> return addr | None -> failwith "cannot parse %s to get a valid destination" s) @@ -68,7 +68,7 @@ type wallet_entry = { alias : string; public_key_hash : Tezos_crypto.Bls.Public_key_hash.t; public_key : Tezos_crypto.Bls.Public_key.t option; - secret_key_uri : Client_keys.aggregate_sk_uri option; + secret_key_uri : Client_keys_v0.aggregate_sk_uri option; } let wallet_parameter () = @@ -76,16 +76,16 @@ let wallet_parameter () = let open Lwt_result_syntax in let open Tezos_crypto.Aggregate_signature in let* (Bls12_381 public_key_hash) = - Client_keys.Aggregate_alias.Public_key_hash.find cctxt alias + Client_keys_v0.Aggregate_alias.Public_key_hash.find cctxt alias in let* _, pk_opt = - Client_keys.Aggregate_alias.Public_key.find cctxt alias + Client_keys_v0.Aggregate_alias.Public_key.find cctxt alias in let public_key = Option.map (fun (Bls12_381 pk : public_key) -> pk) pk_opt in let+ secret_key_uri = - Client_keys.Aggregate_alias.Secret_key.find_opt cctxt alias + Client_keys_v0.Aggregate_alias.Secret_key.find_opt cctxt alias in {alias; public_key_hash; public_key; secret_key_uri}) @@ -93,16 +93,16 @@ let wallet_param ?(name = "an alias for a tz4 address") ?(desc = "an alias for a tz4 address") = Tezos_clic.param ~name ~desc @@ wallet_parameter () -let tezos_pkh_param = Client_keys.Public_key_hash.source_param +let tezos_pkh_param = Client_keys_v0.Public_key_hash.source_param let bls_pkh_parameter () = Tezos_clic.parameter - ~autocomplete:Client_keys.Aggregate_alias.Public_key_hash.autocomplete + ~autocomplete:Client_keys_v0.Aggregate_alias.Public_key_hash.autocomplete (fun cctxt s -> let open Lwt_result_syntax in let from_alias s = let* (Bls12_381 pkh) = - Client_keys.Aggregate_alias.Public_key_hash.find cctxt s + Client_keys_v0.Aggregate_alias.Public_key_hash.find cctxt s in return pkh in @@ -131,8 +131,8 @@ let bls_pkh_param ?(name = "public key hash") let bls_sk_uri_parameter () = Tezos_clic.parameter - ~autocomplete:Client_keys.Aggregate_alias.Secret_key.autocomplete - Client_keys.Aggregate_alias.Secret_key.find + ~autocomplete:Client_keys_v0.Aggregate_alias.Secret_key.autocomplete + Client_keys_v0.Aggregate_alias.Secret_key.find let bls_sk_uri_param ?(name = "secret key") ?(desc = "Bls secret key to use.") = let desc = @@ -327,7 +327,7 @@ let sign_transaction cctxt sks_uri txs = in List.map_ep (fun sk -> - let* signature = Client_keys.aggregate_sign cctxt sk buf in + let* signature = Client_keys_v0.aggregate_sign cctxt sk buf in match signature with | Bls12_381 signature -> return signature | Unknown _signature -> failwith "failed to sign") diff --git a/src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.ml b/src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.ml index bd688f020a2b0ad5313047b39a4f3b8138c90d5e..ebdf07b28fd2068ec69304c147e599d1ddc83c25 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.ml @@ -28,7 +28,7 @@ let executable_name = Filename.basename Sys.executable_name let argv () = Array.to_list Sys.argv |> List.tl |> Stdlib.Option.get let register_signers () = - Tezos_client_base.Client_keys.register_aggregate_signer + Tezos_client_base.Client_keys_v0.register_aggregate_signer (module Tezos_signer_backends.Unencrypted.Aggregate) (* FIXME: https://gitlab.com/tezos/tezos/-/issues/4025 diff --git a/src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.ml b/src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.ml index 4d6d99a785feff9eebe1e082d7531f7c4e331ede..d091375c6f770536eaa84db2ad1e8a61bef968c7 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.ml @@ -52,42 +52,42 @@ let data_dir_arg = Client_proto_args.string_parameter let operator_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"operator" ~placeholder:"operator" ~doc:"The operator of the rollup" () let batch_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"batch-signer" ~placeholder:"batch-signer" ~doc:"The signer for submission of batches" () let finalize_commitment_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"finalize-commitment-signer" ~placeholder:"finalize-commitment-signer" ~doc:"The signer for finalization of commitments" () let remove_commitment_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"remove-commitment-signer" ~placeholder:"remove-commitment-signer" ~doc:"The signer for removals of commitments" () let rejection_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"rejection-signer" ~placeholder:"rejection-signer" ~doc:"The signer for rejections" () let dispatch_withdrawals_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"dispatch-withdrawals-signer" ~placeholder:"dispatch-withdrawals-signer" ~doc:"The signer for dispatch withdrawals" diff --git a/src/proto_014_PtKathma/lib_benchmark/autocomp.ml b/src/proto_014_PtKathma/lib_benchmark/autocomp.ml index a5ffb8cf0e8bf884da2c3b367fef38c0512e81fa..a43161a7c3f34699f2133ea4504ccb5cd36d00c9 100644 --- a/src/proto_014_PtKathma/lib_benchmark/autocomp.ml +++ b/src/proto_014_PtKathma/lib_benchmark/autocomp.ml @@ -156,7 +156,7 @@ end module Make (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct (* Generates minimally sized random data of specified type. Used in autocompletion. *) diff --git a/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml b/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml index 5672070a26e740415ac526d6012b1eb3dab118fc..8395355273ce543e3e4f484d4cebf977f4e6b0b2 100644 --- a/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml +++ b/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml @@ -386,12 +386,18 @@ module Data = struct let key_hash kh = let b = - Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding kh + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key_hash.encoding + kh in prim A_Key_hash [bytes b] [] let key k = - let b = Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding k in + let b = + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key.encoding + k + in prim A_Key [bytes b] [] let integer (i : int) = prim A_Int [int (Z.of_int i)] [] diff --git a/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli b/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli index 4cebbffb4467867f921d23f4921d00fcca564d32..724bfa299074d04eb4a0743caa9210735a7c550f 100644 --- a/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli +++ b/src/proto_014_PtKathma/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli @@ -309,9 +309,9 @@ module Data : sig val mutez : Alpha_context.Tez.t -> node - val key_hash : Signature.Public_key_hash.t -> node + val key_hash : Environment.Signature.Public_key_hash.t -> node - val key : Signature.Public_key.t -> node + val key : Environment.Signature.Public_key.t -> node val integer : int -> node diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.ml b/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.ml index 7dc0f4edd716a6ee3064981493a71cad88a12f76..29704a91d5e0dff40c34403c6045977d086b12cd 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.ml +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.ml @@ -208,7 +208,7 @@ end module Make_code_sampler (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) (X : sig + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t val target_size : int @@ -267,7 +267,7 @@ end module Make_data_sampler (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) (X : sig + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t val target_size : int diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.mli b/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.mli index bd67d13e3c165f1a7261a8074c71525c0ca74e24..66f409c121c919e3070499bac8ab8ef1f07fca44 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.mli +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.mli @@ -79,7 +79,7 @@ val load : filename:string -> michelson_sample list *) module Make_code_sampler : functor (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t @@ -98,7 +98,7 @@ end (** See documentation for [Make_code_sampler] *) module Make_data_sampler : functor (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.ml b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.ml index fbe05e675e521a2b69c5e077f3708b8e68e40d19..fe1135bca5d8dc8ee81e307d426487d1efa4f63d 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.ml +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.ml @@ -266,7 +266,7 @@ let fail_sampling error = raise (SamplingError error) module Make (P : sig val parameters : parameters end) -(Crypto_samplers : Crypto_samplers.Finite_key_pool_S) : S = struct +(Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) : S = struct module Michelson_base = Michelson_samplers_base.Make (struct let parameters = P.parameters.base_parameters end) diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.mli b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.mli index c6730c7312ca33328a746a0e74263582482e8d4a..60248424bebf1e3fd783059548304f99aaddd8a9 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.mli +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers.mli @@ -94,7 +94,7 @@ module Make : functor (P : sig val parameters : parameters end) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) -> S module Internal_for_tests : sig diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.ml b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.ml index 3f8f301fd1ab7718fe34b741ce9d397679166dcb..847b8406a4a3c80fb2a9329b80064e2a9ba33b11 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.ml @@ -53,7 +53,7 @@ module type S = sig val nat : Script_int.n Script_int.num sampler - val signature : Tezos_crypto.Signature.t sampler + val signature : Tezos_crypto.Signature.V0.t sampler val string : Script_string.t sampler @@ -85,21 +85,21 @@ end) : S = struct let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_ed25519 s) + | Some s -> Tezos_crypto.Signature.V0.of_ed25519 s) | 1 -> ( let open Tezos_crypto.Secp256k1 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_secp256k1 s) + | Some s -> Tezos_crypto.Signature.V0.of_secp256k1 s) | 2 -> ( let open Tezos_crypto.P256 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_p256 s) + | Some s -> Tezos_crypto.Signature.V0.of_p256 s) | _ -> ( - let open Tezos_crypto.Signature in + let open Tezos_crypto.Signature.V0 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with None -> assert false | Some s -> s) diff --git a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.mli b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.mli index 18a150245cfce7b351421295d52b40c6bb140116..b29fb1868ba02ae868aed989771c7f0849d46ce9 100644 --- a/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.mli +++ b/src/proto_014_PtKathma/lib_benchmark/michelson_samplers_base.mli @@ -47,7 +47,7 @@ module type S = sig val nat : Script_int.n Script_int.num sampler - val signature : Tezos_crypto.Signature.t sampler + val signature : Tezos_crypto.Signature.V0.t sampler val string : Script_string.t sampler diff --git a/src/proto_014_PtKathma/lib_benchmark/rules.ml b/src/proto_014_PtKathma/lib_benchmark/rules.ml index ce35900d5a20a039eae100288c724c8af7708c39..45d31deda24a16c1e9374f5dab2c123a05401c84 100644 --- a/src/proto_014_PtKathma/lib_benchmark/rules.ml +++ b/src/proto_014_PtKathma/lib_benchmark/rules.ml @@ -580,7 +580,7 @@ end module Data_rewrite_leaves (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct let hole_patt = let open Patt in @@ -917,7 +917,7 @@ end module Data (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct let match_data_node = let open Patt in diff --git a/src/proto_014_PtKathma/lib_benchmark/test/test_autocompletion.ml b/src/proto_014_PtKathma/lib_benchmark/test/test_autocompletion.ml index c2f3e6c742956c823d50e5a08ea4aeff08fe3c19..91a8ed29d1cb57424dc2eb65bad425503d88a03b 100644 --- a/src/proto_014_PtKathma/lib_benchmark/test/test_autocompletion.ml +++ b/src/proto_014_PtKathma/lib_benchmark/test/test_autocompletion.ml @@ -25,7 +25,7 @@ let rng_state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_014_PtKathma/lib_benchmark/test/test_distribution.ml b/src/proto_014_PtKathma/lib_benchmark/test/test_distribution.ml index 7822b5b6e08cd476377340106be16136c9142616..b7f46d1753d38a7924f690a223455bf3c4b5457f 100644 --- a/src/proto_014_PtKathma/lib_benchmark/test/test_distribution.ml +++ b/src/proto_014_PtKathma/lib_benchmark/test/test_distribution.ml @@ -95,7 +95,7 @@ let rec tnames_of_type : | Script_typed_ir.Chest_key_t -> assert false | Script_typed_ir.Chest_t -> assert false -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_code.ml b/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_code.ml index e5e8edf378d5c87a4ab171f387d082a782e2e89d..1a23352b714a15d99b38c399eee9c998b67274ff 100644 --- a/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_code.ml +++ b/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_code.ml @@ -39,7 +39,7 @@ let verbose = let state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_data.ml b/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_data.ml index fb67a046d1ef33ccfd2970c4419e48a293c74273..f69f30af7d3cf9f5eb1407ef37f079ccbf5a0169 100644 --- a/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_data.ml +++ b/src/proto_014_PtKathma/lib_benchmark/test/test_sampling_data.ml @@ -39,7 +39,7 @@ let verbose = let state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml index 8eae1aac90f6373316da81db2dda19b3655f50dc..a465c60a30890e200e4d32eae07127d912aeef8f 100644 --- a/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -145,8 +145,9 @@ module Default_config = struct end let make_default_samplers ?(algo = `Default) cfg : - (module Crypto_samplers.Finite_key_pool_S) * (module Michelson_samplers.S) = - let module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct + (module Crypto_samplers.V0.Finite_key_pool_S) + * (module Michelson_samplers.S) = + let module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let size = 16 let algo = algo @@ -2255,14 +2256,14 @@ module Registration_section = struct ~kinstr:(ILevel (dummy_loc, halt)) () - let check_signature (algo : Tezos_crypto.Signature.algo) ~for_intercept = + let check_signature (algo : Tezos_crypto.Signature.V0.algo) ~for_intercept = let name = match algo with - | Tezos_crypto.Signature.Ed25519 -> + | Tezos_crypto.Signature.V0.Ed25519 -> Interpreter_workload.N_ICheck_signature_ed25519 - | Tezos_crypto.Signature.Secp256k1 -> + | Tezos_crypto.Signature.V0.Secp256k1 -> Interpreter_workload.N_ICheck_signature_secp256k1 - | Tezos_crypto.Signature.P256 -> + | Tezos_crypto.Signature.V0.P256 -> Interpreter_workload.N_ICheck_signature_p256 in benchmark_with_stack_sampler @@ -2281,7 +2282,7 @@ module Registration_section = struct else Samplers.Random_value.value Script_typed_ir.bytes_t rng_state in let signed_message = - Tezos_crypto.Signature.sign sk unsigned_message + Tezos_crypto.Signature.V0.sign sk unsigned_message in let signed_message = Script_signature.make signed_message in (pk, (signed_message, (unsigned_message, eos)))) @@ -2291,11 +2292,11 @@ module Registration_section = struct check_signature algo ~for_intercept:true ; check_signature algo ~for_intercept:false - let () = check_signature Tezos_crypto.Signature.Ed25519 + let () = check_signature Tezos_crypto.Signature.V0.Ed25519 - let () = check_signature Tezos_crypto.Signature.Secp256k1 + let () = check_signature Tezos_crypto.Signature.V0.Secp256k1 - let () = check_signature Tezos_crypto.Signature.P256 + let () = check_signature Tezos_crypto.Signature.V0.P256 let () = simple_benchmark @@ -2991,7 +2992,7 @@ module Registration_section = struct let open Script_typed_ir in let open Alpha_context in let zero = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero in let step_constants = { diff --git a/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_workload.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_workload.ml index 08e5aefa47a05ba3ad469aefa1dea773a86833b6..6e03d5fc37dd786bb29791819845da0694a95f41 100644 --- a/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_workload.ml @@ -1337,19 +1337,19 @@ let extract_ir_sized_step : | ILevel (_, _), _ -> Instructions.level | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with - | Tezos_crypto.Signature.Ed25519 _pk -> + | Tezos_crypto.Signature.V0.Ed25519 _pk -> let pk = Size.of_int Tezos_crypto.Ed25519.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message - | Tezos_crypto.Signature.Secp256k1 _pk -> + | Tezos_crypto.Signature.V0.Secp256k1 _pk -> let pk = Size.of_int Tezos_crypto.Secp256k1.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message - | Tezos_crypto.Signature.P256 _pk -> + | Tezos_crypto.Signature.V0.P256 _pk -> let pk = Size.of_int Tezos_crypto.P256.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_p256 pk signature message) | IHash_key (_, _), _ -> Instructions.hash_key diff --git a/src/proto_014_PtKathma/lib_benchmarks_proto/michelson_generation.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/michelson_generation.ml index d1422930010aa84e1f20e06e14f4763745f68599..a96d9c8cea416c0f1eb8db29109a596783e742de 100644 --- a/src/proto_014_PtKathma/lib_benchmarks_proto/michelson_generation.ml +++ b/src/proto_014_PtKathma/lib_benchmarks_proto/michelson_generation.ml @@ -44,7 +44,7 @@ let generator_config_encoding = (* ----------------------------------------------------------------------- *) -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let size = 16 let algo = `Default diff --git a/src/proto_014_PtKathma/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/ticket_benchmarks.ml index 71f39d3be7b007f1a548635044197cf976d3ab40..405d918c27ed2384439705095756b2866f93e026 100644 --- a/src/proto_014_PtKathma/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_014_PtKathma/lib_benchmarks_proto/ticket_benchmarks.ml @@ -256,8 +256,8 @@ let () = Registration_helpers.register (module Has_tickets_type_benchmark) let ticket_sampler rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let pkh, _, _ = - Tezos_crypto.Signature.generate_key - ~algo:Tezos_crypto.Signature.Ed25519 + Tezos_crypto.Signature.V0.generate_key + ~algo:Tezos_crypto.Signature.V0.Ed25519 ~seed () in diff --git a/src/proto_014_PtKathma/lib_client/client_proto_args.ml b/src/proto_014_PtKathma/lib_client/client_proto_args.ml index e60eac54177c8823e37dda7a6975f41e1803d331..e4d4fbf4183e2b4891d2765241fdfc4a4800f5fb 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_args.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_args.ml @@ -218,7 +218,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -549,7 +549,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_014_PtKathma/lib_client/client_proto_args.mli b/src/proto_014_PtKathma/lib_client/client_proto_args.mli index c6c07437ea695a0f8071295ffd3bccc2004bce19..a8140d2b736f6c01cb49f3ac2d0eab586ec2f854 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_args.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_args.mli @@ -61,7 +61,7 @@ val entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val default_entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -118,7 +118,8 @@ val global_constant_param : ('a, full) Tezos_clic.params -> (string -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_014_PtKathma/lib_client/client_proto_context.ml b/src/proto_014_PtKathma/lib_client/client_proto_context.ml index cc67c1b7e368bc3d57bd5cdcbf64f29296ed4fbf..2435305cc82030d3a8df1d8d00934f0b5b454447 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -300,7 +300,7 @@ let set_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -596,14 +596,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -643,21 +643,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -671,7 +673,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_014_PtKathma/lib_client/client_proto_context.mli b/src/proto_014_PtKathma/lib_client/client_proto_context.mli index e8af7739e8fd393c657d8ca929619b3a1c3f60dd..ce1afbf2f68711c36890da4eeee9835340af0261 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.mli @@ -60,9 +60,9 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -105,7 +105,7 @@ val get_frozen_deposits_limit : #Protocol_client_context.rpc_context -> chain:Shell_services.chain -> block:Shell_services.block -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -126,7 +126,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -142,7 +142,7 @@ val set_deposits_limit : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> Tez.t option -> Kind.set_deposits_limit Kind.manager Injection.result tzresult Lwt.t @@ -163,7 +163,7 @@ val increase_paid_storage : source:public_key_hash -> destination:Contract_hash.t -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> amount_in_bytes:Z.t -> unit -> @@ -177,7 +177,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -205,7 +205,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -239,7 +239,7 @@ val transfer_with_script : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> parameters:Script.lazy_expr -> @@ -268,7 +268,7 @@ val transfer : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> ?arg:string -> @@ -301,7 +301,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -392,7 +392,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -404,7 +404,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> @@ -456,9 +456,9 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -480,9 +480,9 @@ val submit_tx_rollup_batch : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -505,9 +505,9 @@ val submit_tx_rollup_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> inbox_merkle_root:Tx_rollup_inbox.Merkle.root -> @@ -533,9 +533,9 @@ val submit_tx_rollup_finalize_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -558,9 +558,9 @@ val submit_tx_rollup_remove_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -582,9 +582,9 @@ val submit_tx_rollup_rejection : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -616,9 +616,9 @@ val submit_tx_rollup_return_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -640,9 +640,9 @@ val tx_rollup_dispatch_tickets : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -669,9 +669,9 @@ val transfer_ticket : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> ty:string -> @@ -703,7 +703,7 @@ val sc_rollup_originate : boot_sector:string -> parameters_ty:Script.lazy_expr -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> ( Tezos_crypto.Operation_hash.t @@ -729,7 +729,7 @@ val sc_rollup_add_messages : rollup:Alpha_context.Sc_rollup.t -> messages:string list -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -754,7 +754,7 @@ val sc_rollup_cement : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment.Hash.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -779,7 +779,7 @@ val sc_rollup_publish : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -808,7 +808,7 @@ val sc_rollup_execute_outbox_message : inclusion_proof:string -> message:string -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> ( Tezos_crypto.Operation_hash.t @@ -831,9 +831,9 @@ val sc_rollup_recover_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> unit -> @@ -859,7 +859,7 @@ val sc_rollup_dal_slot_subscribe : rollup:Alpha_context.Sc_rollup.t -> slot_index:int -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t diff --git a/src/proto_014_PtKathma/lib_client/client_proto_contracts.ml b/src/proto_014_PtKathma/lib_client/client_proto_contracts.ml index 55ac47e920fca4d9f9fd2ebeb33b451558220768..1ec7e0d930087a1bed14680c11595eebc302bdd7 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_contracts.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_contracts.ml @@ -101,18 +101,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return v | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (Contract.Implicit v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (Contract.Implicit v) let rev_find cctxt (c : Contract.t) = match c with | Implicit hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | Originated _ -> RawContractAlias.rev_find cctxt c @@ -123,7 +123,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -139,7 +139,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (Contract.Implicit v) | ["text"; text] -> ContractEntity.of_source text | _ -> ( @@ -154,7 +154,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -191,7 +191,7 @@ end let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> let contracts = List.map (fun (n, v) -> ("", n, v)) raw_contracts in - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_014_PtKathma/lib_client/client_proto_fa12.mli b/src/proto_014_PtKathma/lib_client/client_proto_fa12.mli index 76800482921ca900650c3b0496ec9506b0b37a28..08a2cef8d74f330cc808882a2661ff3dd1f91e85 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_fa12.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_fa12.mli @@ -99,7 +99,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract_hash.t -> action:action -> tez_amount:Tez.t -> @@ -137,7 +137,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> diff --git a/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml b/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml index 7a671305c7886b5c2869d490f50fa6b4095db797..eda34eba7679cf4e9fc0c19822b21a9a18aca210 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml @@ -139,9 +139,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -586,11 +586,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) let mutez ~loc (amount : Tez.t) = int ~loc (Z.of_int64 (Tez.to_mutez amount)) let optimized_key_hash ~loc - (key_hash : Tezos_crypto.Signature.Public_key_hash.t) = + (key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) @@ -601,11 +601,11 @@ let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) Data_encoding.(tup2 Contract.encoding Entrypoint.value_encoding) (address, entrypoint)) -let optimized_key ~loc (key : Tezos_crypto.Signature.Public_key.t) = +let optimized_key ~loc (key : Tezos_crypto.Signature.V0.Public_key.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding key) (** * Actions *) @@ -711,7 +711,7 @@ let action_of_expr_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -787,7 +787,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -814,7 +814,7 @@ let action_of_expr_not_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -824,7 +824,7 @@ let action_of_expr_not_generic e = let action_of_expr ~generic = if generic then action_of_expr_generic else action_of_expr_not_generic -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -852,7 +852,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -864,7 +865,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -888,7 +889,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc ~generic action >>=? fun expr -> @@ -1057,7 +1058,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli b/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli index 5650cc2355eaeb741e7294952a8735b23fa3b305..1eb71be4ddf08fe1894d59f172e67340b289dcf6 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli @@ -83,7 +83,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -109,10 +109,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract_hash.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> @@ -136,10 +136,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract_hash.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_014_PtKathma/lib_client/client_proto_utils.ml b/src/proto_014_PtKathma/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_014_PtKathma/lib_client/client_proto_utils.mli b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_client/injection.ml b/src/proto_014_PtKathma/lib_client/injection.ml index cd9ee168b5033d70f9fe5a0ae3ad2f21f4c7237e..575fa92eed8cdb229ed74f51176255444e5c4f74 100644 --- a/src/proto_014_PtKathma/lib_client/injection.ml +++ b/src/proto_014_PtKathma/lib_client/injection.ml @@ -192,9 +192,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -218,7 +218,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -244,7 +244,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with (* TODO-TB sign endorsement? *) - | _ -> Tezos_crypto.Signature.Generic_operation + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -252,14 +252,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -779,7 +779,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding @@ -1201,10 +1201,12 @@ let pending_applied_operations_of_source (cctxt : #full) chain src : (fun acc (_oph, {protocol_data = Operation_data {contents; _}; _}) -> match contents with | Single (Manager_operation {source; _} as _op) - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | Cons (Manager_operation {source; _}, _rest) as _op - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | _ -> acc) [] @@ -1327,14 +1329,14 @@ let replace_operation (type kind) (cctxt : #full) chain source cctxt#error "Cannot replace! No applied manager operation found for %a in \ mempool@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source >>= fun () -> exit 1 | _ :: _ :: _ as l -> cctxt#error "More than one applied manager operation found for %a in mempool. \ Found %d operations. Are you sure the node is in precheck mode?@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source (List.length l) >>= fun () -> exit 1 diff --git a/src/proto_014_PtKathma/lib_client/injection.mli b/src/proto_014_PtKathma/lib_client/injection.mli index e510735766bb49873419ff7ffdaf4c68e7215c5e..1ab767fb6bf210130f397e279ca3c85f3c05e917 100644 --- a/src/proto_014_PtKathma/lib_client/injection.mli +++ b/src/proto_014_PtKathma/lib_client/injection.mli @@ -46,7 +46,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -79,7 +79,7 @@ val inject_operation : ?simulation:bool -> ?successor_level:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> 'kind contents_list -> @@ -106,9 +106,9 @@ val inject_manager_operation : ?verbose_signing:bool -> ?simulation:bool -> ?force:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_014_PtKathma/lib_client/managed_contract.ml b/src/proto_014_PtKathma/lib_client/managed_contract.ml index d413248efc908e81a881b7eef6e292be6054476c..04d07c2b9279a034ffbf72dea4da217d29b7f674 100644 --- a/src/proto_014_PtKathma/lib_client/managed_contract.ml +++ b/src/proto_014_PtKathma/lib_client/managed_contract.ml @@ -49,7 +49,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -61,7 +61,7 @@ let get_contract_manager (cctxt : #full) contract = for \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( match - Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -106,7 +106,7 @@ let entrypoint_remove_delegate = Entrypoint.remove_delegate let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = entrypoint_do in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -141,7 +141,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -162,7 +162,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -193,7 +193,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_014_PtKathma/lib_client/managed_contract.mli b/src/proto_014_PtKathma/lib_client/managed_contract.mli index e02cf3fa7aab6e658ba9992b98fd535495013865..dda67bdbe348df3332c566ca4cba08be7ebb0e56 100644 --- a/src/proto_014_PtKathma/lib_client/managed_contract.mli +++ b/src/proto_014_PtKathma/lib_client/managed_contract.mli @@ -60,7 +60,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract_hash.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -98,7 +98,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> diff --git a/src/proto_014_PtKathma/lib_client/mockup.ml b/src/proto_014_PtKathma/lib_client/mockup.ml index 7cb74c31fe5a3c0b64baecdffd6b5def65382bf2..82ee7b04c5fe8a7afd66ec82d6864207bb7d5d28 100644 --- a/src/proto_014_PtKathma/lib_client/mockup.ml +++ b/src/proto_014_PtKathma/lib_client/mockup.ml @@ -100,7 +100,8 @@ module Protocol_constants_overrides = struct frozen_deposits_percentage : int option; double_baking_punishment : Tez.t option; ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio.t option; - testnet_dictator : Tezos_crypto.Signature.Public_key_hash.t option option; + testnet_dictator : + Tezos_crypto.Signature.V0.Public_key_hash.t option option; cache_script_size : int option; cache_stake_distribution_cycles : int option; cache_sampler_state_cycles : int option; @@ -409,7 +410,8 @@ module Protocol_constants_overrides = struct Ratio.encoding) (opt "testnet_dictator" - (option Tezos_crypto.Signature.Public_key_hash.encoding)) + (option + Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (opt "chain_id" Tezos_crypto.Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding) (opt "initial_seed" (option State_hash.encoding))) @@ -1158,7 +1160,7 @@ module Protocol_constants_overrides = struct end module Parsed_account = struct - type t = {name : string; sk_uri : Client_keys.sk_uri; amount : Tez.t} + type t = {name : string; sk_uri : Client_keys_v0.sk_uri; amount : Tez.t} let pp ppf account = let open Format in @@ -1178,13 +1180,15 @@ module Parsed_account = struct (fun (name, sk_uri, amount) -> {name; sk_uri; amount}) (obj3 (req "name" string) - (req "sk_uri" Client_keys.Secret_key.encoding) + (req "sk_uri" Client_keys_v0.Secret_key.encoding) (req "amount" Tez.encoding)) let to_bootstrap_account repr = - Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + Client_keys_v0.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys_v0.public_key pk_uri >>=? fun public_key -> + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. { @@ -1200,7 +1204,7 @@ module Parsed_account = struct let wallet = (cctxt :> Client_context.wallet) in let parsed_account_reprs = ref [] in let errors = ref [] in - Client_keys.list_keys wallet >>=? fun all_keys -> + Client_keys_v0.list_keys wallet >>=? fun all_keys -> List.iter_s (function | name, pkh, _pk_opt, Some sk_uri -> ( @@ -1251,8 +1255,8 @@ module Bootstrap_account = struct (obj3 (req "public_key_hash" - Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding)) (function | {public_key_hash; public_key; amount; delegate_to = None} -> @@ -1266,10 +1270,12 @@ module Bootstrap_account = struct (obj4 (req "public_key_hash" - Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding) - (req "delegate_to" Tezos_crypto.Signature.Public_key_hash.encoding)) + (req + "delegate_to" + Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function | {public_key_hash; public_key; amount; delegate_to = Some delegate} -> @@ -1288,7 +1294,7 @@ module Bootstrap_contract = struct (fun {delegate; amount; script} -> (delegate, amount, script)) (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 - (opt "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -1349,11 +1355,11 @@ let lib_parameters_json_encoding = (fun (pk, amount) -> { Parameters.public_key = Some pk; - public_key_hash = Tezos_crypto.Signature.Public_key.hash pk; + public_key_hash = Tezos_crypto.Signature.V0.Public_key.hash pk; amount; delegate_to = None; }) - (tup2 Tezos_crypto.Signature.Public_key.encoding Tez.encoding) + (tup2 Tezos_crypto.Signature.V0.Public_key.encoding Tez.encoding) in Data_encoding.( merge_objs @@ -1574,7 +1580,7 @@ let mem_init : ] in let open Protocol.Alpha_context.Block_header in - let _, _, sk = Tezos_crypto.Signature.generate_key () in + let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -1594,7 +1600,7 @@ let mem_init : (shell_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Protocol.Alpha_context.Block_header.( to_watermark (Block_header chain_id)) diff --git a/src/proto_014_PtKathma/lib_client/operation_result.ml b/src/proto_014_PtKathma/lib_client/operation_result.ml index c8a665e3e46e4821ea399055b50ef0de4e781516..394f9e9a3411d0947ff58ec2263f970f4f80f158 100644 --- a/src/proto_014_PtKathma/lib_client/operation_result.ml +++ b/src/proto_014_PtKathma/lib_client/operation_result.ml @@ -96,13 +96,14 @@ let pp_internal_operation ppf (Internal_contents {operation; source; _}) = Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) | Delegation delegate_opt -> ( Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Contract.pp source ; match delegate_opt with | None -> Format.pp_print_string ppf "nobody" - | Some delegate -> Tezos_crypto.Signature.Public_key_hash.pp ppf delegate) + | Some delegate -> + Tezos_crypto.Signature.V0.Public_key_hash.pp ppf delegate) | Event {ty; tag; payload} -> Format.fprintf ppf @@ -169,7 +170,7 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) | Reveal key -> Format.fprintf @@ -177,13 +178,14 @@ let pp_manager_operation_content (type kind) source ppf "Revelation of manager public key:@,Contract: %a@,Key: %a" Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key | Delegation delegate_opt -> ( Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Contract.pp source ; match delegate_opt with | None -> Format.pp_print_string ppf "nobody" - | Some delegate -> Tezos_crypto.Signature.Public_key_hash.pp ppf delegate) + | Some delegate -> + Tezos_crypto.Signature.V0.Public_key_hash.pp ppf delegate) | Register_global_constant {value} -> Format.fprintf ppf @@ -383,11 +385,11 @@ let pp_balance_updates ppf balance_updates = key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -872,7 +874,7 @@ let pp_manager_operation_result ppf Format.fprintf ppf "@,From: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source ; Format.fprintf ppf "@,Fee to the baker: %s%a" tez_sym Tez.pp fee ; Format.fprintf ppf "@,Expected counter: %a" Z.pp_print counter ; @@ -944,7 +946,7 @@ let pp_contents_and_result : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate preendorsement_power | ( Endorsement {level; _}, @@ -960,14 +962,14 @@ let pp_contents_and_result : level pp_balance_updates balance_updates - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate endorsement_power | Dal_slot_availability _, Dal_slot_availability_result {delegate} -> Format.fprintf ppf "@[Slot availability:@,Delegate: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> @@ -1014,7 +1016,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -1023,7 +1025,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_context_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_context_commands.ml index 075d0ae660ca5b13d101d762f49d70a9d7d978c7..ad454af4ccbf247f8977ac4068fed612c27554b7 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Alpha_context open Client_proto_context open Client_proto_contracts open Client_proto_rollups -open Client_keys +open Client_keys_v0 open Client_proto_args let save_tx_rollup ~force (cctxt : #Client_context.full) alias_name rollup @@ -677,7 +677,7 @@ let transfer_command amount (source : Contract.t) destination let contract = source in Managed_contract.get_contract_manager cctxt contract_hash >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -702,7 +702,7 @@ let transfer_command amount (source : Contract.t) destination ?counter () | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer cctxt ~chain:cctxt#chain @@ -879,7 +879,7 @@ let commands_rw () = | Originated contract -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -903,7 +903,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Implicit mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -933,7 +933,7 @@ let commands_rw () = | Originated contract -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Managed_contract.set_delegate cctxt ~chain:cctxt#chain @@ -956,7 +956,7 @@ let commands_rw () = errors >>= fun _ -> return_unit | Implicit mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_delegate cctxt ~chain:cctxt#chain @@ -981,7 +981,7 @@ let commands_rw () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag fee_parameter_args) @@ -1025,7 +1025,7 @@ let commands_rw () = failwith "only implicit accounts can be the source of an origination" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> originate_contract cctxt ~chain:cctxt#chain @@ -1148,11 +1148,11 @@ let commands_rw () = | Originated contract -> Managed_contract.get_contract_manager cctxt contract >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk) | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> - return (source, src_pk, src_sk)) + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> return (source, src_pk, src_sk)) >>=? fun (source, src_pk, src_sk) -> List.mapi_ep prepare operations >>=? fun contents -> let (Manager_list contents) = @@ -1310,7 +1310,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can register global constants" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> register_global_constant cctxt ~chain:cctxt#chain @@ -1412,7 +1412,7 @@ let commands_rw () = match source with | Originated _ -> failwith "only implicit accounts can be revealed" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> reveal cctxt ~dry_run @@ -1436,7 +1436,7 @@ let commands_rw () = @@ prefixes ["as"; "delegate"] @@ stop) (fun (fee, dry_run, verbose_signing, fee_parameter) src_pkh cctxt -> - Client_keys.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt src_pkh >>=? fun (_, src_pk, src_sk) -> register_as_delegate cctxt ~chain:cctxt#chain @@ -1530,7 +1530,7 @@ let commands_rw () = match source with | Originated _ -> failwith "only implicit accounts can submit proposals" | Implicit src_pkh -> ( - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1615,7 +1615,7 @@ let commands_rw () = error "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -1716,7 +1716,7 @@ let commands_rw () = match source with | Originated _ -> failwith "only implicit accounts can submit ballot" | Implicit src_pkh -> - Client_keys.get_key cctxt src_pkh + Client_keys_v0.get_key cctxt src_pkh >>=? fun (src_name, _src_pk, src_sk) -> get_period_info (* Find period info of the successor, because the operation will @@ -1762,7 +1762,7 @@ let commands_rw () = (if force then cctxt#warning else cctxt#error) "Public-key-hash `%a` from account `%s` does not appear to \ have voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name) >>= fun () -> @@ -1806,7 +1806,7 @@ let commands_rw () = Contract.pp contract | Implicit mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain @@ -1846,7 +1846,7 @@ let commands_rw () = Contract.pp contract | Implicit mgr -> - Client_keys.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt mgr >>=? fun (_, src_pk, manager_sk) -> set_deposits_limit cctxt ~chain:cctxt#chain @@ -1888,7 +1888,7 @@ let commands_rw () = amount_in_bytes payer (cctxt : Protocol_client_context.full) -> - Client_keys.get_key cctxt payer >>=? fun (_, src_pk, manager_sk) -> + Client_keys_v0.get_key cctxt payer >>=? fun (_, src_pk, manager_sk) -> increase_paid_storage cctxt ~chain:cctxt#chain @@ -1943,7 +1943,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can originate transaction rollups" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> Protocol_client_context.Alpha_block_services.Header.shell_header cctxt () @@ -2026,7 +2026,7 @@ let commands_rw () = failwith "Only implicit accounts can submit transaction rollup batches" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_batch cctxt ~chain:cctxt#chain @@ -2101,7 +2101,7 @@ let commands_rw () = failwith "Only implicit accounts can submit transaction rollup commitments" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_commitment cctxt ~chain:cctxt#chain @@ -2157,7 +2157,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can finalize commitments" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_finalize_commitment cctxt ~chain:cctxt#chain @@ -2208,7 +2208,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can deposit/recover bonds" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_return_bond cctxt ~chain:cctxt#chain @@ -2260,7 +2260,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can remove commitments." | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_remove_commitment cctxt ~chain:cctxt#chain @@ -2368,7 +2368,7 @@ let commands_rw () = "Only implicit accounts can reject transaction rollup \ commitments." | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> submit_tx_rollup_rejection cctxt ~chain:cctxt#chain @@ -2466,7 +2466,7 @@ let commands_rw () = "Only implicit account can dispatch tickets for a transaction \ rollup." | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> tx_rollup_dispatch_tickets cctxt ~chain:cctxt#chain @@ -2550,7 +2550,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can transfer tickets." | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> transfer_ticket cctxt ~chain:cctxt#chain @@ -2623,7 +2623,7 @@ let commands_rw () = failwith "Only implicit accounts can originate smart-contract rollups" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let (module R : Sc_rollup.PVM.S) = pvm in let Michelson_v1_parser.{expanded; _} = parameters_ty in let parameters_ty = Script.lazy_expr expanded in @@ -2702,7 +2702,7 @@ let commands_rw () = "Could not read list of messages (expected list of bytes)" | messages -> return messages)) >>=? fun messages -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> sc_rollup_add_messages cctxt ~chain:cctxt#chain @@ -2766,7 +2766,7 @@ let commands_rw () = failwith "Only implicit accounts can cement commitments" | Implicit source -> return source) >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> sc_rollup_cement cctxt ~chain:cctxt#chain @@ -2870,7 +2870,7 @@ let commands_rw () = transactions" | Implicit source -> return source) >>=? fun source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> sc_rollup_execute_outbox_message cctxt ~chain:cctxt#chain @@ -2929,7 +2929,7 @@ let commands_rw () = | Originated _ -> failwith "Only implicit accounts can deposit/recover bonds" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> sc_rollup_recover_bond cctxt ~chain:cctxt#chain diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_fa12_commands.ml index a239d399e7503ea6a46a5561da285fc895e3e302..5f4c6ad726967413f2fa555596bb4400268dfe49 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_fa12_commands.ml @@ -110,14 +110,14 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt (caller : Contract.t) = match caller with | Originated _ -> failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, caller_pk, caller_sk) -> return (source, caller_pk, caller_sk) let commands_ro () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_multisig_commands.ml index f89f934b5d07324acfe38c996765f506a6aa0754..72a301368561517f6a3af7ea82190fe9ac18e4d8 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_multisig_commands.ml @@ -41,12 +41,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -128,7 +128,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let get_parameter_type (cctxt : #Protocol_client_context.full) @@ -195,7 +195,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.fee_parameter_args Client_proto_context_commands.verbose_signing_switch) @@ -240,9 +240,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys >>=? fun keys -> Client_proto_multisig.originate_multisig @@ -324,8 +325,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = {amount; destination; entrypoint; parameter_type; parameter}) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -354,8 +356,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Lambda lambda) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -365,7 +368,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -383,8 +386,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -405,8 +409,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -429,7 +434,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction @@ -441,8 +446,9 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () >>=? fun prepared_command -> - Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." @@ -495,7 +501,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> Client_proto_multisig.call_multisig cctxt ~chain:cctxt#chain @@ -565,7 +572,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> Lwt.return @@ Micheline_parser.no_parsing_error @@ Michelson_v1_parser.parse_expression lambda >>=? fun {expanded = lambda; _} -> @@ -605,7 +613,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -632,7 +640,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> Client_proto_multisig.call_multisig cctxt ~chain:cctxt#chain @@ -691,7 +700,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> Client_proto_multisig.call_multisig cctxt ~chain:cctxt#chain @@ -754,9 +764,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.call_multisig @@ -831,7 +842,8 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> ( - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source + >>=? fun (_, src_pk, src_sk) -> Client_proto_multisig.call_multisig_on_bytes cctxt ~chain:cctxt#chain @@ -942,7 +954,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -1003,7 +1015,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = new_keys (cctxt : #Protocol_client_context.full) -> List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys >>=? fun keys -> Client_proto_multisig.prepare_multisig_transaction diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_programs_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_programs_commands.ml index 48a2bae7a7f79a7fa1f2f35073695b56e9eaf425..3ec4884f9e17fa3e1e03c9506c79e67e5f3f4f70 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_programs_commands.ml @@ -133,7 +133,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") in @@ -662,10 +662,10 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> - Client_keys.sign cctxt sk bytes >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -676,7 +676,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -688,7 +688,7 @@ let commands () = (_, (key_locator, _)) signature (cctxt : #Protocol_client_context.full) -> - Client_keys.check key_locator signature bytes >>=? function + Client_keys_v0.check key_locator signature bytes >>=? function | false -> cctxt#error "invalid signature" | true -> if quiet then return_unit diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml index 7686a8356c232200a1811b85fb9da1eea6f7c03e..4b2bce49ed42c2231ae45eefadce6a99f25ba2d3 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml @@ -64,15 +64,15 @@ type origin = Explicit | Wallet_pkh | Wallet_alias of string type source = { pkh : public_key_hash; pk : public_key; - sk : Tezos_crypto.Signature.secret_key; + sk : Tezos_crypto.Signature.V0.secret_key; } type source_with_uri = { pkh : public_key_hash; pk : public_key; - pk_uri : Client_keys.pk_uri; - sk : Tezos_crypto.Signature.secret_key; - sk_uri : Client_keys.sk_uri; + pk_uri : Client_keys_v0.pk_uri; + sk : Tezos_crypto.Signature.V0.secret_key; + sk_uri : Client_keys_v0.sk_uri; } type input_source = @@ -85,7 +85,7 @@ type source_origin = {source : source; origin : origin} (** Destination of a call: either an implicit contract or an originated one with all the necessary data (entrypoint and the argument). *) type destination = - | Implicit of Tezos_crypto.Signature.Public_key_hash.t + | Implicit of Tezos_crypto.Signature.V0.Public_key_hash.t | Originated of Smart_contracts.invocation_parameters type transfer = { @@ -104,7 +104,7 @@ type state = { mutable pool : source_origin list; mutable pool_size : int; mutable shuffled_pool : source list; - mutable revealed : Tezos_crypto.Signature.Public_key_hash.Set.t; + mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; mutable last_block : Tezos_crypto.Block_hash.t; mutable last_level : int; mutable target_block : Tezos_crypto.Block_hash.t; @@ -162,9 +162,9 @@ let input_source_encoding = ~title:"explicit" (Tag 0) (obj3 - (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "pk" Tezos_crypto.Signature.Public_key.encoding) - (req "sk" Tezos_crypto.Signature.Secret_key.encoding)) + (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (req "pk" Tezos_crypto.Signature.V0.Public_key.encoding) + (req "sk" Tezos_crypto.Signature.V0.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -176,7 +176,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -241,20 +241,20 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + Tezos_crypto.Signature.V0.Secret_key.of_b58check + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( - Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >>= function - | Error _ -> Lwt.return_none - | Ok sk -> Lwt.return_some sk) + Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function + | Error _ -> None + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = cctxt#warning msg alias >>= fun () -> Lwt.return_none in - (Client_keys.alias_keys cctxt alias >>= function + (Client_keys_v0.alias_keys cctxt alias >>= function | Error _ | Ok None -> warning "Alias \"%s\" not found in the wallet" alias | Ok (Some (_, None, _)) | Ok (Some (_, _, None)) -> warning @@ -277,10 +277,10 @@ let normalize_source cctxt = in let key_from_wallet pkh = let warning msg pkh = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh + cctxt#warning msg Tezos_crypto.Signature.V0.Public_key_hash.pp pkh >>= fun () -> Lwt.return_none in - (Client_keys.get_key cctxt pkh >>= function + (Client_keys_v0.get_key cctxt pkh >>= function | Error _ -> warning "Pkh \"%a\" not found in the wallet" pkh | Ok (alias, pk, sk_uri) -> ( sk_of_sk_uri sk_uri >>= function @@ -288,7 +288,7 @@ let normalize_source cctxt = cctxt#warning "Cannot extract the secret key form the pkh \"%a\" (alias: \ \"%s\") of the wallet" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh alias >>= fun () -> Lwt.return_none @@ -347,7 +347,7 @@ let random_seed rng = let generate_fresh_source state = let seed = random_seed state.rng_state in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~seed () in + let pkh, pk, sk = Tezos_crypto.Signature.V0.generate_key ~seed () in let fresh = {source = {pkh; pk; sk}; origin = Explicit} in state.pool <- fresh :: state.pool ; state.pool_size <- state.pool_size + 1 ; @@ -440,7 +440,7 @@ let rec sample_transfer (cctxt : Protocol_client_context.full) chain block log Debug (fun () -> cctxt#message "sample_transfer: invalid balance %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src.pkh) >>= fun () -> (* Sampled source has zero balance: the transfer that created that @@ -485,8 +485,8 @@ let inject_contents (cctxt : Protocol_client_context.full) branch sk contents = in let signature = Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation + (Tezos_crypto.Signature.V0.sign + ~watermark:Tezos_crypto.Signature.V0.Generic_operation sk bytes) in @@ -539,7 +539,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state Alpha_services.Contract.counter cctxt (`Main, `Head 0) transfer.src.pkh >>=? fun current_counter -> (if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem transfer.src.pkh state.revealed then return true @@ -548,7 +548,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state revealed, or we immediately inject a reveal operation: in any case the key is revealed in the end. *) state.revealed <- - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add transfer.src.pkh state.revealed ; Alpha_services.Contract.manager_key cctxt (`Main, `Head 0) transfer.src.pkh @@ -577,7 +577,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Info (fun () -> cctxt#message "injecting reveal+transfer from %a (counters=%a,%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print reveal_counter @@ -602,7 +602,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Info (fun () -> cctxt#message "injecting transfer from %a (counter=%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print transf_counter @@ -1125,7 +1125,7 @@ let generate_random_transactions = let sources = List.sort_uniq (fun src1 src2 -> - Tezos_crypto.Signature.Secret_key.compare + Tezos_crypto.Signature.V0.Secret_key.compare src1.source.sk src2.source.sk) sources @@ -1155,7 +1155,7 @@ let generate_random_transactions = List.shuffle ~rng:rng_state (List.map (fun src_org -> src_org.source) sources); - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.level; target_block = current_target_block; @@ -1417,7 +1417,7 @@ let generate_account_funding_batches (starter_sources : source_with_uri list) (* Loads a wallet by reading directly the files to speed up things. *) let load_wallet cctxt ~source_pkh = let open Lwt_result_syntax in - let* keys = Client_keys.get_keys cctxt in + let* keys = Client_keys_v0.get_keys cctxt in (* Convert loaded and filter identities. We want to ban activator and bootstrap<1-5> in sandbox, as well as the "faucet source" on test networks. *) @@ -1432,14 +1432,14 @@ let load_wallet cctxt ~source_pkh = | [] -> return acc | (alias, pkh, _, _) :: tl when List.exists (String.equal alias) to_ban - || Tezos_crypto.Signature.Public_key_hash.equal pkh source_pkh -> + || Tezos_crypto.Signature.V0.Public_key_hash.equal pkh source_pkh -> aux acc tl | (_, pkh, pk, sk_uri) :: tl -> - let* pk_uri = Client_keys.neuterize sk_uri in + let* pk_uri = Client_keys_v0.neuterize sk_uri in let payload = Uri.path (sk_uri : Tezos_signer_backends.Unencrypted.sk_uri :> Uri.t) in - let sk = Tezos_crypto.Signature.Secret_key.of_b58check_exn payload in + let sk = Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn payload in aux ({pkh; pk; pk_uri; sk; sk_uri} :: acc) tl in aux [] keys @@ -1452,7 +1452,7 @@ let source_key_arg = "Source key public key hash from which the tokens will be transferred to \ start the funding." (parameter (fun _ s -> - let r = Tezos_crypto.Signature.Public_key_hash.of_b58check s in + let r = Tezos_crypto.Signature.V0.Public_key_hash.of_b58check s in match r with | Ok pkh -> Lwt_result_syntax.return pkh | Error e -> @@ -1728,7 +1728,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command (cctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in let* source_pk, source_sk = - let* _, src_pk, src_sk = Client_keys.get_key cctxt source_pkh in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source_pkh in return (src_pk, src_sk) in let*! () = log Notice (fun () -> cctxt#message "@.") in @@ -1737,7 +1737,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command cctxt#message "Starting funding from %a with parameters:@.- batch_size %d@.- \ batches_per_block %d@.- initial_amount %a@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh batch_size batches_per_block @@ -1804,7 +1804,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command source_balance Tez.pp req_balance - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh else let*! () = @@ -1813,7 +1813,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command "Transfering %a tz from %a (out of %a)@." Tez.pp req_balance - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh Tez.pp source_balance) diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_contracts.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_contracts.ml index 59076da0f11bf81df680b45400bd0a35c5118f84..046615615597f0b402d9074a5445bcc80bc87cda 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_contracts.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_contracts.ml @@ -179,7 +179,7 @@ let originate_command = | Originated _ -> failwith "only implicit accounts can be the source of an origination" | Implicit source -> - Client_keys.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> + Client_keys_v0.get_key cctxt source >>=? fun (_, src_pk, src_sk) -> let originate_one (scontract : smart_contract) = let fee_parameter = { diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_utils_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_utils_commands.ml index cd8c924cfff6b697a2a3ffc115ead8c973084188..d4a22b0e8ea96336511e65777c1bb2054d49e02e 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_utils_commands.ml @@ -80,7 +80,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -88,7 +88,7 @@ let commands () = Shell_services.Blocks.hash cctxt ~chain:cctxt#chain ~block:block_head () >>=? fun block -> sign_message cctxt ~src_sk ~block ~message >>=? fun signature -> - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group @@ -102,7 +102,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] @@ -134,7 +134,7 @@ let commands () = no_options (prefixes ["sign"; "block"] @@ unsigned_block_header_param @@ prefixes ["for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"signing delegate" @@ stop) @@ -149,8 +149,8 @@ let commands () = in Shell_services.Chain.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> - Client_keys.get_key cctxt delegate >>=? fun (_, _, sk) -> - Client_keys.sign + Client_keys_v0.get_key cctxt delegate >>=? fun (_, _, sk) -> + Client_keys_v0.sign cctxt ~watermark: (Protocol.Alpha_context.Block_header.to_watermark @@ -158,5 +158,6 @@ let commands () = sk unsigned_header >>=? fun s -> - cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.to_hex s) >>= return); + cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.V0.to_hex s) + >>= return); ] diff --git a/src/proto_014_PtKathma/lib_client_sapling/client_sapling_commands.ml b/src/proto_014_PtKathma/lib_client_sapling/client_sapling_commands.ml index 4c8cbdab0c9f325cf6c5f75ddb9b0e33a91b7db4..a3350a3cf1893c463341eacf0e2406ac70cdf2a6 100644 --- a/src/proto_014_PtKathma/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_014_PtKathma/lib_client_sapling/client_sapling_commands.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client let json_switch = Tezos_clic.switch ~long:"json" ~doc:"Use JSON format" () @@ -46,7 +46,8 @@ let keys_of_implicit_account cctxt (source : Protocol.Alpha_context.Contract.t) match source with | Originated _ -> assert false | Implicit src -> - Client_keys.get_key cctxt src >>=? fun (_, pk, sk) -> return (src, pk, sk) + Client_keys_v0.get_key cctxt src >>=? fun (_, pk, sk) -> + return (src, pk, sk) let viewing_key_of_string s = let exception Unknown_sapling_address in @@ -71,7 +72,7 @@ let bound_data_of_public_key_hash cctxt dst = let open Protocol.Michelson_v1_primitives in let pkh_bytes = Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding dst in let micheline_bytes = Micheline.(Bytes (0, pkh_bytes) |> strip_locations) in diff --git a/src/proto_014_PtKathma/lib_client_sapling/wallet.ml b/src/proto_014_PtKathma/lib_client_sapling/wallet.ml index ab43f45d388930bf1fe54235c2edd58573a7b577..e9403f19b76179c962467d103a75700208d49337 100644 --- a/src/proto_014_PtKathma/lib_client_sapling/wallet.ml +++ b/src/proto_014_PtKathma/lib_client_sapling/wallet.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client (* Transform a spending key to an uri, encrypted or not. *) diff --git a/src/proto_014_PtKathma/lib_delegate/baking_actions.ml b/src/proto_014_PtKathma/lib_delegate/baking_actions.ml index 58d91acbc7bac687eb2832c160806e5e52d6b5c5..6575167f0b5e6d601c80223636d8a0e5c8fb246f 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_actions.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_actions.ml @@ -205,7 +205,7 @@ let sign_block_header state proposer unsigned_block_header = >>=? function | false -> fail (Block_previously_baked {level; round}) | true -> - Client_keys.sign + Client_keys_v0.sign cctxt proposer.secret_key_uri ~watermark:Block_header.(to_watermark (Block_header chain_id)) @@ -383,7 +383,7 @@ let inject_preendorsements ~state_recorder state ~preendorsements ~updated_state Operation.unsigned_encoding unsigned_operation in - Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes + Client_keys_v0.sign cctxt ~watermark sk_uri unsigned_operation_bytes else fail (Baking_highwatermarks.Block_previously_preendorsed {round; level})) >>= function @@ -472,7 +472,7 @@ let sign_endorsements state endorsements = Operation.unsigned_encoding unsigned_operation in - Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes + Client_keys_v0.sign cctxt ~watermark sk_uri unsigned_operation_bytes else fail (Baking_highwatermarks.Block_previously_endorsed {round; level})) >>= function | Error err -> diff --git a/src/proto_014_PtKathma/lib_delegate/baking_commands.ml b/src/proto_014_PtKathma/lib_delegate/baking_commands.ml index e07e48e8fca662b2cd318436b3391be23c922db2..916b277cf05cfaa9df9cf863c8085314cc6762ca 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_commands.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_commands.ml @@ -166,7 +166,7 @@ let liquidity_baking_toggle_vote_arg = liquidity_baking_toggle_vote_parameter let get_delegates (cctxt : Protocol_client_context.full) - (pkhs : Tezos_crypto.Signature.public_key_hash list) = + (pkhs : Tezos_crypto.Signature.V0.public_key_hash list) = let proj_delegate (alias, public_key_hash, public_key, secret_key_uri) = { Baking_state.alias = Some alias; @@ -176,12 +176,12 @@ let get_delegates (cctxt : Protocol_client_context.full) } in (if pkhs = [] then - Client_keys.get_keys cctxt >>=? fun keys -> + Client_keys_v0.get_keys cctxt >>=? fun keys -> List.map proj_delegate keys |> return else List.map_es (fun pkh -> - Client_keys.get_key cctxt pkh >>=? function + Client_keys_v0.get_key cctxt pkh >>=? function | alias, pk, sk_uri -> return (proj_delegate (alias, pkh, pk, sk_uri))) pkhs) >>=? fun delegates -> @@ -202,7 +202,7 @@ let get_delegates (cctxt : Protocol_client_context.full) let sources_param = Tezos_clic.seq_of_param - (Client_keys.Public_key_hash.source_param + (Client_keys_v0.Public_key_hash.source_param ~name:"baker" ~desc:"name of the delegate owning the endorsement right") diff --git a/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml b/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml index 4af172f183fe5e13807314564a2a72cc1c1de5b5..c0d9e41a200a3d13c3ef478812aac068a75ba6aa 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml @@ -100,9 +100,9 @@ let () = (fun highwatermark -> Block_previously_endorsed highwatermark) module DelegateMap = Map.Make (struct - type t = Tezos_crypto.Signature.Public_key_hash.t + type t = Tezos_crypto.Signature.V0.Public_key_hash.t - let compare = Tezos_crypto.Signature.Public_key_hash.compare + let compare = Tezos_crypto.Signature.V0.Public_key_hash.compare end) let highwatermark_delegate_map_encoding = @@ -113,7 +113,7 @@ let highwatermark_delegate_map_encoding = fun l -> List.fold_left (fun map (k, v) -> add k v map) empty l) (list (obj2 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "highwatermark" highwatermark_encoding))) type highwatermarks = { diff --git a/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.mli b/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.mli index 30d4d6f4ea3ea04f27408ebd410cbb49bf72ede8..59138855ba6453acd1049a5903aabcae1e502bc8 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.mli +++ b/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.mli @@ -45,7 +45,7 @@ val load : val may_sign_block : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -53,7 +53,7 @@ val may_sign_block : val may_sign_preendorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -61,7 +61,7 @@ val may_sign_preendorsement : val may_sign_endorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -69,7 +69,7 @@ val may_sign_endorsement : val record_block : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t @@ -77,7 +77,7 @@ val record_block : val record_preendorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t @@ -85,7 +85,7 @@ val record_preendorsement : val record_endorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml index a3b0bf620a2a283a68f383da02f3b79dc61876be..7fa8d6ba1af9d3373fb1cc13bfbee763a4e28c90 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml @@ -210,7 +210,7 @@ let generate_seed_nonce (nonce_config : Baking_configuration.nonce_config) (match nonce_config with | Deterministic -> let data = Data_encoding.Binary.to_bytes_exn Raw_level.encoding level in - Client_keys.deterministic_nonce delegate.secret_key_uri data + Client_keys_v0.deterministic_nonce delegate.secret_key_uri data >>=? fun nonce -> return (Data_encoding.Binary.of_bytes_exn Nonce.encoding nonce) | Random -> ( @@ -247,7 +247,9 @@ let inject_seed_nonce_revelation (cctxt : #Protocol_client_context.full) ~chain () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat + bytes + Tezos_crypto.Signature.V0.zero in Shell_services.Injection.operation ~async:true cctxt ~chain bytes >>=? fun oph -> diff --git a/src/proto_014_PtKathma/lib_delegate/baking_state.ml b/src/proto_014_PtKathma/lib_delegate/baking_state.ml index 65e7d5a5cc888989c6c59a69949f90d02067ac82..c61c4d4ba6bbd520aae912e3e54d1c50dcde4bf0 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.ml @@ -31,9 +31,9 @@ open Protocol_client_context public key, its public key hash, and its secret key. *) type delegate = { alias : string option; - public_key : Tezos_crypto.Signature.Public_key.t; - public_key_hash : Tezos_crypto.Signature.Public_key_hash.t; - secret_key_uri : Client_keys.sk_uri; + public_key : Tezos_crypto.Signature.V0.Public_key.t; + public_key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t; + secret_key_uri : Client_keys_v0.sk_uri; } let delegate_encoding = @@ -50,14 +50,16 @@ let delegate_encoding = public_key; public_key_hash; secret_key_uri = - (match Client_keys.make_sk_uri (Uri.of_string secret_key_uri) with + (match Client_keys_v0.make_sk_uri (Uri.of_string secret_key_uri) with | Ok sk -> sk | Error e -> Format.kasprintf Stdlib.failwith "%a" pp_print_trace e); }) (obj4 (req "alias" (option string)) - (req "public_key" Tezos_crypto.Signature.Public_key.encoding) - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "secret_key_uri" string)) let pp_delegate fmt {alias; public_key_hash; _} = @@ -66,14 +68,14 @@ let pp_delegate fmt {alias; public_key_hash; _} = Format.fprintf fmt "%a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp public_key_hash | Some alias -> Format.fprintf fmt "%s (%a)" alias - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp public_key_hash type validation_mode = Node | Local of Abstract_context_index.t @@ -222,7 +224,7 @@ module SlotMap : Map.S with type key = Slot.t = Map.Make (Slot) other words the list of rounds when it will be the proposer), and its endorsing power. *) type endorsing_slot = { - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; slots : Slot.t list; endorsing_power : int; } @@ -584,7 +586,7 @@ module DelegateSet = struct type t = delegate let compare {public_key_hash = pkh; _} {public_key_hash = pkh'; _} = - Tezos_crypto.Signature.Public_key_hash.compare pkh pkh' + Tezos_crypto.Signature.V0.Public_key_hash.compare pkh pkh' end) let find_pkh pkh s = @@ -592,7 +594,7 @@ module DelegateSet = struct try iter (fun ({public_key_hash; _} as delegate) -> - if Tezos_crypto.Signature.Public_key_hash.equal pkh public_key_hash + if Tezos_crypto.Signature.V0.Public_key_hash.equal pkh public_key_hash then raise (Found delegate) else ()) s ; diff --git a/src/proto_014_PtKathma/lib_delegate/baking_state.mli b/src/proto_014_PtKathma/lib_delegate/baking_state.mli index ef7db2844dd12a337cd489f216c3ac666b8274dc..86a673e0d0c68cf428de714071b3c3c2b700770b 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.mli +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.mli @@ -28,9 +28,9 @@ open Alpha_context type delegate = { alias : string option; - public_key : Tezos_crypto.Signature.public_key; - public_key_hash : Tezos_crypto.Signature.public_key_hash; - secret_key_uri : Client_keys.sk_uri; + public_key : Tezos_crypto.Signature.V0.public_key; + public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; + secret_key_uri : Client_keys_v0.sk_uri; } val delegate_encoding : delegate Data_encoding.t @@ -88,7 +88,7 @@ val round_of_shell_header : Block_header.shell_header -> Round.t tzresult module SlotMap : Map.S with type key = Slot.t type endorsing_slot = { - delegate : Tezos_crypto.Signature.public_key_hash; + delegate : Tezos_crypto.Signature.V0.public_key_hash; slots : Slot.t trace; endorsing_power : int; } diff --git a/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml b/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml index 6dc6d5e9abb11155f89c728d8bc002a41d6d98ab..23f95c9075e6426d2f4f7518c3c5caaec945385b 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml @@ -156,7 +156,9 @@ let inject_vdf_revelation cctxt hash chain_id solution = ~solution () in - let bytes = Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero in + let bytes = + Tezos_crypto.Signature.V0.concat bytes Tezos_crypto.Signature.V0.zero + in Shell_services.Injection.operation cctxt ~chain bytes (* Checks if the VDF setup saved in the state is equal to the one computed diff --git a/src/proto_014_PtKathma/lib_delegate/block_forge.ml b/src/proto_014_PtKathma/lib_delegate/block_forge.ml index dcd4e7228e820a786873ac4230870ed6f309317e..3301fe0c874362509ac91abf085bb7b922ea3472 100644 --- a/src/proto_014_PtKathma/lib_delegate/block_forge.ml +++ b/src/proto_014_PtKathma/lib_delegate/block_forge.ml @@ -52,7 +52,7 @@ let forge_faked_protocol_data ?(payload_hash = Block_payload_hash.zero) proof_of_work_nonce = Baking_pow.empty_proof_of_work_nonce; liquidity_baking_toggle_vote; }; - signature = Tezos_crypto.Signature.zero; + signature = Tezos_crypto.Signature.V0.zero; } let convert_operation (op : packed_operation) : Tezos_base.Operation.t = @@ -385,7 +385,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info let unsigned_block_header = { Block_header.shell = shell_header; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; } in return {unsigned_block_header; operations} diff --git a/src/proto_014_PtKathma/lib_delegate/client_baking_denunciation.ml b/src/proto_014_PtKathma/lib_delegate/client_baking_denunciation.ml index 784a4f38989f9b45da1f6e6d23c63b67a3d114a1..719e3621f7d68ea5863a6209bebf3dbed7ebeeaf 100644 --- a/src/proto_014_PtKathma/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_014_PtKathma/lib_delegate/client_baking_denunciation.ml @@ -40,7 +40,7 @@ module HLevel = Hashtbl.Make (struct end) (* Blocks are associated to the delegates who baked them *) -module Delegate_Map = Map.Make (Tezos_crypto.Signature.Public_key_hash) +module Delegate_Map = Map.Make (Tezos_crypto.Signature.V0.Public_key_hash) (* (pre)endorsements are associated to the slot they are injected with; we rely on the fact that there is a unique canonical slot @@ -177,7 +177,7 @@ let process_consensus_op (type kind) cctxt () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat bytes Tezos_crypto.Signature.V0.zero in let double_op_detected, double_op_denounced = Events.( @@ -307,7 +307,9 @@ let process_block (cctxt : #Protocol_client_context.full) state () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat + bytes + Tezos_crypto.Signature.V0.zero in Events.(emit double_baking_detected) () >>= fun () -> Shell_services.Injection.operation cctxt ~chain bytes diff --git a/src/proto_014_PtKathma/lib_delegate/operation_selection.ml b/src/proto_014_PtKathma/lib_delegate/operation_selection.ml index eec3576100decd57f70f13a4ab2329e24480c1fd..34b1851b8690648abb7b1d3fdd314808012bda10 100644 --- a/src/proto_014_PtKathma/lib_delegate/operation_selection.ml +++ b/src/proto_014_PtKathma/lib_delegate/operation_selection.ml @@ -58,7 +58,7 @@ module PrioritizedManagerSet = Set.Make (struct {source = source'; counter = counter'; weight = weight'; op = op'; _} = (* Be careful with the [compare] *) let cmp_src = - Tezos_crypto.Signature.Public_key_hash.compare source source' + Tezos_crypto.Signature.V0.Public_key_hash.compare source source' in if cmp_src = 0 then (* we want the smallest counter first *) diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml index 2e739c50fc34757ed72441e0691dcb7838f000ca..4d346224f60b160ce0ae0084b9832ece44e65c7d 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -801,8 +801,8 @@ let baker_process ~(delegates : Baking_state.delegate list) ~base_dir Baking_state.delegate) -> let open Tezos_client_base in let name = alias |> WithExceptions.Option.get ~loc:__LOC__ in - Client_keys.neuterize secret_key_uri >>=? fun public_key_uri -> - Client_keys.register_key + Client_keys_v0.neuterize secret_key_uri >>=? fun public_key_uri -> + Client_keys_v0.register_key wallet ~force:false (public_key_hash, public_key_uri, secret_key_uri) @@ -835,7 +835,7 @@ let baker_process ~(delegates : Baking_state.delegate list) ~base_dir Lwt.pick [listener_process (); baker_process ()] >>=? fun () -> User_hooks.check_chain_on_success ~chain:state.chain -let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) +let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.V0.secret_key) (predecessor_block_hash : Tezos_crypto.Block_hash.t) (block_header : Block_header.shell_header) : Bytes.t = let proof_of_work_nonce = @@ -865,7 +865,7 @@ let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) (block_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) baker_sk @@ -881,7 +881,7 @@ let deduce_baker_sk (Protocol.Alpha_context.Parameters.bootstrap_account * Tezos_mockup_commands.Mockup_wallet.bootstrap_secret) list) (total_accounts : int) (level : int) : - Tezos_crypto.Signature.secret_key tzresult Lwt.t = + Tezos_crypto.Signature.V0.secret_key tzresult Lwt.t = (match (total_accounts, level) with | _, 0 -> return 0 (* apparently this doesn't really matter *) | _ -> @@ -896,7 +896,7 @@ let deduce_baker_sk |> WithExceptions.Option.get ~loc:__LOC__ in let secret_key = - Tezos_crypto.Signature.Secret_key.of_b58check_exn + Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn (Uri.path (secret.sk_uri :> Uri.t)) in return secret_key @@ -1073,7 +1073,7 @@ type config = { round1 : int64; timeout : int; delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + (int32 * (int32 * Tezos_crypto.Signature.V0.public_key_hash) list) list; initial_seed : State_hash.t option; consensus_committee_size : int; consensus_threshold : int; @@ -1108,7 +1108,7 @@ let make_baking_delegate } let run ?(config = default_config) bakers_spec = - Tezos_client_base.Client_keys.register_signer + Tezos_client_base.Client_keys_v0.register_signer (module Tezos_signer_backends.Unencrypted) ; let total_accounts = List.fold_left (fun acc (n, _) -> acc + n) 0 bakers_spec @@ -1209,7 +1209,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) (block_header.shell, protocol_data.contents) in if - Tezos_crypto.Signature.check + Tezos_crypto.Signature.V0.check ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) public_key @@ -1221,7 +1221,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) "unexpected signature for %a; tried with %a@." Tezos_crypto.Block_hash.pp block_hash - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp public_key type op_predicate = @@ -1258,7 +1258,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) Alpha_context.Operation.to_watermark (Endorsement chain_id) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation) + | _ -> Tezos_crypto.Signature.V0.Generic_operation) | _ -> failwith "unexpected contents in %a@." @@ -1278,7 +1278,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) (op.shell, Contents_list d.contents) in return - (Tezos_crypto.Signature.check + (Tezos_crypto.Signature.V0.check ~watermark public_key signature diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.mli b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.mli index a541c900fe5b6c4d41605e36361044430bf90f26..125c64ea1d768b0eece078e094aa94e15f3a2e80 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.mli +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.mli @@ -145,7 +145,7 @@ type config = { longer to terminate it'll be aborted with an error. *) delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + (int32 * (int32 * Tezos_crypto.Signature.V0.public_key_hash) list) list; (** Desired selection of delegates per level/round *) initial_seed : State_hash.t option; (** Optional initial seed for protocol (used to control delegate selection) *) @@ -177,21 +177,21 @@ val default_config : config to the final result. *) val run : ?config:config -> (int * (module Hooks)) list -> unit tzresult Lwt.t -val bootstrap1 : Tezos_crypto.Signature.public_key +val bootstrap1 : Tezos_crypto.Signature.V0.public_key -val bootstrap2 : Tezos_crypto.Signature.public_key +val bootstrap2 : Tezos_crypto.Signature.V0.public_key -val bootstrap3 : Tezos_crypto.Signature.public_key +val bootstrap3 : Tezos_crypto.Signature.V0.public_key -val bootstrap4 : Tezos_crypto.Signature.public_key +val bootstrap4 : Tezos_crypto.Signature.V0.public_key -val bootstrap5 : Tezos_crypto.Signature.public_key +val bootstrap5 : Tezos_crypto.Signature.V0.public_key (** Check if a block header is signed by a given delegate. *) val check_block_signature : block_hash:Tezos_crypto.Block_hash.t -> block_header:Block_header.t -> - public_key:Tezos_crypto.Signature.public_key -> + public_key:Tezos_crypto.Signature.V0.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) @@ -224,7 +224,7 @@ val mempool_has_op_ref : (** Check if an operation is signed by the given delegate. *) val op_is_signed_by : - public_key:Tezos_crypto.Signature.public_key -> op_predicate + public_key:Tezos_crypto.Signature.V0.public_key -> op_predicate (** Check that an operation is a preendorsement. *) val op_is_preendorsement : ?level:int32 -> ?round:int32 -> op_predicate diff --git a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.ml b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.ml index 54054d23b97e8a4eaa4b8415dbfec0b1277ffa21..c95313d796dce88d5993ec7d0a3839bd103dc78f 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.ml @@ -27,7 +27,7 @@ open Protocol type delegate_selection = (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) + * (Round_repr.t * Tezos_crypto.Signature.V0.public_key_hash) list) list module LevelRoundMap = Map.Make (struct @@ -39,7 +39,8 @@ module LevelRoundMap = Map.Make (struct (Raw_level_repr.to_int32 l2.Level_repr.level, Round_repr.to_int32 r2) end) -let _ = Client_keys.register_signer (module Tezos_signer_backends.Unencrypted) +let _ = + Client_keys_v0.register_signer (module Tezos_signer_backends.Unencrypted) (* Initialize a context in memory with the Mockup *) let init_context ?constants_overrides_json ?bootstrap_accounts_json parameters = @@ -105,7 +106,7 @@ let check ctxt ~selection = Delegate_storage.baking_rights_owner ctxt level ~round >|= Environment.wrap_tzresult >>=? fun (ctxt, _, (_, pkh)) -> - if not (Tezos_crypto.Signature.Public_key_hash.equal delegate pkh) + if not (Tezos_crypto.Signature.V0.Public_key_hash.equal delegate pkh) then raise Exit else return ctxt) selection diff --git a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.mli b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.mli index c13cc23edb6002253f31f4d91e524a6833584dfd..ccfdad3bf387c8bcc7c7c597f60a9a049700e96a 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.mli +++ b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/lib/tenderbrute.mli @@ -30,7 +30,7 @@ open Protocol specified level and rounds are not constrained. *) type delegate_selection = (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) + * (Round_repr.t * Tezos_crypto.Signature.V0.public_key_hash) list) list (** Brute-force an initial seed nonce for the desired delegate selection. diff --git a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/tenderbrute_main.ml b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/tenderbrute_main.ml index 123db4e59248226fa738d75b7e6225a6cac5e88d..c6b659b6eeae815d22f2a175d5ec361322752945 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/tenderbrute_main.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/tenderbrute/tenderbrute_main.ml @@ -49,7 +49,7 @@ let delegate_encoding = case ~title:"Public key hash" (Tag 0) - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding (function `Pkh p -> Some p | _ -> None) (fun p -> `Pkh p); case diff --git a/src/proto_014_PtKathma/lib_delegate/test/test_scenario.ml b/src/proto_014_PtKathma/lib_delegate/test/test_scenario.ml index f10b60904c24c39e2620965ed7886a116c8d2744..381962fee1a59eeaf893c82c280c7d3959eb76d0 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/test_scenario.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/test_scenario.ml @@ -1,14 +1,14 @@ open Mockup_simulator -let bootstrap1 = Tezos_crypto.Signature.Public_key.hash bootstrap1 +let bootstrap1 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap1 -let bootstrap2 = Tezos_crypto.Signature.Public_key.hash bootstrap2 +let bootstrap2 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap2 -let bootstrap3 = Tezos_crypto.Signature.Public_key.hash bootstrap3 +let bootstrap3 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap3 -let bootstrap4 = Tezos_crypto.Signature.Public_key.hash bootstrap4 +let bootstrap4 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap4 -let bootstrap5 = Tezos_crypto.Signature.Public_key.hash bootstrap5 +let bootstrap5 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap5 let some_seed s = Some (Protocol.State_hash.of_b58check_exn s) diff --git a/src/proto_014_PtKathma/lib_injector/common.ml b/src/proto_014_PtKathma/lib_injector/common.ml index 3612ecfafb28b1d375c5866ae6713f69597ceecb..69c4376cd88d904ea99de9f74aa0ab4321c28e65 100644 --- a/src/proto_014_PtKathma/lib_injector/common.ml +++ b/src/proto_014_PtKathma/lib_injector/common.ml @@ -27,14 +27,14 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } let get_signer cctxt pkh = let open Lwt_result_syntax in - let* alias, pk, sk = Client_keys.get_key cctxt pkh in + let* alias, pk, sk = Client_keys_v0.get_key cctxt pkh in return {alias; pkh; pk; sk} type 'block reorg = {old_chain : 'block list; new_chain : 'block list} diff --git a/src/proto_014_PtKathma/lib_injector/common.mli b/src/proto_014_PtKathma/lib_injector/common.mli index bff16a3f72e1563bf4f825bcdf6c97a63d7b0000..6e9cbff0c20db099af25f65cf15d2c2500846250 100644 --- a/src/proto_014_PtKathma/lib_injector/common.mli +++ b/src/proto_014_PtKathma/lib_injector/common.mli @@ -28,9 +28,9 @@ open Protocol_client_context (** The type of signers for operations injected by the injector *) type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) @@ -45,7 +45,7 @@ type 'block reorg = { (** Retrieve a signer from the client wallet. *) val get_signer : #Client_context.wallet -> - Tezos_crypto.Signature.public_key_hash -> + Tezos_crypto.Signature.V0.public_key_hash -> signer tzresult Lwt.t val no_reorg : 'a reorg diff --git a/src/proto_014_PtKathma/lib_injector/injector_errors.ml b/src/proto_014_PtKathma/lib_injector/injector_errors.ml index e638807b51541636fd77adb9df362e9e3cb821e1..b0e69ff4f6dab1b602eb8e5b0124a6d02ffdf274 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_errors.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_errors.ml @@ -23,7 +23,8 @@ (* *) (*****************************************************************************) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t let () = register_error_kind @@ -35,11 +36,11 @@ let () = Format.fprintf ppf "No worker for source %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp s) `Permanent Data_encoding.( - obj1 (req "source" Tezos_crypto.Signature.Public_key_hash.encoding)) + obj1 (req "source" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function No_worker_for_source s -> Some s | _ -> None) (fun s -> No_worker_for_source s) diff --git a/src/proto_014_PtKathma/lib_injector/injector_errors.mli b/src/proto_014_PtKathma/lib_injector/injector_errors.mli index ac6a0727965735282124f40140d48bce07460072..4676461a00af0dee365c7c1461c0b7a15b234334 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_errors.mli +++ b/src/proto_014_PtKathma/lib_injector/injector_errors.mli @@ -25,7 +25,8 @@ (** Error when the injector has no worker for the source which must inject an operation. *) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t (** Error when the injector has no worker for the tag of the operation to be injected. *) diff --git a/src/proto_014_PtKathma/lib_injector/injector_events.ml b/src/proto_014_PtKathma/lib_injector/injector_events.ml index 7fbfdd1fd99b8f764a190d912aee935f09a7b4bf..7789fe3352a6f366237925e0d21f99d82d5579c7 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_events.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_events.ml @@ -37,10 +37,10 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 @@ -50,11 +50,11 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 @@ -65,12 +65,12 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 enc3 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 diff --git a/src/proto_014_PtKathma/lib_injector/injector_functor.ml b/src/proto_014_PtKathma/lib_injector/injector_functor.ml index e5244531d41cc4ecc142db7b8f66d7d9dab68e2a..dbb2eb77887a54a78fa141d435f41d698049fe7b 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_functor.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_functor.ml @@ -507,9 +507,9 @@ module Make (Rollup : PARAMETERS) = struct Data_encoding.Binary.to_bytes_exn Operation.unsigned_encoding unsigned_op in let* signature = - Client_keys.sign + Client_keys_v0.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -619,14 +619,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = - match state.signer.pkh with - | Tezos_crypto.Signature.Ed25519 _ -> - Tezos_crypto.Signature.of_ed25519 Tezos_crypto.Ed25519.zero - | Secp256k1 _ -> - Tezos_crypto.Signature.of_secp256k1 Tezos_crypto.Secp256k1.zero - | P256 _ -> Tezos_crypto.Signature.of_p256 Tezos_crypto.P256.zero - in + let signature = Tezos_crypto.Signature.V0.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { @@ -924,7 +917,7 @@ module Make (Rollup : PARAMETERS) = struct let tags = Tags.of_list tags in let strategy, tags = match - Tezos_crypto.Signature.Public_key_hash.Map.find_opt signer acc + Tezos_crypto.Signature.V0.Public_key_hash.Map.find_opt signer acc with | None -> (strategy, tags) | Some (other_strategy, other_tags) -> @@ -939,14 +932,14 @@ module Make (Rollup : PARAMETERS) = struct in (strategy, Tags.union other_tags tags) in - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add signer (strategy, tags) acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty + Tezos_crypto.Signature.V0.Public_key_hash.Map.empty signers in - Tezos_crypto.Signature.Public_key_hash.Map.iter_es + Tezos_crypto.Signature.V0.Public_key_hash.Map.iter_es (fun signer (strategy, tags) -> let+ worker = Worker.launch diff --git a/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml b/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml index 2f0afaeb7f17aac76a006518b04a408a741e4068..3633c6397c61ea58f3091815bb1012ae63c63a8f 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml @@ -98,11 +98,11 @@ end module Name = struct type t = public_key_hash - let encoding = Tezos_crypto.Signature.Public_key_hash.encoding + let encoding = Tezos_crypto.Signature.V0.Public_key_hash.encoding let base = ["tx_rollup_injector"] - let pp = Tezos_crypto.Signature.Public_key_hash.pp_short + let pp = Tezos_crypto.Signature.V0.Public_key_hash.pp_short - let equal = Tezos_crypto.Signature.Public_key_hash.equal + let equal = Tezos_crypto.Signature.V0.Public_key_hash.equal end diff --git a/src/proto_014_PtKathma/lib_injector/l1_operation.ml b/src/proto_014_PtKathma/lib_injector/l1_operation.ml index 6d9776258e79b229dd1423c51896ba45c5ec81b7..a023725ebd35fa754697497cc2ac1cf972a6ccac 100644 --- a/src/proto_014_PtKathma/lib_injector/l1_operation.ml +++ b/src/proto_014_PtKathma/lib_injector/l1_operation.ml @@ -145,7 +145,7 @@ module Manager_operation = struct ty pp_lazy_expr contents - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp claimer in Format.fprintf diff --git a/src/proto_014_PtKathma/lib_parameters/default_parameters.ml b/src/proto_014_PtKathma/lib_parameters/default_parameters.ml index 501895e461a183d0d2cafe3b5a624878b31a1a58..6a473850a0c657c800bae663da4a98948c341964 100644 --- a/src/proto_014_PtKathma/lib_parameters/default_parameters.ml +++ b/src/proto_014_PtKathma/lib_parameters/default_parameters.ml @@ -333,8 +333,10 @@ let bootstrap_balance = Tez.of_mutez_exn 4_000_000_000_000L let compute_accounts = List.map (fun s -> - let public_key = Tezos_crypto.Signature.Public_key.of_b58check_exn s in - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key = Tezos_crypto.Signature.V0.Public_key.of_b58check_exn s in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in Parameters. { public_key_hash; diff --git a/src/proto_014_PtKathma/lib_parameters/default_parameters.mli b/src/proto_014_PtKathma/lib_parameters/default_parameters.mli index 64b33d4af4ceb9248bca5a310bd2006d853b3943..90bacb2bd0915d8971c63c7d3f5555b024202798 100644 --- a/src/proto_014_PtKathma/lib_parameters/default_parameters.mli +++ b/src/proto_014_PtKathma/lib_parameters/default_parameters.mli @@ -35,10 +35,10 @@ val constants_test : Constants.Parametric.t val test_commitments : Commitment.t list lazy_t val make_bootstrap_account : - Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key + Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key * Tez.t - * Tezos_crypto.Signature.public_key_hash option -> + * Tezos_crypto.Signature.V0.public_key_hash option -> Parameters.bootstrap_account val parameters_of_constants : diff --git a/src/proto_014_PtKathma/lib_plugin/RPC.ml b/src/proto_014_PtKathma/lib_plugin/RPC.ml index ef87cdc1077036bcec8b4070b8da03c56bd4bbb5..408b715712e48af44518bebe7b1d834213831602 100644 --- a/src/proto_014_PtKathma/lib_plugin/RPC.ml +++ b/src/proto_014_PtKathma/lib_plugin/RPC.ml @@ -819,7 +819,7 @@ module Scripts = struct let operation : _ operation = {shell; protocol_data} in let hash = Operation.hash {shell; protocol_data} in let ctxt = Origination_nonce.init ctxt hash in - let payload_producer = Tezos_crypto.Signature.Public_key_hash.zero in + let payload_producer = Tezos_crypto.Signature.V0.Public_key_hash.zero in Validate_operation.TMP_for_plugin .precheck_manager__do_nothing_on_non_manager_op ctxt @@ -2456,7 +2456,7 @@ let requested_levels ~default_level ctxt cycles levels = module Baking_rights = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; round : Round.t; timestamp : Timestamp.t option; } @@ -2470,7 +2470,7 @@ module Baking_rights = struct {level; delegate; round; timestamp}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "round" Round.encoding) (opt "estimated_time" Timestamp.encoding)) @@ -2484,7 +2484,7 @@ module Baking_rights = struct type baking_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; max_round : int option; all : bool; } @@ -2559,16 +2559,16 @@ module Baking_rights = struct @@ List.fold_left (fun (acc, previous) r -> if - Tezos_crypto.Signature.Public_key_hash.Set.exists - (Tezos_crypto.Signature.Public_key_hash.equal r.delegate) + Tezos_crypto.Signature.V0.Public_key_hash.Set.exists + (Tezos_crypto.Signature.V0.Public_key_hash.equal r.delegate) previous then (acc, previous) else ( r :: acc, - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add r.delegate previous )) - ([], Tezos_crypto.Signature.Public_key_hash.Set.empty) + ([], Tezos_crypto.Signature.V0.Public_key_hash.Set.empty) rights let register () = @@ -2603,7 +2603,7 @@ module Baking_rights = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) @@ -2620,7 +2620,7 @@ end module Endorsing_rights = struct type delegate_rights = { - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; first_slot : Slot.t; endorsing_power : int; } @@ -2639,7 +2639,7 @@ module Endorsing_rights = struct (fun (delegate, first_slot, endorsing_power) -> {delegate; first_slot; endorsing_power}) (obj3 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "first_slot" Slot.encoding) (req "endorsing_power" uint16)) @@ -2663,7 +2663,7 @@ module Endorsing_rights = struct type endorsing_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let endorsing_rights_query = @@ -2740,7 +2740,7 @@ module Endorsing_rights = struct (fun rights_at_level -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in match @@ -2763,7 +2763,7 @@ end module Validators = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Tezos_crypto.Signature.V0.Public_key_hash.t; slots : Slot.t list; } @@ -2774,7 +2774,7 @@ module Validators = struct (fun (level, delegate, slots) -> {level; delegate; slots}) (obj3 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "slots" (list Slot.encoding))) module S = struct @@ -2784,7 +2784,7 @@ module Validators = struct type validators_query = { levels : Raw_level.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Tezos_crypto.Signature.V0.Public_key_hash.t list; } let validators_query = @@ -2834,7 +2834,7 @@ module Validators = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Tezos_crypto.Signature.V0.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights) diff --git a/src/proto_014_PtKathma/lib_plugin/mempool.ml b/src/proto_014_PtKathma/lib_plugin/mempool.ml index 8ea7180db2ee381c956e1f1a9d45f4e0db0462da..ec8fd1093b1b97606057c942d2aab0105adaf69f 100644 --- a/src/proto_014_PtKathma/lib_plugin/mempool.ml +++ b/src/proto_014_PtKathma/lib_plugin/mempool.ml @@ -206,14 +206,15 @@ type state = { grandparent_level_start : Timestamp.t option; round_zero_duration : Period.t option; op_prechecked_managers : - manager_op_info Tezos_crypto.Signature.Public_key_hash.Map.t; + manager_op_info Tezos_crypto.Signature.V0.Public_key_hash.Map.t; (** All managers that are the source of manager operations prechecked in the mempool. Each manager in the map is associated to a record of type [manager_op_info] (See for record details above). Each manager in the map should be accessible with an operation hash in [operation_hash_to_manager]. *) operation_hash_to_manager : - Tezos_crypto.Signature.Public_key_hash.t Tezos_crypto.Operation_hash.Map.t; + Tezos_crypto.Signature.V0.Public_key_hash.t + Tezos_crypto.Operation_hash.Map.t; (** Map of operation hash to manager used to remove a manager from [op_prechecked_managers] with an operation hash. Each manager in the map should also be in [op_prechecked_managers]. *) @@ -235,7 +236,7 @@ let empty : state = { grandparent_level_start = None; round_zero_duration = None; - op_prechecked_managers = Tezos_crypto.Signature.Public_key_hash.Map.empty; + op_prechecked_managers = Tezos_crypto.Signature.V0.Public_key_hash.Map.empty; operation_hash_to_manager = Tezos_crypto.Operation_hash.Map.empty; prechecked_operations_count = 0; ops_prechecked = ManagerOpWeightSet.empty; @@ -313,7 +314,7 @@ let remove ~(filter_state : state) oph = in let removed_op = ref None in let op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.update + Tezos_crypto.Signature.V0.Public_key_hash.Map.update source (function | None -> None @@ -497,7 +498,7 @@ let better_fees_and_ratio = let check_manager_restriction config filter_state source ~fee ~gas_limit = match - Tezos_crypto.Signature.Public_key_hash.Map.find + Tezos_crypto.Signature.V0.Public_key_hash.Map.find source filter_state.op_prechecked_managers with @@ -1075,7 +1076,7 @@ let add_manager_restriction filter_state oph info source replacement = filter_state with op_prechecked_managers = (* Manager not seen yet, record it for next ops *) - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add source info filter_state.op_prechecked_managers; diff --git a/src/proto_014_PtKathma/lib_plugin/test/generators.ml b/src/proto_014_PtKathma/lib_plugin/test/generators.ml index 61a08b89bfc9738609ef5a4a4a7eaf855d2b5dc6..54628a715c1523653ce25a17b56cef247234da53 100644 --- a/src/proto_014_PtKathma/lib_plugin/test/generators.ml +++ b/src/proto_014_PtKathma/lib_plugin/test/generators.ml @@ -26,14 +26,14 @@ let string_gen = QCheck2.Gen.small_string ?gen:None let public_key_hash_gen : - (Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key - * Tezos_crypto.Signature.secret_key) + (Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key + * Tezos_crypto.Signature.V0.secret_key) QCheck2.Gen.t = let open QCheck2.Gen in let+ seed = string_size (32 -- 64) in let seed = Bytes.of_string seed in - Tezos_crypto.Signature.generate_key ~seed () + Tezos_crypto.Signature.V0.generate_key ~seed () (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) @@ -51,7 +51,7 @@ let dummy_manager_op_info oph = } let dummy_manager_op_info_with_key_gen : - (Plugin.Mempool.manager_op_info * Tezos_crypto.Signature.public_key_hash) + (Plugin.Mempool.manager_op_info * Tezos_crypto.Signature.V0.public_key_hash) QCheck2.Gen.t = let open QCheck2.Gen in let+ oph, (pkh, _, _) = pair operation_hash_gen public_key_hash_gen in @@ -86,7 +86,7 @@ let filter_state_gen : Plugin.Mempool.state QCheck2.Gen.t = { state with op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add pkh info state.op_prechecked_managers; @@ -105,7 +105,7 @@ let filter_state_gen : Plugin.Mempool.state QCheck2.Gen.t = let with_filter_state_operation_gen : Plugin.Mempool.state -> - (Plugin.Mempool.manager_op_info * Tezos_crypto.Signature.public_key_hash) + (Plugin.Mempool.manager_op_info * Tezos_crypto.Signature.V0.public_key_hash) QCheck2.Gen.t = fun state -> let open QCheck2.Gen in @@ -122,7 +122,8 @@ let with_filter_state_operation_gen : let filter_state_with_operation_gen : (Plugin.Mempool.state - * (Plugin.Mempool.manager_op_info * Tezos_crypto.Signature.public_key_hash)) + * (Plugin.Mempool.manager_op_info + * Tezos_crypto.Signature.V0.public_key_hash)) QCheck2.Gen.t = let open QCheck2.Gen in filter_state_gen >>= fun state -> diff --git a/src/proto_014_PtKathma/lib_plugin/test/test_filter_state.ml b/src/proto_014_PtKathma/lib_plugin/test/test_filter_state.ml index fa065244efa8251fd6f6a017d3b7fd10422e5c7e..18946bd42fbdca21481024a8be33663f4101d551 100644 --- a/src/proto_014_PtKathma/lib_plugin/test/test_filter_state.ml +++ b/src/proto_014_PtKathma/lib_plugin/test/test_filter_state.ml @@ -52,7 +52,7 @@ let test_check_manager_restriction_fresh = { filter_state with op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.remove + Tezos_crypto.Signature.V0.Public_key_hash.Map.remove pkh filter_state.op_prechecked_managers; } @@ -71,7 +71,7 @@ let test_check_manager_restriction_fresh = "@[Check manager restriction failed!@,\ %a should not be in the set of precheck managers:@,\ %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state) @@ -93,7 +93,7 @@ let test_check_manager_restriction_fail = { filter_state with op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add pkh {op_info with fee = Alpha_context.Tez.one} (* We force higher fee than below: [one > zero]. *) @@ -114,7 +114,7 @@ let test_check_manager_restriction_fail = "@[Check manager restriction failed!@,\ %a should be in the set of precheck managers:@,\ %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state @@ -124,7 +124,7 @@ let test_check_manager_restriction_fail = %a is in the set of precheck managers:@,\ %a@,\ but should not replace the old operation:%a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state @@ -148,7 +148,7 @@ let test_check_manager_restriction_replace = { filter_state with op_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add pkh op_info filter_state.op_prechecked_managers; @@ -168,7 +168,7 @@ let test_check_manager_restriction_replace = "@[Check manager restriction failed!@,\ %a should be in the set of precheck managers:@,\ %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state @@ -178,7 +178,7 @@ let test_check_manager_restriction_replace = %a is in the set of prechecked managers:@,\ %a but the old version should have been replaced because the new \ fees(%a) are higher@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state @@ -212,11 +212,11 @@ let test_add_manager_restriction_set = Format.fprintf fmt "%a was not found in prechecked_managers : %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_prechecked_managers set) - ~cond:(Tezos_crypto.Signature.Public_key_hash.Map.mem pkh) + ~cond:(Tezos_crypto.Signature.V0.Public_key_hash.Map.mem pkh) filter_state.op_prechecked_managers ()) @@ -301,7 +301,7 @@ let test_add_manager_restriction_check = "@[Check manager restriction failed!@,\ %a should be in the set of precheck managers:@,\ %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh pp_state filter_state @@ -332,7 +332,7 @@ let test_remove = in let actual_state = remove ~filter_state op_info.operation_hash in let expected_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.remove + Tezos_crypto.Signature.V0.Public_key_hash.Map.remove pkh filter_state.op_prechecked_managers in diff --git a/src/proto_014_PtKathma/lib_plugin/test/test_utils.ml b/src/proto_014_PtKathma/lib_plugin/test/test_utils.ml index d7e5811126dce905bd1dc26e84ea05073dec621c..55626ab0233b076be7c9775a1ea180549274c21a 100644 --- a/src/proto_014_PtKathma/lib_plugin/test/test_utils.ml +++ b/src/proto_014_PtKathma/lib_plugin/test/test_utils.ml @@ -44,7 +44,7 @@ let pp_prechecked_managers fmt set = Format.fprintf ppf "(%a -> (hash:%a,gas:%a,fee:%a))" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Operation_hash.pp op_info.operation_hash @@ -52,7 +52,7 @@ let pp_prechecked_managers fmt set = op_info.gas_limit Alpha_context.Tez.pp op_info.fee)) - (Tezos_crypto.Signature.Public_key_hash.Map.bindings set) + (Tezos_crypto.Signature.V0.Public_key_hash.Map.bindings set) let pp_operation_hash_manager fmt map = Format.fprintf @@ -64,7 +64,7 @@ let pp_operation_hash_manager fmt map = "(%a -> %a)" Tezos_crypto.Operation_hash.pp hash - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh)) (Tezos_crypto.Operation_hash.Map.bindings map) @@ -113,7 +113,7 @@ let pp_state fmt state = state.min_prechecked_op_weight let eq_prechecked_managers = - Tezos_crypto.Signature.Public_key_hash.Map.equal + Tezos_crypto.Signature.V0.Public_key_hash.Map.equal (fun ({operation_hash = oph1; gas_limit = _; fee = _; weight = _} : manager_op_info) @@ -133,7 +133,7 @@ let eq_state s1 s2 = in eq_prechecked_managers s1.op_prechecked_managers s2.op_prechecked_managers && Tezos_crypto.Operation_hash.Map.equal - (fun k1 k2 -> Tezos_crypto.Signature.Public_key_hash.equal k1 k2) + (fun k1 k2 -> Tezos_crypto.Signature.V0.Public_key_hash.equal k1 k2) s1.operation_hash_to_manager s2.operation_hash_to_manager && s1.prechecked_operations_count = s2.prechecked_operations_count diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/account.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/account.ml index f3e5a608dec024a85d303b43bf7f4f09f43bd5e7..eccfb5b0a4a44a759d12cd0e9285f9b2d3befd1e 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/account.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/account.ml @@ -27,14 +27,14 @@ open Protocol open Alpha_context type t = { - pkh : Tezos_crypto.Signature.Public_key_hash.t; - pk : Tezos_crypto.Signature.Public_key.t; - sk : Tezos_crypto.Signature.Secret_key.t; + pkh : Tezos_crypto.Signature.V0.Public_key_hash.t; + pk : Tezos_crypto.Signature.V0.Public_key.t; + sk : Tezos_crypto.Signature.V0.Secret_key.t; } type account = t -let known_accounts = Tezos_crypto.Signature.Public_key_hash.Table.create 17 +let known_accounts = Tezos_crypto.Signature.V0.Public_key_hash.Table.create 17 let random_seed ~rng_state = Bytes.init Tezos_crypto.Hacl.Ed25519.sk_size (fun _i -> @@ -42,14 +42,14 @@ let random_seed ~rng_state = let new_account ?seed () = let pkh, pk, sk = - Tezos_crypto.Signature.generate_key ~algo:Ed25519 ?seed () + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ?seed () in let account = {pkh; pk; sk} in - Tezos_crypto.Signature.Public_key_hash.Table.add known_accounts pkh account ; + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account ; account let add_account ({pkh; _} as account) = - Tezos_crypto.Signature.Public_key_hash.Table.add known_accounts pkh account + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account let activator_account = let seed = random_seed ~rng_state:(Random.State.make [|0x1337533D|]) in @@ -57,21 +57,21 @@ let activator_account = let find pkh = match - Tezos_crypto.Signature.Public_key_hash.Table.find known_accounts pkh + Tezos_crypto.Signature.V0.Public_key_hash.Table.find known_accounts pkh with | Some k -> return k | None -> failwith "Missing account: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh let find_alternate pkh = let exception Found of t in try - Tezos_crypto.Signature.Public_key_hash.Table.iter + Tezos_crypto.Signature.V0.Public_key_hash.Table.iter (fun pkh' account -> - if not (Tezos_crypto.Signature.Public_key_hash.equal pkh pkh') then + if not (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh pkh') then raise (Found account)) known_accounts ; raise Not_found @@ -86,8 +86,8 @@ let dummy_account = let default_initial_balance = Tez.of_mutez_exn 4_000_000_000_000L let generate_accounts ?rng_state ?(initial_balances = []) ?bootstrap_delegations - n : (t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list = - Tezos_crypto.Signature.Public_key_hash.Table.clear known_accounts ; + n : (t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list = + Tezos_crypto.Signature.V0.Public_key_hash.Table.clear known_accounts ; let amount i = match List.nth_opt initial_balances i with | None -> default_initial_balance @@ -110,13 +110,13 @@ let generate_accounts ?rng_state ?(initial_balances = []) ?bootstrap_delegations List.map (fun i -> let pkh, pk, sk = - Tezos_crypto.Signature.generate_key + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ~seed:(random_seed ~rng_state) () in let account = {pkh; pk; sk} in - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account ; @@ -130,7 +130,7 @@ let commitment_secret = let new_commitment ?seed () = let pkh, pk, sk = - Tezos_crypto.Signature.generate_key ?seed ~algo:Ed25519 () + Tezos_crypto.Signature.V0.generate_key ?seed ~algo:Ed25519 () in let unactivated_account = {pkh; pk; sk} in let open Commitment in diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/account.mli b/src/proto_014_PtKathma/lib_protocol/test/helpers/account.mli index 645b55cbbaef8347f1aefae83a9752127bf9d5ce..e644072ac79600e740b7529713e6dcd93be417a0 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/account.mli +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/account.mli @@ -27,14 +27,14 @@ open Protocol open Alpha_context type t = { - pkh : Tezos_crypto.Signature.Public_key_hash.t; - pk : Tezos_crypto.Signature.Public_key.t; - sk : Tezos_crypto.Signature.Secret_key.t; + pkh : Tezos_crypto.Signature.V0.Public_key_hash.t; + pk : Tezos_crypto.Signature.V0.Public_key.t; + sk : Tezos_crypto.Signature.V0.Secret_key.t; } type account = t -val known_accounts : t Tezos_crypto.Signature.Public_key_hash.Table.t +val known_accounts : t Tezos_crypto.Signature.V0.Public_key_hash.Table.t val activator_account : account @@ -44,9 +44,9 @@ val new_account : ?seed:Bytes.t -> unit -> account val add_account : t -> unit -val find : Tezos_crypto.Signature.Public_key_hash.t -> t tzresult Lwt.t +val find : Tezos_crypto.Signature.V0.Public_key_hash.t -> t tzresult Lwt.t -val find_alternate : Tezos_crypto.Signature.Public_key_hash.t -> t +val find_alternate : Tezos_crypto.Signature.V0.Public_key_hash.t -> t (** 4.000.000.000 tez *) val default_initial_balance : Tez.t @@ -60,11 +60,11 @@ val generate_accounts : ?rng_state:Random.State.t -> ?initial_balances:int64 list -> ?bootstrap_delegations: - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key_hash.t) + (Tezos_crypto.Signature.V0.Public_key_hash.t + * Tezos_crypto.Signature.V0.Public_key_hash.t) list -> int -> - (t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list + (t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list val commitment_secret : Blinded_public_key_hash.activation_code diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/assert.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/assert.ml index 049698c05301d4ad4f0580c656013a0e52103bd8..04c7458fc021dc02f6e7f7744d6b09945522c5a0 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/assert.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/assert.ml @@ -143,14 +143,14 @@ let not_equal_tez ~loc (a : Alpha_context.Tez.t) (b : Alpha_context.Tez.t) = not_equal ~loc Tez.( = ) "Tez are equal" Tez.pp a b (* pkh *) -let equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) - (b : Tezos_crypto.Signature.Public_key_hash.t) = - let module PKH = Tezos_crypto.Signature.Public_key_hash in +let equal_pkh ~loc (a : Tezos_crypto.Signature.V0.Public_key_hash.t) + (b : Tezos_crypto.Signature.V0.Public_key_hash.t) = + let module PKH = Tezos_crypto.Signature.V0.Public_key_hash in equal ~loc PKH.equal "Public key hashes aren't equal" PKH.pp a b -let not_equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) - (b : Tezos_crypto.Signature.Public_key_hash.t) = - let module PKH = Tezos_crypto.Signature.Public_key_hash in +let not_equal_pkh ~loc (a : Tezos_crypto.Signature.V0.Public_key_hash.t) + (b : Tezos_crypto.Signature.V0.Public_key_hash.t) = + let module PKH = Tezos_crypto.Signature.V0.Public_key_hash in not_equal ~loc PKH.equal "Public key hashes are equal" PKH.pp a b let get_some ~loc = function diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/block.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/block.ml index 81686aa03301bc1d663a7f21542b5963c7328c24..e578e23d76c3ae55eb1ed1f63c0d96740c1338f7 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/block.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/block.ml @@ -84,7 +84,7 @@ let get_next_baker_by_account pkh block = | None -> failwith "No slots found for %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh) >>=? fun {Plugin.RPC.Baking_rights.delegate = pkh; timestamp; round; _} -> Environment.wrap_tzresult (Round.to_int round) >>?= fun round -> @@ -99,7 +99,7 @@ let get_next_baker_excluding excludes block = (fun {Plugin.RPC.Baking_rights.delegate; _} -> not (List.mem - ~equal:Tezos_crypto.Signature.Public_key_hash.equal + ~equal:Tezos_crypto.Signature.V0.Public_key_hash.equal delegate excludes)) bakers @@ -169,7 +169,7 @@ module Forge = struct (shell, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) delegate.sk @@ -422,7 +422,7 @@ let genesis_with_parameters parameters = header = { shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; }; operations = []; context; @@ -430,8 +430,8 @@ let genesis_with_parameters parameters = let validate_initial_accounts (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - tokens_per_roll = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) tokens_per_roll = if initial_accounts = [] then Stdlib.failwith "Must have one account with a roll to bake" ; (* Check there is at least one roll *) @@ -599,8 +599,8 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum ?tx_rollup_origination_size ?sc_rollup_enable ?dal_enable ?hard_gas_limit_per_block ?nonce_revelation_threshold (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) = prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum @@ -642,7 +642,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum header = { shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; }; operations = []; context; @@ -650,8 +650,8 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum let alpha_context ?commitments ?min_proposal_quorum (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) = prepare_initial_context_params ?min_proposal_quorum initial_accounts >>=? fun (constants, shell, _hash) -> initial_alpha_context ?commitments constants shell initial_accounts diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/block.mli b/src/proto_014_PtKathma/lib_protocol/test/helpers/block.mli index 72b1971d7a2673ff581ac071ec44d372afec6065..aa605a62f209a99531f63ef4b65ccd8acecc2ed0 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/block.mli +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/block.mli @@ -128,7 +128,8 @@ val genesis : ?dal_enable:bool -> ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> - (Account.t * Tez.tez * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.tez * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list -> block tzresult Lwt.t val genesis_with_parameters : Parameters.t -> block tzresult Lwt.t @@ -140,7 +141,8 @@ val genesis_with_parameters : Parameters.t -> block tzresult Lwt.t val alpha_context : ?commitments:Commitment.t list -> ?min_proposal_quorum:int32 -> - (Account.t * Tez.tez * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.tez * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list -> Alpha_context.t tzresult Lwt.t (** @@ -272,7 +274,7 @@ val prepare_initial_context_params : ?dal_enable:bool -> ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list -> ( Constants.Parametric.t * Block_header.shell_header * Tezos_crypto.Block_hash.t, diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml index 0a6cfc766eca2bd00541a6ec287e8d607452aaf0..113400f3aa998f7a3e42858876e2b400775cabb7 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml @@ -139,7 +139,7 @@ let get_endorsing_power_for_delegate ctxt ?levels pkh = let rec find_slots_for_delegate = function | [] -> return 0 | {Plugin.RPC.Validators.delegate; slots; _} :: t -> - if Tezos_crypto.Signature.Public_key_hash.equal delegate pkh then + if Tezos_crypto.Signature.V0.Public_key_hash.equal delegate pkh then return (List.length slots) else find_slots_for_delegate t in @@ -163,7 +163,7 @@ let get_first_different_baker baker bakers = WithExceptions.Option.get ~loc:__LOC__ @@ List.find (fun baker' -> - Tezos_crypto.Signature.Public_key_hash.( <> ) baker baker') + Tezos_crypto.Signature.V0.Public_key_hash.( <> ) baker baker') bakers let get_first_different_bakers ctxt = diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.mli b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.mli index 052552cec055df45f4353c4d16dc874bffb292a6..66a83d729070538971d56a7f9c6fa777f23f04ba 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.mli +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.mli @@ -95,7 +95,8 @@ module Vote : sig val get_ballot_list : t -> - (Tezos_crypto.Signature.Public_key_hash.t * Vote.ballot) list tzresult Lwt.t + (Tezos_crypto.Signature.V0.Public_key_hash.t * Vote.ballot) list tzresult + Lwt.t val get_current_period : t -> Voting_period.info tzresult Lwt.t @@ -104,7 +105,8 @@ module Vote : sig val get_participation_ema : Block.t -> int32 tzresult Lwt.t val get_listings : - t -> (Tezos_crypto.Signature.Public_key_hash.t * int64) list tzresult Lwt.t + t -> + (Tezos_crypto.Signature.V0.Public_key_hash.t * int64) list tzresult Lwt.t val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t @@ -231,8 +233,8 @@ type 'accounts init := ?min_proposal_quorum:int32 -> ?bootstrap_contracts:Parameters.bootstrap_contract list -> ?bootstrap_delegations: - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key_hash.t) + (Tezos_crypto.Signature.V0.Public_key_hash.t + * Tezos_crypto.Signature.V0.Public_key_hash.t) list -> ?level:int32 -> ?cost_per_byte:Tez.t -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/contract_helpers.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/contract_helpers.ml index bb9badbd08c5e19df9fe15d55ed1c8784267c6ac..fe4e2b0e53ba56ae3aa3ea6e77cd5c54faf60a86 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/contract_helpers.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/contract_helpers.ml @@ -70,7 +70,7 @@ let fake_KT1 = let default_self = fake_KT1 let default_source = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero let default_step_constants = Script_interpreter. diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/expr_common.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/expr_common.ml index e6444892c6008c3ce5a41cd5b61b1c050495ba1e..02802931c5bfa80b2e73258ca3735896d01567ef 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/expr_common.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/expr_common.ml @@ -78,7 +78,9 @@ let big_map_id ?(loc = 0) id = int ~loc @@ Big_map.Id.unparse_to_z id let timestamp_of_zint zint = Script_timestamp.of_zint zint let public_key_of_bytes_exn b = - Data_encoding.Binary.of_bytes_exn Tezos_crypto.Signature.Public_key.encoding b + Data_encoding.Binary.of_bytes_exn + Tezos_crypto.Signature.V0.Public_key.encoding + b let address_of_bytes_exn b = Data_encoding.Binary.of_bytes_exn Contract.encoding b diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/incremental.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/incremental.ml index f8ebb003119899f35df3a8a2352ee68defaaf972..a02afde0e2f62c155140f222473ad64fb7322ff8 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/incremental.ml @@ -88,7 +88,8 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) in let protocol_data = if mempool_mode then None - else Some {Block_header.contents; signature = Tezos_crypto.Signature.zero} + else + Some {Block_header.contents; signature = Tezos_crypto.Signature.V0.zero} in let header = { @@ -103,7 +104,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) context = Tezos_crypto.Context_hash.zero; operations_hash = Tezos_crypto.Operation_list_list_hash.zero; }; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; } in begin_construction diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/liquidity_baking_machine.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/liquidity_baking_machine.ml index 06b649b3744b46997e71c6d264cfaf108727b24b..75e8953b1b023fa576c9e1453ad0374df5e5a34a 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/liquidity_baking_machine.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/liquidity_baking_machine.ml @@ -390,13 +390,13 @@ let total_xtz = 32_000_000_000_000L let tzbtc_admin_account : Account.t = { pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"; pk = - Tezos_crypto.Signature.Public_key.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key.of_b58check_exn "edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav"; sk = - Tezos_crypto.Signature.Secret_key.of_b58check_exn + Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh"; } diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/lqt_fa12_repr.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/lqt_fa12_repr.ml index 168bbb43dac674352ea7598a7517b6262f4fcd17..25511a68258be4d5b40fea1712e7a9a9fa31d363 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/lqt_fa12_repr.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/lqt_fa12_repr.ml @@ -135,7 +135,7 @@ module Storage = struct { tokens = Big_map.Id.parse_z Z.zero; allowances = Big_map.Id.parse_z Z.one; - admin = Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero; + admin = Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero; totalSupply = Z.zero; } diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/op.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/op.ml index 19e222b0fb30b8fe5f27cc22960321db7bb461b2..fe8e88be35da4fa71c69d0320d53564c1c4c17d1 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/op.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/op.ml @@ -26,7 +26,7 @@ open Protocol open Alpha_context -let sign ?(watermark = Tezos_crypto.Signature.Generic_operation) sk ctxt +let sign ?(watermark = Tezos_crypto.Signature.V0.Generic_operation) sk ctxt contents = let branch = Context.branch ctxt in let unsigned = @@ -34,7 +34,9 @@ let sign ?(watermark = Tezos_crypto.Signature.Generic_operation) sk ctxt Operation.unsigned_encoding ({branch}, Contents_list contents) in - let signature = Some (Tezos_crypto.Signature.sign ~watermark sk unsigned) in + let signature = + Some (Tezos_crypto.Signature.V0.sign ~watermark sk unsigned) + in ({shell = {branch}; protocol_data = {contents; signature}} : _ Operation.t) (** Generates the block payload hash based on the hash [pred_hash] of @@ -223,7 +225,7 @@ let combine_operations ?public_key ?counter ?spurious_operation ~source ctxt let reveal_op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -292,7 +294,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee; counter; operation; @@ -308,7 +310,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op_reveal = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -319,7 +321,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee; counter = Z.succ counter; operation; @@ -338,7 +340,7 @@ let revelation ?(fee = Tez.zero) ?(gas_limit = High) ?(storage_limit = Z.zero) let pkh = match forge_pkh with | Some pkh -> pkh - | None -> Tezos_crypto.Signature.Public_key.hash public_key + | None -> Tezos_crypto.Signature.V0.Public_key.hash public_key in resolve_gas_limit ctxt gas_limit >>=? fun gas_limit -> let source = Contract.Implicit pkh in @@ -505,7 +507,7 @@ let increase_paid_storage ?force_reveal ?counter ?fee ?gas_limit ?storage_limit Context.Contract.manager ctxt source >|=? fun account -> sign account.sk ctxt sop -let activation ctxt (pkh : Tezos_crypto.Signature.Public_key_hash.t) +let activation ctxt (pkh : Tezos_crypto.Signature.V0.Public_key_hash.t) activation_code = (match pkh with | Ed25519 edpkh -> return edpkh @@ -513,7 +515,7 @@ let activation ctxt (pkh : Tezos_crypto.Signature.Public_key_hash.t) failwith "Wrong public key hash : %a - Commitments must be activated with an \ Tezos_crypto.Ed25519 encrypted public key hash" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh) >|=? fun id -> let contents = Single (Activate_account {id; activation_code}) in diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/op.mli b/src/proto_014_PtKathma/lib_protocol/test/helpers/op.mli index 6ffbb9f33c775db0c41fbe11669414a9e353fb43..4ddc321009a14ca10f964ccf984c14e78008697b 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/op.mli +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/op.mli @@ -30,8 +30,8 @@ open Alpha_context Improve documentation of the operation helpers *) val sign : - ?watermark:Tezos_crypto.Signature.watermark -> - Tezos_crypto.Signature.secret_key -> + ?watermark:Tezos_crypto.Signature.V0.watermark -> + Tezos_crypto.Signature.V0.secret_key -> Context.t -> packed_contents_list -> packed_operation @@ -230,7 +230,7 @@ val originated_contract : Operation.packed -> Contract.t val register_global_constant : ?force_reveal:bool -> ?counter:Z.t -> - ?public_key:Tezos_crypto.Signature.public_key -> + ?public_key:Tezos_crypto.Signature.V0.public_key -> ?fee:Tez.tez -> ?gas_limit:gas_limit -> ?storage_limit:Z.t -> @@ -261,7 +261,7 @@ val double_baking : val activation : Context.t -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Blinded_public_key_hash.activation_code -> Operation.packed tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 264b2507fedff59dd0c53dbe3fe5e24f306761c9..21c4e09e912b19088f1144cdb60539e7d1cf4ead 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml @@ -97,7 +97,7 @@ let empty_context : Context_l2.t = empty_storage let rng_state = Random.State.make_self_init () let gen_l1_address ?seed () = - Tezos_crypto.Signature.generate_key ~algo:Ed25519 ?seed () + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ?seed () let gen_l2_address () = let _pkh, public_key, secret_key = Tezos_crypto.Bls.generate_key () in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_baking.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_baking.ml index 63b287f3d84bb9dcc3a62b3c61d5d3928b7c1c39..70ca0bd482ca36072d60a8a1834d6afd77637e03 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_baking.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_baking.ml @@ -171,7 +171,8 @@ let get_contract_for_pkh contracts pkh = | [] -> assert false | c :: t -> let c_pkh = Context.Contract.pkh c in - if Tezos_crypto.Signature.Public_key_hash.equal c_pkh pkh then return c + if Tezos_crypto.Signature.V0.Public_key_hash.equal c_pkh pkh then + return c else find_contract t in find_contract contracts @@ -226,7 +227,7 @@ let test_rewards_block_and_payload_producer () = >>=? fun frozen_deposit -> Context.get_baking_reward_fixed_portion (B b2) >>=? fun baking_reward -> Context.get_bonus_reward (B b2) ~endorsing_power >>=? fun bonus_reward -> - (if Tezos_crypto.Signature.Public_key_hash.equal baker_b2 baker_b1 then + (if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2 baker_b1 then Context.get_baking_reward_fixed_portion (B b1) else return Tez.zero) >>=? fun reward_for_b1 -> @@ -270,7 +271,7 @@ let test_rewards_block_and_payload_producer () = Context.Delegate.current_frozen_deposits (B b2') baker_b2 >>=? fun frozen_deposit -> let reward_for_b1 = - if Tezos_crypto.Signature.Public_key_hash.equal baker_b2 baker_b1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2 baker_b1 then baking_reward else Tez.zero in @@ -288,7 +289,7 @@ let test_rewards_block_and_payload_producer () = >>=? fun frozen_deposits' -> Context.get_baker (B genesis) ~round:Round.zero >>=? fun baker_b1 -> let reward_for_b1' = - if Tezos_crypto.Signature.Public_key_hash.equal baker_b2' baker_b1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2' baker_b1 then baking_reward else Tez.zero in @@ -398,7 +399,7 @@ let test_committee_sampling () = Format.fprintf ppf "@[- %a %d%a@]@," - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh n (fun ppf failed -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_deactivation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_deactivation.ml index 3750866824bab81d8c52494ea815f9f3ccdfcace..17e12f6bc724ef8f02e5dbe11054d5da46a8d659 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_deactivation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_deactivation.ml @@ -311,7 +311,8 @@ let test_delegation () = Context.Contract.delegate_opt (B b) a1 >>=? fun delegate -> (match delegate with | None -> assert false - | Some pkh -> assert (Tezos_crypto.Signature.Public_key_hash.equal pkh m1.pkh)) ; + | Some pkh -> + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh m1.pkh)) ; let constants = Default_parameters.constants_test in let one_roll = constants.tokens_per_roll in Op.transaction ~force_reveal:true (B b) a1 a3 one_roll >>=? fun transact -> @@ -324,7 +325,8 @@ let test_delegation () = Context.Contract.delegate_opt (B b) a3 >>=? fun delegate -> (match delegate with | None -> assert false - | Some pkh -> assert (Tezos_crypto.Signature.Public_key_hash.equal pkh m3.pkh)) ; + | Some pkh -> + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh m3.pkh)) ; check_active_staking_balance ~loc:__LOC__ ~deactivated:false b m3 >>=? fun () -> check_stake ~loc:__LOC__ b m3 >>=? fun () -> check_stake ~loc:__LOC__ b m1 diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml index b7816b92dc6d6d2a1737c41696bcec54a176f047..c3a78d3112f0d32b2ed105398bfb66dc23dc1351 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml @@ -305,11 +305,11 @@ let undelegated_originated_bootstrap_contract () = let delegated_implicit_bootstrap_contract () = (* These values are fixed because we use a fixed RNG seed. *) let from_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1TDZG4vFoA2xutZMYauUnS4HVucnAGQSpZ" in let to_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1MBWU1WkszFfkEER2pgn4ATKXE9ng7x1sR" in let bootstrap_delegations = [(from_pkh, to_pkh)] in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_baking.ml index 257db7b4a190c2c1e1418d57a750b142c2a33fbf..01e0e9ab514b90bb54babcfa7dc743012f05c15b 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -119,7 +119,7 @@ let test_valid_double_baking_followed_by_double_endorsing () = >>=? fun blk_with_db_evidence -> Context.get_first_different_endorsers (B blk_a) >>=? fun (e1, e2) -> let delegate = - if Tezos_crypto.Signature.Public_key_hash.( = ) e1.delegate baker1 then + if Tezos_crypto.Signature.V0.Public_key_hash.( = ) e1.delegate baker1 then (e1.delegate, e1.slots) else (e2.delegate, e2.slots) in @@ -168,7 +168,7 @@ let test_valid_double_endorsing_followed_by_double_baking () = Block.bake blk_2 >>=? fun blk_b -> Context.get_first_different_endorsers (B blk_a) >>=? fun (e1, e2) -> let delegate = - if Tezos_crypto.Signature.Public_key_hash.( = ) e1.delegate baker1 then + if Tezos_crypto.Signature.V0.Public_key_hash.( = ) e1.delegate baker1 then (e1.delegate, e1.slots) else (e2.delegate, e2.slots) in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_endorsement.ml index 2a7de51129f4b5e583ddf558cd60c8aef1175dd4..f45b86b26aa64bd38f48581fa6492f8b44f4abc9 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -238,7 +238,7 @@ let test_different_delegates () = >>=? fun (endorser_b1c, endorser_b2c) -> let endorser_b, b_slots = if - Tezos_crypto.Signature.Public_key_hash.( = ) + Tezos_crypto.Signature.V0.Public_key_hash.( = ) endorser_a endorser_b1c.delegate then (endorser_b2c.delegate, endorser_b2c.slots) @@ -278,7 +278,7 @@ let test_wrong_delegate () = Context.get_endorser_n (B blk_b) 0 >>=? fun (endorser0, slots0) -> Context.get_endorser_n (B blk_b) 1 >>=? fun (endorser1, slots1) -> let endorser_b, b_slots = - if Tezos_crypto.Signature.Public_key_hash.equal endorser_a endorser0 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal endorser_a endorser0 then (endorser1, slots1) else (endorser0, slots0) in @@ -298,10 +298,11 @@ let test_freeze_more_with_low_balance = Context.get_endorsers ctxt >>=? function | [d1; d2] -> return - (if Tezos_crypto.Signature.Public_key_hash.equal account d1.delegate + (if + Tezos_crypto.Signature.V0.Public_key_hash.equal account d1.delegate then d1 else if - Tezos_crypto.Signature.Public_key_hash.equal account d2.delegate + Tezos_crypto.Signature.V0.Public_key_hash.equal account d2.delegate then d2 else assert false) .slots @@ -334,7 +335,7 @@ let test_freeze_more_with_low_balance = let check_unique_endorser b account2 = Context.get_endorsers (B b) >>=? function | [{delegate; _}] - when Tezos_crypto.Signature.Public_key_hash.equal account2 delegate -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal account2 delegate -> return_unit | _ -> failwith "We are supposed to only have account2 as endorser." in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index b7a4f0087a0364eed4894acd86f477dc36b1fa42..b6660af8aa4cd89bba0c8a349200a29839f9aeda 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_double_preendorsement.ml @@ -134,7 +134,7 @@ end = struct let denun_reward = Test_tez.(lost_deposit /! 2L) in (* if the baker is the endorser, he'll only loose half of the deposits *) let expected_endo_loss = - if Tezos_crypto.Signature.Public_key_hash.equal baker d1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker d1 then Test_tez.(lost_deposit -! denun_reward) else lost_deposit in @@ -148,7 +148,7 @@ end = struct burnt deposit of d1, so it's higher *) let high, low = - if Tezos_crypto.Signature.Public_key_hash.equal baker d1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker d1 then (bal_good, bal_bad) else (bal_bad, bal_good) in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_participation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_participation.ml index 93c4b456c3028b9626fcee75e7e77b8140d7d646..1ed5f12418a7b29cd72720313610d38cb939b853 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_participation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_participation.ml @@ -42,8 +42,8 @@ let bake_and_endorse_once (b_pred, b_cur) baker endorser = List.find_map (function | {Plugin.RPC.Validators.delegate; slots; _} -> - if Tezos_crypto.Signature.Public_key_hash.equal delegate endorser then - Some (delegate, slots) + if Tezos_crypto.Signature.V0.Public_key_hash.equal delegate endorser + then Some (delegate, slots) else None) endorsers_list |> function diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/gas/test_gas_costs.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/gas/test_gas_costs.ml index 9cd6b83539f3062ef0349c1179249b731effd452..d271cfb3add9d8096ae36d3289e26986a32cd88c 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/gas/test_gas_costs.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/gas/test_gas_costs.ml @@ -54,7 +54,7 @@ let dummy_map = let dummy_timestamp = Script_timestamp.of_zint (Z.of_int 42) let dummy_pk = - Tezos_crypto.Signature.Public_key.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key.of_b58check_exn "edpkuFrRoDSEbJYgxRtLx2ps82UdaYc1WwfS9sE11yhauZt5DgCHbU" let dummy_bytes = Bytes.of_string "dummy" diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_interpretation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_interpretation.ml index 06d13b7b981426ad74878281e1fc967033599a59..227a28812c75abc36a53083a654dab3cf7dff69a 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_interpretation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_interpretation.ml @@ -202,7 +202,7 @@ let test_json_roundtrip_err name e () = let error_encoding_tests = let contract_zero = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero in let script_expr_int = Micheline.strip_locations (Micheline.Int (0, Z.zero)) in List.map diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml index b204e70a2322d35935cc9d957e7e4dc611d2456c..30e162766b140b919507d496693d64f3f43757e5 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml @@ -99,7 +99,7 @@ let dont_show _fmt _ = () let size = {Tezos_benchmark.Base_samplers.min = 4; max = 32} module Crypto_samplers = -Tezos_benchmark.Crypto_samplers.Make_finite_key_pool (struct +Tezos_benchmark.Crypto_samplers.V0.Make_finite_key_pool (struct let size = 10 let algo = `Default @@ -235,7 +235,7 @@ let check_value_size () = =========== *) @ (let show fmt (Script_typed_ir.Script_signature.Signature_tag s) = - Tezos_crypto.Signature.pp fmt s + Tezos_crypto.Signature.V0.pp fmt s in exs ~error:8 nsample show Signature_t ": signature") (* @@ -260,13 +260,13 @@ let check_value_size () = Key_hash_t ========== *) - @ (let show = Tezos_crypto.Signature.Public_key_hash.pp in + @ (let show = Tezos_crypto.Signature.V0.Public_key_hash.pp in exs nsample show Key_hash_t ": key_hash") (* Key_t ===== *) - @ (let show = Tezos_crypto.Signature.Public_key.pp in + @ (let show = Tezos_crypto.Signature.V0.Public_key.pp in exs nsample show Key_t ": key_t") (* Timestamp_t diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_balance.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_balance.ml index 7a50c5383e8b05ce2757b76b9a597e30cfc10c58..ce58de9a2b0c1f7be77595c5c26b41c9be52b580 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_balance.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_balance.ml @@ -40,7 +40,7 @@ let wrap m = m >|= Environment.wrap_tzresult type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Tezos_crypto.Signature.V0.public_key_hash; contract : Contract.t; } diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_manager.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_manager.ml index 27c70e08a2170fc80c952ea6a9d1c49a6bdd90e7..a708d6e821655a0e0eeb678f699b6e157ac238f5 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_manager.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/michelson/test_ticket_manager.ml @@ -46,7 +46,7 @@ let wrap m = m >|= Environment.wrap_tzresult type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Tezos_crypto.Signature.V0.public_key_hash; contract : Contract.t; } diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_activation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_activation.ml index 913c679007b35795fb83116e74c4b2498ee0d8b3..54dd7002a2f36adf16adec589cab2e473cc2d27e 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_activation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_activation.ml @@ -85,21 +85,21 @@ let secrets () = let passphrase = Bytes.(cat (of_string email) (of_string password)) in let sk = Tezos_client_base.Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in (pkh, pk, sk) in List.map (fun (mnemonic, secret, amount, pkh, password, email) -> let pkh', pk, sk = read_key mnemonic email password in - let pkh = Tezos_crypto.Signature.Public_key_hash.of_b58check_exn pkh in - assert (Tezos_crypto.Signature.Public_key_hash.equal pkh pkh') ; + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn pkh in + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh pkh') ; let account = Account.{pkh; pk; sk} in Account.add_account account ; { @@ -489,7 +489,7 @@ let test_invalid_activation_inexistent_pkh () = WithExceptions.Option.get ~loc:__LOC__ @@ List.hd secrets in let inexistent_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1PeQHGKPWSpNoozvxgqLN9TFsj6rDqNV3o" in Op.activation (B blk) inexistent_pkh activation_code >>=? fun operation -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_reveal.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_reveal.ml index 40ef088ef31f595bab077f0a6203f7f7e05fabeb..5d6104ef00aa165ed1e0ef0764920cfa913dd3ea 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_reveal.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_reveal.ml @@ -146,12 +146,12 @@ let test_reveal_with_fake_account () = These preambles are too verbose and boilerplate. We should factor out revealing fresh unrevealed accounts. *) - when_ (Tezos_crypto.Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> + when_ (Tezos_crypto.Signature.V0.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp b_pkh) >>=? fun () -> Op.transaction (B blk) bootstrap a_contract Tez.one >>=? fun oa -> @@ -228,12 +228,12 @@ let test_reveal_with_fake_account_already_revealed () = These preambles are too verbose and boilerplate. We should factor out revealing fresh unrevealed accounts. *) - when_ (Tezos_crypto.Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> + when_ (Tezos_crypto.Signature.V0.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp b_pkh) >>=? fun () -> Op.transaction (B blk) bootstrap a_contract Tez.one >>=? fun oa -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_tx_rollup.ml index b848fe414f1fd443932037037ef72571b64c47be..22307c7e137f123888f3c0bad88d5ba5d382ffe9 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -311,8 +311,8 @@ let commitment_hash_testable = let public_key_hash_testable = Alcotest.testable - Tezos_crypto.Signature.Public_key_hash.pp - Tezos_crypto.Signature.Public_key_hash.( = ) + Tezos_crypto.Signature.V0.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.( = ) let raw_level_testable = Alcotest.testable Raw_level.pp Raw_level.( = ) diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/test_frozen_bonds.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/test_frozen_bonds.ml index 1a66ef0c7bbe54b3f1652a2988750bcf60af1d1b..cf42e022ecf157865731b03a8319b34133b98b17 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/test_frozen_bonds.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/test_frozen_bonds.ml @@ -74,13 +74,13 @@ let create_context () = delegate's pkh. *) let init_test ~user_is_delegate = create_context () >>=? fun (ctxt, _) -> - let delegate, delegate_pk, _ = Tezos_crypto.Signature.generate_key () in + let delegate, delegate_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let delegate_contract = Contract.Implicit delegate in let delegate_account = `Contract (Contract.Implicit delegate) in let user_contract = if user_is_delegate then delegate_contract else - let user, _, _ = Tezos_crypto.Signature.generate_key () in + let user, _, _ = Tezos_crypto.Signature.V0.generate_key () in Contract.Implicit user in let user_account = `Contract user_contract in @@ -398,7 +398,7 @@ let test_rpcs () = let test_scenario scenario = init_test ~user_is_delegate:false >>=? fun (ctxt, user_contract, user_account, delegate1) -> - let delegate2, delegate_pk2, _ = Tezos_crypto.Signature.generate_key () in + let delegate2, delegate_pk2, _ = Tezos_crypto.Signature.V0.generate_key () in let delegate_contract2 = Contract.Implicit delegate2 in let delegate_account2 = `Contract delegate_contract2 in let delegate_balance2 = big_random_amount () in diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/test_token.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/test_token.ml index e9b9966a4c437073e8e72df800cf6fcb5da7ccd4..e66cd6692b9790323a5b8a864711d4c1b7c24274 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/test_token.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/test_token.ml @@ -62,7 +62,7 @@ let test_simple_balances () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let src = `Contract (Contract.Implicit pkh) in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = `Contract (Contract.Implicit pkh) in let amount = Tez.one in wrap (Token.transfer ctxt src dest amount) >>=? fun (ctxt', _) -> @@ -81,7 +81,7 @@ let test_simple_balance_updates () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let src = Contract.Implicit pkh in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = Tez.one in wrap (Token.transfer ctxt (`Contract src) (`Contract dest) amount) @@ -130,7 +130,7 @@ let test_allocated () = create_context () >>=? fun (ctxt, pkh) -> let dest = `Delegate_balance pkh in test_allocated_and_still_allocated_when_empty ctxt dest true >>=? fun _ -> - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = `Contract (Contract.Implicit pkh) in test_allocated_and_deallocated_when_empty ctxt dest >>=? fun _ -> let dest = `Collected_commitments Blinded_public_key_hash.zero in @@ -183,7 +183,7 @@ let test_transferring_to_sink ctxt sink amount expected_bupds = Assert.proto_error_with_info ~loc:__LOC__ res "Overflowing tez addition" let test_transferring_to_contract ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -202,7 +202,7 @@ let test_transferring_to_collected_commitments ctxt = [(Commitments bpkh, Credited amount, Block_application)] let test_transferring_to_delegate_balance ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -212,7 +212,7 @@ let test_transferring_to_delegate_balance ctxt = [(Contract dest, Credited amount, Block_application)] let test_transferring_to_frozen_deposits ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in test_transferring_to_sink ctxt @@ -254,7 +254,7 @@ let test_transferring_to_burned ctxt = ]) true >>=? fun () -> - let pkh = Tezos_crypto.Signature.Public_key_hash.zero in + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero in let p, r = (Random.bool (), Random.bool ()) in wrap (Token.transfer ctxt `Minted (`Lost_endorsing_rewards (pkh, p, r)) amount) @@ -280,7 +280,7 @@ let test_transferring_to_burned ctxt = true let test_transferring_to_frozen_bonds ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let contract = Contract.Implicit pkh in let tx_rollup = mk_rollup () in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in @@ -380,7 +380,7 @@ let test_transferring_from_bounded_source ctxt src amount expected_bupds = Assert.proto_error_with_info ~loc:__LOC__ res error_title let test_transferring_from_contract ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let src = Contract.Implicit pkh in let amount = random_amount () in test_transferring_from_bounded_source @@ -399,7 +399,7 @@ let test_transferring_from_collected_commitments ctxt = [(Commitments bpkh, Debited amount, Block_application)] let test_transferring_from_delegate_balance ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in let src = Contract.Implicit pkh in test_transferring_from_bounded_source @@ -409,7 +409,7 @@ let test_transferring_from_delegate_balance ctxt = [(Contract src, Debited amount, Block_application)] let test_transferring_from_frozen_deposits ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in test_transferring_from_bounded_source ctxt @@ -426,7 +426,7 @@ let test_transferring_from_collected_fees ctxt = [(Block_fees, Debited amount, Block_application)] let test_transferring_from_frozen_bonds ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let contract = Contract.Implicit pkh in let tx_rollup = mk_rollup () in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in @@ -497,13 +497,13 @@ let cast_to_container_type x = let build_test_cases () = create_context () >>=? fun (ctxt, pkh) -> let origin = `Contract (Contract.Implicit pkh) in - let user1, _, _ = Tezos_crypto.Signature.generate_key () in + let user1, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let baker1, baker1_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker1, baker1_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let baker1c = `Contract (Contract.Implicit baker1) in - let baker2, baker2_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker2, baker2_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let baker2c = `Contract (Contract.Implicit baker2) in (* Allocate contracts for user1, user2, baker1, and baker2. *) wrap (Token.transfer ctxt origin user1c (random_amount ())) @@ -706,13 +706,13 @@ let test_transfer_n_with_non_empty_source () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let origin = `Contract (Contract.Implicit pkh) in - let user1, _, _ = Tezos_crypto.Signature.generate_key () in + let user1, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let user3, _, _ = Tezos_crypto.Signature.generate_key () in + let user3, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user3c = `Contract (Contract.Implicit user3) in - let user4, _, _ = Tezos_crypto.Signature.generate_key () in + let user4, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user4c = `Contract (Contract.Implicit user4) in (* Allocate contracts for user1, user2, user3, and user4. *) let amount = diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/validate/manager_operation_helpers.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/validate/manager_operation_helpers.ml index 0e15bf9ec8f9c61be6cbdb4e13a67f570a4f3c89..36e180c7384dc6a5bdd20c15a7d2e04274bc7a01 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/validate/manager_operation_helpers.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/validate/manager_operation_helpers.ml @@ -1167,7 +1167,7 @@ let make_tztest_batched ?(fmt = Format.std_formatter) name test subjects increment of the counters aka 1 for a single operation, n for a batch of n manager operations. *) type probes = { - source : Tezos_crypto.Signature.Public_key_hash.t; + source : Tezos_crypto.Signature.V0.Public_key_hash.t; fee : Tez.tez; gas_limit : Gas.Arith.integral; nb_counter : Z.t; diff --git a/src/proto_014_PtKathma/lib_protocol/test/pbt/test_script_comparison.ml b/src/proto_014_PtKathma/lib_protocol/test/pbt/test_script_comparison.ml index dd8c348f794239ed1890ad9608b2f4cf352d8430..a1ef407b00623436a239a7f597479d18bec689ca 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/pbt/test_script_comparison.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/pbt/test_script_comparison.ml @@ -57,9 +57,9 @@ let rec reference_compare_comparable : type a. a comparable_ty -> a -> a -> int | Bool_t, x, y -> normalize_compare @@ Compare.Bool.compare x y | Mutez_t, x, y -> normalize_compare @@ Tez.compare x y | Key_hash_t, x, y -> - normalize_compare @@ Tezos_crypto.Signature.Public_key_hash.compare x y + normalize_compare @@ Tezos_crypto.Signature.V0.Public_key_hash.compare x y | Key_t, x, y -> - normalize_compare @@ Tezos_crypto.Signature.Public_key.compare x y + normalize_compare @@ Tezos_crypto.Signature.V0.Public_key.compare x y | Int_t, x, y -> normalize_compare @@ Script_int.compare x y | Nat_t, x, y -> normalize_compare @@ Script_int.compare x y | Timestamp_t, x, y -> normalize_compare @@ Script_timestamp.compare x y @@ -117,7 +117,7 @@ module Parameters = struct end module Crypto_samplers = -Tezos_benchmark.Crypto_samplers.Make_finite_key_pool (struct +Tezos_benchmark.Crypto_samplers.V0.Make_finite_key_pool (struct let size = 1000 let algo = `Default diff --git a/src/proto_014_PtKathma/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml b/src/proto_014_PtKathma/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index 56c0ba7dc36534104c43af58208a094b5a4b8f22..6c5fc38166df34d8100a18abe4edb7b3e112f888 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml @@ -79,7 +79,7 @@ let idx_l2_address_gen = oneof [idx_l2_address_idx_gen; return idx_l2_address_value] let public_key_hash = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU" let public_key_hash_gen = @@ -93,7 +93,7 @@ let ticket_hash : Protocol.Alpha_context.Ticket_hash.t = we could introduce a bit more randomness here *) let ticketer_b58 = "tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU" in let ticketer_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn ticketer_b58 + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn ticketer_b58 in let ticketer = Protocol.Alpha_context.Contract.Implicit ticketer_pkh in Tx_rollup_l2_helpers.make_unit_ticket_key ticketer l2_address diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_contract_repr.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_contract_repr.ml index 9a758c030b675cd8e7c817456298f224c4e46e0b..d60870eaed669e5f77b4d5e811104b8e5340d09a 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_contract_repr.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_contract_repr.ml @@ -62,7 +62,7 @@ module Test_contract_repr = struct Contract_hash.hash_bytes [data] let dummy_implicit_contract = - Implicit Tezos_crypto.Signature.Public_key_hash.zero + Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero let dummy_originated_contract = originated_contract @@ dummy_origination_nonce @@ -73,7 +73,7 @@ module Test_contract_repr = struct "%s should have been equal to %" Format.pp_print_string (to_b58check dummy_implicit_contract) - Tezos_crypto.Signature.Public_key_hash.(to_b58check zero) + Tezos_crypto.Signature.V0.Public_key_hash.(to_b58check zero) let test_to_b58check_originated () = Assert.equal diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_receipt.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_receipt.ml index bb2d82de530236502b9c57228b7890c44fbf76dd..dcc2cd95f7c9eda4469e21b4b2c78a830e22f3b4 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_receipt.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_receipt.ml @@ -68,7 +68,7 @@ let test_encodings balance = let test_encodings () = let open Receipt in - let pkh = Tezos_crypto.Signature.Public_key_hash.zero in + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero in test_encodings (Contract (Contract.Implicit pkh)) >>=? fun () -> test_encodings Block_fees >>=? fun () -> test_encodings (Deposits pkh) >>=? fun () -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml index d87843d0888fe31820e442d6c083152c5a1442ec..0c6636ae2fdb637f200dbff7aa2da0a661fe2d77 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml @@ -91,7 +91,7 @@ let test_encode_decode_internal_inbox_message () = let source = Result.get_ok ~loc:__LOC__ - (Tezos_crypto.Signature.Public_key_hash.of_b58check + (Tezos_crypto.Signature.V0.Public_key_hash.of_b58check "tz1RjtZUVeLhADFHDL8UwDZA6vjWWhojpu5w") in let*? (Script_typed_ir.Ty_ex_c pair_nat_ticket_string_ty) = diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_storage.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_storage.ml index f532dd1b32240e87308decd079f40c6e2a530307..123864885dac814d984639c06e672cd0bb4543b6 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_storage.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_sc_rollup_storage.ml @@ -69,7 +69,9 @@ let new_context () = let* ctxt, _stakers = new_context_with_stakers 1 in (* Mint some tez for staker accounts. *) let mint_tez_for ctxt pkh_str = - let pkh = Tezos_crypto.Signature.Public_key_hash.of_b58check_exn pkh_str in + let pkh = + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn pkh_str + in let contract = Contract_repr.Implicit pkh in let+ ctxt, _ = lift @@ -343,7 +345,7 @@ let test_deposit_then_withdraw () = let* ctxt = new_context () in let* rollup, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in let* ctxt = deposit_stake_and_check_balances ctxt rollup staker in @@ -361,7 +363,7 @@ let test_withdraw_when_not_staked () = let* ctxt = new_context () in let* rollup, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in assert_fails_with @@ -373,7 +375,7 @@ let test_withdrawing_twice () = let* ctxt = new_context () in let* rollup, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in let* ctxt = deposit_stake_and_check_balances ctxt rollup staker in diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2.ml index a2368b23c1869c41dd46f36209bc29e2561233ad..abb579eb887bb4a4b098510cccea953582d8faab 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2.ml @@ -518,7 +518,7 @@ module Test_batch_encodings = struct Format.fprintf fmt "@[Withdraw:@ destination=%a,@ ticket_hash=%a,@ qty:%a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp destination Alpha_context.Ticket_hash.pp ticket_hash diff --git a/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml b/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index dc16a0e7e123686fa8893d07699de2651963a67e..9bcb4dd05cc21d6608fc7b88829834550b39f8d1 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml @@ -48,7 +48,7 @@ open Indexable (** {3. Various helpers to facilitate the tests. } *) -let pkh = Tezos_crypto.Signature.Public_key_hash.zero +let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero let ((_, pk1, addr1) as l2_addr1) = gen_l2_address () @@ -155,7 +155,7 @@ let pp_withdrawal fmt = function Format.fprintf fmt "{claimer=%a; ticket_hash=%a; amount=%a}" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp claimer Ticket_hash.pp ticket_hash diff --git a/src/proto_014_PtKathma/lib_tx_rollup/accuser.mli b/src/proto_014_PtKathma/lib_tx_rollup/accuser.mli index d37405227453b209b67fac92f2d6b9de39b096b2..708084471840c12231e954dafbb8d0fe4eacdc27 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/accuser.mli +++ b/src/proto_014_PtKathma/lib_tx_rollup/accuser.mli @@ -38,7 +38,7 @@ val build_rejection : (** [reject_bad_commitment ~source state commitment] injects a rejection operation with [source] if the [commitment] is rejectable. *) val reject_bad_commitment : - source:Tezos_crypto.Signature.Public_key_hash.t -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> State.t -> Tx_rollup_commitment.Full.t -> unit tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_tx_rollup/batcher.ml b/src/proto_014_PtKathma/lib_tx_rollup/batcher.ml index e3e6d07864611fcff168b29aa8e83f3a82ddf9be..35f152099d46cf1d8c616b1020e132922a90bbd4 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/batcher.ml +++ b/src/proto_014_PtKathma/lib_tx_rollup/batcher.ml @@ -33,7 +33,7 @@ type state = { constants : Constants.t; batch_burn_limit : Tez.t option; index : Context.index; - signer : Tezos_crypto.Signature.public_key_hash; + signer : Tezos_crypto.Signature.V0.public_key_hash; transactions : Tx_queue.t; mutable incr_context : Context.t; lock : Lwt_mutex.t; @@ -241,7 +241,7 @@ module Types = struct type nonrec state = state type parameters = { - signer : Tezos_crypto.Signature.public_key_hash; + signer : Tezos_crypto.Signature.V0.public_key_hash; index : Context.index; constants : Constants.t; batch_burn_limit : Tez.t option; diff --git a/src/proto_014_PtKathma/lib_tx_rollup/batcher.mli b/src/proto_014_PtKathma/lib_tx_rollup/batcher.mli index 6a287c15683f2175644bf60f974fae4d1e4a1754..4a72ad02ee8ef7ce66a4f077eef446ece1464e5d 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/batcher.mli +++ b/src/proto_014_PtKathma/lib_tx_rollup/batcher.mli @@ -28,7 +28,7 @@ open Alpha_context (** Initialize the internal state of the batcher. *) val init : rollup:Tx_rollup.t -> - signer:Tezos_crypto.Signature.public_key_hash -> + signer:Tezos_crypto.Signature.V0.public_key_hash -> batch_burn_limit:Tez.t option -> Context.index -> Constants.t -> diff --git a/src/proto_014_PtKathma/lib_tx_rollup/dispatcher.mli b/src/proto_014_PtKathma/lib_tx_rollup/dispatcher.mli index e143b73b8ceb262f70b37ce0c470623f58a66f91..8237e9efdc01ad4d88d8fd9cf618952b32719406 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/dispatcher.mli +++ b/src/proto_014_PtKathma/lib_tx_rollup/dispatcher.mli @@ -26,7 +26,7 @@ (** Produce dispatch of withdrawals operations and sends them to the injector. *) val dispatch_withdrawals : - source:Tezos_crypto.Signature.Public_key_hash.t -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> State.t -> L2block.t -> unit tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_tx_rollup/node_config.ml b/src/proto_014_PtKathma/lib_tx_rollup/node_config.ml index 80c54b6d56478ae2e24da512f99da8111f518d0e..575fe3a78f08f9cbd7cd24948f6f4665aed64fc6 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/node_config.ml +++ b/src/proto_014_PtKathma/lib_tx_rollup/node_config.ml @@ -38,7 +38,7 @@ type 'a purposed = { dispatch_withdrawals : 'a; } -type signers = Tezos_crypto.Signature.public_key_hash option purposed +type signers = Tezos_crypto.Signature.V0.public_key_hash option purposed type cost_caps = { fee_cap : Protocol.Alpha_context.Tez.t; @@ -171,28 +171,28 @@ let signers_encoding = (opt ~description:"The operator of the rollup (public key hash) if any" "operator" - Tezos_crypto.Signature.Public_key_hash.encoding) + Tezos_crypto.Signature.V0.Public_key_hash.encoding) (opt "submit_batch" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description:"The public key hash of the signer for batch submission") (opt "finalize_commitment" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for finalization of commitments") (opt "remove_commitment" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for removals of commitments") (opt "rejection" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description:"The public key hash of the signer for rejections") (opt "dispatch_withdrawals" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for the dispatch of withdrawals") diff --git a/src/proto_014_PtKathma/lib_tx_rollup/node_config.mli b/src/proto_014_PtKathma/lib_tx_rollup/node_config.mli index 31a006cc418cda86a0cf6c09959e2b6d6d0fb360..1f3747c13292e0fbdb501066136df15d34d923fe 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/node_config.mli +++ b/src/proto_014_PtKathma/lib_tx_rollup/node_config.mli @@ -50,7 +50,7 @@ type 'a purposed = { dispatch_withdrawals : 'a; } -type signers = Tezos_crypto.Signature.public_key_hash option purposed +type signers = Tezos_crypto.Signature.V0.public_key_hash option purposed type cost_caps = { fee_cap : Protocol.Alpha_context.Tez.t; diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml index ad80ad0d1c83e149cd0ec897e804e7b1253387df..1456382e394b7866d9c223f1262f1bbbe9464a62 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml @@ -27,7 +27,7 @@ open Tezos_client_base let l1_destination_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Signature.Public_key_hash.of_b58check_opt s with + match Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt s with | Some addr -> return addr | None -> failwith "cannot parse %s to get a valid destination" s) @@ -68,7 +68,7 @@ type wallet_entry = { alias : string; public_key_hash : Tezos_crypto.Bls.Public_key_hash.t; public_key : Tezos_crypto.Bls.Public_key.t option; - secret_key_uri : Client_keys.aggregate_sk_uri option; + secret_key_uri : Client_keys_v0.aggregate_sk_uri option; } let wallet_parameter () = @@ -76,16 +76,16 @@ let wallet_parameter () = let open Lwt_result_syntax in let open Tezos_crypto.Aggregate_signature in let* (Bls12_381 public_key_hash) = - Client_keys.Aggregate_alias.Public_key_hash.find cctxt alias + Client_keys_v0.Aggregate_alias.Public_key_hash.find cctxt alias in let* _, pk_opt = - Client_keys.Aggregate_alias.Public_key.find cctxt alias + Client_keys_v0.Aggregate_alias.Public_key.find cctxt alias in let public_key = Option.map (fun (Bls12_381 pk : public_key) -> pk) pk_opt in let+ secret_key_uri = - Client_keys.Aggregate_alias.Secret_key.find_opt cctxt alias + Client_keys_v0.Aggregate_alias.Secret_key.find_opt cctxt alias in {alias; public_key_hash; public_key; secret_key_uri}) @@ -93,16 +93,16 @@ let wallet_param ?(name = "an alias for a tz4 address") ?(desc = "an alias for a tz4 address") = Tezos_clic.param ~name ~desc @@ wallet_parameter () -let tezos_pkh_param = Client_keys.Public_key_hash.source_param +let tezos_pkh_param = Client_keys_v0.Public_key_hash.source_param let bls_pkh_parameter () = Tezos_clic.parameter - ~autocomplete:Client_keys.Aggregate_alias.Public_key_hash.autocomplete + ~autocomplete:Client_keys_v0.Aggregate_alias.Public_key_hash.autocomplete (fun cctxt s -> let open Lwt_result_syntax in let from_alias s = let* (Bls12_381 pkh) = - Client_keys.Aggregate_alias.Public_key_hash.find cctxt s + Client_keys_v0.Aggregate_alias.Public_key_hash.find cctxt s in return pkh in @@ -131,8 +131,8 @@ let bls_pkh_param ?(name = "public key hash") let bls_sk_uri_parameter () = Tezos_clic.parameter - ~autocomplete:Client_keys.Aggregate_alias.Secret_key.autocomplete - Client_keys.Aggregate_alias.Secret_key.find + ~autocomplete:Client_keys_v0.Aggregate_alias.Secret_key.autocomplete + Client_keys_v0.Aggregate_alias.Secret_key.find let bls_sk_uri_param ?(name = "secret key") ?(desc = "Bls secret key to use.") = let desc = @@ -327,7 +327,7 @@ let sign_transaction cctxt sks_uri txs = in List.map_ep (fun sk -> - let* signature = Client_keys.aggregate_sign cctxt sk buf in + let* signature = Client_keys_v0.aggregate_sign cctxt sk buf in match signature with | Bls12_381 signature -> return signature | Unknown _signature -> failwith "failed to sign") diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_client/main_tx_rollup_client_015_PtLimaPt.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_client/main_tx_rollup_client_015_PtLimaPt.ml index bd688f020a2b0ad5313047b39a4f3b8138c90d5e..ebdf07b28fd2068ec69304c147e599d1ddc83c25 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/main_tx_rollup_client_015_PtLimaPt.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/main_tx_rollup_client_015_PtLimaPt.ml @@ -28,7 +28,7 @@ let executable_name = Filename.basename Sys.executable_name let argv () = Array.to_list Sys.argv |> List.tl |> Stdlib.Option.get let register_signers () = - Tezos_client_base.Client_keys.register_aggregate_signer + Tezos_client_base.Client_keys_v0.register_aggregate_signer (module Tezos_signer_backends.Unencrypted.Aggregate) (* FIXME: https://gitlab.com/tezos/tezos/-/issues/4025 diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_node/main_tx_rollup_node_015_PtLimaPt.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_node/main_tx_rollup_node_015_PtLimaPt.ml index 4d6d99a785feff9eebe1e082d7531f7c4e331ede..d091375c6f770536eaa84db2ad1e8a61bef968c7 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_node/main_tx_rollup_node_015_PtLimaPt.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_node/main_tx_rollup_node_015_PtLimaPt.ml @@ -52,42 +52,42 @@ let data_dir_arg = Client_proto_args.string_parameter let operator_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"operator" ~placeholder:"operator" ~doc:"The operator of the rollup" () let batch_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"batch-signer" ~placeholder:"batch-signer" ~doc:"The signer for submission of batches" () let finalize_commitment_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"finalize-commitment-signer" ~placeholder:"finalize-commitment-signer" ~doc:"The signer for finalization of commitments" () let remove_commitment_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"remove-commitment-signer" ~placeholder:"remove-commitment-signer" ~doc:"The signer for removals of commitments" () let rejection_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"rejection-signer" ~placeholder:"rejection-signer" ~doc:"The signer for rejections" () let dispatch_withdrawals_signer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"dispatch-withdrawals-signer" ~placeholder:"dispatch-withdrawals-signer" ~doc:"The signer for dispatch withdrawals" diff --git a/src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml b/src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml index a5ffb8cf0e8bf884da2c3b367fef38c0512e81fa..a43161a7c3f34699f2133ea4504ccb5cd36d00c9 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml @@ -156,7 +156,7 @@ end module Make (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct (* Generates minimally sized random data of specified type. Used in autocompletion. *) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml b/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml index 5672070a26e740415ac526d6012b1eb3dab118fc..8395355273ce543e3e4f484d4cebf977f4e6b0b2 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml @@ -386,12 +386,18 @@ module Data = struct let key_hash kh = let b = - Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding kh + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key_hash.encoding + kh in prim A_Key_hash [bytes b] [] let key k = - let b = Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding k in + let b = + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key.encoding + k + in prim A_Key [bytes b] [] let integer (i : int) = prim A_Int [int (Z.of_int i)] [] diff --git a/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli b/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli index 4cebbffb4467867f921d23f4921d00fcca564d32..724bfa299074d04eb4a0743caa9210735a7c550f 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli +++ b/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli @@ -309,9 +309,9 @@ module Data : sig val mutez : Alpha_context.Tez.t -> node - val key_hash : Signature.Public_key_hash.t -> node + val key_hash : Environment.Signature.Public_key_hash.t -> node - val key : Signature.Public_key.t -> node + val key : Environment.Signature.Public_key.t -> node val integer : int -> node diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.ml index 7dc0f4edd716a6ee3064981493a71cad88a12f76..29704a91d5e0dff40c34403c6045977d086b12cd 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.ml @@ -208,7 +208,7 @@ end module Make_code_sampler (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) (X : sig + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t val target_size : int @@ -267,7 +267,7 @@ end module Make_data_sampler (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) (X : sig + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t val target_size : int diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.mli b/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.mli index bd67d13e3c165f1a7261a8074c71525c0ca74e24..66f409c121c919e3070499bac8ab8ef1f07fca44 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.mli +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.mli @@ -79,7 +79,7 @@ val load : filename:string -> michelson_sample list *) module Make_code_sampler : functor (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t @@ -98,7 +98,7 @@ end (** See documentation for [Make_code_sampler] *) module Make_data_sampler : functor (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) (X : sig val rng_state : Random.State.t diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml index 0d51700eabe1678fbcfd3deddb09db04279ec6e4..ed701eca32ce877e173731330465261a4fb7360e 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml @@ -266,7 +266,7 @@ let fail_sampling error = raise (SamplingError error) module Make (P : sig val parameters : parameters end) -(Crypto_samplers : Crypto_samplers.Finite_key_pool_S) : S = struct +(Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) : S = struct module Michelson_base = Michelson_samplers_base.Make (struct let parameters = P.parameters.base_parameters end) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.mli b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.mli index c333639b79a9b026e0acbcd15f1c12b090bc8ef4..790b07559bd5f9282002602d92ce7c1c40263064 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.mli +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.mli @@ -94,7 +94,7 @@ module Make : functor (P : sig val parameters : parameters end) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) -> S module Internal_for_tests : sig diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml index 3f8f301fd1ab7718fe34b741ce9d397679166dcb..847b8406a4a3c80fb2a9329b80064e2a9ba33b11 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml @@ -53,7 +53,7 @@ module type S = sig val nat : Script_int.n Script_int.num sampler - val signature : Tezos_crypto.Signature.t sampler + val signature : Tezos_crypto.Signature.V0.t sampler val string : Script_string.t sampler @@ -85,21 +85,21 @@ end) : S = struct let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_ed25519 s) + | Some s -> Tezos_crypto.Signature.V0.of_ed25519 s) | 1 -> ( let open Tezos_crypto.Secp256k1 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_secp256k1 s) + | Some s -> Tezos_crypto.Signature.V0.of_secp256k1 s) | 2 -> ( let open Tezos_crypto.P256 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false - | Some s -> Tezos_crypto.Signature.of_p256 s) + | Some s -> Tezos_crypto.Signature.V0.of_p256 s) | _ -> ( - let open Tezos_crypto.Signature in + let open Tezos_crypto.Signature.V0 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with None -> assert false | Some s -> s) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.mli b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.mli index 18a150245cfce7b351421295d52b40c6bb140116..b29fb1868ba02ae868aed989771c7f0849d46ce9 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.mli +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.mli @@ -47,7 +47,7 @@ module type S = sig val nat : Script_int.n Script_int.num sampler - val signature : Tezos_crypto.Signature.t sampler + val signature : Tezos_crypto.Signature.V0.t sampler val string : Script_string.t sampler diff --git a/src/proto_015_PtLimaPt/lib_benchmark/rules.ml b/src/proto_015_PtLimaPt/lib_benchmark/rules.ml index ce35900d5a20a039eae100288c724c8af7708c39..45d31deda24a16c1e9374f5dab2c123a05401c84 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/rules.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/rules.ml @@ -580,7 +580,7 @@ end module Data_rewrite_leaves (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct let hole_patt = let open Patt in @@ -917,7 +917,7 @@ end module Data (Michelson_base : Michelson_samplers_base.S) - (Crypto_samplers : Crypto_samplers.Finite_key_pool_S) = + (Crypto_samplers : Crypto_samplers.V0.Finite_key_pool_S) = struct let match_data_node = let open Patt in diff --git a/src/proto_015_PtLimaPt/lib_benchmark/test/test_autocompletion.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_autocompletion.ml index c2f3e6c742956c823d50e5a08ea4aeff08fe3c19..91a8ed29d1cb57424dc2eb65bad425503d88a03b 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/test/test_autocompletion.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/test/test_autocompletion.ml @@ -25,7 +25,7 @@ let rng_state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_015_PtLimaPt/lib_benchmark/test/test_distribution.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_distribution.ml index 7822b5b6e08cd476377340106be16136c9142616..b7f46d1753d38a7924f690a223455bf3c4b5457f 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/test/test_distribution.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/test/test_distribution.ml @@ -95,7 +95,7 @@ let rec tnames_of_type : | Script_typed_ir.Chest_key_t -> assert false | Script_typed_ir.Chest_t -> assert false -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_code.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_code.ml index e5e8edf378d5c87a4ab171f387d082a782e2e89d..1a23352b714a15d99b38c399eee9c998b67274ff 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_code.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_code.ml @@ -39,7 +39,7 @@ let verbose = let state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_data.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_data.ml index fb67a046d1ef33ccfd2970c4419e48a293c74273..f69f30af7d3cf9f5eb1407ef37f079ccbf5a0169 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_data.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/test/test_sampling_data.ml @@ -39,7 +39,7 @@ let verbose = let state = Random.State.make [|42; 987897; 54120|] -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let algo = `Default let size = 16 diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml index fa296e227b094d56ad554afab1ca6f7223d0c576..835e4e2035cda8a908990b1c9db499fb1c5d1946 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -145,8 +145,9 @@ module Default_config = struct end let make_default_samplers ?(algo = `Default) cfg : - (module Crypto_samplers.Finite_key_pool_S) * (module Michelson_samplers.S) = - let module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct + (module Crypto_samplers.V0.Finite_key_pool_S) + * (module Michelson_samplers.S) = + let module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let size = 16 let algo = algo @@ -2325,14 +2326,14 @@ module Registration_section = struct ~kinstr:(ILevel (dummy_loc, halt)) () - let check_signature (algo : Tezos_crypto.Signature.algo) ~for_intercept = + let check_signature (algo : Tezos_crypto.Signature.V0.algo) ~for_intercept = let name = match algo with - | Tezos_crypto.Signature.Ed25519 -> + | Tezos_crypto.Signature.V0.Ed25519 -> Interpreter_workload.N_ICheck_signature_ed25519 - | Tezos_crypto.Signature.Secp256k1 -> + | Tezos_crypto.Signature.V0.Secp256k1 -> Interpreter_workload.N_ICheck_signature_secp256k1 - | Tezos_crypto.Signature.P256 -> + | Tezos_crypto.Signature.V0.P256 -> Interpreter_workload.N_ICheck_signature_p256 in benchmark_with_stack_sampler @@ -2351,7 +2352,7 @@ module Registration_section = struct else Samplers.Random_value.value Script_typed_ir.bytes_t rng_state in let signed_message = - Tezos_crypto.Signature.sign sk unsigned_message + Tezos_crypto.Signature.V0.sign sk unsigned_message in let signed_message = Script_signature.make signed_message in (pk, (signed_message, (unsigned_message, eos)))) @@ -2361,11 +2362,11 @@ module Registration_section = struct check_signature algo ~for_intercept:true ; check_signature algo ~for_intercept:false - let () = check_signature Tezos_crypto.Signature.Ed25519 + let () = check_signature Tezos_crypto.Signature.V0.Ed25519 - let () = check_signature Tezos_crypto.Signature.Secp256k1 + let () = check_signature Tezos_crypto.Signature.V0.Secp256k1 - let () = check_signature Tezos_crypto.Signature.P256 + let () = check_signature Tezos_crypto.Signature.V0.P256 let () = simple_benchmark @@ -3075,8 +3076,8 @@ module Registration_section = struct let step_constants = { source = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero; - payer = Tezos_crypto.Signature.Public_key_hash.zero; + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero; + payer = Tezos_crypto.Signature.V0.Public_key_hash.zero; self = Contract_hash.zero; amount = Tez.zero; balance = Tez.zero; diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml index 01a1a59eea37e0b93c40f34bea8e2b24bdaaafc4..032f8fb857bc5468b127cfdb1ac50f6a3f4e0cf9 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml @@ -1341,19 +1341,19 @@ let extract_ir_sized_step : | ILevel (_, _), _ -> Instructions.level | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with - | Tezos_crypto.Signature.Ed25519 _pk -> + | Tezos_crypto.Signature.V0.Ed25519 _pk -> let pk = Size.of_int Tezos_crypto.Ed25519.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message - | Tezos_crypto.Signature.Secp256k1 _pk -> + | Tezos_crypto.Signature.V0.Secp256k1 _pk -> let pk = Size.of_int Tezos_crypto.Secp256k1.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message - | Tezos_crypto.Signature.P256 _pk -> + | Tezos_crypto.Signature.V0.P256 _pk -> let pk = Size.of_int Tezos_crypto.P256.size in - let signature = Size.of_int Tezos_crypto.Signature.size in + let signature = Size.of_int Tezos_crypto.Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_p256 pk signature message) | IHash_key (_, _), _ -> Instructions.hash_key diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/michelson_generation.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/michelson_generation.ml index d1422930010aa84e1f20e06e14f4763745f68599..a96d9c8cea416c0f1eb8db29109a596783e742de 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/michelson_generation.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/michelson_generation.ml @@ -44,7 +44,7 @@ let generator_config_encoding = (* ----------------------------------------------------------------------- *) -module Crypto_samplers = Crypto_samplers.Make_finite_key_pool (struct +module Crypto_samplers = Crypto_samplers.V0.Make_finite_key_pool (struct let size = 16 let algo = `Default diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml index 5934b358431acf4efbd45a2942ae7cb9c8248c8d..57f93ff31797983afea55554b0fb8cf8ced4c14a 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml @@ -255,8 +255,8 @@ let () = Registration_helpers.register (module Has_tickets_type_benchmark) let ticket_sampler rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let pkh, _, _ = - Tezos_crypto.Signature.generate_key - ~algo:Tezos_crypto.Signature.Ed25519 + Tezos_crypto.Signature.V0.generate_key + ~algo:Tezos_crypto.Signature.V0.Ed25519 ~seed () in diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml index 4715eb2330e9d54523145ffda494ff21cd89592d..2d13cc8e3ca51a3a1feb5446328c9bcdd79b5eca 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml @@ -218,7 +218,7 @@ let default_arg_arg = string_parameter let delegate_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"delegate" ~placeholder:"address" ~doc:"delegate of the contract\nMust be a known address." @@ -551,7 +551,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> return s | None -> failwith "Not given a valid signature") diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli index 568adb1a38551ed65ef11d2e0fdb956f416c4826..39946abf4a069bb9dfad05cf0353197c3407c347 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli @@ -61,7 +61,7 @@ val entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val default_entrypoint_arg : (Entrypoint.t option, full) Tezos_clic.arg val delegate_arg : - (Tezos_crypto.Signature.Public_key_hash.t option, full) Tezos_clic.arg + (Tezos_crypto.Signature.V0.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -118,7 +118,8 @@ val global_constant_param : ('a, full) Tezos_clic.params -> (string -> 'a, full) Tezos_clic.params -val signature_parameter : (Tezos_crypto.Signature.t, full) Tezos_clic.parameter +val signature_parameter : + (Tezos_crypto.Signature.V0.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml index f1226f563a5581d5894ea8523cf68cf0a7f6d5d8..5f3ddb053db59868d0a5fbb8070c38c8e2b71d6b 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml @@ -28,7 +28,7 @@ open Alpha_context open Protocol_client_context open Tezos_micheline open Client_proto_contracts -open Client_keys +open Client_keys_v0 let get_balance (rpc : #rpc_context) ~chain ~block contract = Alpha_services.Contract.balance rpc (chain, block) contract @@ -314,7 +314,7 @@ let build_update_consensus_key ?fee ?gas_limit ?storage_limit consensus_pk = let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?fee ~manager_sk ~fee_parameter ?consensus_pk src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in let delegate_op = build_delegate_operation ?fee (Some source) in match consensus_pk with | None -> ( @@ -375,7 +375,7 @@ let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run let update_consensus_key cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?fee ~consensus_pk ~manager_sk ~fee_parameter src_pk = - let source = Tezos_crypto.Signature.Public_key.hash src_pk in + let source = Tezos_crypto.Signature.V0.Public_key.hash src_pk in let operation = build_update_consensus_key ?fee consensus_pk in let operation = Annotated_manager_operation.Single_manager operation in Injection.inject_manager_operation @@ -703,14 +703,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -750,21 +750,23 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?(encrypted = false) ?force key name = read_key key >>=? fun (pkh, pk, sk) -> fail_unless - (Tezos_crypto.Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V0.public_key pk in + let sk = Tezos_crypto.Signature.Of_V0.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk else Tezos_signer_backends.Unencrypted.make_sk sk >>?= return) >>=? fun sk_uri -> - Client_keys.register_key cctxt ?force (pkh, pk_uri, sk_uri) name + Client_keys_v0.register_key cctxt ?force (pkh, pk_uri, sk_uri) name >>=? fun () -> inject_activate_operation cctxt @@ -778,7 +780,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run let activate_existing_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run alias activation_code = - Client_keys.alias_keys cctxt alias >>=? function + Client_keys_v0.alias_keys cctxt alias >>=? function | Some (Ed25519 pkh, _, _) -> inject_activate_operation cctxt diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli index 9e2c022e82deef3b51f54a6efcc40efe7de8715a..37b0b362034fa798d2530fac9c89b66dfc84805c 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli @@ -81,9 +81,9 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -131,7 +131,7 @@ val get_frozen_deposits_limit : #Protocol_client_context.rpc_context -> chain:Shell_services.chain -> block:Shell_services.block -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t (** Calls {!Injection.prepare_manager_operation} @@ -157,7 +157,7 @@ val set_delegate : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> public_key_hash option -> Kind.delegation Kind.manager Injection.result tzresult Lwt.t @@ -171,10 +171,10 @@ val update_consensus_key : ?verbose_signing:bool -> ?simulation:bool -> ?fee:Tez.tez -> - consensus_pk:Tezos_crypto.Signature.public_key -> - manager_sk:Client_keys.sk_uri -> + consensus_pk:Tezos_crypto.Signature.V0.public_key -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> - Tezos_crypto.Signature.public_key -> + Tezos_crypto.Signature.V0.public_key -> Kind.update_consensus_key Kind.manager Injection.result tzresult Lwt.t val drain_delegate : @@ -185,10 +185,10 @@ val drain_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?simulation:bool -> - consensus_sk:Client_keys.sk_uri -> - consensus_pkh:Tezos_crypto.Signature.public_key_hash -> - ?destination:Tezos_crypto.Signature.public_key_hash -> - delegate:Tezos_crypto.Signature.public_key_hash -> + consensus_sk:Client_keys_v0.sk_uri -> + consensus_pkh:Tezos_crypto.Signature.V0.public_key_hash -> + ?destination:Tezos_crypto.Signature.V0.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> unit -> Kind.drain_delegate Injection.result tzresult Lwt.t @@ -206,7 +206,7 @@ val set_deposits_limit : ?fee:Tez.tez -> public_key_hash -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> Tez.t option -> Kind.set_deposits_limit Kind.manager Injection.result tzresult Lwt.t @@ -227,14 +227,14 @@ val increase_paid_storage : source:public_key_hash -> destination:Contract_hash.t -> src_pk:public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> amount_in_bytes:Z.t -> unit -> Kind.increase_paid_storage Kind.manager Injection.result tzresult Lwt.t (** Same as {!set_delegate} but the [~source] argument of {!Injection.inject_manager_operation} - is {!Tezos_crypto.Signature.Public_key.hash} [src_pk]. *) + is {!Tezos_crypto.Signature.V0.Public_key.hash} [src_pk]. *) val register_as_delegate : #Protocol_client_context.full -> chain:Shell_services.chain -> @@ -243,7 +243,7 @@ val register_as_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?fee:Tez.tez -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> ?consensus_pk:public_key -> public_key -> @@ -281,7 +281,7 @@ val originate_contract : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> code:Script.expr -> fee_parameter:Injection.fee_parameter -> unit -> @@ -319,7 +319,7 @@ val transfer_with_script : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> parameters:Script.lazy_expr -> @@ -353,7 +353,7 @@ val transfer : ?successor_level:bool -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> ?arg:string -> @@ -391,7 +391,7 @@ val reveal : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> ?fee:Tez.t -> fee_parameter:Injection.fee_parameter -> unit -> @@ -501,7 +501,7 @@ val submit_proposals : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t @@ -516,7 +516,7 @@ val submit_ballot : chain:Shell_services.chain -> block:Shell_services.block -> ?confirmations:int -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> public_key_hash -> Tezos_crypto.Protocol_hash.t -> Vote.ballot -> @@ -572,9 +572,9 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -596,9 +596,9 @@ val submit_tx_rollup_batch : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -621,9 +621,9 @@ val submit_tx_rollup_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> inbox_merkle_root:Tx_rollup_inbox.Merkle.root -> @@ -649,9 +649,9 @@ val submit_tx_rollup_finalize_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -674,9 +674,9 @@ val submit_tx_rollup_remove_commitment : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -698,9 +698,9 @@ val submit_tx_rollup_rejection : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -732,9 +732,9 @@ val submit_tx_rollup_return_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -756,9 +756,9 @@ val tx_rollup_dispatch_tickets : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -785,9 +785,9 @@ val transfer_ticket : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> ty:string -> @@ -819,7 +819,7 @@ val sc_rollup_originate : boot_sector:string -> parameters_ty:Script.lazy_expr -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> ( Tezos_crypto.Operation_hash.t @@ -845,7 +845,7 @@ val sc_rollup_add_messages : rollup:Alpha_context.Sc_rollup.t -> messages:string list -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -870,7 +870,7 @@ val sc_rollup_cement : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment.Hash.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -895,7 +895,7 @@ val sc_rollup_publish : rollup:Alpha_context.Sc_rollup.t -> commitment:Alpha_context.Sc_rollup.Commitment.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -921,7 +921,7 @@ val sc_rollup_execute_outbox_message : cemented_commitment:Sc_rollup.Commitment.Hash.t -> output_proof:string -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> ( Tezos_crypto.Operation_hash.t @@ -944,9 +944,9 @@ val sc_rollup_recover_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> unit -> @@ -973,7 +973,7 @@ val sc_rollup_refute : refutation:Alpha_context.Sc_rollup.Game.refutation option -> opponent:Alpha_context.Sc_rollup.Staker.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -999,7 +999,7 @@ val sc_rollup_timeout : alice:Alpha_context.Sc_rollup.Staker.t -> bob:Alpha_context.Sc_rollup.Staker.t -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t @@ -1024,7 +1024,7 @@ val sc_rollup_dal_slot_subscribe : rollup:Alpha_context.Sc_rollup.t -> slot_index:int -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Tezos_crypto.Operation_hash.t diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_contracts.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_contracts.ml index 55ac47e920fca4d9f9fd2ebeb33b451558220768..1ec7e0d930087a1bed14680c11595eebc302bdd7 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_contracts.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_contracts.ml @@ -101,18 +101,18 @@ module ContractAlias = struct RawContractAlias.find_opt cctxt s >>=? function | Some v -> return v | None -> ( - Client_keys.Public_key_hash.find_opt cctxt s >>=? function + Client_keys_v0.Public_key_hash.find_opt cctxt s >>=? function | Some v -> return (Contract.Implicit v) | None -> failwith "no contract or key named %s" s) let find_key cctxt name = - Client_keys.Public_key_hash.find cctxt name >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt name >>=? fun v -> return (Contract.Implicit v) let rev_find cctxt (c : Contract.t) = match c with | Implicit hash -> ( - Client_keys.Public_key_hash.rev_find cctxt hash >>=? function + Client_keys_v0.Public_key_hash.rev_find cctxt hash >>=? function | Some name -> return_some ("key:" ^ name) | None -> return_none) | Originated _ -> RawContractAlias.rev_find cctxt c @@ -123,7 +123,7 @@ module ContractAlias = struct | _ -> find cctxt s let autocomplete cctxt = - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun keys -> RawContractAlias.autocomplete cctxt >>=? fun contracts -> return (List.map (( ^ ) "key:") keys @ contracts) @@ -139,7 +139,7 @@ module ContractAlias = struct match String.split ~limit:1 ':' s with | ["alias"; alias] -> find cctxt alias | ["key"; text] -> - Client_keys.Public_key_hash.find cctxt text >>=? fun v -> + Client_keys_v0.Public_key_hash.find cctxt text >>=? fun v -> return (Contract.Implicit v) | ["text"; text] -> ContractEntity.of_source text | _ -> ( @@ -154,7 +154,7 @@ module ContractAlias = struct Tezos_clic.parameter ~autocomplete:(fun cctxt -> autocomplete cctxt >>=? fun list1 -> - Client_keys.Public_key_hash.autocomplete cctxt >>=? fun list2 -> + Client_keys_v0.Public_key_hash.autocomplete cctxt >>=? fun list2 -> return (list1 @ list2)) find_destination @@ -191,7 +191,7 @@ end let list_contracts cctxt = RawContractAlias.load cctxt >>=? fun raw_contracts -> let contracts = List.map (fun (n, v) -> ("", n, v)) raw_contracts in - Client_keys.Public_key_hash.load cctxt >>=? fun keys -> + Client_keys_v0.Public_key_hash.load cctxt >>=? fun keys -> (* List accounts (implicit contracts of identities) *) List.map_es (fun (n, v) -> diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli index cbfa0e1be8ac0acd8dd3f034c3fcdd005717be16..de7fbd67e89460fc3318abc0c91622a9d1ef2a6c 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli @@ -99,7 +99,7 @@ val call_contract : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract_hash.t -> action:action -> tez_amount:Tez.t -> @@ -137,7 +137,7 @@ val inject_token_transfer_batch : sender:Contract.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> token_transfers:token_transfer list -> fee_parameter:Injection.fee_parameter -> ?counter:counter -> @@ -155,7 +155,7 @@ val run_view_action : ?source:Contract.t -> contract:Contract_hash.t -> action:action -> - ?payer:Tezos_crypto.Signature.public_key_hash -> + ?payer:Tezos_crypto.Signature.V0.public_key_hash -> ?gas:Gas.Arith.integral -> unparsing_mode:Script_ir_unparser.unparsing_mode -> unit -> diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml index 7a671305c7886b5c2869d490f50fa6b4095db797..eda34eba7679cf4e9fc0c19822b21a9a18aca210 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml @@ -139,9 +139,9 @@ let () = Format.fprintf ppf "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) + (Tezos_crypto.Signature.V0.to_b58check s)) Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + obj1 (req "invalid_signature" Tezos_crypto.Signature.V0.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -586,11 +586,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) let mutez ~loc (amount : Tez.t) = int ~loc (Z.of_int64 (Tez.to_mutez amount)) let optimized_key_hash ~loc - (key_hash : Tezos_crypto.Signature.Public_key_hash.t) = + (key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) @@ -601,11 +601,11 @@ let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) Data_encoding.(tup2 Contract.encoding Entrypoint.value_encoding) (address, entrypoint)) -let optimized_key ~loc (key : Tezos_crypto.Signature.Public_key.t) = +let optimized_key ~loc (key : Tezos_crypto.Signature.V0.Public_key.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding key) (** * Actions *) @@ -711,7 +711,7 @@ let action_of_expr_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -787,7 +787,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -814,7 +814,7 @@ let action_of_expr_not_generic e = | Tezos_micheline.Micheline.Bytes (_, s) -> return @@ Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Tezos_crypto.Signature.V0.Public_key.encoding s | _ -> fail ()) key_bytes @@ -824,7 +824,7 @@ let action_of_expr_not_generic e = let action_of_expr ~generic = if generic then action_of_expr_generic else action_of_expr_not_generic -type key_list = Tezos_crypto.Signature.Public_key.t list +type key_list = Tezos_crypto.Signature.V0.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -852,7 +852,8 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain (function | String (_, key_str) -> return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + @@ Tezos_crypto.Signature.V0.Public_key.of_b58check_exn + key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -864,7 +865,7 @@ let multisig_create_storage ~counter ~threshold ~keys () : let open Tezos_micheline.Micheline in List.map_es (fun key -> - let key_str = Tezos_crypto.Signature.Public_key.to_b58check key in + let key_str = Tezos_crypto.Signature.V0.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -888,7 +889,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : return @@ some ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + (String (loc, Tezos_crypto.Signature.V0.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc ~generic action >>=? fun expr -> @@ -1057,7 +1058,7 @@ let check_multisig_signatures ~bytes ~threshold ~keys signatures = let opt_sigs_arr = Array.make nkeys None in let matching_key_found = ref false in let check_signature_against_key_number signature i key = - if Tezos_crypto.Signature.check key signature bytes then ( + if Tezos_crypto.Signature.V0.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli index 5650cc2355eaeb741e7294952a8735b23fa3b305..1eb71be4ddf08fe1894d59f172e67340b289dcf6 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli @@ -83,7 +83,7 @@ val originate_multisig : balance:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> (Kind.origination Kind.manager Injection.result * Contract.t) tzresult Lwt.t @@ -109,10 +109,10 @@ val call_multisig : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract_hash.t -> action:multisig_action -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> @@ -136,10 +136,10 @@ val call_multisig_on_bytes : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> multisig_contract:Contract_hash.t -> bytes:Bytes.t -> - signatures:Tezos_crypto.Signature.t list -> + signatures:Tezos_crypto.Signature.V0.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_programs.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_programs.ml index 3f944c498f9fe2161b2fc15747c29e0fba93a9f0..b23aab87d0c3d8bfd0e4de3375018b7d1bec7d58 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_programs.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_programs.ml @@ -126,7 +126,7 @@ type simulation_params = { now : Script_timestamp.t option; level : Script_int.n Script_int.num option; source : Contract.t option; - payer : Tezos_crypto.Signature.public_key_hash option; + payer : Tezos_crypto.Signature.V0.public_key_hash option; gas : Gas.Arith.integral option; } diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_programs.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_programs.mli index 8e5c87d2ef5e59579801ec49473e3be1faaf0047..a577a713a678383ab333455abcc79708ef23659d 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_programs.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_programs.mli @@ -39,7 +39,7 @@ type simulation_params = { now : Script_timestamp.t option; level : Script_int.n Script_int.num option; source : Contract.t option; - payer : Tezos_crypto.Signature.public_key_hash option; + payer : Tezos_crypto.Signature.V0.public_key_hash option; gas : Gas.Arith.integral option; } diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml index 5f98e3c9228609825d851deb977c117ec234a4c7..7495f6a00449eb30333a3bcef164c71d6c073a9e 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml @@ -40,9 +40,9 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = let json, bytes = to_json_and_bytes block message in cctxt#message "signed content: @[%a@]" Data_encoding.Json.pp json >>= fun () -> - Client_keys.sign + Client_keys_v0.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -52,8 +52,8 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature (if quiet then Lwt.return_unit else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> - Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + Client_keys_v0.check + ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature bytes diff --git a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..7393491c2dac9550055db52cb79be105e06691a7 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli @@ -25,16 +25,16 @@ val sign_message : #Protocol_client_context.full -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> block:Tezos_crypto.Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> block:Tezos_crypto.Block_hash.t -> - key_locator:Client_keys.pk_uri -> + key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> - signature:Tezos_crypto.Signature.t -> + signature:Tezos_crypto.Signature.V0.t -> bool tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_client/injection.ml b/src/proto_015_PtLimaPt/lib_client/injection.ml index 6189bf830f4c2bceef40fe6ca68f7abc5976a724..6d6f8e519526b8293e2a19bb5215659595b3bcbf 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.ml +++ b/src/proto_015_PtLimaPt/lib_client/injection.ml @@ -192,9 +192,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Tezos_crypto.Signature.V0.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) + (Hex.of_bytes (Tezos_crypto.Signature.V0.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; @@ -218,7 +218,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = pp_print_text ppf "Blake 2B Hash (ledger-style, with operation watermark): " ; - hash_pp [Tezos_crypto.Signature.bytes_of_watermark watermark; bytes]) ; + hash_pp [Tezos_crypto.Signature.V0.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -244,7 +244,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block let watermark = match contents with (* TODO-TB sign endorsement? *) - | _ -> Tezos_crypto.Signature.Generic_operation + | _ -> Tezos_crypto.Signature.V0.Generic_operation in (if verbose_signing then cctxt#message @@ -252,14 +252,14 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block (print_for_verbose_signing ~watermark ~bytes ~branch ~contents) else Lwt.return_unit) >>= fun () -> - Client_keys.sign cctxt ~watermark src_sk bytes >>=? fun signature -> + Client_keys_v0.sign cctxt ~watermark src_sk bytes >>=? fun signature -> return_some signature) >>=? fun signature -> let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} in let oph = Operation.hash op in - let size = Bytes.length bytes + Tezos_crypto.Signature.size in + let size = Bytes.length bytes + Tezos_crypto.Signature.V0.size in (match fee_parameter with | Some fee_parameter -> check_fees cctxt fee_parameter contents size | None -> Lwt.return_unit) @@ -794,7 +794,7 @@ let may_patch_limits (type kind) (cctxt : #Protocol_client_context.full) + Data_encoding.Binary.length Operation.contents_encoding (Contents op) - + Tezos_crypto.Signature.size + + Tezos_crypto.Signature.V0.size else Data_encoding.Binary.length Operation.contents_encoding @@ -1216,10 +1216,12 @@ let pending_applied_operations_of_source (cctxt : #full) chain src : (fun acc (_oph, {protocol_data = Operation_data {contents; _}; _}) -> match contents with | Single (Manager_operation {source; _} as _op) - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | Cons (Manager_operation {source; _}, _rest) as _op - when Tezos_crypto.Signature.Public_key_hash.equal source src -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal source src + -> Contents_list contents :: acc | _ -> acc) [] @@ -1342,14 +1344,14 @@ let replace_operation (type kind) (cctxt : #full) chain source cctxt#error "Cannot replace! No applied manager operation found for %a in \ mempool@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source >>= fun () -> exit 1 | _ :: _ :: _ as l -> cctxt#error "More than one applied manager operation found for %a in mempool. \ Found %d operations. Are you sure the node is in precheck mode?@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source (List.length l) >>= fun () -> exit 1 diff --git a/src/proto_015_PtLimaPt/lib_client/injection.mli b/src/proto_015_PtLimaPt/lib_client/injection.mli index e510735766bb49873419ff7ffdaf4c68e7215c5e..1ab767fb6bf210130f397e279ca3c85f3c05e917 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.mli +++ b/src/proto_015_PtLimaPt/lib_client/injection.mli @@ -46,7 +46,7 @@ val preapply : ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> 'kind contents_list -> 'kind preapply_result tzresult Lwt.t @@ -79,7 +79,7 @@ val inject_operation : ?simulation:bool -> ?successor_level:bool -> ?branch:int -> - ?src_sk:Client_keys.sk_uri -> + ?src_sk:Client_keys_v0.sk_uri -> ?verbose_signing:bool -> ?fee_parameter:fee_parameter -> 'kind contents_list -> @@ -106,9 +106,9 @@ val inject_manager_operation : ?verbose_signing:bool -> ?simulation:bool -> ?force:bool -> - source:Tezos_crypto.Signature.Public_key_hash.t -> - src_pk:Tezos_crypto.Signature.public_key -> - src_sk:Client_keys.sk_uri -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> + src_sk:Client_keys_v0.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral Limit.t -> storage_limit:Z.t Limit.t -> diff --git a/src/proto_015_PtLimaPt/lib_client/managed_contract.ml b/src/proto_015_PtLimaPt/lib_client/managed_contract.ml index 3edbaae334159dc0f533115188b17f4067da403f..ea85493a30dee7491c571aa2a118da2603abab82 100644 --- a/src/proto_015_PtLimaPt/lib_client/managed_contract.ml +++ b/src/proto_015_PtLimaPt/lib_client/managed_contract.ml @@ -51,7 +51,7 @@ let get_contract_manager (cctxt : #full) contract = | Prim (_, D_Pair, Bytes (_, bytes) :: _, _) | Bytes (_, bytes) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding bytes with | Some k -> return k @@ -62,7 +62,7 @@ let get_contract_manager (cctxt : #full) contract = Transfer from scripted contract are currently only supported for \ \"manager\" contract.") | Prim (_, D_Pair, String (_, value) :: _, _) | String (_, value) -> ( - match Tezos_crypto.Signature.Public_key_hash.of_b58check_opt value with + match Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> cctxt#error @@ -90,7 +90,7 @@ let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ @@ -106,7 +106,7 @@ let entrypoint_remove_delegate = Entrypoint.remove_delegate let build_delegate_operation (cctxt : #full) ~chain ~block ?fee contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = let entrypoint = entrypoint_do in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -141,7 +141,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee match delegate with | Some delegate -> let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate + Tezos_crypto.Signature.V0.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -162,7 +162,7 @@ let build_delegate_operation (cctxt : #full) ~chain ~block ?fee let set_delegate (cctxt : #full) ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?branch ~fee_parameter ?fee ~source ~src_pk ~src_sk contract (* the KT1 to delegate *) - (delegate : Tezos_crypto.Signature.public_key_hash option) = + (delegate : Tezos_crypto.Signature.V0.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -193,7 +193,7 @@ let t_unit = let build_lambda_for_transfer_to_implicit ~destination ~amount = let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination + Tezos_crypto.Signature.V0.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ diff --git a/src/proto_015_PtLimaPt/lib_client/managed_contract.mli b/src/proto_015_PtLimaPt/lib_client/managed_contract.mli index e0cc3d291769cfa01f1cf9f35e3257cc94ba097a..c342e39982eb60d13f485c026a15d1d424c360c1 100644 --- a/src/proto_015_PtLimaPt/lib_client/managed_contract.mli +++ b/src/proto_015_PtLimaPt/lib_client/managed_contract.mli @@ -67,7 +67,7 @@ val set_delegate : ?fee:Tez.t -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> Contract_hash.t -> public_key_hash option -> Kind.transaction Kind.manager Injection.result tzresult Lwt.t @@ -105,7 +105,7 @@ val transfer : ?branch:int -> source:public_key_hash -> src_pk:public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> contract:Contract.t -> destination:Contract.t -> ?entrypoint:Entrypoint.t -> diff --git a/src/proto_015_PtLimaPt/lib_client/mockup.ml b/src/proto_015_PtLimaPt/lib_client/mockup.ml index ad1b10ea3158871b82c7eb0e2e4e6a1555e6b5aa..c1a05a03d092badcf43affcfda9ae9474b276ab3 100644 --- a/src/proto_015_PtLimaPt/lib_client/mockup.ml +++ b/src/proto_015_PtLimaPt/lib_client/mockup.ml @@ -73,7 +73,7 @@ module Protocol_constants_overrides = struct end module Parsed_account = struct - type t = {name : string; sk_uri : Client_keys.sk_uri; amount : Tez.t} + type t = {name : string; sk_uri : Client_keys_v0.sk_uri; amount : Tez.t} let pp ppf account = let open Format in @@ -93,13 +93,15 @@ module Parsed_account = struct (fun (name, sk_uri, amount) -> {name; sk_uri; amount}) (obj3 (req "name" string) - (req "sk_uri" Client_keys.Secret_key.encoding) + (req "sk_uri" Client_keys_v0.Secret_key.encoding) (req "amount" Tez.encoding)) let to_bootstrap_account repr = - Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + Client_keys_v0.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys_v0.public_key pk_uri >>=? fun public_key -> + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. { @@ -116,7 +118,7 @@ module Parsed_account = struct let wallet = (cctxt :> Client_context.wallet) in let parsed_account_reprs = ref [] in let errors = ref [] in - Client_keys.list_keys wallet >>=? fun all_keys -> + Client_keys_v0.list_keys wallet >>=? fun all_keys -> List.iter_s (function | name, pkh, _pk_opt, Some sk_uri -> ( @@ -165,11 +167,13 @@ module Bootstrap_account = struct (fun (public_key_hash, public_key, amount, delegate_to, consensus_key) -> {public_key_hash; public_key; amount; delegate_to; consensus_key}) (obj5 - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "public_key" Tezos_crypto.Signature.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) (req "amount" Tez.encoding) - (opt "delegate_to" Tezos_crypto.Signature.Public_key_hash.encoding) - (opt "consensus_key" Tezos_crypto.Signature.Public_key.encoding)) + (opt "delegate_to" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (opt "consensus_key" Tezos_crypto.Signature.V0.Public_key.encoding)) end module Bootstrap_contract = struct @@ -180,7 +184,7 @@ module Bootstrap_contract = struct (fun {delegate; amount; script} -> (delegate, amount, script)) (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 - (opt "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (opt "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -501,7 +505,7 @@ let mem_init : ] in let open Protocol.Alpha_context.Block_header in - let _, _, sk = Tezos_crypto.Signature.generate_key () in + let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -521,7 +525,7 @@ let mem_init : (shell_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Protocol.Alpha_context.Block_header.( to_watermark (Block_header chain_id)) diff --git a/src/proto_015_PtLimaPt/lib_client/operation_result.ml b/src/proto_015_PtLimaPt/lib_client/operation_result.ml index 6941577071d59cfdadd88c3a3a0e39242d830d95..aa12c1b8024fa65426711752f0a70cd572c800a5 100644 --- a/src/proto_015_PtLimaPt/lib_client/operation_result.ml +++ b/src/proto_015_PtLimaPt/lib_client/operation_result.ml @@ -96,13 +96,14 @@ let pp_internal_operation ppf (Internal_operation {operation; source; _}) = Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) | Delegation delegate_opt -> ( Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Contract.pp source ; match delegate_opt with | None -> Format.pp_print_string ppf "nobody" - | Some delegate -> Tezos_crypto.Signature.Public_key_hash.pp ppf delegate) + | Some delegate -> + Tezos_crypto.Signature.V0.Public_key_hash.pp ppf delegate) | Event {ty; tag; payload} -> Format.fprintf ppf @@ -169,7 +170,7 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate) | Reveal key -> Format.fprintf @@ -177,13 +178,14 @@ let pp_manager_operation_content (type kind) source ppf "Revelation of manager public key:@,Contract: %a@,Key: %a" Contract.pp source - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp key | Delegation delegate_opt -> ( Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Contract.pp source ; match delegate_opt with | None -> Format.pp_print_string ppf "nobody" - | Some delegate -> Tezos_crypto.Signature.Public_key_hash.pp ppf delegate) + | Some delegate -> + Tezos_crypto.Signature.V0.Public_key_hash.pp ppf delegate) | Register_global_constant {value} -> Format.fprintf ppf @@ -213,8 +215,8 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "Update_consensus_key:@,Public key hash: %a" - Tezos_crypto.Signature.Public_key_hash.pp - (Tezos_crypto.Signature.Public_key.hash pk) + Tezos_crypto.Signature.V0.Public_key_hash.pp + (Tezos_crypto.Signature.V0.Public_key.hash pk) | Tx_rollup_origination -> Format.fprintf ppf @@ -430,11 +432,11 @@ let pp_balance_updates ppf balance_updates = key hash, we want to make the result more informative. *) let pp_baker ppf baker = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.Public_key_hash.zero + Tezos_crypto.Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.Public_key_hash.pp ppf baker + else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -1003,7 +1005,7 @@ let pp_manager_operation_result ppf Format.fprintf ppf "@,From: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source ; Format.fprintf ppf "@,Fee to the baker: %s%a" tez_sym Tez.pp fee ; Format.fprintf ppf "@,Expected counter: %a" Z.pp_print counter ; @@ -1099,7 +1101,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[Slot availability:@,Delegate: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> @@ -1146,7 +1148,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) @@ -1155,7 +1157,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source period Tezos_crypto.Protocol_hash.pp @@ -1171,11 +1173,11 @@ let pp_contents_and_result : Consensus key hash: %a@,\ Delegate: %a@,\ Destination: %a%s%a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp consensus_key - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp destination (if allocated_destination_contract then " (allocated)" else "") pp_balance_updates diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_context_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_context_commands.ml index 043591e74abd81f9f543e59187a21173d7521865..208eba2140d4a2423ce06251f22135d4c1479a91 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_context_commands.ml @@ -30,7 +30,7 @@ open Alpha_context open Client_proto_context open Client_proto_contracts open Client_proto_rollups -open Client_keys +open Client_keys_v0 open Client_proto_args let save_tx_rollup ~force (cctxt : #Client_context.full) alias_name rollup @@ -814,7 +814,7 @@ let transfer_command amount (source : Contract.t) destination let* source = Managed_contract.get_contract_manager cctxt contract_hash in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in Managed_contract.transfer cctxt ~chain:cctxt#chain @@ -839,7 +839,7 @@ let transfer_command amount (source : Contract.t) destination ?counter () | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in transfer cctxt ~chain:cctxt#chain @@ -1031,7 +1031,7 @@ let commands_rw () = let* source = Managed_contract.get_contract_manager cctxt contract in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Managed_contract.set_delegate cctxt @@ -1062,7 +1062,7 @@ let commands_rw () = in return_unit | Implicit mgr -> - let* _, src_pk, manager_sk = Client_keys.get_key cctxt mgr in + let* _, src_pk, manager_sk = Client_keys_v0.get_key cctxt mgr in let* (_ : _ Injection.result) = set_delegate cctxt @@ -1096,7 +1096,7 @@ let commands_rw () = let* source = Managed_contract.get_contract_manager cctxt contract in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Managed_contract.set_delegate cctxt @@ -1122,7 +1122,7 @@ let commands_rw () = in return_unit | Implicit mgr -> - let* _, src_pk, manager_sk = Client_keys.get_key cctxt mgr in + let* _, src_pk, manager_sk = Client_keys_v0.get_key cctxt mgr in let*! (_ : _ Injection.result tzresult) = set_delegate cctxt @@ -1149,7 +1149,7 @@ let commands_rw () = gas_limit_arg storage_limit_arg delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) init_arg no_print_source_flag fee_parameter_args) @@ -1160,7 +1160,7 @@ let commands_rw () = @@ prefix "transferring" @@ tez_param ~name:"qty" ~desc:"amount taken from source" @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"name of the source contract" @@ prefix "running" @@ -1190,7 +1190,7 @@ let commands_rw () = let* {expanded = code; _} = Lwt.return (Micheline_parser.no_parsing_error program) in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = originate_contract cctxt @@ -1318,7 +1318,7 @@ let commands_rw () = Managed_contract.get_contract_manager cctxt contract | Implicit source -> return source in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* contents = List.mapi_ep prepare operations in let (Manager_list contents) = Annotated_manager_operation.manager_of_list contents @@ -1467,7 +1467,7 @@ let commands_rw () = "Michelson expression to register. Note the value is not \ typechecked before registration." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"name of the account registering the global constant" @@ stop) @@ -1482,7 +1482,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = register_global_constant cctxt @@ -1579,13 +1579,13 @@ let commands_rw () = ~desc:"Reveal the public key of the contract manager." (args4 fee_arg dry_run_switch verbose_signing_switch fee_parameter_args) (prefixes ["reveal"; "key"; "for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"name of the source contract" @@ stop) (fun (fee, dry_run, verbose_signing, fee_parameter) source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = reveal cctxt @@ -1612,7 +1612,7 @@ let commands_rw () = @@ stop) (fun (fee, dry_run, verbose_signing, fee_parameter) src_pkh cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt src_pkh in let*! r = register_as_delegate cctxt @@ -1650,11 +1650,11 @@ let commands_rw () = (name_pk, consensus_pk) cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt src_pkh in let* consensus_pk = match consensus_pk with | Some pk -> return pk - | None -> Client_keys.public_key name_pk + | None -> Client_keys_v0.public_key name_pk in let*! r = register_as_delegate @@ -1695,12 +1695,12 @@ let commands_rw () = cctxt -> let open Lwt_result_syntax in let* _, delegate_pk, delegate_sk = - Client_keys.get_key cctxt delegate_pkh + Client_keys_v0.get_key cctxt delegate_pkh in let* consensus_pk = match consensus_pk with | Some pk -> return pk - | None -> Client_keys.public_key name_pk + | None -> Client_keys_v0.public_key name_pk in let*! r = update_consensus_key @@ -1729,7 +1729,7 @@ let commands_rw () = (fun (dry_run, verbose_signing) delegate_pkh consensus_pkh cctxt -> let open Lwt_result_syntax in let* _, _consensus_pk, consensus_sk = - Client_keys.get_key cctxt consensus_pkh + Client_keys_v0.get_key cctxt consensus_pkh in let*! r = drain_delegate @@ -1765,7 +1765,7 @@ let commands_rw () = cctxt -> let open Lwt_result_syntax in let* _, _consensus_pk, consensus_sk = - Client_keys.get_key cctxt consensus_pkh + Client_keys_v0.get_key cctxt consensus_pkh in let*! r = drain_delegate @@ -1842,7 +1842,7 @@ let commands_rw () = ~long:"force" ())) (prefixes ["submit"; "proposals"; "for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"the delegate who makes the proposal" @@ seq_of_param @@ -1859,7 +1859,7 @@ let commands_rw () = proposals (cctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* src_name, _src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* src_name, _src_pk, src_sk = Client_keys_v0.get_key cctxt src_pkh in let* info = get_period_info (* Find period info of the successor, because the operation will @@ -1946,7 +1946,7 @@ let commands_rw () = error "Public-key-hash `%a` from account `%s` does not appear to have \ voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -2023,7 +2023,7 @@ let commands_rw () = ~long:"force" ())) (prefixes ["submit"; "ballot"; "for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"the delegate who votes" @@ param @@ -2054,7 +2054,7 @@ let commands_rw () = ballot (cctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* src_name, _src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* src_name, _src_pk, src_sk = Client_keys_v0.get_key cctxt src_pkh in let* info = get_period_info (* Find period info of the successor, because the operation will @@ -2108,7 +2108,7 @@ let commands_rw () = (if force then cctxt#warning else cctxt#error) "Public-key-hash `%a` from account `%s` does not appear to have \ voting rights." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src_pkh src_name in @@ -2155,7 +2155,7 @@ let commands_rw () = Contract.pp contract | Implicit mgr -> - let* _, src_pk, manager_sk = Client_keys.get_key cctxt mgr in + let* _, src_pk, manager_sk = Client_keys_v0.get_key cctxt mgr in let* (_ : _ Injection.result) = set_deposits_limit cctxt @@ -2198,7 +2198,7 @@ let commands_rw () = Contract.pp contract | Implicit mgr -> - let* _, src_pk, manager_sk = Client_keys.get_key cctxt mgr in + let* _, src_pk, manager_sk = Client_keys_v0.get_key cctxt mgr in let* (_ : _ Injection.result) = set_deposits_limit cctxt @@ -2243,7 +2243,7 @@ let commands_rw () = payer (cctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* _, src_pk, manager_sk = Client_keys.get_key cctxt payer in + let* _, src_pk, manager_sk = Client_keys_v0.get_key cctxt payer in let* (_ : _ Injection.result) = increase_paid_storage cctxt @@ -2281,7 +2281,7 @@ let commands_rw () = ~name:"tx_rollup" ~desc:"Fresh name for a transaction rollup" @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account originating the transaction rollup." @@ stop) @@ -2297,7 +2297,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* {level = head_level; _} = Protocol_client_context.Alpha_block_services.Header.shell_header cctxt @@ -2361,7 +2361,7 @@ let commands_rw () = @@ Tx_rollup.tx_rollup_address_param ~usage:"Tx rollup receiving the batch." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account submitting the transaction rollup batches." @@ stop) @@ -2377,7 +2377,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_batch cctxt @@ -2422,7 +2422,7 @@ let commands_rw () = @@ Tx_rollup.tx_rollup_address_param ~usage:"Transaction rollup address committed to." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account committing to the transaction rollup." @@ prefixes ["for"; "level"] @@ -2450,7 +2450,7 @@ let commands_rw () = messages cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_commitment cctxt @@ -2490,7 +2490,7 @@ let commands_rw () = @@ Tx_rollup.tx_rollup_address_param ~usage:"Tx rollup that have its commitment finalized." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account finalizing the commitment." @@ stop) @@ -2505,7 +2505,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_finalize_commitment cctxt @@ -2538,7 +2538,7 @@ let commands_rw () = storage_limit_arg counter_arg) (prefixes ["recover"; "bond"; "of"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account that owns the bond." @@ prefixes ["for"; "tx"; "rollup"] @@ -2555,7 +2555,7 @@ let commands_rw () = tx_rollup cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_return_bond cctxt @@ -2591,7 +2591,7 @@ let commands_rw () = @@ Tx_rollup.tx_rollup_address_param ~usage:"Tx rollup that have its commitment removed." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"name of the account removing the commitment." @@ stop) @@ -2606,7 +2606,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_remove_commitment cctxt @@ -2686,7 +2686,7 @@ let commands_rw () = ~usage: "Proof that the disputed message result provided is incorrect." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Account rejecting the commitment." @@ stop) @@ -2711,7 +2711,7 @@ let commands_rw () = source cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = submit_tx_rollup_rejection cctxt @@ -2764,7 +2764,7 @@ let commands_rw () = @@ Tx_rollup.tx_rollup_address_param ~usage:"Tx rollup which have some tickets dispatched." @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"source" ~desc:"Account used to dispatch tickets." @@ prefixes ["at"; "level"] @@ -2806,7 +2806,7 @@ let commands_rw () = tickets_info cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = tx_rollup_dispatch_tickets cctxt @@ -2846,7 +2846,7 @@ let commands_rw () = (prefix "transfer" @@ non_negative_z_param ~name:"qty" ~desc:"Amount of tickets to transfer." @@ prefixes ["tickets"; "from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"tickets owner" ~desc:"Implicit account owning the tickets." @@ prefix "to" @@ -2889,7 +2889,7 @@ let commands_rw () = ticketer cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in match Ticket_amount.of_zint amount with | Some amount -> let* _res = @@ -2930,7 +2930,7 @@ let commands_rw () = storage_limit_arg counter_arg) (prefixes ["originate"; "sc"; "rollup"; "from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Name of the account originating the smart-contract rollup." @@ prefixes ["of"; "kind"] @@ -2964,7 +2964,7 @@ let commands_rw () = boot_sector cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let (module R : Alpha_context.Sc_rollup.PVM.S) = pvm in let Michelson_v1_parser.{expanded; _} = parameters_ty in let parameters_ty = Script.lazy_expr expanded in @@ -3011,7 +3011,7 @@ let commands_rw () = messages>|file:)." Sc_rollup_params.messages_parameter @@ prefixes ["from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Name of the source contract." @@ prefixes ["to"] @@ -3042,7 +3042,7 @@ let commands_rw () = "Could not read list of messages (expected list of bytes)" | messages -> return messages) in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = sc_rollup_add_messages cctxt @@ -3077,7 +3077,7 @@ let commands_rw () = fee_parameter_args) (prefixes ["publish"; "commitment"] @@ prefixes ["from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Name of the source contract." @@ prefixes ["for"; "sc"; "rollup"] @@ -3123,7 +3123,7 @@ let commands_rw () = number_of_ticks cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let commitment : Alpha_context.Sc_rollup.Commitment.t = {compressed_state; inbox_level; predecessor; number_of_ticks} in @@ -3165,7 +3165,7 @@ let commands_rw () = ~desc:"The hash of the commitment to be cemented for a sc rollup." Sc_rollup_params.commitment_hash_parameter @@ prefixes ["from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Name of the source contract." @@ prefixes ["for"; "sc"; "rollup"] @@ -3188,7 +3188,7 @@ let commands_rw () = rollup cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = sc_rollup_cement cctxt @@ -3229,11 +3229,11 @@ let commands_rw () = dispute has timed-out." Sc_rollup_params.sc_rollup_address_parameter @@ prefixes ["with"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"staker" ~desc:"One of the players involved in the dispute." @@ prefixes ["from"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"Name of the source contract." @@ stop) @@ -3265,7 +3265,7 @@ let commands_rw () = rollup." | Some (_, alice, bob) -> return (alice, bob) in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = sc_rollup_timeout cctxt @@ -3326,7 +3326,7 @@ let commands_rw () = resides." Sc_rollup_params.sc_rollup_address_parameter @@ prefix "from" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"source" ~desc:"The account used for executing the outbox message." @@ prefixes ["for"; "commitment"; "hash"] @@ -3354,7 +3354,7 @@ let commands_rw () = output_proof cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = sc_rollup_execute_outbox_message cctxt @@ -3389,7 +3389,7 @@ let commands_rw () = storage_limit_arg counter_arg) (prefixes ["recover"; "bond"; "of"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"src" ~desc:"The implicit account that owns the frozen bond." @@ prefixes ["for"; "sc"; "rollup"] @@ -3409,7 +3409,7 @@ let commands_rw () = sc_rollup cctxt -> let open Lwt_result_syntax in - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* _res = sc_rollup_recover_bond cctxt diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_fa12_commands.ml index bac3b401d30d79778555bba2187c82080d8f4676..42e9a04e991cc6f4f7b2ca30bd49366bb36c9c12 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_fa12_commands.ml @@ -66,7 +66,7 @@ let as_arg = () let payer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"payer" ~doc:"name of the payer (i.e. SOURCE) contract for the transaction" () @@ -110,7 +110,7 @@ let view_options = (unparsing_mode_arg ~default:"Readable") let dummy_callback = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero let get_contract_caller_keys cctxt (caller : Contract.t) = let open Lwt_result_syntax in @@ -118,7 +118,7 @@ let get_contract_caller_keys cctxt (caller : Contract.t) = | Originated _ -> failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, caller_pk, caller_sk = Client_keys.get_key cctxt source in + let* _, caller_pk, caller_sk = Client_keys_v0.get_key cctxt source in return (source, caller_pk, caller_sk) let commands_ro () : #Protocol_client_context.full Tezos_clic.command list = diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_multisig_commands.ml index 50f395d6eb77e9aaad32ef1c02b4343fcd793eb9..57e899e78fc9490842b9c117515cb562bfb7dfcf 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_multisig_commands.ml @@ -41,12 +41,12 @@ let threshold_param () = Client_proto_args.int_parameter let public_key_param () = - Client_keys.Public_key.source_param + Client_keys_v0.Public_key.source_param ~name:"key" ~desc:"Each signer of the multisig contract" let secret_key_param () = - Client_keys.Secret_key.source_param + Client_keys_v0.Secret_key.source_param ~name:"key" ~desc: "Secret key corresponding to one of the public keys stored on the \ @@ -128,7 +128,7 @@ let prepare_command_display prepared_command bytes_only = "@[<2>Public keys of the signers:@ %a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf "@ ") - Tezos_crypto.Signature.Public_key.pp)) + Tezos_crypto.Signature.V0.Public_key.pp)) prepared_command.Client_proto_multisig.keys let get_parameter_type (cctxt : #Protocol_client_context.full) @@ -198,7 +198,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = Client_proto_args.gas_limit_arg Client_proto_args.storage_limit_arg Client_proto_args.delegate_arg - (Client_keys.force_switch ()) + (Client_keys_v0.force_switch ()) Client_proto_args.no_print_source_flag Client_proto_args.fee_parameter_args Client_proto_context_commands.verbose_signing_switch) @@ -245,10 +245,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of an origination" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* keys = List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) keys in let*! errors = @@ -335,8 +335,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = {amount; destination; entrypoint; parameter_type; parameter}) () in - let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -369,8 +371,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Lambda lambda) () in - let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -381,7 +385,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["using"; "secret"; "key"] @@ -401,8 +405,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate (Some delegate)) () in - let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -426,8 +432,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~action:(Client_proto_multisig.Change_delegate None) () in - let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -453,7 +461,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = let open Lwt_result_syntax in let* keys = List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys in let* prepared_command = @@ -466,8 +474,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = (Client_proto_multisig.Change_keys (Z.of_int new_threshold, keys)) () in - let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -524,7 +534,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Client_proto_multisig.call_multisig cctxt @@ -598,7 +608,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*? {expanded = lambda; _} = Micheline_parser.no_parsing_error @@ Michelson_v1_parser.parse_expression lambda @@ -642,7 +652,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefix "to" - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ prefixes ["on"; "behalf"; "of"] @@ -670,7 +680,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Client_proto_multisig.call_multisig cctxt @@ -734,7 +744,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Client_proto_multisig.call_multisig cctxt @@ -801,10 +811,10 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let* keys = List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys in let*! errors = @@ -883,7 +893,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = failwith "only implicit accounts can be the source of a contract call" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let*! errors = Client_proto_multisig.call_multisig_on_bytes cctxt @@ -1004,7 +1014,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = ~name:"multisig" ~desc:"name or address of the originated multisig contract" @@ prefixes ["setting"; "delegate"; "to"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"dlgt" ~desc:"new delegate of the new multisig contract" @@ stop) @@ -1072,7 +1082,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = let open Lwt_result_syntax in let* keys = List.map_es - (fun (pk_uri, _) -> Client_keys.public_key pk_uri) + (fun (pk_uri, _) -> Client_keys_v0.public_key pk_uri) new_keys in let* prepared_command = diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_programs_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_programs_commands.ml index df0b2eec95f3962798389e46f25beac8f1226847..d7cdf1bfac17c0437f6db86733a28f9711afb348 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_programs_commands.ml @@ -91,7 +91,7 @@ let commands () = () in let payer_arg = - Client_keys.Public_key_hash.source_arg + Client_keys_v0.Public_key_hash.source_arg ~long:"payer" ~doc:"name of the payer (i.e. SOURCE) contract for the transaction" () @@ -136,7 +136,7 @@ let commands () = in let signature_parameter = parameter (fun _cctxt s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Tezos_crypto.Signature.V0.of_b58check_opt s with | Some s -> Lwt_result_syntax.return s | None -> failwith "Not given a valid signature") in @@ -731,12 +731,12 @@ let commands () = no_options (prefixes ["sign"; "bytes"] @@ bytes_parameter ~name:"data" ~desc:"the raw data to sign" - @@ prefixes ["for"] @@ Client_keys.Secret_key.source_param @@ stop) + @@ prefixes ["for"] @@ Client_keys_v0.Secret_key.source_param @@ stop) (fun () bytes sk cctxt -> let open Lwt_result_syntax in - let* signature = Client_keys.sign cctxt sk bytes in + let* signature = Client_keys_v0.sign cctxt sk bytes in let*! () = - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature in return_unit); command @@ -748,7 +748,7 @@ let commands () = (prefixes ["check"; "that"; "bytes"] @@ bytes_parameter ~name:"bytes" ~desc:"the signed data" @@ prefixes ["were"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param ~name:"key" + @@ Client_keys_v0.Public_key.alias_param ~name:"key" @@ prefixes ["to"; "produce"] @@ param ~name:"signature" @@ -761,7 +761,7 @@ let commands () = signature (cctxt : #Protocol_client_context.full) -> let open Lwt_result_syntax in - let* check = Client_keys.check key_locator signature bytes in + let* check = Client_keys_v0.check key_locator signature bytes in if check then if quiet then return_unit else diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml index 3f6801a5209b6ca138a3a361d221d6e951312962..30b70b3765bdb6b6c901eb202a4a5bc2bb94cf45 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml @@ -64,15 +64,15 @@ type origin = Explicit | Wallet_pkh | Wallet_alias of string type source = { pkh : public_key_hash; pk : public_key; - sk : Tezos_crypto.Signature.secret_key; + sk : Tezos_crypto.Signature.V0.secret_key; } type source_with_uri = { pkh : public_key_hash; pk : public_key; - pk_uri : Client_keys.pk_uri; - sk : Tezos_crypto.Signature.secret_key; - sk_uri : Client_keys.sk_uri; + pk_uri : Client_keys_v0.pk_uri; + sk : Tezos_crypto.Signature.V0.secret_key; + sk_uri : Client_keys_v0.sk_uri; } type input_source = @@ -85,7 +85,7 @@ type source_origin = {source : source; origin : origin} (** Destination of a call: either an implicit contract or an originated one with all the necessary data (entrypoint and the argument). *) type destination = - | Implicit of Tezos_crypto.Signature.Public_key_hash.t + | Implicit of Tezos_crypto.Signature.V0.Public_key_hash.t | Originated of Smart_contracts.invocation_parameters type transfer = { @@ -104,7 +104,7 @@ type state = { mutable pool : source_origin list; mutable pool_size : int; mutable shuffled_pool : source list; - mutable revealed : Tezos_crypto.Signature.Public_key_hash.Set.t; + mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; mutable last_block : Tezos_crypto.Block_hash.t; mutable last_level : int; mutable target_block : Tezos_crypto.Block_hash.t; @@ -162,9 +162,9 @@ let input_source_encoding = ~title:"explicit" (Tag 0) (obj3 - (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding) - (req "pk" Tezos_crypto.Signature.Public_key.encoding) - (req "sk" Tezos_crypto.Signature.Secret_key.encoding)) + (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (req "pk" Tezos_crypto.Signature.V0.Public_key.encoding) + (req "sk" Tezos_crypto.Signature.V0.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -176,7 +176,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -242,13 +242,14 @@ let normalize_source cctxt = let open Lwt_syntax in let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + Tezos_crypto.Signature.V0.Secret_key.of_b58check + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> let+ r = Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri in - Option.of_result r + let sk = Option.of_result r in + Option.bind sk Tezos_crypto.Signature.V0.Of_V_latest.secret_key in let key_from_alias alias = let warning msg alias = @@ -256,7 +257,7 @@ let normalize_source cctxt = return_none in let* key = - let* r = Client_keys.alias_keys cctxt alias in + let* r = Client_keys_v0.alias_keys cctxt alias in match r with | Error _ | Ok None -> warning "Alias \"%s\" not found in the wallet" alias @@ -284,12 +285,12 @@ let normalize_source cctxt = let key_from_wallet pkh = let warning msg pkh = let* () = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh + cctxt#warning msg Tezos_crypto.Signature.V0.Public_key_hash.pp pkh in return_none in let* key = - let* r = Client_keys.get_key cctxt pkh in + let* r = Client_keys_v0.get_key cctxt pkh in match r with | Error _ -> warning "Pkh \"%a\" not found in the wallet" pkh | Ok (alias, pk, sk_uri) -> ( @@ -300,7 +301,7 @@ let normalize_source cctxt = cctxt#warning "Cannot extract the secret key form the pkh \"%a\" (alias: \ \"%s\") of the wallet" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh alias in @@ -365,7 +366,7 @@ let random_seed rng = let generate_fresh_source state = let seed = random_seed state.rng_state in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~seed () in + let pkh, pk, sk = Tezos_crypto.Signature.V0.generate_key ~seed () in let fresh = {source = {pkh; pk; sk}; origin = Explicit} in state.pool <- fresh :: state.pool ; state.pool_size <- state.pool_size + 1 ; @@ -461,7 +462,7 @@ let rec sample_transfer (cctxt : Protocol_client_context.full) chain block log Debug (fun () -> cctxt#message "sample_transfer: invalid balance %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp src.pkh) in (* Sampled source has zero balance: the transfer that created that @@ -508,8 +509,8 @@ let inject_contents (cctxt : Protocol_client_context.full) branch sk contents = in let signature = Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation + (Tezos_crypto.Signature.V0.sign + ~watermark:Tezos_crypto.Signature.V0.Generic_operation sk bytes) in @@ -565,7 +566,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state in let* already_revealed = if - Tezos_crypto.Signature.Public_key_hash.Set.mem + Tezos_crypto.Signature.V0.Public_key_hash.Set.mem transfer.src.pkh state.revealed then return true @@ -574,7 +575,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state revealed, or we immediately inject a reveal operation: in any case the key is revealed in the end. *) state.revealed <- - Tezos_crypto.Signature.Public_key_hash.Set.add + Tezos_crypto.Signature.V0.Public_key_hash.Set.add transfer.src.pkh state.revealed ; let* pk_opt = @@ -610,7 +611,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Info (fun () -> cctxt#message "injecting reveal+transfer from %a (counters=%a,%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print reveal_counter @@ -636,7 +637,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Info (fun () -> cctxt#message "injecting transfer from %a (counter=%a) to %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp transfer.src.pkh Z.pp_print transf_counter @@ -1200,7 +1201,7 @@ let generate_random_transactions = let sources = List.sort_uniq (fun src1 src2 -> - Tezos_crypto.Signature.Secret_key.compare + Tezos_crypto.Signature.V0.Secret_key.compare src1.source.sk src2.source.sk) sources @@ -1233,7 +1234,7 @@ let generate_random_transactions = List.shuffle ~rng:rng_state (List.map (fun src_org -> src_org.source) sources); - revealed = Tezos_crypto.Signature.Public_key_hash.Set.empty; + revealed = Tezos_crypto.Signature.V0.Public_key_hash.Set.empty; last_block = current_head_on_start; last_level = Int32.to_int header_on_start.level; target_block = current_target_block; @@ -1503,7 +1504,7 @@ let generate_account_funding_batches (starter_sources : source_with_uri list) (* Loads a wallet by reading directly the files to speed up things. *) let load_wallet cctxt ~source_pkh = let open Lwt_result_syntax in - let* keys = Client_keys.get_keys cctxt in + let* keys = Client_keys_v0.get_keys cctxt in (* Convert loaded and filter identities. We want to ban activator and bootstrap<1-5> in sandbox, as well as the "faucet source" on test networks. *) @@ -1518,14 +1519,14 @@ let load_wallet cctxt ~source_pkh = | [] -> return acc | (alias, pkh, _, _) :: tl when List.exists (String.equal alias) to_ban - || Tezos_crypto.Signature.Public_key_hash.equal pkh source_pkh -> + || Tezos_crypto.Signature.V0.Public_key_hash.equal pkh source_pkh -> aux acc tl | (_, pkh, pk, sk_uri) :: tl -> - let* pk_uri = Client_keys.neuterize sk_uri in + let* pk_uri = Client_keys_v0.neuterize sk_uri in let payload = Uri.path (sk_uri : Tezos_signer_backends.Unencrypted.sk_uri :> Uri.t) in - let sk = Tezos_crypto.Signature.Secret_key.of_b58check_exn payload in + let sk = Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn payload in aux ({pkh; pk; pk_uri; sk; sk_uri} :: acc) tl in aux [] keys @@ -1538,7 +1539,7 @@ let source_key_arg = "Source key public key hash from which the tokens will be transferred to \ start the funding." (parameter (fun _ s -> - let r = Tezos_crypto.Signature.Public_key_hash.of_b58check s in + let r = Tezos_crypto.Signature.V0.Public_key_hash.of_b58check s in match r with | Ok pkh -> Lwt_result_syntax.return pkh | Error e -> @@ -1814,7 +1815,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command (cctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in let* source_pk, source_sk = - let* _, src_pk, src_sk = Client_keys.get_key cctxt source_pkh in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source_pkh in return (src_pk, src_sk) in let*! () = log Notice (fun () -> cctxt#message "@.") in @@ -1823,7 +1824,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command cctxt#message "Starting funding from %a with parameters:@.- batch_size %d@.- \ batches_per_block %d@.- initial_amount %a@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh batch_size batches_per_block @@ -1890,7 +1891,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command source_balance Tez.pp req_balance - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh else let*! () = @@ -1899,7 +1900,7 @@ let fund_accounts_from_source : Protocol_client_context.full Tezos_clic.command "Transfering %a tz from %a (out of %a)@." Tez.pp req_balance - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp source_pkh Tez.pp source_balance) diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_contracts.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_contracts.ml index 8d67a8cc13ac5d05ad2e1bd69cedab1ada66a5b6..b36856565e7471cf0eeb49103add485e36418fca 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_contracts.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_contracts.ml @@ -185,7 +185,7 @@ let originate_command = | Originated _ -> failwith "only implicit accounts can be the source of an origination" | Implicit source -> - let* _, src_pk, src_sk = Client_keys.get_key cctxt source in + let* _, src_pk, src_sk = Client_keys_v0.get_key cctxt source in let originate_one (scontract : smart_contract) = let fee_parameter = { diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_utils_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_utils_commands.ml index 837defaed6008e252c9d722e18a8058fb9b07e59..0fb6d824fdc6c62f9c88f2b339a2323294e8a2cd 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_utils_commands.ml @@ -81,7 +81,7 @@ let commands () = (prefixes ["sign"; "message"] @@ string_param ~name:"message" ~desc:"message to sign" @@ prefixes ["for"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"src" ~desc:"name of the signer contract" @@ stop) @@ -96,7 +96,7 @@ let commands () = in let* signature = sign_message cctxt ~src_sk ~block ~message in let*! () = - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature in return_unit); command @@ -111,7 +111,7 @@ let commands () = (prefixes ["check"; "that"; "message"] @@ string_param ~name:"message" ~desc:"signed message" @@ prefixes ["was"; "signed"; "by"] - @@ Client_keys.Public_key.alias_param + @@ Client_keys_v0.Public_key.alias_param ~name:"signer" ~desc:"name of the signer contract" @@ prefixes ["to"; "produce"] @@ -150,7 +150,7 @@ let commands () = no_options (prefixes ["sign"; "block"] @@ unsigned_block_header_param @@ prefixes ["for"] - @@ Client_keys.Public_key_hash.source_param + @@ Client_keys_v0.Public_key_hash.source_param ~name:"delegate" ~desc:"signing delegate" @@ stop) @@ -167,9 +167,9 @@ let commands () = let* chain_id = Shell_services.Chain.chain_id cctxt ~chain:cctxt#chain () in - let* _, _, sk = Client_keys.get_key cctxt delegate in + let* _, _, sk = Client_keys_v0.get_key cctxt delegate in let* s = - Client_keys.sign + Client_keys_v0.sign cctxt ~watermark: (Protocol.Alpha_context.Block_header.to_watermark @@ -178,7 +178,7 @@ let commands () = unsigned_header in let*! () = - cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.to_hex s) + cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.V0.to_hex s) in return_unit); ] diff --git a/src/proto_015_PtLimaPt/lib_client_sapling/client_sapling_commands.ml b/src/proto_015_PtLimaPt/lib_client_sapling/client_sapling_commands.ml index 6b61dc936cffa8b05fab16e05b013c09d0230094..30f0628da78f9f1497ea9864a6da223e088fa461 100644 --- a/src/proto_015_PtLimaPt/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_sapling/client_sapling_commands.ml @@ -24,7 +24,7 @@ (*****************************************************************************) open Tezos_clic -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client let json_switch = switch ~long:"json" ~doc:"Use JSON format" () @@ -47,7 +47,8 @@ let keys_of_implicit_account cctxt (source : Protocol.Alpha_context.Contract.t) match source with | Originated _ -> assert false | Implicit src -> - Client_keys.get_key cctxt src >>=? fun (_, pk, sk) -> return (src, pk, sk) + Client_keys_v0.get_key cctxt src >>=? fun (_, pk, sk) -> + return (src, pk, sk) let viewing_key_of_string s = let exception Unknown_sapling_address in @@ -72,7 +73,7 @@ let bound_data_of_public_key_hash cctxt dst = let open Protocol.Michelson_v1_primitives in let pkh_bytes = Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding dst in let micheline_bytes = Micheline.(Bytes (0, pkh_bytes) |> strip_locations) in diff --git a/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml b/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml index ab43f45d388930bf1fe54235c2edd58573a7b577..e9403f19b76179c962467d103a75700208d49337 100644 --- a/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml +++ b/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Client_keys +open Client_keys_v0 open Tezos_sapling.Core.Client (* Transform a spending key to an uri, encrypted or not. *) diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_actions.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_actions.ml index b8a6e51d07a30f1b4a23d343fad7600903d4fd8a..d0c11618a285206079d68e311f67077864fcde57 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_actions.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_actions.ml @@ -205,7 +205,7 @@ let sign_block_header state proposer unsigned_block_header = >>=? function | false -> fail (Block_previously_baked {level; round}) | true -> - Client_keys.sign + Client_keys_v0.sign cctxt proposer.secret_key_uri ~watermark:Block_header.(to_watermark (Block_header chain_id)) @@ -384,7 +384,7 @@ let inject_preendorsements ~state_recorder state ~preendorsements ~updated_state Operation.unsigned_encoding unsigned_operation in - Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes + Client_keys_v0.sign cctxt ~watermark sk_uri unsigned_operation_bytes else fail (Baking_highwatermarks.Block_previously_preendorsed {round; level})) >>= function @@ -472,7 +472,7 @@ let sign_endorsements state endorsements = Operation.unsigned_encoding unsigned_operation in - Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes + Client_keys_v0.sign cctxt ~watermark sk_uri unsigned_operation_bytes else fail (Baking_highwatermarks.Block_previously_endorsed {round; level})) >>= function | Error err -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml index 9d76b8745fff52ab03b1a5827649bc4656ee242f..788eae2ea480df4d51cc1797d962a6f555cd4e82 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml @@ -166,7 +166,7 @@ let liquidity_baking_toggle_vote_arg = liquidity_baking_toggle_vote_parameter let get_delegates (cctxt : Protocol_client_context.full) - (pkhs : Tezos_crypto.Signature.public_key_hash list) = + (pkhs : Tezos_crypto.Signature.V0.public_key_hash list) = let proj_delegate (alias, public_key_hash, public_key, secret_key_uri) = { Baking_state.alias = Some alias; @@ -176,12 +176,12 @@ let get_delegates (cctxt : Protocol_client_context.full) } in (if pkhs = [] then - Client_keys.get_keys cctxt >>=? fun keys -> + Client_keys_v0.get_keys cctxt >>=? fun keys -> List.map proj_delegate keys |> return else List.map_es (fun pkh -> - Client_keys.get_key cctxt pkh >>=? function + Client_keys_v0.get_key cctxt pkh >>=? function | alias, pk, sk_uri -> return (proj_delegate (alias, pkh, pk, sk_uri))) pkhs) >>=? fun delegates -> @@ -202,7 +202,7 @@ let get_delegates (cctxt : Protocol_client_context.full) let sources_param = Tezos_clic.seq_of_param - (Client_keys.Public_key_hash.source_param + (Client_keys_v0.Public_key_hash.source_param ~name:"baker" ~desc: "name of the delegate owning the endorsement/baking right or name of \ diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml index 4af172f183fe5e13807314564a2a72cc1c1de5b5..c0d9e41a200a3d13c3ef478812aac068a75ba6aa 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml @@ -100,9 +100,9 @@ let () = (fun highwatermark -> Block_previously_endorsed highwatermark) module DelegateMap = Map.Make (struct - type t = Tezos_crypto.Signature.Public_key_hash.t + type t = Tezos_crypto.Signature.V0.Public_key_hash.t - let compare = Tezos_crypto.Signature.Public_key_hash.compare + let compare = Tezos_crypto.Signature.V0.Public_key_hash.compare end) let highwatermark_delegate_map_encoding = @@ -113,7 +113,7 @@ let highwatermark_delegate_map_encoding = fun l -> List.fold_left (fun map (k, v) -> add k v map) empty l) (list (obj2 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "highwatermark" highwatermark_encoding))) type highwatermarks = { diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.mli index 30d4d6f4ea3ea04f27408ebd410cbb49bf72ede8..59138855ba6453acd1049a5903aabcae1e502bc8 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.mli @@ -45,7 +45,7 @@ val load : val may_sign_block : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -53,7 +53,7 @@ val may_sign_block : val may_sign_preendorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -61,7 +61,7 @@ val may_sign_preendorsement : val may_sign_endorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> bool tzresult Lwt.t @@ -69,7 +69,7 @@ val may_sign_endorsement : val record_block : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t @@ -77,7 +77,7 @@ val record_block : val record_preendorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t @@ -85,7 +85,7 @@ val record_preendorsement : val record_endorsement : #Protocol_client_context.full -> [`Highwatermarks] Baking_files.location -> - delegate:Tezos_crypto.Signature.public_key_hash -> + delegate:Tezos_crypto.Signature.V0.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml index 3acc87f16377153ccf76449d6b79c29c68dee393..6ec9597c9ff936baa23f14371e779cf7ffe9a7cf 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml @@ -210,7 +210,7 @@ let generate_seed_nonce (nonce_config : Baking_configuration.nonce_config) (match nonce_config with | Deterministic -> let data = Data_encoding.Binary.to_bytes_exn Raw_level.encoding level in - Client_keys.deterministic_nonce delegate.secret_key_uri data + Client_keys_v0.deterministic_nonce delegate.secret_key_uri data >>=? fun nonce -> return (Data_encoding.Binary.of_bytes_exn Nonce.encoding nonce) | Random -> ( @@ -247,7 +247,9 @@ let inject_seed_nonce_revelation (cctxt : #Protocol_client_context.full) ~chain () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat + bytes + Tezos_crypto.Signature.V0.zero in Shell_services.Injection.operation ~async:true cctxt ~chain bytes >>=? fun oph -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml index 2902469662c791bc4b21cb9dcd9266ff320ba838..387055676d98dda7b3850e4bca9cd5a2c329690d 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml @@ -31,9 +31,9 @@ open Protocol_client_context public key, its public key hash, and its secret key. *) type consensus_key = { alias : string option; - public_key : Tezos_crypto.Signature.Public_key.t; - public_key_hash : Tezos_crypto.Signature.Public_key_hash.t; - secret_key_uri : Client_keys.sk_uri; + public_key : Tezos_crypto.Signature.V0.Public_key.t; + public_key_hash : Tezos_crypto.Signature.V0.Public_key_hash.t; + secret_key_uri : Client_keys_v0.sk_uri; } let consensus_key_encoding = @@ -50,14 +50,16 @@ let consensus_key_encoding = public_key; public_key_hash; secret_key_uri = - (match Client_keys.make_sk_uri (Uri.of_string secret_key_uri) with + (match Client_keys_v0.make_sk_uri (Uri.of_string secret_key_uri) with | Ok sk -> sk | Error e -> Format.kasprintf Stdlib.failwith "%a" pp_print_trace e); }) (obj4 (req "alias" (option string)) - (req "public_key" Tezos_crypto.Signature.Public_key.encoding) - (req "public_key_hash" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "public_key" Tezos_crypto.Signature.V0.Public_key.encoding) + (req + "public_key_hash" + Tezos_crypto.Signature.V0.Public_key_hash.encoding) (req "secret_key_uri" string)) let pp_consensus_key fmt {alias; public_key_hash; _} = @@ -66,28 +68,28 @@ let pp_consensus_key fmt {alias; public_key_hash; _} = Format.fprintf fmt "%a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp public_key_hash | Some alias -> Format.fprintf fmt "%s (%a)" alias - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp public_key_hash type consensus_key_and_delegate = - consensus_key * Tezos_crypto.Signature.Public_key_hash.t + consensus_key * Tezos_crypto.Signature.V0.Public_key_hash.t let consensus_key_and_delegate_encoding = let open Data_encoding in merge_objs consensus_key_encoding - (obj1 (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "delegate" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) let pp_consensus_key_and_delegate fmt (consensus_key, delegate) = if - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal consensus_key.public_key_hash delegate then pp_consensus_key fmt consensus_key @@ -97,7 +99,7 @@ let pp_consensus_key_and_delegate fmt (consensus_key, delegate) = "%a@,on behalf of %a" pp_consensus_key consensus_key - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp delegate type validation_mode = Node | Local of Abstract_context_index.t @@ -604,7 +606,7 @@ module DelegateSet = struct type t = consensus_key let compare {public_key_hash = pkh; _} {public_key_hash = pkh'; _} = - Tezos_crypto.Signature.Public_key_hash.compare pkh pkh' + Tezos_crypto.Signature.V0.Public_key_hash.compare pkh pkh' end) let find_pkh pkh s = @@ -612,7 +614,7 @@ module DelegateSet = struct try iter (fun ({public_key_hash; _} as delegate) -> - if Tezos_crypto.Signature.Public_key_hash.equal pkh public_key_hash + if Tezos_crypto.Signature.V0.Public_key_hash.equal pkh public_key_hash then raise (Found delegate) else ()) s ; diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli index 3936193bb34693055d2759d7dc22ec1acef17120..19437bc5b7b770af30666a22634b2fecd38d0c34 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli @@ -28,9 +28,9 @@ open Alpha_context type consensus_key = { alias : string option; - public_key : Tezos_crypto.Signature.public_key; - public_key_hash : Tezos_crypto.Signature.public_key_hash; - secret_key_uri : Client_keys.sk_uri; + public_key : Tezos_crypto.Signature.V0.public_key; + public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; + secret_key_uri : Client_keys_v0.sk_uri; } val consensus_key_encoding : consensus_key Data_encoding.t @@ -38,7 +38,7 @@ val consensus_key_encoding : consensus_key Data_encoding.t val pp_consensus_key : Format.formatter -> consensus_key -> unit type consensus_key_and_delegate = - consensus_key * Tezos_crypto.Signature.Public_key_hash.t + consensus_key * Tezos_crypto.Signature.V0.Public_key_hash.t val consensus_key_and_delegate_encoding : consensus_key_and_delegate Data_encoding.t diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml index 6dc6d5e9abb11155f89c728d8bc002a41d6d98ab..23f95c9075e6426d2f4f7518c3c5caaec945385b 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml @@ -156,7 +156,9 @@ let inject_vdf_revelation cctxt hash chain_id solution = ~solution () in - let bytes = Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero in + let bytes = + Tezos_crypto.Signature.V0.concat bytes Tezos_crypto.Signature.V0.zero + in Shell_services.Injection.operation cctxt ~chain bytes (* Checks if the VDF setup saved in the state is equal to the one computed diff --git a/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml b/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml index dcd4e7228e820a786873ac4230870ed6f309317e..3301fe0c874362509ac91abf085bb7b922ea3472 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml @@ -52,7 +52,7 @@ let forge_faked_protocol_data ?(payload_hash = Block_payload_hash.zero) proof_of_work_nonce = Baking_pow.empty_proof_of_work_nonce; liquidity_baking_toggle_vote; }; - signature = Tezos_crypto.Signature.zero; + signature = Tezos_crypto.Signature.V0.zero; } let convert_operation (op : packed_operation) : Tezos_base.Operation.t = @@ -385,7 +385,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info let unsigned_block_header = { Block_header.shell = shell_header; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; } in return {unsigned_block_header; operations} diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml b/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml index 21b58428d339f4e495eb9f39bac6d1016d0acd62..45a81bf1421b4c06da1d7f2ad7c1d4bbeb38819a 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml @@ -40,7 +40,7 @@ module HLevel = Hashtbl.Make (struct end) (* Blocks are associated to the delegates who baked them *) -module Delegate_Map = Map.Make (Tezos_crypto.Signature.Public_key_hash) +module Delegate_Map = Map.Make (Tezos_crypto.Signature.V0.Public_key_hash) (* (pre)endorsements are associated to the slot they are injected with; we rely on the fact that there is a unique canonical slot @@ -177,7 +177,7 @@ let process_consensus_op (type kind) cctxt () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat bytes Tezos_crypto.Signature.V0.zero in let double_op_detected, double_op_denounced = Events.( @@ -307,7 +307,9 @@ let process_block (cctxt : #Protocol_client_context.full) state () >>=? fun bytes -> let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero + Tezos_crypto.Signature.V0.concat + bytes + Tezos_crypto.Signature.V0.zero in Events.(emit double_baking_detected) () >>= fun () -> Shell_services.Injection.operation cctxt ~chain bytes diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml index acbe2bbcf5de556f715e5856864a51c20065667f..4ce38666a3a084f3d5b43355781db896ed4e7889 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml @@ -58,7 +58,7 @@ module PrioritizedManagerSet = Set.Make (struct {source = source'; counter = counter'; weight = weight'; op = op'; _} = (* Be careful with the [compare] *) let cmp_src = - Tezos_crypto.Signature.Public_key_hash.compare source source' + Tezos_crypto.Signature.V0.Public_key_hash.compare source source' in if cmp_src = 0 then (* we want the smallest counter first *) diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml index e6cad8f09673bec3823b4647d6ddbdf927c69ab6..2d309f37e65348fb75aad4553fa6c17aea5fc1ca 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -821,8 +821,8 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir Baking_state.consensus_key) -> let open Tezos_client_base in let name = alias |> WithExceptions.Option.get ~loc:__LOC__ in - Client_keys.neuterize secret_key_uri >>=? fun public_key_uri -> - Client_keys.register_key + Client_keys_v0.neuterize secret_key_uri >>=? fun public_key_uri -> + Client_keys_v0.register_key wallet ~force:false (public_key_hash, public_key_uri, secret_key_uri) @@ -855,7 +855,7 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir Lwt.pick [listener_process (); baker_process ()] >>=? fun () -> User_hooks.check_chain_on_success ~chain:state.chain -let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) +let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.V0.secret_key) (predecessor_block_hash : Tezos_crypto.Block_hash.t) (block_header : Block_header.shell_header) : Bytes.t = let proof_of_work_nonce = @@ -885,7 +885,7 @@ let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) (block_header, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) baker_sk @@ -901,7 +901,7 @@ let deduce_baker_sk (Protocol.Alpha_context.Parameters.bootstrap_account * Tezos_mockup_commands.Mockup_wallet.bootstrap_secret) list) (total_accounts : int) (level : int) : - Tezos_crypto.Signature.secret_key tzresult Lwt.t = + Tezos_crypto.Signature.V0.secret_key tzresult Lwt.t = (match (total_accounts, level) with | _, 0 -> return 0 (* apparently this doesn't really matter *) | _ -> @@ -916,7 +916,7 @@ let deduce_baker_sk |> WithExceptions.Option.get ~loc:__LOC__ in let secret_key = - Tezos_crypto.Signature.Secret_key.of_b58check_exn + Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn (Uri.path (secret.sk_uri :> Uri.t)) in return secret_key @@ -1093,7 +1093,7 @@ type config = { round1 : int64; timeout : int; delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + (int32 * (int32 * Tezos_crypto.Signature.V0.public_key_hash) list) list; initial_seed : State_hash.t option; consensus_committee_size : int; consensus_threshold : int; @@ -1128,7 +1128,7 @@ let make_baking_delegate } let run ?(config = default_config) bakers_spec = - Tezos_client_base.Client_keys.register_signer + Tezos_client_base.Client_keys_v0.register_signer (module Tezos_signer_backends.Unencrypted) ; let total_accounts = List.fold_left (fun acc (n, _) -> acc + n) 0 bakers_spec @@ -1229,7 +1229,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) (block_header.shell, protocol_data.contents) in if - Tezos_crypto.Signature.check + Tezos_crypto.Signature.V0.check ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) public_key @@ -1241,7 +1241,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) "unexpected signature for %a; tried with %a@." Tezos_crypto.Block_hash.pp block_hash - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp public_key type op_predicate = @@ -1278,7 +1278,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) Alpha_context.Operation.to_watermark (Endorsement chain_id) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation) + | _ -> Tezos_crypto.Signature.V0.Generic_operation) | _ -> failwith "unexpected contents in %a@." @@ -1298,7 +1298,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) (op.shell, Contents_list d.contents) in return - (Tezos_crypto.Signature.check + (Tezos_crypto.Signature.V0.check ~watermark public_key signature diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.mli b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.mli index 42a13cae3af4dfd224674fe09c171a142f9ade27..2c6652a1ec2e9219607f366e5012b686b8124c7d 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.mli @@ -145,7 +145,7 @@ type config = { longer to terminate it'll be aborted with an error. *) delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + (int32 * (int32 * Tezos_crypto.Signature.V0.public_key_hash) list) list; (** Desired selection of delegates per level/round *) initial_seed : State_hash.t option; (** Optional initial seed for protocol (used to control delegate selection) *) @@ -177,21 +177,21 @@ val default_config : config to the final result. *) val run : ?config:config -> (int * (module Hooks)) list -> unit tzresult Lwt.t -val bootstrap1 : Tezos_crypto.Signature.public_key +val bootstrap1 : Tezos_crypto.Signature.V0.public_key -val bootstrap2 : Tezos_crypto.Signature.public_key +val bootstrap2 : Tezos_crypto.Signature.V0.public_key -val bootstrap3 : Tezos_crypto.Signature.public_key +val bootstrap3 : Tezos_crypto.Signature.V0.public_key -val bootstrap4 : Tezos_crypto.Signature.public_key +val bootstrap4 : Tezos_crypto.Signature.V0.public_key -val bootstrap5 : Tezos_crypto.Signature.public_key +val bootstrap5 : Tezos_crypto.Signature.V0.public_key (** Check if a block header is signed by a given delegate. *) val check_block_signature : block_hash:Tezos_crypto.Block_hash.t -> block_header:Block_header.t -> - public_key:Tezos_crypto.Signature.public_key -> + public_key:Tezos_crypto.Signature.V0.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) @@ -224,7 +224,7 @@ val mempool_has_op_ref : (** Check if an operation is signed by the given delegate. *) val op_is_signed_by : - public_key:Tezos_crypto.Signature.public_key -> op_predicate + public_key:Tezos_crypto.Signature.V0.public_key -> op_predicate (** Check that an operation is a preendorsement. *) val op_is_preendorsement : ?level:int32 -> ?round:int32 -> op_predicate diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.ml b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.ml index fdc0a6dc5abb8041ee537196f2761b845287073b..205cc0e14f80c1b2d17672b617f4399e04cc0e2f 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.ml @@ -27,7 +27,7 @@ open Protocol type delegate_selection = (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) + * (Round_repr.t * Tezos_crypto.Signature.V0.public_key_hash) list) list module LevelRoundMap = Map.Make (struct @@ -39,7 +39,8 @@ module LevelRoundMap = Map.Make (struct (Raw_level_repr.to_int32 l2.Level_repr.level, Round_repr.to_int32 r2) end) -let _ = Client_keys.register_signer (module Tezos_signer_backends.Unencrypted) +let _ = + Client_keys_v0.register_signer (module Tezos_signer_backends.Unencrypted) (* Initialize a context in memory with the Mockup *) let init_context ?constants_overrides_json ?bootstrap_accounts_json parameters = @@ -107,7 +108,7 @@ let check ctxt ~selection = >>=? fun (ctxt, _, pk) -> if not - (Tezos_crypto.Signature.Public_key_hash.equal + (Tezos_crypto.Signature.V0.Public_key_hash.equal delegate pk.delegate) then raise Exit diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.mli b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.mli index c13cc23edb6002253f31f4d91e524a6833584dfd..ccfdad3bf387c8bcc7c7c597f60a9a049700e96a 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/lib/tenderbrute.mli @@ -30,7 +30,7 @@ open Protocol specified level and rounds are not constrained. *) type delegate_selection = (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) + * (Round_repr.t * Tezos_crypto.Signature.V0.public_key_hash) list) list (** Brute-force an initial seed nonce for the desired delegate selection. diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/tenderbrute_main.ml b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/tenderbrute_main.ml index 123db4e59248226fa738d75b7e6225a6cac5e88d..c6b659b6eeae815d22f2a175d5ec361322752945 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/tenderbrute_main.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/tenderbrute/tenderbrute_main.ml @@ -49,7 +49,7 @@ let delegate_encoding = case ~title:"Public key hash" (Tag 0) - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding (function `Pkh p -> Some p | _ -> None) (fun p -> `Pkh p); case diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/test_scenario.ml b/src/proto_015_PtLimaPt/lib_delegate/test/test_scenario.ml index f10b60904c24c39e2620965ed7886a116c8d2744..381962fee1a59eeaf893c82c280c7d3959eb76d0 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/test_scenario.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/test_scenario.ml @@ -1,14 +1,14 @@ open Mockup_simulator -let bootstrap1 = Tezos_crypto.Signature.Public_key.hash bootstrap1 +let bootstrap1 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap1 -let bootstrap2 = Tezos_crypto.Signature.Public_key.hash bootstrap2 +let bootstrap2 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap2 -let bootstrap3 = Tezos_crypto.Signature.Public_key.hash bootstrap3 +let bootstrap3 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap3 -let bootstrap4 = Tezos_crypto.Signature.Public_key.hash bootstrap4 +let bootstrap4 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap4 -let bootstrap5 = Tezos_crypto.Signature.Public_key.hash bootstrap5 +let bootstrap5 = Tezos_crypto.Signature.V0.Public_key.hash bootstrap5 let some_seed s = Some (Protocol.State_hash.of_b58check_exn s) diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml index b6177f871e7a63fb06ad50a9a2bc2c3bb285def6..d742edb00e33c143aaed13a7f0aa153e2193b97e 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml @@ -27,14 +27,14 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } let get_signer cctxt pkh = let open Lwt_result_syntax in - let* alias, pk, sk = Client_keys.get_key cctxt pkh in + let* alias, pk, sk = Client_keys_v0.get_key cctxt pkh in return {alias; pkh; pk; sk} type 'block reorg = {old_chain : 'block list; new_chain : 'block list} diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli index 6519834b301f263666a1b9ca6c14fe0dea463e80..83dd948534f94892d5f9ac4bffafada12cc42cca 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli @@ -28,9 +28,9 @@ open Protocol_client_context (** The type of signers for operations injected by the injector *) type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Client_keys.sk_uri; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) @@ -45,7 +45,7 @@ type 'block reorg = { (** Retrieve a signer from the client wallet. *) val get_signer : #Client_context.wallet -> - Tezos_crypto.Signature.public_key_hash -> + Tezos_crypto.Signature.V0.public_key_hash -> signer tzresult Lwt.t val no_reorg : 'a reorg diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_errors.ml b/src/proto_015_PtLimaPt/lib_injector/injector_errors.ml index b2e5b98bebc3859edeace13a3be59f6a56bed10c..1eedc371c57291c0fa7fc7581e576abffa7c349a 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_errors.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_errors.ml @@ -23,7 +23,8 @@ (* *) (*****************************************************************************) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t let () = register_error_kind @@ -35,11 +36,11 @@ let () = Format.fprintf ppf "No worker for source %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp s) `Permanent Data_encoding.( - obj1 (req "source" Tezos_crypto.Signature.Public_key_hash.encoding)) + obj1 (req "source" Tezos_crypto.Signature.V0.Public_key_hash.encoding)) (function No_worker_for_source s -> Some s | _ -> None) (fun s -> No_worker_for_source s) diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_errors.mli b/src/proto_015_PtLimaPt/lib_injector/injector_errors.mli index 1c39b4ffc53ab88fe47b98ba7347bb3b48a16fbe..64d90a50f0e4a4671e9b668a23c12b3b51a308b3 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_errors.mli +++ b/src/proto_015_PtLimaPt/lib_injector/injector_errors.mli @@ -25,7 +25,8 @@ (** Error when the injector has no worker for the source which must inject an operation. *) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += + | No_worker_for_source of Tezos_crypto.Signature.V0.Public_key_hash.t (** Error when the injector has no worker for the tag of the operation to be injected. *) diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_events.ml b/src/proto_015_PtLimaPt/lib_injector/injector_events.ml index 520fce71ea2f571459cf77d6136be24250776630..4f897439cce8391c9cab9a8da069f0cf9509b4a5 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_events.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_events.ml @@ -37,10 +37,10 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 @@ -50,11 +50,11 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 @@ -65,12 +65,12 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name ~msg:("[{signer}: {tags}] " ^ msg) ~level - ("signer", Tezos_crypto.Signature.Public_key_hash.encoding) + ("signer", Tezos_crypto.Signature.V0.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 enc3 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Tezos_crypto.Signature.V0.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml index b8129d3070a35f5700179073b14bac5b742b144b..e7d81d0a117191977e19c71962dad425f70ecadb 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml @@ -541,9 +541,9 @@ module Make (Rollup : PARAMETERS) = struct Data_encoding.Binary.to_bytes_exn Operation.unsigned_encoding unsigned_op in let* signature = - Client_keys.sign + Client_keys_v0.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -657,14 +657,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = - match state.signer.pkh with - | Tezos_crypto.Signature.Ed25519 _ -> - Tezos_crypto.Signature.of_ed25519 Tezos_crypto.Ed25519.zero - | Secp256k1 _ -> - Tezos_crypto.Signature.of_secp256k1 Tezos_crypto.Secp256k1.zero - | P256 _ -> Tezos_crypto.Signature.of_p256 Tezos_crypto.P256.zero - in + let signature = Tezos_crypto.Signature.V0.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { @@ -963,7 +956,7 @@ module Make (Rollup : PARAMETERS) = struct let tags = Tags.of_list tags in let strategy, tags = match - Tezos_crypto.Signature.Public_key_hash.Map.find_opt signer acc + Tezos_crypto.Signature.V0.Public_key_hash.Map.find_opt signer acc with | None -> (strategy, tags) | Some (other_strategy, other_tags) -> @@ -978,14 +971,14 @@ module Make (Rollup : PARAMETERS) = struct in (strategy, Tags.union other_tags tags) in - Tezos_crypto.Signature.Public_key_hash.Map.add + Tezos_crypto.Signature.V0.Public_key_hash.Map.add signer (strategy, tags) acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty + Tezos_crypto.Signature.V0.Public_key_hash.Map.empty signers in - Tezos_crypto.Signature.Public_key_hash.Map.iter_es + Tezos_crypto.Signature.V0.Public_key_hash.Map.iter_es (fun signer (strategy, tags) -> let+ worker = Worker.launch diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml b/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml index 7f86e158a7751d7cb5aedc4f153986d3efa52092..102fe5188ce76f150769b4fb19e2cc9318ae7888 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml @@ -98,11 +98,11 @@ end module Name = struct type t = public_key_hash - let encoding = Tezos_crypto.Signature.Public_key_hash.encoding + let encoding = Tezos_crypto.Signature.V0.Public_key_hash.encoding let base = ["tx_rollup_injector"] - let pp = Tezos_crypto.Signature.Public_key_hash.pp_short + let pp = Tezos_crypto.Signature.V0.Public_key_hash.pp_short - let equal = Tezos_crypto.Signature.Public_key_hash.equal + let equal = Tezos_crypto.Signature.V0.Public_key_hash.equal end diff --git a/src/proto_015_PtLimaPt/lib_injector/l1_operation.ml b/src/proto_015_PtLimaPt/lib_injector/l1_operation.ml index aa0ae008f78f2966f0b11d9eede25dac10eedebb..89143ca57ecf6c8a2682ae31dc4250cba9ed946c 100644 --- a/src/proto_015_PtLimaPt/lib_injector/l1_operation.ml +++ b/src/proto_015_PtLimaPt/lib_injector/l1_operation.ml @@ -150,7 +150,7 @@ module Manager_operation = struct ty pp_lazy_expr contents - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp claimer in Format.fprintf diff --git a/src/proto_015_PtLimaPt/lib_parameters/default_parameters.ml b/src/proto_015_PtLimaPt/lib_parameters/default_parameters.ml index fd5a927f3a4af56c145004372f8837a4897021d0..abe96c84f5efd1f26f87448cbe954e13c3391bcb 100644 --- a/src/proto_015_PtLimaPt/lib_parameters/default_parameters.ml +++ b/src/proto_015_PtLimaPt/lib_parameters/default_parameters.ml @@ -370,8 +370,10 @@ let bootstrap_balance = Tez.of_mutez_exn 4_000_000_000_000L let compute_accounts = List.map (fun s -> - let public_key = Tezos_crypto.Signature.Public_key.of_b58check_exn s in - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key = Tezos_crypto.Signature.V0.Public_key.of_b58check_exn s in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in Parameters. { public_key_hash; diff --git a/src/proto_015_PtLimaPt/lib_parameters/default_parameters.mli b/src/proto_015_PtLimaPt/lib_parameters/default_parameters.mli index f930bc38fd87d9098a4fb08164c0be69758be90f..a15acce832703a691662ff3c20e0a55de3346b75 100644 --- a/src/proto_015_PtLimaPt/lib_parameters/default_parameters.mli +++ b/src/proto_015_PtLimaPt/lib_parameters/default_parameters.mli @@ -35,11 +35,11 @@ val constants_test : Constants.Parametric.t val test_commitments : Commitment.t list lazy_t val make_bootstrap_account : - Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key + Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key * Tez.t - * Tezos_crypto.Signature.public_key_hash option - * Tezos_crypto.Signature.public_key option -> + * Tezos_crypto.Signature.V0.public_key_hash option + * Tezos_crypto.Signature.V0.public_key option -> Parameters.bootstrap_account val parameters_of_constants : diff --git a/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml b/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml index 64ef40d9afe313c1cb214715aa3da334c2073b9f..1ec770d1a613ee0d7a9f6191a27681c109338710 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml @@ -28,14 +28,14 @@ module Mempool = Plugin.Mempool let string_gen = QCheck2.Gen.small_string ?gen:None let public_key_hash_gen : - (Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key - * Tezos_crypto.Signature.secret_key) + (Tezos_crypto.Signature.V0.public_key_hash + * Tezos_crypto.Signature.V0.public_key + * Tezos_crypto.Signature.V0.secret_key) QCheck2.Gen.t = let open QCheck2.Gen in let+ seed = string_size (32 -- 64) in let seed = Bytes.of_string seed in - Tezos_crypto.Signature.generate_key ~seed () + Tezos_crypto.Signature.V0.generate_key ~seed () (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) @@ -49,7 +49,7 @@ let dummy_manager_op_info = let gas_limit = Alpha_context.Gas.Arith.zero in let manager_op = let open Alpha_context in - let source = Tezos_crypto.Signature.Public_key_hash.zero in + let source = Tezos_crypto.Signature.V0.Public_key_hash.zero in let counter = Z.zero in let storage_limit = Z.zero in let operation = Set_deposits_limit None in @@ -59,7 +59,7 @@ let dummy_manager_op_info = in let contents = Single contents in let protocol_data = - {contents; signature = Some Tezos_crypto.Signature.zero} + {contents; signature = Some Tezos_crypto.Signature.V0.zero} in let branch = Tezos_crypto.Block_hash.zero in Mempool.Manager_op {shell = {branch}; protocol_data} diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.ml index 17f6fe9696a292b9a9d4fb7523a363bf91ee01d6..1ed09fc079e15c72012c9775a58a963c67fb6379 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.ml @@ -27,14 +27,14 @@ open Protocol open Alpha_context type t = { - pkh : Tezos_crypto.Signature.Public_key_hash.t; - pk : Tezos_crypto.Signature.Public_key.t; - sk : Tezos_crypto.Signature.Secret_key.t; + pkh : Tezos_crypto.Signature.V0.Public_key_hash.t; + pk : Tezos_crypto.Signature.V0.Public_key.t; + sk : Tezos_crypto.Signature.V0.Secret_key.t; } type account = t -let known_accounts = Tezos_crypto.Signature.Public_key_hash.Table.create 17 +let known_accounts = Tezos_crypto.Signature.V0.Public_key_hash.Table.create 17 let random_seed ~rng_state = Bytes.init Tezos_crypto.Hacl.Ed25519.sk_size (fun _i -> @@ -42,14 +42,14 @@ let random_seed ~rng_state = let new_account ?seed () = let pkh, pk, sk = - Tezos_crypto.Signature.generate_key ~algo:Ed25519 ?seed () + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ?seed () in let account = {pkh; pk; sk} in - Tezos_crypto.Signature.Public_key_hash.Table.add known_accounts pkh account ; + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account ; account let add_account ({pkh; _} as account) = - Tezos_crypto.Signature.Public_key_hash.Table.add known_accounts pkh account + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account let activator_account = let seed = random_seed ~rng_state:(Random.State.make [|0x1337533D|]) in @@ -57,21 +57,21 @@ let activator_account = let find pkh = match - Tezos_crypto.Signature.Public_key_hash.Table.find known_accounts pkh + Tezos_crypto.Signature.V0.Public_key_hash.Table.find known_accounts pkh with | Some k -> return k | None -> failwith "Missing account: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh let find_alternate pkh = let exception Found of t in try - Tezos_crypto.Signature.Public_key_hash.Table.iter + Tezos_crypto.Signature.V0.Public_key_hash.Table.iter (fun pkh' account -> - if not (Tezos_crypto.Signature.Public_key_hash.equal pkh pkh') then + if not (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh pkh') then raise (Found account)) known_accounts ; raise Not_found @@ -86,8 +86,8 @@ let dummy_account = let default_initial_balance = Tez.of_mutez_exn 4_000_000_000_000L let generate_accounts ?rng_state ?(initial_balances = []) ?bootstrap_delegations - n : (t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list = - Tezos_crypto.Signature.Public_key_hash.Table.clear known_accounts ; + n : (t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list = + Tezos_crypto.Signature.V0.Public_key_hash.Table.clear known_accounts ; let amount i = match List.nth_opt initial_balances i with | None -> default_initial_balance @@ -110,13 +110,13 @@ let generate_accounts ?rng_state ?(initial_balances = []) ?bootstrap_delegations List.map (fun i -> let pkh, pk, sk = - Tezos_crypto.Signature.generate_key + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ~seed:(random_seed ~rng_state) () in let account = {pkh; pk; sk} in - Tezos_crypto.Signature.Public_key_hash.Table.add + Tezos_crypto.Signature.V0.Public_key_hash.Table.add known_accounts pkh account ; @@ -130,7 +130,7 @@ let commitment_secret = let new_commitment ?seed () = let pkh, pk, sk = - Tezos_crypto.Signature.generate_key ?seed ~algo:Ed25519 () + Tezos_crypto.Signature.V0.generate_key ?seed ~algo:Ed25519 () in let unactivated_account = {pkh; pk; sk} in let open Commitment in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.mli index 4cb885e6d277851c7270256d3210e418c41dc468..4f6d0373f7e8eac5871466378c71351bea3a1949 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/account.mli @@ -27,14 +27,14 @@ open Protocol open Alpha_context type t = { - pkh : Tezos_crypto.Signature.Public_key_hash.t; - pk : Tezos_crypto.Signature.Public_key.t; - sk : Tezos_crypto.Signature.Secret_key.t; + pkh : Tezos_crypto.Signature.V0.Public_key_hash.t; + pk : Tezos_crypto.Signature.V0.Public_key.t; + sk : Tezos_crypto.Signature.V0.Secret_key.t; } type account = t -val known_accounts : t Tezos_crypto.Signature.Public_key_hash.Table.t +val known_accounts : t Tezos_crypto.Signature.V0.Public_key_hash.Table.t val activator_account : account @@ -44,9 +44,9 @@ val new_account : ?seed:Bytes.t -> unit -> account val add_account : t -> unit -val find : Tezos_crypto.Signature.Public_key_hash.t -> t tzresult Lwt.t +val find : Tezos_crypto.Signature.V0.Public_key_hash.t -> t tzresult Lwt.t -val find_alternate : Tezos_crypto.Signature.Public_key_hash.t -> t +val find_alternate : Tezos_crypto.Signature.V0.Public_key_hash.t -> t (** 4.000.000.000 tez *) val default_initial_balance : Tez.t @@ -60,11 +60,11 @@ val generate_accounts : ?rng_state:Random.State.t -> ?initial_balances:int64 list -> ?bootstrap_delegations: - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key_hash.t) + (Tezos_crypto.Signature.V0.Public_key_hash.t + * Tezos_crypto.Signature.V0.Public_key_hash.t) list -> int -> - (t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list + (t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list val commitment_secret : Blinded_public_key_hash.activation_code @@ -72,4 +72,5 @@ val new_commitment : ?seed:Bytes.t -> unit -> (account * Commitment.t) tzresult Lwt.t (** Fails if the contract is not an implicit one *) -val pkh_of_contract_exn : Contract.t -> Tezos_crypto.Signature.Public_key_hash.t +val pkh_of_contract_exn : + Contract.t -> Tezos_crypto.Signature.V0.Public_key_hash.t diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml index 02d5f8c7d0c080b4db383f8f441e75e11cb0e34b..f96f148c96165b7f26de8b098dabe1b3f9fac8cc 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml @@ -160,14 +160,14 @@ let not_equal_tez ~loc (a : Alpha_context.Tez.t) (b : Alpha_context.Tez.t) = not_equal ~loc Tez.( = ) "Tez are equal" Tez.pp a b (* pkh *) -let equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) - (b : Tezos_crypto.Signature.Public_key_hash.t) = - let module PKH = Tezos_crypto.Signature.Public_key_hash in +let equal_pkh ~loc (a : Tezos_crypto.Signature.V0.Public_key_hash.t) + (b : Tezos_crypto.Signature.V0.Public_key_hash.t) = + let module PKH = Tezos_crypto.Signature.V0.Public_key_hash in equal ~loc PKH.equal "Public key hashes aren't equal" PKH.pp a b -let not_equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) - (b : Tezos_crypto.Signature.Public_key_hash.t) = - let module PKH = Tezos_crypto.Signature.Public_key_hash in +let not_equal_pkh ~loc (a : Tezos_crypto.Signature.V0.Public_key_hash.t) + (b : Tezos_crypto.Signature.V0.Public_key_hash.t) = + let module PKH = Tezos_crypto.Signature.V0.Public_key_hash in not_equal ~loc PKH.equal "Public key hashes are equal" PKH.pp a b (* protocol hash *) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml index 4c54c10a347cf9e0f14c4a138c627b0f1e4a751f..ccb3d64f6c9ebcfcc2e5aa741758e29ee7e548a4 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml @@ -96,7 +96,7 @@ let get_next_baker_by_account pkh block = | None -> failwith "No slots found for %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh) >>=? fun { Plugin.RPC.Baking_rights.delegate = pkh; @@ -126,7 +126,7 @@ let get_next_baker_excluding excludes block = (fun {Plugin.RPC.Baking_rights.consensus_key; _} -> not (List.mem - ~equal:Tezos_crypto.Signature.Public_key_hash.equal + ~equal:Tezos_crypto.Signature.V0.Public_key_hash.equal consensus_key excludes)) bakers @@ -203,7 +203,7 @@ module Forge = struct (shell, contents) in let signature = - Tezos_crypto.Signature.sign + Tezos_crypto.Signature.V0.sign ~watermark: Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) signer_account.sk @@ -456,7 +456,7 @@ let genesis_with_parameters parameters = header = { shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; }; operations = []; context; @@ -464,8 +464,8 @@ let genesis_with_parameters parameters = let validate_initial_accounts (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - minimal_stake = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) minimal_stake = if initial_accounts = [] then Stdlib.failwith "Must have one account with minimal_stake to bake" ; (* Check there are at least minimal_stake tokens *) @@ -654,8 +654,8 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum ?sc_rollup_max_number_of_messages_per_commitment_period ?dal_enable ?zk_rollup_enable ?hard_gas_limit_per_block ?nonce_revelation_threshold (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) = prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum @@ -699,7 +699,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum header = { shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; }; operations = []; context; @@ -707,8 +707,8 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum let alpha_context ?commitments ?min_proposal_quorum (initial_accounts : - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list) - = + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list) = prepare_initial_context_params ?min_proposal_quorum initial_accounts >>=? fun (constants, shell, _hash) -> initial_alpha_context ?commitments constants shell initial_accounts diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli index d272a1538bafec5f16f2938ba7cbf5970c695456..ace3a64907cefe87cb0cfe67f78a4a633dd931bc 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli @@ -103,7 +103,7 @@ module Forge : sig (** Sets the baker that will sign the header to an arbitrary pkh *) val set_baker : public_key_hash -> - ?consensus_key:Tezos_crypto.Signature.public_key_hash -> + ?consensus_key:Tezos_crypto.Signature.V0.public_key_hash -> header -> header @@ -141,7 +141,8 @@ val genesis : ?zk_rollup_enable:bool -> ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> - (Account.t * Tez.tez * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.tez * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list -> block tzresult Lwt.t val genesis_with_parameters : Parameters.t -> block tzresult Lwt.t @@ -153,7 +154,8 @@ val genesis_with_parameters : Parameters.t -> block tzresult Lwt.t val alpha_context : ?commitments:Commitment.t list -> ?min_proposal_quorum:int32 -> - (Account.t * Tez.tez * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.tez * Tezos_crypto.Signature.V0.Public_key_hash.t option) + list -> Alpha_context.t tzresult Lwt.t (** @@ -289,7 +291,7 @@ val prepare_initial_context_params : ?zk_rollup_enable:bool -> ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> - (Account.t * Tez.t * Tezos_crypto.Signature.Public_key_hash.t option) list -> + (Account.t * Tez.t * Tezos_crypto.Signature.V0.Public_key_hash.t option) list -> ( Constants.Parametric.t * Block_header.shell_header * Tezos_crypto.Block_hash.t, diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml index 1f7ae6753b448d09e3ce2866c1a08508fab7f59b..ec12b5ee131b4f8af685cefb1c41aa3b1c8967e4 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml @@ -136,7 +136,7 @@ let get_endorser_slot ctxt pkh = List.find_map (function | {Plugin.RPC.Validators.delegate; slots; _} -> - if Tezos_crypto.Signature.Public_key_hash.(delegate = pkh) then + if Tezos_crypto.Signature.V0.Public_key_hash.(delegate = pkh) then Some slots else None) endorsers @@ -153,7 +153,7 @@ let get_endorsing_power_for_delegate ctxt ?levels pkh = let rec find_slots_for_delegate = function | [] -> return 0 | {Plugin.RPC.Validators.delegate; slots; _} :: t -> - if Tezos_crypto.Signature.Public_key_hash.equal delegate pkh then + if Tezos_crypto.Signature.V0.Public_key_hash.equal delegate pkh then return (List.length slots) else find_slots_for_delegate t in @@ -177,7 +177,7 @@ let get_first_different_baker baker bakers = WithExceptions.Option.get ~loc:__LOC__ @@ List.find (fun baker' -> - Tezos_crypto.Signature.Public_key_hash.( <> ) baker baker') + Tezos_crypto.Signature.V0.Public_key_hash.( <> ) baker baker') bakers let get_first_different_bakers ctxt = @@ -351,9 +351,9 @@ module Delegate = struct deactivated : bool; grace_period : Cycle.t; voting_info : Alpha_context.Vote.delegate_info; - active_consensus_key : Tezos_crypto.Signature.Public_key_hash.t; + active_consensus_key : Tezos_crypto.Signature.V0.Public_key_hash.t; pending_consensus_keys : - (Cycle.t * Tezos_crypto.Signature.Public_key_hash.t) list; + (Cycle.t * Tezos_crypto.Signature.V0.Public_key_hash.t) list; } let info ctxt pkh = Delegate_services.info rpc_ctxt ctxt pkh diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli index 04930bd2ed66043b2fb88295930f5a5f023380b2..7e24aa16026b78bae80754f1c5d518446dec3d4f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli @@ -113,7 +113,8 @@ module Vote : sig val get_ballot_list : t -> - (Tezos_crypto.Signature.Public_key_hash.t * Vote.ballot) list tzresult Lwt.t + (Tezos_crypto.Signature.V0.Public_key_hash.t * Vote.ballot) list tzresult + Lwt.t val get_current_period : t -> Voting_period.info tzresult Lwt.t @@ -122,7 +123,8 @@ module Vote : sig val get_participation_ema : Block.t -> int32 tzresult Lwt.t val get_listings : - t -> (Tezos_crypto.Signature.Public_key_hash.t * int64) list tzresult Lwt.t + t -> + (Tezos_crypto.Signature.V0.Public_key_hash.t * int64) list tzresult Lwt.t val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/contract_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/contract_helpers.ml index f7d6c63dab2ad9f8dc113a67e2bd1e3272c7d816..46449066c26d0fd96470b8d8ebf9ba9102e318d5 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/contract_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/contract_helpers.ml @@ -67,7 +67,7 @@ let fake_KT1 = let default_self = fake_KT1 -let default_payer = Tezos_crypto.Signature.Public_key_hash.zero +let default_payer = Tezos_crypto.Signature.V0.Public_key_hash.zero let default_source = Contract.Implicit default_payer diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/dummy_zk_rollup.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/dummy_zk_rollup.ml index 4e1eafefa0dca7784764de78d1d39e9d2cf4716c..dc083ab9cce8eb705db826c49be2a1e6e05b4c04 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/dummy_zk_rollup.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/dummy_zk_rollup.ml @@ -201,8 +201,8 @@ module Types = struct conv (fun pkhu -> pkhu) (fun w -> w) - (encoding_to_scalar Tezos_crypto.Signature.Public_key_hash.encoding) - (encoding_of_scalar Tezos_crypto.Signature.Public_key_hash.encoding) + (encoding_to_scalar Tezos_crypto.Signature.V0.Public_key_hash.encoding) + (encoding_of_scalar Tezos_crypto.Signature.V0.Public_key_hash.encoding) scalar_encoding let amount_encoding ~safety = Bounded_e.encoding ~safety Bound.bound_amount @@ -445,7 +445,7 @@ end = struct {id; amount = Z.zero}); l1_dst = Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding dummy_l1_dst; rollup_id = Data_encoding.Binary.of_bytes_exn diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/expr_common.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/expr_common.ml index e6444892c6008c3ce5a41cd5b61b1c050495ba1e..02802931c5bfa80b2e73258ca3735896d01567ef 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/expr_common.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/expr_common.ml @@ -78,7 +78,9 @@ let big_map_id ?(loc = 0) id = int ~loc @@ Big_map.Id.unparse_to_z id let timestamp_of_zint zint = Script_timestamp.of_zint zint let public_key_of_bytes_exn b = - Data_encoding.Binary.of_bytes_exn Tezos_crypto.Signature.Public_key.encoding b + Data_encoding.Binary.of_bytes_exn + Tezos_crypto.Signature.V0.Public_key.encoding + b let address_of_bytes_exn b = Data_encoding.Binary.of_bytes_exn Contract.encoding b diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml index 65dbd4073c72803bbc2390ae9f50c821cb188653..1d7ecf55267bc9fb715c18d072c8e64a73b6ea13 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml @@ -100,7 +100,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) Partial_construction {predecessor_hash = predecessor.hash; timestamp} else let block_header_data = - {Block_header.contents; signature = Tezos_crypto.Signature.zero} + {Block_header.contents; signature = Tezos_crypto.Signature.V0.zero} in Construction {predecessor_hash = predecessor.hash; timestamp; block_header_data} @@ -118,7 +118,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) context = Tezos_crypto.Context_hash.zero; operations_hash = Tezos_crypto.Operation_list_list_hash.zero; }; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; } in begin_validation_and_application diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/liquidity_baking_machine.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/liquidity_baking_machine.ml index 723f26ae43c0105ace77924276668c556c87f35d..5f9799b4590b46332580c52cd48b3459ce11e245 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/liquidity_baking_machine.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/liquidity_baking_machine.ml @@ -390,13 +390,13 @@ let total_xtz = 32_000_000_000_000L let tzbtc_admin_account : Account.t = { pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"; pk = - Tezos_crypto.Signature.Public_key.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key.of_b58check_exn "edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav"; sk = - Tezos_crypto.Signature.Secret_key.of_b58check_exn + Tezos_crypto.Signature.V0.Secret_key.of_b58check_exn "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh"; } diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/lqt_fa12_repr.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/lqt_fa12_repr.ml index 168bbb43dac674352ea7598a7517b6262f4fcd17..25511a68258be4d5b40fea1712e7a9a9fa31d363 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/lqt_fa12_repr.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/lqt_fa12_repr.ml @@ -135,7 +135,7 @@ module Storage = struct { tokens = Big_map.Id.parse_z Z.zero; allowances = Big_map.Id.parse_z Z.one; - admin = Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero; + admin = Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero; totalSupply = Z.zero; } diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml index fac515505e1f9071e560013ccdbdc072c6dded60..d16ef42873da5ac493728a7dd6704312de047388 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml @@ -31,7 +31,7 @@ let pack_operation ctxt signature contents = Operation.pack ({shell = {branch}; protocol_data = {contents; signature}} : _ Operation.t) -let sign ?(watermark = Tezos_crypto.Signature.Generic_operation) sk ctxt +let sign ?(watermark = Tezos_crypto.Signature.V0.Generic_operation) sk ctxt contents = let branch = Context.branch ctxt in let unsigned = @@ -39,7 +39,9 @@ let sign ?(watermark = Tezos_crypto.Signature.Generic_operation) sk ctxt Operation.unsigned_encoding ({branch}, Contents_list contents) in - let signature = Some (Tezos_crypto.Signature.sign ~watermark sk unsigned) in + let signature = + Some (Tezos_crypto.Signature.V0.sign ~watermark sk unsigned) + in ({shell = {branch}; protocol_data = {contents; signature}} : _ Operation.t) (** Generates the block payload hash based on the hash [pred_hash] of @@ -228,7 +230,7 @@ let combine_operations ?public_key ?counter ?spurious_operation ~source ctxt let reveal_op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -297,7 +299,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee; counter; operation; @@ -313,7 +315,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op_reveal = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -324,7 +326,7 @@ let manager_operation ?(force_reveal = false) ?counter ?(fee = Tez.zero) let op = Manager_operation { - source = Tezos_crypto.Signature.Public_key.hash public_key; + source = Tezos_crypto.Signature.V0.Public_key.hash public_key; fee; counter = Z.succ counter; operation; @@ -343,7 +345,7 @@ let revelation ?(fee = Tez.zero) ?(gas_limit = High) ?(storage_limit = Z.zero) let pkh = match forge_pkh with | Some pkh -> pkh - | None -> Tezos_crypto.Signature.Public_key.hash public_key + | None -> Tezos_crypto.Signature.V0.Public_key.hash public_key in resolve_gas_limit ctxt gas_limit >>=? fun gas_limit -> let source = Contract.Implicit pkh in @@ -510,7 +512,7 @@ let increase_paid_storage ?force_reveal ?counter ?fee ?gas_limit ?storage_limit Context.Contract.manager ctxt source >|=? fun account -> sign account.sk ctxt sop -let activation ctxt (pkh : Tezos_crypto.Signature.Public_key_hash.t) +let activation ctxt (pkh : Tezos_crypto.Signature.V0.Public_key_hash.t) activation_code = (match pkh with | Ed25519 edpkh -> return edpkh @@ -518,7 +520,7 @@ let activation ctxt (pkh : Tezos_crypto.Signature.Public_key_hash.t) failwith "Wrong public key hash : %a - Commitments must be activated with an \ Tezos_crypto.Ed25519 encrypted public key hash" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh) >|=? fun id -> let contents = Single (Activate_account {id; activation_code}) in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli index d96033bfbcba002636c9c5cd9d700ced8bef8373..79268ce12bd466a37cd63fa21ddcc61b4df5526d 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli @@ -45,8 +45,8 @@ val pack_operation : Context.t -> signature option -> 'a contents_list -> packed_operation val sign : - ?watermark:Tezos_crypto.Signature.watermark -> - Tezos_crypto.Signature.secret_key -> + ?watermark:Tezos_crypto.Signature.V0.watermark -> + Tezos_crypto.Signature.V0.secret_key -> Context.t -> packed_contents_list -> packed_operation @@ -245,7 +245,7 @@ val originated_contract : Operation.packed -> Contract.t val register_global_constant : ?force_reveal:bool -> ?counter:Z.t -> - ?public_key:Tezos_crypto.Signature.public_key -> + ?public_key:Tezos_crypto.Signature.V0.public_key -> ?fee:Tez.tez -> ?gas_limit:gas_limit -> ?storage_limit:Z.t -> @@ -276,7 +276,7 @@ val double_baking : val activation : Context.t -> - Tezos_crypto.Signature.Public_key_hash.t -> + Tezos_crypto.Signature.V0.Public_key_hash.t -> Blinded_public_key_hash.activation_code -> Operation.packed tzresult Lwt.t @@ -762,9 +762,9 @@ val update_consensus_key : val drain_delegate : Context.t -> - consensus_key:Tezos_crypto.Signature.Public_key_hash.t -> - delegate:Tezos_crypto.Signature.Public_key_hash.t -> - destination:Tezos_crypto.Signature.Public_key_hash.t -> + consensus_key:Tezos_crypto.Signature.V0.Public_key_hash.t -> + delegate:Tezos_crypto.Signature.V0.Public_key_hash.t -> + destination:Tezos_crypto.Signature.V0.Public_key_hash.t -> packed_operation tzresult Lwt.t (** [zk_rollup_publish ctxt source ~zk_rollup ~op] tries to add an operation diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/operation_generator.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/operation_generator.ml index 7e59308338f7bda89cfb179c9caf221c759a3d0b..de1f90105310a22547ac9a11fb0ba9e0ccf3bbe6 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/operation_generator.ml @@ -142,7 +142,7 @@ let random_payload_hash = QCheck2.Gen.oneofl payload_hashes let signatures = List.map - Tezos_crypto.Signature.of_b58check_exn + Tezos_crypto.Signature.V0.of_b58check_exn [ "sigaNsiye7D8dJHKSQZBwDbS2aQNXipDP7bw8uQnMgnaXi5pcnoPZRKXrDeFRx4FjWJD2xfyUA9CuBXhwPHhVs7LxkL4vT32"; "sigvtPBMQvk2DgNtu3AKFU1ZRsagGxsoiZVQyQhJNEojReBY2vE5sDwt3H7Mh8RMe27QHBjemxqhMVVszZqpNsdDux6KAELX"; @@ -153,7 +153,7 @@ let random_signature = QCheck2.Gen.oneofl signatures let pkhs = List.map - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn [ "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"; "tz1b7tUupMgCNw2cCLpKTkSD1NZzB5TkP2sv"; @@ -164,7 +164,7 @@ let random_pkh = QCheck2.Gen.oneofl pkhs let pks = List.map - Tezos_crypto.Signature.Public_key.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key.of_b58check_exn [ "edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2"; "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n"; @@ -432,7 +432,7 @@ let generate_activate_account = let+ id = random_pkh in let id = match id with - | Tezos_crypto.Signature.Ed25519 pkh -> pkh + | Tezos_crypto.Signature.V0.Ed25519 pkh -> pkh | _ -> assert false in Activate_account {id; activation_code} diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 22acc5dfcb67740ccd1b268a22dd119231fb8065..b8b174bbfe49659422f5f83809079f0ab50355ba 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml @@ -97,7 +97,7 @@ let empty_context : Context_l2.t = empty_storage let rng_state = Random.State.make_self_init () let gen_l1_address ?seed () = - Tezos_crypto.Signature.generate_key ~algo:Ed25519 ?seed () + Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ?seed () let gen_l2_address () = let pkh, public_key, secret_key = Tezos_crypto.Bls.generate_key () in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_baking.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_baking.ml index 3e58da9b774ac9bb8421204007066afb1e9ece5a..94cc6cbdeae3888b3f2e38a31496bed9abe1d11b 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_baking.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_baking.ml @@ -171,7 +171,8 @@ let get_contract_for_pkh contracts pkh = | [] -> assert false | c :: t -> let c_pkh = Context.Contract.pkh c in - if Tezos_crypto.Signature.Public_key_hash.equal c_pkh pkh then return c + if Tezos_crypto.Signature.V0.Public_key_hash.equal c_pkh pkh then + return c else find_contract t in find_contract contracts @@ -226,7 +227,7 @@ let test_rewards_block_and_payload_producer () = >>=? fun frozen_deposit -> Context.get_baking_reward_fixed_portion (B b2) >>=? fun baking_reward -> Context.get_bonus_reward (B b2) ~endorsing_power >>=? fun bonus_reward -> - (if Tezos_crypto.Signature.Public_key_hash.equal baker_b2 baker_b1 then + (if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2 baker_b1 then Context.get_baking_reward_fixed_portion (B b1) else return Tez.zero) >>=? fun reward_for_b1 -> @@ -270,7 +271,7 @@ let test_rewards_block_and_payload_producer () = Context.Delegate.current_frozen_deposits (B b2') baker_b2 >>=? fun frozen_deposit -> let reward_for_b1 = - if Tezos_crypto.Signature.Public_key_hash.equal baker_b2 baker_b1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2 baker_b1 then baking_reward else Tez.zero in @@ -288,7 +289,7 @@ let test_rewards_block_and_payload_producer () = >>=? fun frozen_deposits' -> Context.get_baker (B genesis) ~round:Round.zero >>=? fun baker_b1 -> let reward_for_b1' = - if Tezos_crypto.Signature.Public_key_hash.equal baker_b2' baker_b1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker_b2' baker_b1 then baking_reward else Tez.zero in @@ -398,7 +399,7 @@ let test_committee_sampling () = Format.fprintf ppf "@[- %a %d%a@]@," - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh n (fun ppf failed -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_deactivation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_deactivation.ml index a8fa7b8e547b55b63be9dc0f91184fa90e907cf7..17254e6158f8b5e258102431e927fcfa8a7dc634 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_deactivation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_deactivation.ml @@ -311,7 +311,8 @@ let test_delegation () = Context.Contract.delegate_opt (B b) a1 >>=? fun delegate -> (match delegate with | None -> assert false - | Some pkh -> assert (Tezos_crypto.Signature.Public_key_hash.equal pkh m1.pkh)) ; + | Some pkh -> + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh m1.pkh)) ; let constants = Default_parameters.constants_test in let minimal_stake = constants.minimal_stake in Op.transaction ~force_reveal:true (B b) a1 a3 minimal_stake @@ -325,7 +326,8 @@ let test_delegation () = Context.Contract.delegate_opt (B b) a3 >>=? fun delegate -> (match delegate with | None -> assert false - | Some pkh -> assert (Tezos_crypto.Signature.Public_key_hash.equal pkh m3.pkh)) ; + | Some pkh -> + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh m3.pkh)) ; check_active_staking_balance ~loc:__LOC__ ~deactivated:false b m3 >>=? fun () -> check_stake ~loc:__LOC__ b m3 >>=? fun () -> check_stake ~loc:__LOC__ b m1 diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml index d244716cc9aaa838b4a681b1d2b9e0484b8dc8ac..c032c40e1ce77b27358e6327ed3d65f03bc8639f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml @@ -306,11 +306,11 @@ let undelegated_originated_bootstrap_contract () = let delegated_implicit_bootstrap_contract () = (* These values are fixed because we use a fixed RNG seed. *) let from_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1TDZG4vFoA2xutZMYauUnS4HVucnAGQSpZ" in let to_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1MBWU1WkszFfkEER2pgn4ATKXE9ng7x1sR" in let bootstrap_delegations = [(from_pkh, to_pkh)] in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_baking.ml index 0bd2f536a376afc92c3214d77a46c2fb5082d755..54b91e324963f1bd3b5948c0e93119ad38b094b1 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -119,7 +119,7 @@ let test_valid_double_baking_followed_by_double_endorsing () = >>=? fun blk_with_db_evidence -> Context.get_first_different_endorsers (B blk_a) >>=? fun (e1, e2) -> let delegate = - if Tezos_crypto.Signature.Public_key_hash.( = ) e1.delegate baker1 then + if Tezos_crypto.Signature.V0.Public_key_hash.( = ) e1.delegate baker1 then (e1.delegate, e1.slots) else (e2.delegate, e2.slots) in @@ -168,7 +168,7 @@ let test_valid_double_endorsing_followed_by_double_baking () = Block.bake blk_2 >>=? fun blk_b -> Context.get_first_different_endorsers (B blk_a) >>=? fun (e1, e2) -> let delegate = - if Tezos_crypto.Signature.Public_key_hash.( = ) e1.delegate baker1 then + if Tezos_crypto.Signature.V0.Public_key_hash.( = ) e1.delegate baker1 then (e1.delegate, e1.slots) else (e2.delegate, e2.slots) in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_endorsement.ml index cbb03ebeb28a2813f0757c25415604a1334219c9..fe6b64532d72c61ef4a6dfe7687d44873ca20976 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -254,7 +254,7 @@ let test_different_delegates () = >>=? fun (endorser_b1c, endorser_b2c) -> let endorser_b, b_slots = if - Tezos_crypto.Signature.Public_key_hash.( = ) + Tezos_crypto.Signature.V0.Public_key_hash.( = ) endorser_a endorser_b1c.delegate then (endorser_b2c.delegate, endorser_b2c.slots) @@ -298,7 +298,7 @@ let test_wrong_delegate () = Context.get_endorser_n (B blk_b) 0 >>=? fun (endorser0, slots0) -> Context.get_endorser_n (B blk_b) 1 >>=? fun (endorser1, slots1) -> let endorser_b, b_slots = - if Tezos_crypto.Signature.Public_key_hash.equal endorser_a endorser0 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal endorser_a endorser0 then (endorser1, slots1) else (endorser0, slots0) in @@ -322,10 +322,11 @@ let test_freeze_more_with_low_balance = Context.get_endorsers ctxt >>=? function | [d1; d2] -> return - (if Tezos_crypto.Signature.Public_key_hash.equal account d1.delegate + (if + Tezos_crypto.Signature.V0.Public_key_hash.equal account d1.delegate then d1 else if - Tezos_crypto.Signature.Public_key_hash.equal account d2.delegate + Tezos_crypto.Signature.V0.Public_key_hash.equal account d2.delegate then d2 else assert false) .slots @@ -358,7 +359,7 @@ let test_freeze_more_with_low_balance = let check_unique_endorser b account2 = Context.get_endorsers (B b) >>=? function | [{delegate; _}] - when Tezos_crypto.Signature.Public_key_hash.equal account2 delegate -> + when Tezos_crypto.Signature.V0.Public_key_hash.equal account2 delegate -> return_unit | _ -> failwith "We are supposed to only have account2 as endorser." in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index 1f10336eb2b8190dd7286693ab02ca2f954ba127..367d7638c59c704a82f947e920e95a7a4bf3c64e 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_preendorsement.ml @@ -150,7 +150,7 @@ end = struct let denun_reward = Test_tez.(lost_deposit /! 2L) in (* if the baker is the endorser, he'll only loose half of the deposits *) let expected_endo_loss = - if Tezos_crypto.Signature.Public_key_hash.equal baker d1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker d1 then Test_tez.(lost_deposit -! denun_reward) else lost_deposit in @@ -164,7 +164,7 @@ end = struct burnt deposit of d1, so it's higher *) let high, low = - if Tezos_crypto.Signature.Public_key_hash.equal baker d1 then + if Tezos_crypto.Signature.V0.Public_key_hash.equal baker d1 then (bal_good, bal_bad) else (bal_bad, bal_good) in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_participation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_participation.ml index 93c4b456c3028b9626fcee75e7e77b8140d7d646..1ed5f12418a7b29cd72720313610d38cb939b853 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_participation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_participation.ml @@ -42,8 +42,8 @@ let bake_and_endorse_once (b_pred, b_cur) baker endorser = List.find_map (function | {Plugin.RPC.Validators.delegate; slots; _} -> - if Tezos_crypto.Signature.Public_key_hash.equal delegate endorser then - Some (delegate, slots) + if Tezos_crypto.Signature.V0.Public_key_hash.equal delegate endorser + then Some (delegate, slots) else None) endorsers_list |> function diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_costs.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_costs.ml index 9fe85ead49c5c0e6a09708c00e9c28a8be27a191..cd02a5e5402c2143e7cba6429f6b72cdf7961424 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_costs.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_costs.ml @@ -54,7 +54,7 @@ let dummy_map = let dummy_timestamp = Script_timestamp.of_zint (Z.of_int 42) let dummy_pk = - Tezos_crypto.Signature.Public_key.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key.of_b58check_exn "edpkuFrRoDSEbJYgxRtLx2ps82UdaYc1WwfS9sE11yhauZt5DgCHbU" let dummy_bytes = Bytes.of_string "dummy" diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_interpretation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_interpretation.ml index f852060242d4447e0a78267e8444be1697466d3e..c71e5845e8a09aee2471b1adeaffc80927a8d2de 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_interpretation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_interpretation.ml @@ -201,7 +201,7 @@ let test_json_roundtrip_err name e () = let error_encoding_tests = let contract_zero = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero + Contract.Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero in let script_expr_int = Micheline.strip_locations (Micheline.Int (0, Z.zero)) in List.map diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml index aa4d3bb45afa4abc973710994f4f78e09be04e1e..bf639d7b8e203a726855de846b74717ce2476915 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml @@ -98,7 +98,7 @@ let dont_show _fmt _ = () let size = {Tezos_benchmark.Base_samplers.min = 4; max = 32} module Crypto_samplers = -Tezos_benchmark.Crypto_samplers.Make_finite_key_pool (struct +Tezos_benchmark.Crypto_samplers.V0.Make_finite_key_pool (struct let size = 10 let algo = `Default @@ -234,7 +234,7 @@ let check_value_size () = =========== *) @ (let show fmt (Script_typed_ir.Script_signature.Signature_tag s) = - Tezos_crypto.Signature.pp fmt s + Tezos_crypto.Signature.V0.pp fmt s in exs ~error:8 nsample show Signature_t ": signature") (* @@ -259,13 +259,13 @@ let check_value_size () = Key_hash_t ========== *) - @ (let show = Tezos_crypto.Signature.Public_key_hash.pp in + @ (let show = Tezos_crypto.Signature.V0.Public_key_hash.pp in exs nsample show Key_hash_t ": key_hash") (* Key_t ===== *) - @ (let show = Tezos_crypto.Signature.Public_key.pp in + @ (let show = Tezos_crypto.Signature.V0.Public_key.pp in exs nsample show Key_t ": key_t") (* Timestamp_t diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_balance.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_balance.ml index aedf33233b86c44f3905749c3dc28f237e21122f..871426ec08a44789824559ff362d576b366b9b7e 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_balance.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_balance.ml @@ -40,7 +40,7 @@ let wrap m = m >|= Environment.wrap_tzresult type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Tezos_crypto.Signature.V0.public_key_hash; contract : Contract.t; } diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_manager.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_manager.ml index c2b972eed982499268911f4a5fe42a960b015402..55872c994176e5934f875f5daab025f118d00dbf 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_manager.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/test_ticket_manager.ml @@ -46,7 +46,7 @@ let wrap m = m >|= Environment.wrap_tzresult type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Tezos_crypto.Signature.V0.public_key_hash; contract : Contract.t; } diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_activation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_activation.ml index 9580be0be296cf0974a52683e6c4a67762b502ce..e3e1c1de743aaa912d89512aab83d016555274b8 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_activation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_activation.ml @@ -85,21 +85,21 @@ let secrets () = let passphrase = Bytes.(cat (of_string email) (of_string password)) in let sk = Tezos_client_base.Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in (pkh, pk, sk) in List.map (fun (mnemonic, secret, amount, pkh, password, email) -> let pkh', pk, sk = read_key mnemonic email password in - let pkh = Tezos_crypto.Signature.Public_key_hash.of_b58check_exn pkh in - assert (Tezos_crypto.Signature.Public_key_hash.equal pkh pkh') ; + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn pkh in + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh pkh') ; let account = Account.{pkh; pk; sk} in Account.add_account account ; { @@ -493,7 +493,7 @@ let test_invalid_activation_inexistent_pkh () = WithExceptions.Option.get ~loc:__LOC__ @@ List.hd secrets in let inexistent_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1PeQHGKPWSpNoozvxgqLN9TFsj6rDqNV3o" in Op.activation (B blk) inexistent_pkh activation_code >>=? fun operation -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_reveal.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_reveal.ml index ad764995f8fa6fea618325c92f319b5de77373ef..01e80285464bcdbdeaeabd5407438600f5b8e3d3 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_reveal.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_reveal.ml @@ -146,12 +146,12 @@ let test_reveal_with_fake_account () = These preambles are too verbose and boilerplate. We should factor out revealing fresh unrevealed accounts. *) - when_ (Tezos_crypto.Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> + when_ (Tezos_crypto.Signature.V0.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp b_pkh) >>=? fun () -> Op.transaction (B blk) bootstrap a_contract Tez.one >>=? fun oa -> @@ -228,12 +228,12 @@ let test_reveal_with_fake_account_already_revealed () = These preambles are too verbose and boilerplate. We should factor out revealing fresh unrevealed accounts. *) - when_ (Tezos_crypto.Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> + when_ (Tezos_crypto.Signature.V0.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp b_pkh) >>=? fun () -> Op.transaction (B blk) bootstrap a_contract Tez.one >>=? fun oa -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_sc_rollup.ml index dd03b4d1f8e0c3786490ce25f7a7fcbbdfe9c80a..7fc6ef508ec058c85c0adf76839e2544e9324c12 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -1608,17 +1608,17 @@ let test_timeout () = (%ld, %a)] but got [Sc_rollup_timeout_level_not_reached (%ld, \ %a)]" expected_block_left - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh1 blocks_left - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp staker | _ -> failwith "It should have failed with [Sc_rollup_timeout_level_not_reached \ (%ld, %a)]" expected_block_left - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp pkh1 in let* timeout = Op.sc_rollup_timeout (B block) account3 rollup game_index in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_tx_rollup.ml index 640a74bf1bd5370c4699d5784dc045aa31c2db89..dcfd3149f7e54cd65fc19611ae140d7f0d0fbeaa 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -311,8 +311,8 @@ let commitment_hash_testable = let public_key_hash_testable = Alcotest.testable - Tezos_crypto.Signature.Public_key_hash.pp - Tezos_crypto.Signature.Public_key_hash.( = ) + Tezos_crypto.Signature.V0.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.( = ) let raw_level_testable = Alcotest.testable Raw_level.pp Raw_level.( = ) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_voting.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_voting.ml index fa1038f416fbb5cbff20ba1f9f26ac36c6c0c674..1562c0e6557503ce86c1d731f226f9ac62eea49f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_voting.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_voting.ml @@ -1263,7 +1263,7 @@ let test_proposals_invalid_signature () = let* block, proposer = context_init1 () in let* contents = Op.proposals_contents (B block) proposer [protos.(0)] in let op = - Op.pack_operation (B block) (Some Tezos_crypto.Signature.zero) contents + Op.pack_operation (B block) (Some Tezos_crypto.Signature.V0.zero) contents in Incremental.assert_validate_operation_fails (invalid_signature __LOC__) @@ -1696,7 +1696,7 @@ let test_ballot_invalid_signature () = let* block, voter, proposal = context_init_exploration () in let* contents = Op.ballot_contents (B block) voter proposal Vote.Yay in let op = - Op.pack_operation (B block) (Some Tezos_crypto.Signature.zero) contents + Op.pack_operation (B block) (Some Tezos_crypto.Signature.V0.zero) contents in Incremental.assert_validate_operation_fails (invalid_signature __LOC__) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_frozen_bonds.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_frozen_bonds.ml index aca5cf883269f4f306c9ca33d685083f4f6486d1..1ccd4bb94fbc44f3fee5cc494c525632200bc26f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_frozen_bonds.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_frozen_bonds.ml @@ -74,13 +74,13 @@ let create_context () = delegate's pkh. *) let init_test ~user_is_delegate = create_context () >>=? fun (ctxt, _) -> - let delegate, delegate_pk, _ = Tezos_crypto.Signature.generate_key () in + let delegate, delegate_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let delegate_contract = Contract.Implicit delegate in let delegate_account = `Contract (Contract.Implicit delegate) in let user_contract = if user_is_delegate then delegate_contract else - let user, _, _ = Tezos_crypto.Signature.generate_key () in + let user, _, _ = Tezos_crypto.Signature.V0.generate_key () in Contract.Implicit user in let user_account = `Contract user_contract in @@ -398,7 +398,7 @@ let test_rpcs () = let test_scenario scenario = init_test ~user_is_delegate:false >>=? fun (ctxt, user_contract, user_account, delegate1) -> - let delegate2, delegate_pk2, _ = Tezos_crypto.Signature.generate_key () in + let delegate2, delegate_pk2, _ = Tezos_crypto.Signature.V0.generate_key () in let delegate_contract2 = Contract.Implicit delegate2 in let delegate_account2 = `Contract delegate_contract2 in let delegate_balance2 = big_random_amount () in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_token.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_token.ml index f828639aae7d858ded51c03b4dc8a6497a792233..3ac42bda8082b70e3523387f93cee5f72cfba0af 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_token.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/test_token.ml @@ -62,7 +62,7 @@ let test_simple_balances () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let src = `Contract (Contract.Implicit pkh) in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = `Contract (Contract.Implicit pkh) in let amount = Tez.one in wrap (Token.transfer ctxt src dest amount) >>=? fun (ctxt', _) -> @@ -81,7 +81,7 @@ let test_simple_balance_updates () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let src = Contract.Implicit pkh in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = Tez.one in wrap (Token.transfer ctxt (`Contract src) (`Contract dest) amount) @@ -130,7 +130,7 @@ let test_allocated () = create_context () >>=? fun (ctxt, pkh) -> let dest = `Delegate_balance pkh in test_allocated_and_still_allocated_when_empty ctxt dest true >>=? fun _ -> - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = `Contract (Contract.Implicit pkh) in test_allocated_and_deallocated_when_empty ctxt dest >>=? fun _ -> let dest = `Collected_commitments Blinded_public_key_hash.zero in @@ -183,7 +183,7 @@ let test_transferring_to_sink ctxt sink amount expected_bupds = Assert.proto_error_with_info ~loc:__LOC__ res "Overflowing tez addition" let test_transferring_to_contract ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -202,7 +202,7 @@ let test_transferring_to_collected_commitments ctxt = [(Commitments bpkh, Credited amount, Block_application)] let test_transferring_to_delegate_balance ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -212,7 +212,7 @@ let test_transferring_to_delegate_balance ctxt = [(Contract dest, Credited amount, Block_application)] let test_transferring_to_frozen_deposits ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in test_transferring_to_sink ctxt @@ -254,7 +254,7 @@ let test_transferring_to_burned ctxt = ]) true >>=? fun () -> - let pkh = Tezos_crypto.Signature.Public_key_hash.zero in + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero in let p, r = (Random.bool (), Random.bool ()) in wrap (Token.transfer ctxt `Minted (`Lost_endorsing_rewards (pkh, p, r)) amount) @@ -280,7 +280,7 @@ let test_transferring_to_burned ctxt = true let test_transferring_to_frozen_bonds ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let contract = Contract.Implicit pkh in let tx_rollup = mk_rollup () in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in @@ -380,7 +380,7 @@ let test_transferring_from_bounded_source ctxt src amount expected_bupds = Assert.proto_error_with_info ~loc:__LOC__ res error_title let test_transferring_from_contract ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let src = Contract.Implicit pkh in let amount = random_amount () in test_transferring_from_bounded_source @@ -399,7 +399,7 @@ let test_transferring_from_collected_commitments ctxt = [(Commitments bpkh, Debited amount, Block_application)] let test_transferring_from_delegate_balance ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in let src = Contract.Implicit pkh in test_transferring_from_bounded_source @@ -409,7 +409,7 @@ let test_transferring_from_delegate_balance ctxt = [(Contract src, Debited amount, Block_application)] let test_transferring_from_frozen_deposits ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let amount = random_amount () in test_transferring_from_bounded_source ctxt @@ -426,7 +426,7 @@ let test_transferring_from_collected_fees ctxt = [(Block_fees, Debited amount, Block_application)] let test_transferring_from_frozen_bonds ctxt = - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Tezos_crypto.Signature.V0.generate_key () in let contract = Contract.Implicit pkh in let tx_rollup = mk_rollup () in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in @@ -497,13 +497,13 @@ let cast_to_container_type x = let build_test_cases () = create_context () >>=? fun (ctxt, pkh) -> let origin = `Contract (Contract.Implicit pkh) in - let user1, _, _ = Tezos_crypto.Signature.generate_key () in + let user1, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let baker1, baker1_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker1, baker1_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let baker1c = `Contract (Contract.Implicit baker1) in - let baker2, baker2_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker2, baker2_pk, _ = Tezos_crypto.Signature.V0.generate_key () in let baker2c = `Contract (Contract.Implicit baker2) in (* Allocate contracts for user1, user2, baker1, and baker2. *) wrap (Token.transfer ctxt origin user1c (random_amount ())) @@ -706,13 +706,13 @@ let test_transfer_n_with_non_empty_source () = Random.init 0 ; create_context () >>=? fun (ctxt, pkh) -> let origin = `Contract (Contract.Implicit pkh) in - let user1, _, _ = Tezos_crypto.Signature.generate_key () in + let user1, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let user3, _, _ = Tezos_crypto.Signature.generate_key () in + let user3, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user3c = `Contract (Contract.Implicit user3) in - let user4, _, _ = Tezos_crypto.Signature.generate_key () in + let user4, _, _ = Tezos_crypto.Signature.V0.generate_key () in let user4c = `Contract (Contract.Implicit user4) in (* Allocate contracts for user1, user2, user3, and user4. *) let amount = diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/manager_operation_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/manager_operation_helpers.ml index e447e5bb1143675e13eec24e7308e130dcc418c4..014aaaf799c1bdb6273d958e17220c369ba8d4ec 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/manager_operation_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/manager_operation_helpers.ml @@ -1249,7 +1249,7 @@ let make_tztest_batched ?(fmt = Format.std_formatter) name test subjects increment of the counters aka 1 for a single operation, n for a batch of n manager operations. *) type probes = { - source : Tezos_crypto.Signature.Public_key_hash.t; + source : Tezos_crypto.Signature.V0.Public_key_hash.t; fee : Tez.tez; gas_limit : Gas.Arith.integral; nb_counter : Z.t; @@ -1368,7 +1368,7 @@ let observe ~mode ~deallocated ctxt_pre ctxt_post op = | Ok () -> failwith "%a should have been deallocated@." - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp (Context.Contract.pkh contract) | Error [ diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml index 3ad0af08a87cdcaf9a1c5c926acac44f7e873ccc..375fdcc756657dd21a93b83dc5c4529bf2e68345 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml @@ -103,21 +103,21 @@ let secrets = let passphrase = Bytes.(cat (of_string email) (of_string password)) in let sk = Tezos_client_base.Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn Tezos_crypto.Ed25519.Secret_key.encoding sk) in - let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in + let pkh = Tezos_crypto.Signature.V0.Public_key.hash pk in (pkh, pk, sk) in List.map (fun (mnemonic, secret, amount, pkh, password, email) -> let pkh', pk, sk = read_key mnemonic email password in let pkh = Tezos_crypto.Ed25519.Public_key_hash.of_b58check_exn pkh in - assert (Tezos_crypto.Signature.Public_key_hash.equal (Ed25519 pkh) pkh') ; + assert (Tezos_crypto.Signature.V0.Public_key_hash.equal (Ed25519 pkh) pkh') ; let activation_code = Stdlib.Option.get (Blinded_public_key_hash.activation_code_of_hex secret) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_script_comparison.ml b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_script_comparison.ml index 06c47e5e5ac8967240bd1cab82bc9da4f1d23125..397456fd1f398dab74fcf7298b72bd593f6fdd3c 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_script_comparison.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_script_comparison.ml @@ -57,9 +57,9 @@ let rec reference_compare_comparable : type a. a comparable_ty -> a -> a -> int | Bool_t, x, y -> normalize_compare @@ Compare.Bool.compare x y | Mutez_t, x, y -> normalize_compare @@ Tez.compare x y | Key_hash_t, x, y -> - normalize_compare @@ Tezos_crypto.Signature.Public_key_hash.compare x y + normalize_compare @@ Tezos_crypto.Signature.V0.Public_key_hash.compare x y | Key_t, x, y -> - normalize_compare @@ Tezos_crypto.Signature.Public_key.compare x y + normalize_compare @@ Tezos_crypto.Signature.V0.Public_key.compare x y | Int_t, x, y -> normalize_compare @@ Script_int.compare x y | Nat_t, x, y -> normalize_compare @@ Script_int.compare x y | Timestamp_t, x, y -> normalize_compare @@ Script_timestamp.compare x y @@ -117,7 +117,7 @@ module Parameters = struct end module Crypto_samplers = -Tezos_benchmark.Crypto_samplers.Make_finite_key_pool (struct +Tezos_benchmark.Crypto_samplers.V0.Make_finite_key_pool (struct let size = 1000 let algo = `Default diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index 440ffd952908c824c6d8ec7b742870f28e71c07d..7bcdf0c5487db4e261743f8a6903ded900aa88af 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml @@ -76,7 +76,7 @@ let idx_l2_address_gen = oneof [idx_l2_address_idx_gen; return idx_l2_address_value] let public_key_hash = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU" let public_key_hash_gen = @@ -90,7 +90,7 @@ let ticket_hash : Protocol.Alpha_context.Ticket_hash.t = we could introduce a bit more randomness here *) let ticketer_b58 = "tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU" in let ticketer_pkh = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn ticketer_b58 + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn ticketer_b58 in let ticketer = Protocol.Alpha_context.Contract.Implicit ticketer_pkh in Tx_rollup_l2_helpers.make_unit_ticket_key ticketer l2_address diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_zk_rollup_encoding.ml b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_zk_rollup_encoding.ml index 9d55fd7125bb62f47290178aad2cec32965d3fd8..25848466eb9705b16330a8bd6a2bf91ba3fc9067 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_zk_rollup_encoding.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_zk_rollup_encoding.ml @@ -98,7 +98,7 @@ let gen_ticket_hash = Ticket_hash_repr.of_bytes_exn bytes let gen_pkh = - let pkh, _, _ = Tezos_crypto.Signature.generate_key ~algo:Ed25519 () in + let pkh, _, _ = Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 () in Gen.return pkh let gen_z = diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_consensus_key.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_consensus_key.ml index 7e7800af4004eb4798beb9c3f54b8406d4bad01d..41b0a376f857d1305c5aa676c7d74e4d6c02ef29 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_consensus_key.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_consensus_key.ml @@ -77,18 +77,18 @@ module Assert = struct let equal_pkh ~__LOC__ a b = Assert.equal ~loc:__LOC__ - Tezos_crypto.Signature.Public_key_hash.equal + Tezos_crypto.Signature.V0.Public_key_hash.equal "pkh" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp a b let equal_pk ~__LOC__ a b = Assert.equal ~loc:__LOC__ - Tezos_crypto.Signature.Public_key.equal + Tezos_crypto.Signature.V0.Public_key.equal "pk" - Tezos_crypto.Signature.Public_key.pp + Tezos_crypto.Signature.V0.Public_key.pp a b diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_contract_repr.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_contract_repr.ml index 9a758c030b675cd8e7c817456298f224c4e46e0b..d60870eaed669e5f77b4d5e811104b8e5340d09a 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_contract_repr.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_contract_repr.ml @@ -62,7 +62,7 @@ module Test_contract_repr = struct Contract_hash.hash_bytes [data] let dummy_implicit_contract = - Implicit Tezos_crypto.Signature.Public_key_hash.zero + Implicit Tezos_crypto.Signature.V0.Public_key_hash.zero let dummy_originated_contract = originated_contract @@ dummy_origination_nonce @@ -73,7 +73,7 @@ module Test_contract_repr = struct "%s should have been equal to %" Format.pp_print_string (to_b58check dummy_implicit_contract) - Tezos_crypto.Signature.Public_key_hash.(to_b58check zero) + Tezos_crypto.Signature.V0.Public_key_hash.(to_b58check zero) let test_to_b58check_originated () = Assert.equal diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_receipt.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_receipt.ml index 245ae17b0a5407f099f99efa4519a5423f162525..bb41400a8ba208f3ca1f09c6cda6c198df64e070 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_receipt.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_receipt.ml @@ -68,7 +68,7 @@ let test_encodings balance = let test_encodings () = let open Receipt in - let pkh = Tezos_crypto.Signature.Public_key_hash.zero in + let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero in test_encodings (Contract (Contract.Implicit pkh)) >>=? fun () -> test_encodings Block_fees >>=? fun () -> test_encodings (Deposits pkh) >>=? fun () -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml index 66c69757f1e4d506eda246beeaa1004cf5d512d9..90058068a1eeb6e4dd38479ce66209509f7db633 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml @@ -110,7 +110,7 @@ let test_encode_decode_internal_inbox_message () = let source = Result.get_ok ~loc:__LOC__ - (Tezos_crypto.Signature.Public_key_hash.of_b58check + (Tezos_crypto.Signature.V0.Public_key_hash.of_b58check "tz1RjtZUVeLhADFHDL8UwDZA6vjWWhojpu5w") in let*? (Script_typed_ir.Ty_ex_c pair_nat_ticket_string_ty) = diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_storage.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_storage.ml index 0a3889d6c408c63f038b16cbec3ce0cc4ffbd447..3c414d957337ea3d041c84065dcbc4113f515828 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_storage.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_storage.ml @@ -78,7 +78,9 @@ let new_context () = let* ctxt, _stakers = new_context_with_stakers 1 in (* Mint some tez for staker accounts. *) let mint_tez_for ctxt pkh_str = - let pkh = Tezos_crypto.Signature.Public_key_hash.of_b58check_exn pkh_str in + let pkh = + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn pkh_str + in let contract = Contract_repr.Implicit pkh in let+ ctxt, _ = lift @@ -429,7 +431,7 @@ let test_deposit_then_withdraw () = let* ctxt = new_context () in let* rollup, _genesis_hash, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in let* ctxt = deposit_stake_and_check_balances ctxt rollup staker in @@ -447,7 +449,7 @@ let test_withdraw_when_not_staked () = let* ctxt = new_context () in let* rollup, _genesis_hash, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in assert_fails_with @@ -459,7 +461,7 @@ let test_withdrawing_twice () = let* ctxt = new_context () in let* rollup, _genesis_hash, ctxt = lift @@ new_sc_rollup ctxt in let staker = - Tezos_crypto.Signature.Public_key_hash.of_b58check_exn + Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn "tz1SdKt9kjPp1HRQFkBmXtBhgMfvdgFhSjmG" in let* ctxt = deposit_stake_and_check_balances ctxt rollup staker in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2.ml index a2368b23c1869c41dd46f36209bc29e2561233ad..abb579eb887bb4a4b098510cccea953582d8faab 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2.ml @@ -518,7 +518,7 @@ module Test_batch_encodings = struct Format.fprintf fmt "@[Withdraw:@ destination=%a,@ ticket_hash=%a,@ qty:%a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp destination Alpha_context.Ticket_hash.pp ticket_hash diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index 767190f5ba0eca65db173f2924c90af07675dbf5..c5c000e6de9b751f8df328d4ca45b6abb4eeaa5c 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml @@ -48,7 +48,7 @@ open Indexable (** {3. Various helpers to facilitate the tests. } *) -let pkh = Tezos_crypto.Signature.Public_key_hash.zero +let pkh = Tezos_crypto.Signature.V0.Public_key_hash.zero let ((_, pk1, addr1) as l2_addr1) = gen_l2_address () @@ -154,7 +154,7 @@ let pp_withdrawal fmt = function Format.fprintf fmt "{claimer=%a; ticket_hash=%a; amount=%a}" - Tezos_crypto.Signature.Public_key_hash.pp + Tezos_crypto.Signature.V0.Public_key_hash.pp claimer Ticket_hash.pp ticket_hash diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_zk_rollup_storage.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_zk_rollup_storage.ml index dfff16df2926a3cfc8ff41fae4e71669ba224eff..59476f6b9acd86deaaf5e0626c454f5584920825 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_zk_rollup_storage.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_zk_rollup_storage.ml @@ -45,9 +45,9 @@ let batch_size = 10 module ZKRU = struct include Alpha_context.Zk_rollup - type pkh = Tezos_crypto.Signature.Public_key_hash.t + type pkh = Tezos_crypto.Signature.V0.Public_key_hash.t - let pkh_encoding = Tezos_crypto.Signature.Public_key_hash.encoding + let pkh_encoding = Tezos_crypto.Signature.V0.Public_key_hash.encoding type ticket_hash = Alpha_context.Ticket_hash.t @@ -141,7 +141,7 @@ module Raw_context_tests = struct let pending_list_append () = let open Lwt_result_syntax in let* ctx, rollup, _contract = originate_ctx () in - let pkh, _, _ = Tezos_crypto.Signature.generate_key () in + let pkh, _, _ = Tezos_crypto.Signature.V0.generate_key () in let op = no_ticket Zk_rollup_operation_repr. @@ -170,7 +170,7 @@ module Raw_context_tests = struct let pending_list_append_errors () = let open Lwt_result_syntax in let* ctx, rollup, _contract = originate_ctx () in - let pkh, _, _ = Tezos_crypto.Signature.generate_key () in + let pkh, _, _ = Tezos_crypto.Signature.V0.generate_key () in let op = no_ticket Zk_rollup_operation_repr. diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/accuser.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/accuser.mli index 23e56026d7d4a78e1659522c7b7dd87483d1affa..6f20280e03de4c8bd04613f4b4a7e08564a4c898 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/accuser.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/accuser.mli @@ -40,7 +40,7 @@ val build_rejection : (** [reject_bad_commitment ~source state commitment] injects a rejection operation with [source] if the [commitment] is rejectable. *) val reject_bad_commitment : - source:Tezos_crypto.Signature.Public_key_hash.t -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> State.t -> Tx_rollup_commitment.Full.t -> unit tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml index e3e6d07864611fcff168b29aa8e83f3a82ddf9be..35f152099d46cf1d8c616b1020e132922a90bbd4 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml @@ -33,7 +33,7 @@ type state = { constants : Constants.t; batch_burn_limit : Tez.t option; index : Context.index; - signer : Tezos_crypto.Signature.public_key_hash; + signer : Tezos_crypto.Signature.V0.public_key_hash; transactions : Tx_queue.t; mutable incr_context : Context.t; lock : Lwt_mutex.t; @@ -241,7 +241,7 @@ module Types = struct type nonrec state = state type parameters = { - signer : Tezos_crypto.Signature.public_key_hash; + signer : Tezos_crypto.Signature.V0.public_key_hash; index : Context.index; constants : Constants.t; batch_burn_limit : Tez.t option; diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.mli index 6a287c15683f2175644bf60f974fae4d1e4a1754..4a72ad02ee8ef7ce66a4f077eef446ece1464e5d 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.mli @@ -28,7 +28,7 @@ open Alpha_context (** Initialize the internal state of the batcher. *) val init : rollup:Tx_rollup.t -> - signer:Tezos_crypto.Signature.public_key_hash -> + signer:Tezos_crypto.Signature.V0.public_key_hash -> batch_burn_limit:Tez.t option -> Context.index -> Constants.t -> diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/dispatcher.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/dispatcher.mli index e143b73b8ceb262f70b37ce0c470623f58a66f91..8237e9efdc01ad4d88d8fd9cf618952b32719406 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/dispatcher.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/dispatcher.mli @@ -26,7 +26,7 @@ (** Produce dispatch of withdrawals operations and sends them to the injector. *) val dispatch_withdrawals : - source:Tezos_crypto.Signature.Public_key_hash.t -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> State.t -> L2block.t -> unit tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.ml index 80c54b6d56478ae2e24da512f99da8111f518d0e..575fe3a78f08f9cbd7cd24948f6f4665aed64fc6 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.ml @@ -38,7 +38,7 @@ type 'a purposed = { dispatch_withdrawals : 'a; } -type signers = Tezos_crypto.Signature.public_key_hash option purposed +type signers = Tezos_crypto.Signature.V0.public_key_hash option purposed type cost_caps = { fee_cap : Protocol.Alpha_context.Tez.t; @@ -171,28 +171,28 @@ let signers_encoding = (opt ~description:"The operator of the rollup (public key hash) if any" "operator" - Tezos_crypto.Signature.Public_key_hash.encoding) + Tezos_crypto.Signature.V0.Public_key_hash.encoding) (opt "submit_batch" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description:"The public key hash of the signer for batch submission") (opt "finalize_commitment" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for finalization of commitments") (opt "remove_commitment" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for removals of commitments") (opt "rejection" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description:"The public key hash of the signer for rejections") (opt "dispatch_withdrawals" - Tezos_crypto.Signature.Public_key_hash.encoding + Tezos_crypto.Signature.V0.Public_key_hash.encoding ~description: "The public key hash of the signer for the dispatch of withdrawals") diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.mli index 31a006cc418cda86a0cf6c09959e2b6d6d0fb360..1f3747c13292e0fbdb501066136df15d34d923fe 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/node_config.mli @@ -50,7 +50,7 @@ type 'a purposed = { dispatch_withdrawals : 'a; } -type signers = Tezos_crypto.Signature.public_key_hash option purposed +type signers = Tezos_crypto.Signature.V0.public_key_hash option purposed type cost_caps = { fee_cap : Protocol.Alpha_context.Tez.t; diff --git a/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml b/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml index 5672070a26e740415ac526d6012b1eb3dab118fc..8395355273ce543e3e4f484d4cebf977f4e6b0b2 100644 --- a/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml +++ b/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml @@ -386,12 +386,18 @@ module Data = struct let key_hash kh = let b = - Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding kh + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key_hash.encoding + kh in prim A_Key_hash [bytes b] [] let key k = - let b = Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding k in + let b = + Data_encoding.Binary.to_bytes_exn + Environment.Signature.Public_key.encoding + k + in prim A_Key [bytes b] [] let integer (i : int) = prim A_Int [int (Z.of_int i)] [] diff --git a/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli b/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli index 4cebbffb4467867f921d23f4921d00fcca564d32..724bfa299074d04eb4a0743caa9210735a7c550f 100644 --- a/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli +++ b/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.mli @@ -309,9 +309,9 @@ module Data : sig val mutez : Alpha_context.Tez.t -> node - val key_hash : Signature.Public_key_hash.t -> node + val key_hash : Environment.Signature.Public_key_hash.t -> node - val key : Signature.Public_key.t -> node + val key : Environment.Signature.Public_key.t -> node val integer : int -> node diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 17b78483aaebbfff5cedb4a11b200c4862920251..deba522b9f5e7e39fd3b41e98c7742bb63568821 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -769,6 +769,8 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run Tezos_crypto.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> + let pk = Tezos_crypto.Signature.Of_V1.public_key pk in + let sk = Tezos_crypto.Signature.Of_V1.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk diff --git a/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml index 58e97b9d4b15dd6799d612f8fbe9571caad729b0..c98cd68feaa383bf1154c30f115d710f96a4697c 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml @@ -248,7 +248,8 @@ let normalize_source cctxt = | Ok sk -> Lwt.return_some sk | Error _ -> let+ r = Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri in - Option.of_result r + let sk = Option.of_result r in + Option.bind sk Tezos_crypto.Signature.Of_V_latest.secret_key in let key_from_alias alias = let warning msg alias = diff --git a/src/proto_alpha/lib_injector/injector_functor.ml b/src/proto_alpha/lib_injector/injector_functor.ml index cd686719c0c9dc0a605e62e127b8cb0b5a732edb..1af48370900ace9dae4c3a988cdc7f2a61cd73dd 100644 --- a/src/proto_alpha/lib_injector/injector_functor.ml +++ b/src/proto_alpha/lib_injector/injector_functor.ml @@ -634,14 +634,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = - match state.signer.pkh with - | Tezos_crypto.Signature.Ed25519 _ -> - Tezos_crypto.Signature.of_ed25519 Tezos_crypto.Ed25519.zero - | Secp256k1 _ -> - Tezos_crypto.Signature.of_secp256k1 Tezos_crypto.Secp256k1.zero - | P256 _ -> Tezos_crypto.Signature.of_p256 Tezos_crypto.P256.zero - in + let signature = Tezos_crypto.Signature.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { diff --git a/src/proto_genesis/lib_client/client_proto_main.ml b/src/proto_genesis/lib_client/client_proto_main.ml index d6a9e9685a8371e16c14346b40c7cb6ae9e27dd0..ac9a4a21d33f1be4d0e5e9f9294009243faeee23 100644 --- a/src/proto_genesis/lib_client/client_proto_main.ml +++ b/src/proto_genesis/lib_client/client_proto_main.ml @@ -32,7 +32,7 @@ let bake cctxt ?timestamp block command sk = | Some t -> t | None -> Time.System.(to_protocol (Tezos_base.Time.System.now ())) in - let protocol_data = {command; signature = Tezos_crypto.Signature.zero} in + let protocol_data = {command; signature = Tezos_crypto.Signature.V0.zero} in Genesis_block_services.Helpers.Preapply.block cctxt ~block @@ -42,7 +42,7 @@ let bake cctxt ?timestamp block command sk = >>=? fun (shell_header, _) -> let blk = Data.Command.forge shell_header command in Shell_services.Chain.chain_id cctxt ~chain:`Main () >>=? fun chain_id -> - Client_keys.append cctxt sk ~watermark:(Block_header chain_id) blk + Client_keys_v0.append cctxt sk ~watermark:(Block_header chain_id) blk >>=? fun signed_blk -> Shell_services.Injection.block cctxt signed_blk [] let int32_parameter = @@ -148,7 +148,7 @@ let commands () = ~desc:"Hardcoded fitness of the first block (integer)" int32_parameter @@ prefixes ["and"; "key"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"password" ~desc:"Activator's key" @@ prefixes ["and"; "parameters"] @@ -190,7 +190,7 @@ let commands () = "Hardcoded fitness of the first block of the testchain (integer)" int32_parameter @@ prefixes ["and"; "key"] - @@ Client_keys.Secret_key.source_param + @@ Client_keys_v0.Secret_key.source_param ~name:"password" ~desc:"Activator's key" @@ prefixes ["and"; "parameters"] diff --git a/src/proto_genesis/lib_client/client_proto_main.mli b/src/proto_genesis/lib_client/client_proto_main.mli index 902704cb10644b2e091334fd8b115cc7d144adb2..d2a08cabec07563b29b0e126fa7ab0f2bb556530 100644 --- a/src/proto_genesis/lib_client/client_proto_main.mli +++ b/src/proto_genesis/lib_client/client_proto_main.mli @@ -30,5 +30,5 @@ val bake : ?timestamp:Time.Protocol.t -> Shell_services.block -> Data.Command.t -> - Client_keys.sk_uri -> + Client_keys_v0.sk_uri -> Tezos_crypto.Block_hash.t tzresult Lwt.t diff --git a/tezt/tests/mockup.ml b/tezt/tests/mockup.ml index b4a0f69d1c33e3521d881a1b7616ae293645cd7e..416938a91315bb78b1e94af6ef28360e6b49a0a7 100644 --- a/tezt/tests/mockup.ml +++ b/tezt/tests/mockup.ml @@ -1082,7 +1082,8 @@ let test_create_mockup_config_show_init_roundtrip protocols = | typ when typ =~ rex "#/definitions/.*\\.mutez" -> let n_opt = numerical_of_string ~typ value in `String (distinct_sample_numeric ~minimum:0 n_opt |> string_of_int) - | "#/definitions/Signature.Public_key_hash" -> + | "#/definitions/Signature.Public_key_hash" + | "#/definitions/Signature.V0.Public_key_hash" -> let value' = distinct_sample_list ~equal:String.equal