From 55cd72ca13814d22e27e6e619a293c3ec1b707c1 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 30 Aug 2022 16:47:36 +0200 Subject: [PATCH 01/18] Crypto: Versioned Signature module - V0 is the old Signature - V1 is a duplicate of V0 (for now) - V_latest is a pointer to V1 --- src/lib_crypto/signature.ml | 718 +---------------------------- src/lib_crypto/signature.mli | 68 ++- src/lib_crypto/signature_v0.ml | 744 +++++++++++++++++++++++++++++++ src/lib_crypto/signature_v0.mli | 92 ++++ src/lib_crypto/signature_v1.ml | 768 ++++++++++++++++++++++++++++++++ src/lib_crypto/signature_v1.mli | 110 +++++ 6 files changed, 1758 insertions(+), 742 deletions(-) create mode 100644 src/lib_crypto/signature_v0.ml create mode 100644 src/lib_crypto/signature_v0.mli create mode 100644 src/lib_crypto/signature_v1.ml create mode 100644 src/lib_crypto/signature_v1.mli diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index 6135cc851303..0f8ccb5d41ba 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,35 @@ (* *) (*****************************************************************************) -open Error_monad +module V0 = Signature_v0 +module V1 = Signature_v1 -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 type CONV = sig + module V_from : S.COMMON_SIGNATURE -type public_key = - | Ed25519 of Ed25519.Public_key.t - | Secp256k1 of Secp256k1.Public_key.t - | P256 of P256.Public_key.t + module V_to : S.COMMON_SIGNATURE -type secret_key = - | Ed25519 of Ed25519.Secret_key.t - | Secp256k1 of Secp256k1.Secret_key.t - | P256 of P256.Secret_key.t + val public_key_hash : V_from.Public_key_hash.t -> V_to.Public_key_hash.t -type watermark = - | Block_header of Chain_id.t - | Endorsement of Chain_id.t - | Generic_operation - | Custom of Bytes.t + val public_key : V_from.Public_key.t -> V_to.Public_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 + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.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) + val signature : V_from.t -> V_to.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 +module V_latest = struct + include V1 - let of_b58check_exn = of_b58check_exn + module Of_V1 : CONV with module V_from := V1 and module V_to := V1 = struct + let public_key_hash x = x - let to_b58check = to_b58check + let public_key x = x - let to_short_b58check = to_short_b58check - end) + let secret_key x = x - let pp ppf t = Format.fprintf ppf "%s" (to_b58check t) + let signature x = x + end 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 +include V_latest diff --git a/src/lib_crypto/signature.mli b/src/lib_crypto/signature.mli index c5653e9f2e69..8a68f2addb0d 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,38 @@ (* *) (*****************************************************************************) -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 +(** [V0] supports Ed25519, Secp256k1, and P256. *) +module V0 = Signature_v0 -type secret_key = - | Ed25519 of Ed25519.Secret_key.t - | Secp256k1 of Secp256k1.Secret_key.t - | P256 of P256.Secret_key.t +(** [V1] supports Ed25519, Secp256k1, P256 and BLS. *) +module V1 = Signature_v1 -type watermark = - | Block_header of Chain_id.t - | Endorsement of Chain_id.t - | Generic_operation - | Custom of Bytes.t +(** The type of conversion modules from one version to another. *) +module type CONV = sig + module V_from : S.COMMON_SIGNATURE -val bytes_of_watermark : watermark -> Bytes.t + module V_to : S.COMMON_SIGNATURE -val pp_watermark : Format.formatter -> watermark -> unit + val public_key_hash : V_from.Public_key_hash.t -> V_to.Public_key_hash.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 public_key : V_from.Public_key.t -> V_to.Public_key.t -(** [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 + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t -(** [concat buf t] is the concatenation of [buf] and the serialization - of [t]. *) -val concat : Bytes.t -> t -> Bytes.t + val signature : V_from.t -> V_to.t +end -include S.RAW_DATA with type t := t +(** 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 V1 -val of_secp256k1 : Secp256k1.t -> t +include module type of V_latest -val of_ed25519 : Ed25519.t -> t +(** Converting from signatures of {!V0} to {!V_latest}. *) +module Of_V0 : CONV with module V_from := V0 and module V_to := V_latest -val of_p256 : P256.t -> t - -type algo = Ed25519 | Secp256k1 | P256 - -val generate_key : - ?algo:algo -> - ?seed:Bytes.t -> - unit -> - public_key_hash * public_key * secret_key +(** 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 000000000000..1827f52ef661 --- /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 000000000000..88769a465b61 --- /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 000000000000..91184800cc9a --- /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 000000000000..dd16298c5050 --- /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 -- GitLab From d20729d10c8fa9b4f2784ad2dcbf3a44bf2f99ce Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 16 Sep 2022 22:21:12 +0200 Subject: [PATCH 02/18] Cryto: Of_V_latest conversion modules --- src/lib_crypto/signature.ml | 77 +++++++++++++++++++++++++++++++----- src/lib_crypto/signature.mli | 50 +++++++++++++++++++---- 2 files changed, 110 insertions(+), 17 deletions(-) diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index 0f8ccb5d41ba..3833bf5c21ca 100644 --- a/src/lib_crypto/signature.ml +++ b/src/lib_crypto/signature.ml @@ -25,9 +25,6 @@ (* *) (*****************************************************************************) -module V0 = Signature_v0 -module V1 = Signature_v1 - module type CONV = sig module V_from : S.COMMON_SIGNATURE @@ -42,18 +39,78 @@ module type CONV = sig val signature : V_from.t -> V_to.t end -module V_latest = struct - include V1 +module type CONV_OPT = sig + module V_from : S.COMMON_SIGNATURE + + module V_to : S.COMMON_SIGNATURE + + val public_key_hash : + V_from.Public_key_hash.t -> V_to.Public_key_hash.t option + + val public_key : V_from.Public_key.t -> V_to.Public_key.t option + + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t option + + val signature : V_from.t -> V_to.t option +end + +module V_latest = Signature_v1 + +module V0 = struct + include Signature_v0 - module Of_V1 : CONV with module V_from := V1 and module V_to := V1 = struct - let public_key_hash x = x + 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 x = x + 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 x = x + 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 x = x + 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 V1 = struct + include Signature_v1 + + 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 public_key = Option.some + + let secret_key = Option.some + + let signature = Option.some end end include V_latest +module Of_V_latest = V1.Of_V_latest + +module Of_V1 : CONV with module V_from := V1 and module V_to := V1 = struct + let public_key_hash = Fun.id + + let public_key = Fun.id + + let secret_key = Fun.id + + let signature = Fun.id +end diff --git a/src/lib_crypto/signature.mli b/src/lib_crypto/signature.mli index 8a68f2addb0d..555b24672859 100644 --- a/src/lib_crypto/signature.mli +++ b/src/lib_crypto/signature.mli @@ -28,12 +28,6 @@ (** Cryptographic signatures are versioned to expose different versions to different protocols, depending on the support. *) -(** [V0] supports Ed25519, Secp256k1, and P256. *) -module V0 = Signature_v0 - -(** [V1] supports Ed25519, Secp256k1, P256 and BLS. *) -module V1 = Signature_v1 - (** The type of conversion modules from one version to another. *) module type CONV = sig module V_from : S.COMMON_SIGNATURE @@ -49,12 +43,54 @@ module type CONV = sig val signature : V_from.t -> V_to.t end +(** The type of {e partial} conversion modules from one version to another. *) +module type CONV_OPT = sig + module V_from : S.COMMON_SIGNATURE + + module V_to : S.COMMON_SIGNATURE + + val public_key_hash : + V_from.Public_key_hash.t -> V_to.Public_key_hash.t option + + val public_key : V_from.Public_key.t -> V_to.Public_key.t option + + val secret_key : V_from.Secret_key.t -> V_to.Secret_key.t option + + val signature : V_from.t -> V_to.t option +end + (** 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 V1 +module V_latest : module type of Signature_v1 + +(** [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 -- GitLab From c8e75a65ab68c44ea0bc0df056d5f56cc3704867 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 31 May 2022 10:27:58 +0200 Subject: [PATCH 03/18] Environments V0-V7: depend on V0 signature (no BLS) --- .../environment_V0.ml | 8 ++++---- .../environment_V0.mli | 8 ++++---- .../environment_V1.ml | 8 ++++---- .../environment_V1.mli | 8 ++++---- .../environment_V2.ml | 8 ++++---- .../environment_V2.mli | 8 ++++---- .../environment_V3.ml | 10 +++++----- .../environment_V3.mli | 8 ++++---- .../environment_V4.ml | 10 +++++----- .../environment_V4.mli | 8 ++++---- .../environment_V5.ml | 10 +++++----- .../environment_V5.mli | 8 ++++---- .../environment_V6.ml | 10 +++++----- .../environment_V6.mli | 8 ++++---- .../environment_V7.ml | 10 +++++----- .../environment_V7.mli | 8 ++++---- .../structs/v0_signature.ml | 20 +++++++++++-------- 17 files changed, 81 insertions(+), 77 deletions(-) diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index 9f3e857eeccc..e5003dab2401 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 5e31b3574097..2d66950b8e1b 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 1b40214ac966..5edfb7f2b71f 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 560a57cf0d86..715250ce08a5 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 9c60fee46ad7..fa29c2c4cec5 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 a4b1e9d41736..5607402867b6 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 9905a5b8c1f6..62257eb31735 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 1e1ed5e2b3aa..ef96e8b967a1 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 c883b5052f5c..67f641baf7b1 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 771f5ddbea36..482b7d7dff37 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 8da55b05f452..f80ed466cf15 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 5bb9c81581d1..2e6239a7b24b 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 e835c768610c..329598f1357b 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 15a1bc7e9dbc..88ec5f31074a 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 4ffe74e9d440..b454bf6f362d 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 a0149fa22f08..c966ad824611 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/structs/v0_signature.ml b/src/lib_protocol_environment/structs/v0_signature.ml index 582923932c05..338914cda0a3 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 -- GitLab From b93526f814f8fabeca72ed0dfcad575d9b2aeda2 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 4 Nov 2022 16:04:36 +0100 Subject: [PATCH 04/18] Environment V8: depends on V1 signature (prepare for BLS crypto) --- src/lib_protocol_environment/environment_V8.ml | 10 +++++----- src/lib_protocol_environment/environment_V8.mli | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index 0aa570ec5941..f7be6c3705b0 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 f44710bb601a..c3c15f69fd7d 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 -- GitLab From 1c0e1353595491fdffca0c2210284b5f579225c7 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 31 May 2022 10:22:36 +0200 Subject: [PATCH 05/18] Client base: versioned Client_keys --- src/lib_client_base/client_keys.ml | 1071 +++++++++++++++--------- src/lib_client_base/client_keys.mli | 326 ++++---- src/lib_client_base/client_keys_v0.ml | 29 + src/lib_client_base/client_keys_v1.ml | 29 + src/lib_signer_backends/unencrypted.ml | 2 + 5 files changed, 901 insertions(+), 556 deletions(-) create mode 100644 src/lib_client_base/client_keys_v0.ml create mode 100644 src/lib_client_base/client_keys_v1.ml diff --git a/src/lib_client_base/client_keys.ml b/src/lib_client_base/client_keys.ml index cdbff93eb2f0..8728c888694b 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 558ed7684a37..428d0bdcc8c8 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 000000000000..b012affb986b --- /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 000000000000..c789e3f78d2b --- /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_signer_backends/unencrypted.ml b/src/lib_signer_backends/unencrypted.ml index 1d84f31e8dc4..b91d3656545a 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 -- GitLab From dbee4469003f61d94a52447cae7e157575fc7fb6 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 15:57:50 +0100 Subject: [PATCH 06/18] Client/006,008,009,010,011,012,013,014,015: parse V0 keys --- .../lib_client/client_proto_context.ml | 2 ++ .../lib_client/client_proto_context.ml | 2 ++ .../lib_client/client_proto_context.ml | 2 ++ .../lib_client/client_proto_context.ml | 2 ++ .../lib_client/client_proto_context.ml | 2 ++ src/proto_011_PtHangz2/lib_client/mockup.ml | 4 ++-- .../client_proto_stresstest_commands.ml | 6 +++--- .../lib_client/client_proto_context.ml | 2 ++ src/proto_012_Psithaca/lib_client/mockup.ml | 4 ++-- .../client_proto_stresstest_commands.ml | 6 +++--- .../lib_client/client_proto_context.ml | 2 ++ src/proto_013_PtJakart/lib_client/mockup.ml | 4 ++-- .../client_proto_stresstest_commands.ml | 6 +++--- src/proto_013_PtJakart/lib_injector/injector_functor.ml | 9 +-------- .../lib_client/client_proto_context.ml | 2 ++ src/proto_014_PtKathma/lib_client/mockup.ml | 4 ++-- .../client_proto_stresstest_commands.ml | 6 +++--- src/proto_014_PtKathma/lib_injector/injector_functor.ml | 9 +-------- .../lib_client/client_proto_context.ml | 2 ++ src/proto_015_PtLimaPt/lib_client/mockup.ml | 4 ++-- .../client_proto_stresstest_commands.ml | 3 ++- src/proto_015_PtLimaPt/lib_injector/injector_functor.ml | 9 +-------- 22 files changed, 45 insertions(+), 47 deletions(-) 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 fb3555dee8ba..d76dce6b621d 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml @@ -380,6 +380,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_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 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 1a9f8531274b..06314011bfd2 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml @@ -455,6 +455,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_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 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 d54ed0f295b8..6f05cb690bef 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml @@ -465,6 +465,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_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 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 b785f0923f45..6476eeb6a876 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml @@ -492,6 +492,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_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 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 83488d49040b..7b2fc4e76eca 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml @@ -536,6 +536,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_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 diff --git a/src/proto_011_PtHangz2/lib_client/mockup.ml b/src/proto_011_PtHangz2/lib_client/mockup.ml index 44df8927b420..8db7dd564d37 100644 --- a/src/proto_011_PtHangz2/lib_client/mockup.ml +++ b/src/proto_011_PtHangz2/lib_client/mockup.ml @@ -616,8 +616,8 @@ module Parsed_account = struct (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 -> + Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys.public_key pk_uri >>=? fun public_key -> let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in return Parameters. 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 c5b1f3d6eab9..c1486b1df557 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 @@ -204,9 +204,9 @@ let normalize_source cctxt = 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.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = 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 cc1f45d72205..84ea0d261318 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.ml @@ -572,6 +572,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_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 diff --git a/src/proto_012_Psithaca/lib_client/mockup.ml b/src/proto_012_Psithaca/lib_client/mockup.ml index b47dd3ded317..8737e28b35ab 100644 --- a/src/proto_012_Psithaca/lib_client/mockup.ml +++ b/src/proto_012_Psithaca/lib_client/mockup.ml @@ -706,8 +706,8 @@ module Parsed_account = struct (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 -> + Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys.public_key pk_uri >>=? fun public_key -> let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in return Parameters. 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 b6c1ac6419d5..6e084938c2c3 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 @@ -204,9 +204,9 @@ let normalize_source cctxt = 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.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = 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 8efd4e7e46bf..f52650839a73 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.ml @@ -619,6 +619,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_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 diff --git a/src/proto_013_PtJakart/lib_client/mockup.ml b/src/proto_013_PtJakart/lib_client/mockup.ml index ead4324731dd..fabc03a1a725 100644 --- a/src/proto_013_PtJakart/lib_client/mockup.ml +++ b/src/proto_013_PtJakart/lib_client/mockup.ml @@ -1031,8 +1031,8 @@ module Parsed_account = struct (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 -> + Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys.public_key pk_uri >>=? fun public_key -> let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in return Parameters. 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 4d2a53e1a80a..92623393bec4 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 @@ -241,9 +241,9 @@ let normalize_source cctxt = 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.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = diff --git a/src/proto_013_PtJakart/lib_injector/injector_functor.ml b/src/proto_013_PtJakart/lib_injector/injector_functor.ml index e5244531d41c..0f6a3f9d369b 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_functor.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_functor.ml @@ -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 = { 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 cc67c1b7e368..434912e75584 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.ml @@ -652,6 +652,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_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 diff --git a/src/proto_014_PtKathma/lib_client/mockup.ml b/src/proto_014_PtKathma/lib_client/mockup.ml index 7cb74c31fe5a..c2dbcf9eaf30 100644 --- a/src/proto_014_PtKathma/lib_client/mockup.ml +++ b/src/proto_014_PtKathma/lib_client/mockup.ml @@ -1182,8 +1182,8 @@ module Parsed_account = struct (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 -> + Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys.public_key pk_uri >>=? fun public_key -> let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in return Parameters. 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 7686a8356c23..4d0d2e713a85 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 @@ -246,9 +246,9 @@ let normalize_source cctxt = 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.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = diff --git a/src/proto_014_PtKathma/lib_injector/injector_functor.ml b/src/proto_014_PtKathma/lib_injector/injector_functor.ml index e5244531d41c..e3518487bf96 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_functor.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_functor.ml @@ -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.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { 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 f1226f563a55..0128741cbec8 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml @@ -759,6 +759,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_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 diff --git a/src/proto_015_PtLimaPt/lib_client/mockup.ml b/src/proto_015_PtLimaPt/lib_client/mockup.ml index ad1b10ea3158..4c1b93c2d77f 100644 --- a/src/proto_015_PtLimaPt/lib_client/mockup.ml +++ b/src/proto_015_PtLimaPt/lib_client/mockup.ml @@ -97,8 +97,8 @@ module Parsed_account = struct (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 -> + Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> + Client_keys.public_key pk_uri >>=? fun public_key -> let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in return Parameters. 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 3f6801a5209b..387301ce4211 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 @@ -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_015_PtLimaPt/lib_injector/injector_functor.ml b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml index b8129d3070a3..eff97a2fba4b 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml @@ -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.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { -- GitLab From 7cfa735927afa6742603d34e0e7d418737e1d8b9 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 30 Aug 2022 16:25:48 +0200 Subject: [PATCH 07/18] Client/Alpha: parse V1 keys --- src/proto_alpha/lib_client/client_proto_context.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 17b78483aaeb..deba522b9f5e 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 -- GitLab From 0860431b01a42677c5ca6b0a15b870a4926d48af Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 16 Sep 2022 22:22:14 +0200 Subject: [PATCH 08/18] Client/Alpha: compatibility with future versions --- .../lib_client_commands/client_proto_stresstest_commands.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 58e97b9d4b15..c98cd68feaa3 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 = -- GitLab From dc22b7baab69a5c6916eff5d85e17c96e2d42cf5 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 15:58:25 +0100 Subject: [PATCH 09/18] Rollups/Alpha: fixes for signature versions --- src/proto_alpha/lib_injector/injector_functor.ml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_injector/injector_functor.ml b/src/proto_alpha/lib_injector/injector_functor.ml index cd686719c0c9..1af48370900a 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 = { -- GitLab From 9ff281ad9d1ff4e216dd09a3ee7ba856370e57b6 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Thu, 9 Jun 2022 22:23:47 +0200 Subject: [PATCH 10/18] Benchmarks: versioned crypto samplers --- src/lib_benchmark/crypto_samplers.ml | 60 ++++++++++++++++++++++++++- src/lib_benchmark/crypto_samplers.mli | 43 ++++++++++++++++++- 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/src/lib_benchmark/crypto_samplers.ml b/src/lib_benchmark/crypto_samplers.ml index 13051326c24c..74dce70eef8e 100644 --- a/src/lib_benchmark/crypto_samplers.ml +++ b/src/lib_benchmark/crypto_samplers.ml @@ -45,7 +45,27 @@ module type Finite_key_pool_S = sig Base_samplers.sampler end -module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S = struct +module type Signature_S = sig + include Tezos_crypto.S.SIGNATURE + + type algo + + val algos : algo list + + val generate_key : + ?algo:algo -> + ?seed:Bytes.t -> + unit -> + Public_key_hash.t * Public_key.t * Secret_key.t +end + +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. *) @@ -74,7 +94,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 +120,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 6148a0076b89..f60fb5ed3424 100644 --- a/src/lib_benchmark/crypto_samplers.mli +++ b/src/lib_benchmark/crypto_samplers.mli @@ -57,5 +57,44 @@ module type Finite_key_pool_S = sig Base_samplers.sampler end -(** Create a finite key pool. *) -module Make_finite_key_pool (Arg : Param_S) : Finite_key_pool_S +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 + +include module type of V_latest -- GitLab From 09261719d88269d4ff0efc5cb2aecef2709e53af Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 16:06:17 +0100 Subject: [PATCH 11/18] Benchmarks: crypto sampler parameterized by signature module --- src/lib_benchmark/crypto_samplers.ml | 31 +++++++++++++-------------- src/lib_benchmark/crypto_samplers.mli | 24 ++++++++++++--------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/lib_benchmark/crypto_samplers.ml b/src/lib_benchmark/crypto_samplers.ml index 74dce70eef8e..c48149f5b83d 100644 --- a/src/lib_benchmark/crypto_samplers.ml +++ b/src/lib_benchmark/crypto_samplers.ml @@ -26,23 +26,27 @@ (* 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 Finite_key_pool_S = sig - val pk : Tezos_crypto.Signature.public_key Base_samplers.sampler +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 : Tezos_crypto.Signature.public_key_hash Base_samplers.sampler + val pkh : public_key_hash Base_samplers.sampler - val sk : Tezos_crypto.Signature.secret_key Base_samplers.sampler + val sk : secret_key Base_samplers.sampler - 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 type Signature_S = sig @@ -73,12 +77,7 @@ module Make_p_finite_key_pool 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 diff --git a/src/lib_benchmark/crypto_samplers.mli b/src/lib_benchmark/crypto_samplers.mli index f60fb5ed3424..ce0910455f5d 100644 --- a/src/lib_benchmark/crypto_samplers.mli +++ b/src/lib_benchmark/crypto_samplers.mli @@ -32,29 +32,33 @@ *) 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 -- GitLab From df95b356a4ca0d88ec433baa05ecca780061794d Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 09:00:11 +0100 Subject: [PATCH 12/18] Proto_0*: use Signature.V0 Patch obtained with: find src/proto_0* src/proto_genesis -iname "*.ml*" -exec sed -i -e s/Tezos_crypto.Signature/Tezos_crypto.Signature.V0/g {} \; make fmt-ocaml --- .../lib_client/client_proto_main.ml | 2 +- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 4 +- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 4 +- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 4 +- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 4 +- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 10 ++-- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_multisig.ml | 23 +++---- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 12 ++-- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_context_commands.ml | 4 +- .../client_proto_multisig_commands.ml | 10 ++-- .../client_proto_programs_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/managed_contract.ml | 4 +- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_programs_commands.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_programs_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_programs_commands.ml | 4 +- .../client_proto_utils_commands.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_programs_commands.ml | 4 +- .../client_proto_utils_commands.ml | 2 +- src/proto_010_PtGRANAD/lib_plugin/plugin.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_context.mli | 4 +- .../lib_client/client_proto_multisig.ml | 29 ++++----- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 14 ++--- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- src/proto_011_PtHangz2/lib_client/mockup.ml | 16 +++-- .../lib_client/operation_result.ml | 20 +++---- .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 12 ++-- .../client_proto_programs_commands.ml | 4 +- .../client_proto_stresstest_commands.ml | 56 ++++++++--------- .../client_proto_utils_commands.ml | 2 +- .../lib_client_sapling/context.ml | 6 +- .../lib_client_sapling/context.mli | 4 +- .../lib_parameters/default_parameters.ml | 6 +- .../lib_parameters/default_parameters.mli | 4 +- src/proto_011_PtHangz2/lib_plugin/plugin.ml | 26 ++++---- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_context.mli | 6 +- .../lib_client/client_proto_multisig.ml | 29 ++++----- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 12 ++-- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- src/proto_012_Psithaca/lib_client/mockup.ml | 20 ++++--- .../lib_client/operation_result.ml | 22 +++---- .../client_proto_context_commands.ml | 6 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 12 ++-- .../client_proto_programs_commands.ml | 4 +- .../client_proto_stresstest_commands.ml | 56 ++++++++--------- .../client_proto_utils_commands.ml | 5 +- .../lib_client_sapling/context.ml | 6 +- .../lib_client_sapling/context.mli | 4 +- .../lib_parameters/default_parameters.ml | 6 +- .../lib_parameters/default_parameters.mli | 4 +- src/proto_012_Psithaca/lib_plugin/plugin.ml | 55 +++++++++-------- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_context.mli | 42 ++++++------- .../lib_client/client_proto_multisig.ml | 29 ++++----- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 22 +++---- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- src/proto_013_PtJakart/lib_client/mockup.ml | 20 ++++--- .../lib_client/operation_result.ml | 22 +++---- .../client_proto_context_commands.ml | 6 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 12 ++-- .../client_proto_programs_commands.ml | 4 +- .../client_proto_stresstest_commands.ml | 60 ++++++++++--------- .../client_proto_utils_commands.ml | 5 +- .../client_sapling_commands.ml | 2 +- src/proto_013_PtJakart/lib_injector/common.ml | 4 +- .../lib_injector/common.mli | 6 +- .../lib_injector/injector_errors.ml | 7 ++- .../lib_injector/injector_errors.mli | 3 +- .../lib_injector/injector_events.ml | 12 ++-- .../lib_injector/injector_functor.ml | 10 ++-- .../lib_injector/injector_worker_types.ml | 6 +- .../lib_injector/l1_operation.ml | 2 +- .../lib_parameters/default_parameters.ml | 6 +- .../lib_parameters/default_parameters.mli | 4 +- src/proto_013_PtJakart/lib_plugin/plugin.ml | 51 ++++++++-------- .../bin_tx_rollup_client/commands.ml | 2 +- .../lib_benchmark/michelson_samplers_base.ml | 10 ++-- .../lib_benchmark/michelson_samplers_base.mli | 2 +- .../interpreter_benchmarks.ml | 18 +++--- .../interpreter_workload.ml | 12 ++-- .../lib_benchmarks_proto/ticket_benchmarks.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 12 ++-- .../lib_client/client_proto_context.mli | 46 +++++++------- .../lib_client/client_proto_multisig.ml | 29 ++++----- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 22 +++---- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- src/proto_014_PtKathma/lib_client/mockup.ml | 32 ++++++---- .../lib_client/operation_result.ml | 30 +++++----- .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 12 ++-- .../client_proto_programs_commands.ml | 4 +- .../client_proto_stresstest_commands.ml | 56 ++++++++--------- .../client_proto_utils_commands.ml | 5 +- .../client_sapling_commands.ml | 2 +- .../lib_delegate/baking_commands.ml | 2 +- .../lib_delegate/baking_highwatermarks.ml | 6 +- .../lib_delegate/baking_highwatermarks.mli | 12 ++-- .../lib_delegate/baking_nonces.ml | 4 +- .../lib_delegate/baking_state.ml | 20 ++++--- .../lib_delegate/baking_state.mli | 6 +- .../lib_delegate/baking_vdf.ml | 4 +- .../lib_delegate/block_forge.ml | 4 +- .../client_baking_denunciation.ml | 8 ++- .../lib_delegate/operation_selection.ml | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 18 +++--- .../mockup_simulator/mockup_simulator.mli | 16 ++--- .../test/tenderbrute/lib/tenderbrute.ml | 4 +- .../test/tenderbrute/lib/tenderbrute.mli | 2 +- .../test/tenderbrute/tenderbrute_main.ml | 2 +- .../lib_delegate/test/test_scenario.ml | 10 ++-- src/proto_014_PtKathma/lib_injector/common.ml | 4 +- .../lib_injector/common.mli | 6 +- .../lib_injector/injector_errors.ml | 7 ++- .../lib_injector/injector_errors.mli | 3 +- .../lib_injector/injector_events.ml | 12 ++-- .../lib_injector/injector_functor.ml | 12 ++-- .../lib_injector/injector_worker_types.ml | 6 +- .../lib_injector/l1_operation.ml | 2 +- .../lib_parameters/default_parameters.ml | 6 +- .../lib_parameters/default_parameters.mli | 6 +- src/proto_014_PtKathma/lib_plugin/RPC.ml | 34 +++++------ src/proto_014_PtKathma/lib_plugin/mempool.ml | 13 ++-- .../lib_plugin/test/generators.ml | 17 +++--- .../lib_plugin/test/test_filter_state.ml | 24 ++++---- .../lib_plugin/test/test_utils.ml | 10 ++-- .../lib_protocol/test/helpers/account.ml | 32 +++++----- .../lib_protocol/test/helpers/account.mli | 18 +++--- .../lib_protocol/test/helpers/assert.ml | 12 ++-- .../lib_protocol/test/helpers/block.ml | 22 +++---- .../lib_protocol/test/helpers/block.mli | 8 ++- .../lib_protocol/test/helpers/context.ml | 4 +- .../lib_protocol/test/helpers/context.mli | 10 ++-- .../test/helpers/contract_helpers.ml | 2 +- .../lib_protocol/test/helpers/expr_common.ml | 4 +- .../lib_protocol/test/helpers/incremental.ml | 5 +- .../test/helpers/liquidity_baking_machine.ml | 6 +- .../test/helpers/lqt_fa12_repr.ml | 2 +- .../lib_protocol/test/helpers/op.ml | 20 ++++--- .../lib_protocol/test/helpers/op.mli | 8 +-- .../test/helpers/tx_rollup_l2_helpers.ml | 2 +- .../test/integration/consensus/test_baking.ml | 11 ++-- .../consensus/test_deactivation.ml | 6 +- .../integration/consensus/test_delegation.ml | 4 +- .../consensus/test_double_baking.ml | 4 +- .../consensus/test_double_endorsement.ml | 11 ++-- .../consensus/test_double_preendorsement.ml | 4 +- .../consensus/test_participation.ml | 4 +- .../test/integration/gas/test_gas_costs.ml | 2 +- .../michelson/test_interpretation.ml | 2 +- .../michelson/test_script_typed_ir_size.ml | 6 +- .../michelson/test_ticket_balance.ml | 2 +- .../michelson/test_ticket_manager.ml | 2 +- .../integration/operations/test_activation.ml | 12 ++-- .../integration/operations/test_reveal.ml | 12 ++-- .../integration/operations/test_tx_rollup.ml | 4 +- .../test/integration/test_frozen_bonds.ml | 6 +- .../test/integration/test_token.ml | 40 ++++++------- .../validate/manager_operation_helpers.ml | 2 +- .../test/pbt/test_script_comparison.ml | 4 +- .../test/pbt/test_tx_rollup_l2_encoding.ml | 4 +- .../test/unit/test_contract_repr.ml | 4 +- .../lib_protocol/test/unit/test_receipt.ml | 2 +- .../test_sc_rollup_management_protocol.ml | 2 +- .../test/unit/test_sc_rollup_storage.ml | 10 ++-- .../test/unit/test_tx_rollup_l2.ml | 2 +- .../test/unit/test_tx_rollup_l2_apply.ml | 4 +- .../lib_tx_rollup/accuser.mli | 2 +- .../lib_tx_rollup/batcher.ml | 4 +- .../lib_tx_rollup/batcher.mli | 2 +- .../lib_tx_rollup/dispatcher.mli | 2 +- .../lib_tx_rollup/node_config.ml | 14 ++--- .../lib_tx_rollup/node_config.mli | 2 +- .../bin_tx_rollup_client/commands.ml | 2 +- .../lib_benchmark/michelson_samplers_base.ml | 10 ++-- .../lib_benchmark/michelson_samplers_base.mli | 2 +- .../interpreter_benchmarks.ml | 20 +++---- .../interpreter_workload.ml | 12 ++-- .../lib_benchmarks_proto/ticket_benchmarks.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 58 +++++++++--------- .../lib_client/client_proto_fa12.mli | 2 +- .../lib_client/client_proto_multisig.ml | 29 ++++----- .../lib_client/client_proto_multisig.mli | 4 +- .../lib_client/client_proto_programs.ml | 2 +- .../lib_client/client_proto_programs.mli | 2 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 22 +++---- .../lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 14 ++--- src/proto_015_PtLimaPt/lib_client/mockup.ml | 20 ++++--- .../lib_client/operation_result.ml | 36 +++++------ .../client_proto_context_commands.ml | 4 +- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 12 ++-- .../client_proto_programs_commands.ml | 4 +- .../client_proto_stresstest_commands.ml | 56 ++++++++--------- .../client_proto_utils_commands.ml | 4 +- .../client_sapling_commands.ml | 2 +- .../lib_delegate/baking_commands.ml | 2 +- .../lib_delegate/baking_highwatermarks.ml | 6 +- .../lib_delegate/baking_highwatermarks.mli | 12 ++-- .../lib_delegate/baking_nonces.ml | 4 +- .../lib_delegate/baking_state.ml | 26 ++++---- .../lib_delegate/baking_state.mli | 6 +- .../lib_delegate/baking_vdf.ml | 4 +- .../lib_delegate/block_forge.ml | 4 +- .../client_baking_denunciation.ml | 8 ++- .../lib_delegate/operation_selection.ml | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 18 +++--- .../mockup_simulator/mockup_simulator.mli | 16 ++--- .../test/tenderbrute/lib/tenderbrute.ml | 4 +- .../test/tenderbrute/lib/tenderbrute.mli | 2 +- .../test/tenderbrute/tenderbrute_main.ml | 2 +- .../lib_delegate/test/test_scenario.ml | 10 ++-- .../lib_injector/injector_common.ml | 4 +- .../lib_injector/injector_common.mli | 6 +- .../lib_injector/injector_errors.ml | 7 ++- .../lib_injector/injector_errors.mli | 3 +- .../lib_injector/injector_events.ml | 12 ++-- .../lib_injector/injector_functor.ml | 12 ++-- .../lib_injector/injector_worker_types.ml | 6 +- .../lib_injector/l1_operation.ml | 2 +- .../lib_parameters/default_parameters.ml | 6 +- .../lib_parameters/default_parameters.mli | 8 +-- .../lib_plugin/test/generators.ml | 12 ++-- .../lib_protocol/test/helpers/account.ml | 32 +++++----- .../lib_protocol/test/helpers/account.mli | 21 +++---- .../lib_protocol/test/helpers/assert.ml | 12 ++-- .../lib_protocol/test/helpers/block.ml | 22 +++---- .../lib_protocol/test/helpers/block.mli | 10 ++-- .../lib_protocol/test/helpers/context.ml | 10 ++-- .../lib_protocol/test/helpers/context.mli | 6 +- .../test/helpers/contract_helpers.ml | 2 +- .../test/helpers/dummy_zk_rollup.ml | 6 +- .../lib_protocol/test/helpers/expr_common.ml | 4 +- .../lib_protocol/test/helpers/incremental.ml | 4 +- .../test/helpers/liquidity_baking_machine.ml | 6 +- .../test/helpers/lqt_fa12_repr.ml | 2 +- .../lib_protocol/test/helpers/op.ml | 20 ++++--- .../lib_protocol/test/helpers/op.mli | 14 ++--- .../test/helpers/operation_generator.ml | 8 +-- .../test/helpers/tx_rollup_l2_helpers.ml | 2 +- .../test/integration/consensus/test_baking.ml | 11 ++-- .../consensus/test_deactivation.ml | 6 +- .../integration/consensus/test_delegation.ml | 4 +- .../consensus/test_double_baking.ml | 4 +- .../consensus/test_double_endorsement.ml | 11 ++-- .../consensus/test_double_preendorsement.ml | 4 +- .../consensus/test_participation.ml | 4 +- .../test/integration/gas/test_gas_costs.ml | 2 +- .../michelson/test_interpretation.ml | 2 +- .../michelson/test_script_typed_ir_size.ml | 6 +- .../michelson/test_ticket_balance.ml | 2 +- .../michelson/test_ticket_manager.ml | 2 +- .../integration/operations/test_activation.ml | 12 ++-- .../integration/operations/test_reveal.ml | 12 ++-- .../integration/operations/test_sc_rollup.ml | 6 +- .../integration/operations/test_tx_rollup.ml | 4 +- .../integration/operations/test_voting.ml | 4 +- .../test/integration/test_frozen_bonds.ml | 6 +- .../test/integration/test_token.ml | 40 ++++++------- .../validate/manager_operation_helpers.ml | 4 +- .../integration/validate/validate_helpers.ml | 8 +-- .../test/pbt/test_script_comparison.ml | 4 +- .../test/pbt/test_tx_rollup_l2_encoding.ml | 4 +- .../test/pbt/test_zk_rollup_encoding.ml | 2 +- .../test/unit/test_consensus_key.ml | 8 +-- .../test/unit/test_contract_repr.ml | 4 +- .../lib_protocol/test/unit/test_receipt.ml | 2 +- .../test_sc_rollup_management_protocol.ml | 2 +- .../test/unit/test_sc_rollup_storage.ml | 10 ++-- .../test/unit/test_tx_rollup_l2.ml | 2 +- .../test/unit/test_tx_rollup_l2_apply.ml | 4 +- .../test/unit/test_zk_rollup_storage.ml | 8 +-- .../lib_tx_rollup/accuser.mli | 2 +- .../lib_tx_rollup/batcher.ml | 4 +- .../lib_tx_rollup/batcher.mli | 2 +- .../lib_tx_rollup/dispatcher.mli | 2 +- .../lib_tx_rollup/node_config.ml | 14 ++--- .../lib_tx_rollup/node_config.mli | 2 +- .../lib_client/client_proto_main.ml | 2 +- 363 files changed, 1788 insertions(+), 1659 deletions(-) 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 f79e82fafe07..fc84185a8a19 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 diff --git a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml index 09cb02c3d4ef..afe05faed866 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_programs_commands.ml b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_programs_commands.ml index 542fe771f711..c1ecda624485 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 @@ -306,7 +306,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group diff --git a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml index 74667c650b16..237e6b7892ea 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_programs_commands.ml b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_programs_commands.ml index 47a7ff377bca..db0a76ad7300 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 @@ -354,7 +354,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group diff --git a/src/proto_003_PsddFKi3/lib_client/operation_result.ml b/src/proto_003_PsddFKi3/lib_client/operation_result.ml index a85ac41a7533..1bcf19505aa2 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_programs_commands.ml b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_programs_commands.ml index bc5068d7be21..1d752bb7c4c5 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 @@ -343,7 +343,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group diff --git a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml index a85ac41a7533..1bcf19505aa2 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_programs_commands.ml b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_programs_commands.ml index 52ad7b6e8738..6d754ce14a66 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 @@ -377,7 +377,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group diff --git a/src/proto_005_PsBabyM1/lib_client/injection.ml b/src/proto_005_PsBabyM1/lib_client/injection.ml index 53820125e3e3..7fcc73b7bc40 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 @@ -256,7 +256,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 743274890217..cddaaff61aeb 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.mli +++ b/src/proto_005_PsBabyM1/lib_client/injection.mli @@ -82,8 +82,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> ?fee:Tez.t -> ?gas_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 d13d47d2fb98..fbf52c602697 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/operation_result.ml b/src/proto_005_PsBabyM1/lib_client/operation_result.ml index 85811df298d5..cdedc77f8c1f 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_programs_commands.ml b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_programs_commands.ml index 775aca692233..fcf83920d217 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 @@ -440,7 +440,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 fc492598ad75..1d1246af41ab 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_args.ml @@ -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 eb2dce1cd4c3..56351bd7588b 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 d76dce6b621d..6bea3589a6ee 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml @@ -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,11 +371,11 @@ 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) 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 20e130fa5779..28013b4f34f9 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 ff80be2dcc7b..e0c1bdb50925 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli @@ -85,7 +85,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -109,7 +109,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 53820125e3e3..7fcc73b7bc40 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 @@ -256,7 +256,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 743274890217..cddaaff61aeb 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.mli +++ b/src/proto_006_PsCARTHA/lib_client/injection.mli @@ -82,8 +82,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> ?fee:Tez.t -> ?gas_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 98e198c78648..4adca59f1230 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/operation_result.ml b/src/proto_006_PsCARTHA/lib_client/operation_result.ml index ba40e717f8ce..6edf2fc4ab3e 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 ae33de83a659..ca008e2a86a3 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 @@ -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 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 b4bf5a4503d7..39fd8b5dcfdb 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 @@ -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 = @@ -384,7 +384,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -413,7 +413,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -438,7 +438,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -474,7 +474,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." 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 775aca692233..fcf83920d217 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 @@ -440,7 +440,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 a2c681933d6e..5f0d0c58684f 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_args.ml @@ -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 4a6b0ac4e824..435a4578cdf6 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/managed_contract.ml b/src/proto_007_PsDELPH1/lib_client/managed_contract.ml index dcabb8ecffa7..eb072f91b0e9 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 38f3973b8f4c..e55afc20088a 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_programs_commands.ml b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_programs_commands.ml index 3cfbb87ccaaf..ae65e7fb6be7 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 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 b5c0b6b81850..3b4e2ab41192 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_args.ml @@ -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 0710270a2851..ea3c91d65cf7 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 06314011bfd2..e37d5fe9e5ec 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml @@ -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,11 +446,11 @@ 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) diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.ml b/src/proto_008_PtEdo2Zk/lib_client/injection.ml index eabb0c8c9b98..965eaaec1f1d 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 @@ -298,7 +298,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 a90879d8db87..bd9ba0a588f9 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.mli @@ -131,8 +131,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.ml index 8d43b2e20867..1fc69930e869 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/operation_result.ml b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml index 8c68db9d29a0..aa3387c18cbc 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 88a88173999b..fcbf113a0162 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 @@ -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 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 f0aff0b960dc..7bac0013719d 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 @@ -152,7 +152,7 @@ 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 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 60fa9c450033..818f3bf55025 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 @@ -616,7 +616,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 9ea0c27b9240..f3f1f7b82b7d 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_args.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_args.ml @@ -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 0710270a2851..ea3c91d65cf7 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 6f05cb690bef..6636081310f3 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml @@ -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,11 +456,11 @@ 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) 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 5f98e3c92286..77b458425657 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 fef6f26ad2df..b7e6085256cf 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 @@ -259,7 +259,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 8ced153432db..269ee5d8bab6 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.mli +++ b/src/proto_009_PsFLoren/lib_client/injection.mli @@ -93,8 +93,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 67057a96c7df..e3766988d1a1 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/operation_result.ml b/src/proto_009_PsFLoren/lib_client/operation_result.ml index 44adaa93f969..53793a462690 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 7ce830c60224..9474612742dc 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 @@ -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 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 9f6f65741853..9c4f4f5b8fce 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 @@ -152,7 +152,7 @@ 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 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 4d302ba4f83d..37385a43517d 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 @@ -633,7 +633,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 9cb7b75ca765..dcc7a2da10cc 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 @@ -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 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 3f4b1b84576d..6945d83e7ed1 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_args.ml @@ -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 0710270a2851..ea3c91d65cf7 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 6476eeb6a876..f44ee950feeb 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml @@ -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,11 +483,11 @@ 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) 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 5f98e3c92286..77b458425657 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 40a7e67137da..76ef7fe0d0db 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 @@ -265,7 +265,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 8ced153432db..269ee5d8bab6 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.mli +++ b/src/proto_010_PtGRANAD/lib_client/injection.mli @@ -93,8 +93,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 ebd1099a4197..08ff4d07ab24 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/operation_result.ml b/src/proto_010_PtGRANAD/lib_client/operation_result.ml index 0c3d78bd22f9..d523d820b06d 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 33a19d20aba4..572805951932 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 @@ -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 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 83ba1bd3e607..20318a5dec15 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 @@ -146,7 +146,7 @@ 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 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 387618cbb9fa..3b8327eafdf8 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 @@ -633,7 +633,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 9cb7b75ca765..dcc7a2da10cc 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 @@ -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 diff --git a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml index 66e18b5dfa8e..8156bd8acae5 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 9fac18b4bdd3..a1b2a260eb7a 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_args.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_args.ml @@ -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 a50d6d7664e7..14a33dff197b 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 7b2fc4e76eca..4ae64c6bbf93 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml @@ -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,11 +527,11 @@ 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) 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 1a25d50c68f1..f43d397e1bda 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli @@ -60,8 +60,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> 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 0c667664248a..a81da970aa49 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 5a9d0ca664ff..61bc87cfbd5a 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli @@ -112,7 +112,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -138,7 +138,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 5f98e3c92286..77b458425657 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 c88ead280643..e8ae5cf12b00 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 @@ -265,7 +265,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 9c93d9f174fa..94851798b9ac 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.mli +++ b/src/proto_011_PtHangz2/lib_client/injection.mli @@ -94,8 +94,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 99809742245f..2b1dee90be72 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/mockup.ml b/src/proto_011_PtHangz2/lib_client/mockup.ml index 8db7dd564d37..fb5741874e30 100644 --- a/src/proto_011_PtHangz2/lib_client/mockup.ml +++ b/src/proto_011_PtHangz2/lib_client/mockup.ml @@ -618,7 +618,9 @@ module Parsed_account = struct let to_bootstrap_account repr = Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + 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} @@ -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 c741e72d07e5..a12e60c070fb 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 3d54d6e767d2..dfc334cf0a85 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 @@ -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 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 cd19030b504c..925806ad561d 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,7 +120,7 @@ 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 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 c8ac0b0e4f59..041664a0f4c6 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 @@ -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 @@ -478,7 +478,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -508,7 +508,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -537,7 +537,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -562,7 +562,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -598,7 +598,7 @@ let commands () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." 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 fb0ee4a5ce17..9c8a9a77f35a 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 @@ -655,7 +655,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 c1486b1df557..6056c07d0ae2 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,14 +199,14 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check + Tezos_crypto.Signature.V0.Secret_key.of_b58check (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function | Error _ -> None - | Ok sk -> Tezos_crypto.Signature.Of_V_latest.secret_key sk) + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = @@ -235,7 +235,7 @@ 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 @@ -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 9cb7b75ca765..dcc7a2da10cc 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 @@ -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 diff --git a/src/proto_011_PtHangz2/lib_client_sapling/context.ml b/src/proto_011_PtHangz2/lib_client_sapling/context.ml index 56d4f76d4921..3c0a05ff830d 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 1b3fd9c3e0f1..152ff122cd40 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_parameters/default_parameters.ml b/src/proto_011_PtHangz2/lib_parameters/default_parameters.ml index 39666be7fbeb..28abde3796ee 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 b4b31838cdc2..f12dcc7a49c9 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 62761d238360..2aff412d886f 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 869ea564290b..02e2394728c2 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_args.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_args.ml @@ -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 92467e9a060f..cae4467fc1dd 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 84ea0d261318..e06ed01ce480 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.ml @@ -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,11 +563,11 @@ 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) 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 74a28b56f5e5..bf07e948774f 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.mli @@ -60,8 +60,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -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 : 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 b5ffcea2b111..17bb493cf1d6 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 5a9d0ca664ff..61bc87cfbd5a 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli @@ -112,7 +112,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -138,7 +138,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 5f98e3c92286..77b458425657 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 6dd4ac16ee21..303154c8e372 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 @@ -268,7 +268,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 9c93d9f174fa..94851798b9ac 100644 --- a/src/proto_012_Psithaca/lib_client/injection.mli +++ b/src/proto_012_Psithaca/lib_client/injection.mli @@ -94,8 +94,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 99809742245f..2b1dee90be72 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/mockup.ml b/src/proto_012_Psithaca/lib_client/mockup.ml index 8737e28b35ab..243f41c0e09a 100644 --- a/src/proto_012_Psithaca/lib_client/mockup.ml +++ b/src/proto_012_Psithaca/lib_client/mockup.ml @@ -708,7 +708,9 @@ module Parsed_account = struct let to_bootstrap_account repr = Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + 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} @@ -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 ce6a9664edba..287e33a26296 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 055f9ec80035..c280e7109a73 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 @@ -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 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 b49050a23b18..441ee6e5540b 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,7 +120,7 @@ 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 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 a607ab4401bd..1c80269a2139 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 @@ -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 @@ -351,7 +351,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -381,7 +381,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -410,7 +410,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -435,7 +435,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -471,7 +471,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." 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 320a467c8bfc..df925f38d370 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 @@ -658,7 +658,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 6e084938c2c3..62c5f313801e 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,14 +199,14 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check + Tezos_crypto.Signature.V0.Secret_key.of_b58check (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function | Error _ -> None - | Ok sk -> Tezos_crypto.Signature.Of_V_latest.secret_key sk) + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = @@ -235,7 +235,7 @@ 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 @@ -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 cd8c924cfff6..511bf14c5523 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 @@ -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 @@ -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/context.ml b/src/proto_012_Psithaca/lib_client_sapling/context.ml index 56d4f76d4921..3c0a05ff830d 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 1b3fd9c3e0f1..152ff122cd40 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_parameters/default_parameters.ml b/src/proto_012_Psithaca/lib_parameters/default_parameters.ml index 4b3e6185bf50..ef1f9e4787ee 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 3bc1b8edff70..d4cd8df54921 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 ee6833a317da..486e104b4fe3 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 eeb6e2cc739e..3beb8c44acfb 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_args.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_args.ml @@ -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 463d9f2a4f41..8834918aa8ec 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 f52650839a73..31439e51c765 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.ml @@ -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,11 +610,11 @@ 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) 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 fe22473d14d1..e5c4bb2c8d2e 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.mli @@ -60,8 +60,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -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 : @@ -432,8 +432,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> @@ -456,8 +456,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> @@ -481,8 +481,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -509,8 +509,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -534,8 +534,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -558,8 +558,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -592,8 +592,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -616,8 +616,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -645,8 +645,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> 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 f6db6b82d6dc..268dabfc214b 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 609d0c37e66f..26341ec16153 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli @@ -112,7 +112,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -138,7 +138,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 5f98e3c92286..77b458425657 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 42f0090655d7..83a674cc4714 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 @@ -267,7 +267,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 15ce22884d6d..e4b03f739e2c 100644 --- a/src/proto_013_PtJakart/lib_client/injection.mli +++ b/src/proto_013_PtJakart/lib_client/injection.mli @@ -108,8 +108,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 22a347315236..5d3b881d454f 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/mockup.ml b/src/proto_013_PtJakart/lib_client/mockup.ml index fabc03a1a725..1032a418bb2a 100644 --- a/src/proto_013_PtJakart/lib_client/mockup.ml +++ b/src/proto_013_PtJakart/lib_client/mockup.ml @@ -1033,7 +1033,9 @@ module Parsed_account = struct let to_bootstrap_account repr = Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + 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} @@ -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 79c3e8ddd4e6..1f9e41f10903 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 eb61382be7ac..56c7a1e22fcb 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 @@ -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 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 b49050a23b18..441ee6e5540b 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,7 +120,7 @@ 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 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 ac73d803e088..2c7f2d31ff09 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 @@ -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 @@ -355,7 +355,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -385,7 +385,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -414,7 +414,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -439,7 +439,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -475,7 +475,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." 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 bec4370d9ac3..bf526a69b2b1 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 @@ -668,7 +668,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 92623393bec4..cf12288f08cd 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,14 +236,14 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check + Tezos_crypto.Signature.V0.Secret_key.of_b58check (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function | Error _ -> None - | Ok sk -> Tezos_crypto.Signature.Of_V_latest.secret_key sk) + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = @@ -272,7 +272,7 @@ 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 @@ -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_utils_commands.ml b/src/proto_013_PtJakart/lib_client_commands/client_proto_utils_commands.ml index cd8c924cfff6..511bf14c5523 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 @@ -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 @@ -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 761cb6cb4f1b..66bee8dfc491 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 @@ -70,7 +70,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_injector/common.ml b/src/proto_013_PtJakart/lib_injector/common.ml index 3612ecfafb28..e0dd9125729b 100644 --- a/src/proto_013_PtJakart/lib_injector/common.ml +++ b/src/proto_013_PtJakart/lib_injector/common.ml @@ -27,8 +27,8 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } diff --git a/src/proto_013_PtJakart/lib_injector/common.mli b/src/proto_013_PtJakart/lib_injector/common.mli index bff16a3f72e1..095d43560fba 100644 --- a/src/proto_013_PtJakart/lib_injector/common.mli +++ b/src/proto_013_PtJakart/lib_injector/common.mli @@ -28,8 +28,8 @@ 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; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } @@ -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 e638807b5154..b0e69ff4f6da 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 ac6a07279657..4676461a00af 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 7fbfdd1fd99b..7789fe3352a6 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 0f6a3f9d369b..2741b594237d 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_functor.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_functor.ml @@ -509,7 +509,7 @@ module Make (Rollup : PARAMETERS) = struct let* signature = Client_keys.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -917,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) -> @@ -932,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 2f0afaeb7f17..3633c6397c61 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 d3de083f1525..920e15484c42 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 8698a322b85a..d60794b19fea 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 3bc1b8edff70..d4cd8df54921 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 3cc674bbcd37..886bea1d5f55 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 585463b9b0ad..4691595891d3 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) 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 3f8f301fd1ab..847b8406a4a3 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 18a150245cfc..b29fb1868ba0 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_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml index 8eae1aac90f6..6a7b887e857e 100644 --- a/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_014_PtKathma/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -2255,14 +2255,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 +2281,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 +2291,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 +2991,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 08e5aefa47a0..6e03d5fc37dd 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/ticket_benchmarks.ml b/src/proto_014_PtKathma/lib_benchmarks_proto/ticket_benchmarks.ml index 71f39d3be7b0..405d918c27ed 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 e60eac54177c..e055df686d92 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_args.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_args.ml @@ -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 c6c07437ea69..a8140d2b736f 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 434912e75584..bd235bccbf86 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.ml @@ -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,11 +643,11 @@ 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) 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 e8af7739e8fd..4d3c620436fc 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.mli @@ -60,8 +60,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -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 : @@ -456,8 +456,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> @@ -480,8 +480,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> @@ -505,8 +505,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -533,8 +533,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -558,8 +558,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -582,8 +582,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -616,8 +616,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -640,8 +640,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -669,8 +669,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> @@ -831,8 +831,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> 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 7a671305c788..eda34eba7679 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 5650cc2355ea..01911b4e78a0 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli @@ -112,7 +112,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -139,7 +139,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 5f98e3c92286..77b458425657 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 cd9ee168b503..c1c5c0e4235c 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 @@ -259,7 +259,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 e510735766bb..ab9ba6a003d4 100644 --- a/src/proto_014_PtKathma/lib_client/injection.mli +++ b/src/proto_014_PtKathma/lib_client/injection.mli @@ -106,8 +106,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 d413248efc90..04d07c2b9279 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/mockup.ml b/src/proto_014_PtKathma/lib_client/mockup.ml index c2dbcf9eaf30..c4ead8b612a9 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))) @@ -1184,7 +1186,9 @@ module Parsed_account = struct let to_bootstrap_account repr = Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. { @@ -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 c8a665e3e46e..394f9e9a3411 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 075d0ae660ca..c5c05d4a50ee 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 @@ -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 @@ -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 () -> 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 a239d399e750..7f966829fc3e 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,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) = match caller with 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 f89f934b5d07..3e9ab2650bbf 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 @@ -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) @@ -325,7 +325,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a lambda for a generic multisig contract." @@ -355,7 +355,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate change for a multisig contract." @@ -384,7 +384,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Sign a delegate withdraw for a multisig contract." @@ -406,7 +406,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc: @@ -442,7 +442,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () >>=? fun prepared_command -> Client_keys.sign cctxt sk prepared_command.bytes >>=? fun signature -> - return @@ Format.printf "%a@." Tezos_crypto.Signature.pp signature); + return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group ~desc:"Transfer tokens using a multisig contract." 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 48a2bae7a7f7..a6404a8b3070 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 @@ -665,7 +665,7 @@ let commands () = @@ prefixes ["for"] @@ Client_keys.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 + cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command ~group 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 4d0d2e713a85..2f18a0ef4124 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,14 +64,14 @@ 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 : Tezos_crypto.Signature.V0.secret_key; sk_uri : Client_keys.sk_uri; } @@ -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,14 +241,14 @@ let parse_strategy s = let normalize_source cctxt = let sk_of_sk_uri sk_uri = match - Tezos_crypto.Signature.Secret_key.of_b58check + Tezos_crypto.Signature.V0.Secret_key.of_b58check (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri >|= function | Error _ -> None - | Ok sk -> Tezos_crypto.Signature.Of_V_latest.secret_key sk) + | Ok sk -> Tezos_crypto.Signature.V0.Of_V_latest.secret_key sk) in let key_from_alias alias = let warning msg alias = @@ -277,7 +277,7 @@ 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 @@ -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; @@ -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 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 -> @@ -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_utils_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_utils_commands.ml index cd8c924cfff6..511bf14c5523 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 @@ -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 @@ -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 4c8cbdab0c9f..2ce0baff8629 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 @@ -71,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_014_PtKathma/lib_delegate/baking_commands.ml b/src/proto_014_PtKathma/lib_delegate/baking_commands.ml index e07e48e8fca6..d3dde1e3f1b1 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; diff --git a/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml b/src/proto_014_PtKathma/lib_delegate/baking_highwatermarks.ml index 4af172f183fe..c0d9e41a200a 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 30d4d6f4ea3e..59138855ba64 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 a3b0bf620a2a..768fe48414c3 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml @@ -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 65e7d5a5cc88..1fd620e43ee3 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.ml @@ -31,8 +31,8 @@ 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; + 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.sk_uri; } @@ -56,8 +56,10 @@ let delegate_encoding = }) (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 ef7db2844dd1..acaaee934141 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.mli +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.mli @@ -28,8 +28,8 @@ open Alpha_context type delegate = { alias : string option; - public_key : Tezos_crypto.Signature.public_key; - public_key_hash : Tezos_crypto.Signature.public_key_hash; + public_key : Tezos_crypto.Signature.V0.public_key; + public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; secret_key_uri : Client_keys.sk_uri; } @@ -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 6dc6d5e9abb1..23f95c9075e6 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 dcd4e7228e82..3301fe0c8743 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 784a4f38989f..719e3621f7d6 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 eec3576100de..34b1851b8690 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 2e739c50fc34..e4af7254d362 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 @@ -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; @@ -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 a541c900fe5b..125c64ea1d76 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 54054d23b97e..20258621dfc2 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 @@ -105,7 +105,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 c13cc23edb60..ccfdad3bf387 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 123db4e59248..c6b659b6eeae 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 f10b60904c24..381962fee1a5 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 3612ecfafb28..e0dd9125729b 100644 --- a/src/proto_014_PtKathma/lib_injector/common.ml +++ b/src/proto_014_PtKathma/lib_injector/common.ml @@ -27,8 +27,8 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } diff --git a/src/proto_014_PtKathma/lib_injector/common.mli b/src/proto_014_PtKathma/lib_injector/common.mli index bff16a3f72e1..095d43560fba 100644 --- a/src/proto_014_PtKathma/lib_injector/common.mli +++ b/src/proto_014_PtKathma/lib_injector/common.mli @@ -28,8 +28,8 @@ 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; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } @@ -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 e638807b5154..b0e69ff4f6da 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 ac6a07279657..4676461a00af 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 7fbfdd1fd99b..7789fe3352a6 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 e3518487bf96..2741b594237d 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_functor.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_functor.ml @@ -509,7 +509,7 @@ module Make (Rollup : PARAMETERS) = struct let* signature = Client_keys.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -619,7 +619,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = Tezos_crypto.Signature.zero in + let signature = Tezos_crypto.Signature.V0.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { @@ -917,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) -> @@ -932,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 2f0afaeb7f17..3633c6397c61 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 6d9776258e79..a023725ebd35 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 501895e461a1..6a473850a0c6 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 64b33d4af4ce..90bacb2bd091 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 ef87cdc10770..408b715712e4 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 8ea7180db2ee..ec8fd1093b1b 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 61a08b89bfc9..54628a715c15 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 fa065244efa8..18946bd42fbd 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 d7e5811126dc..55626ab0233b 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 f3e5a608dec0..eccfb5b0a4a4 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 645b55cbbaef..e644072ac796 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 049698c05301..04c7458fc021 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 81686aa03301..e578e23d76c3 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 72b1971d7a26..aa605a62f209 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 0a6cfc766eca..113400f3aa99 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 052552cec055..66a83d729070 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 bb9badbd08c5..fe4e2b0e53ba 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 e6444892c600..02802931c5bf 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 f8ebb0031198..a02afde0e2f6 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 06b649b3744b..75e8953b1b02 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 168bbb43dac6..25511a68258b 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 19e222b0fb30..fe8e88be35da 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 6ffbb9f33c77..4ddc321009a1 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 264b2507fedf..21c4e09e912b 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 63b287f3d84b..70ca0bd482ca 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 3750866824ba..17e12f6bc724 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 b7816b92dc6d..c3a78d3112f0 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 257db7b4a190..01e0e9ab514b 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 2a7de51129f4..f45b86b26aa6 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 b7a4f0087a03..b6660af8aa4c 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 93c4b456c302..1ed5f12418a7 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 9cd6b83539f3..d271cfb3add9 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 06d13b7b9814..227a28812c75 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 b204e70a2322..dad93309675f 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 @@ -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 7a50c5383e8b..ce58de9a2b0c 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 27c70e08a217..a708d6e82165 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 913c679007b3..54dd7002a2f3 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 40ef088ef31f..5d6104ef00aa 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 b848fe414f1f..22307c7e137f 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 1a66ef0c7bbe..cf42e022ecf1 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 e9b9966a4c43..e66cd6692b97 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 0e15bf9ec8f9..36e180c7384d 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 dd8c348f7942..08ae159b0842 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 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 56c0ba7dc365..6c5fc38166df 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 9a758c030b67..d60870eaed66 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 bb2d82de5302..dcc2cd95f7c9 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 d87843d0888f..0c6636ae2fdb 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 f532dd1b3224..123864885dac 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 a2368b23c186..abb579eb887b 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 dc16a0e7e123..9bcb4dd05cc2 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 d37405227453..708084471840 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 e3e6d0786461..35f152099d46 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 6a287c15683f..4a72ad02ee8e 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 e143b73b8ceb..8237e9efdc01 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 80c54b6d5647..575fe3a78f08 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 31a006cc418c..1f3747c13292 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 ad80ad0d1c83..3317f80c4b79 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) 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 3f8f301fd1ab..847b8406a4a3 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 18a150245cfc..b29fb1868ba0 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_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml index fa296e227b09..dd574bbd9b34 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -2325,14 +2325,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 +2351,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 +2361,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 +3075,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 01a1a59eea37..032f8fb857bc 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/ticket_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml index 5934b358431a..57f93ff31797 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 4715eb2330e9..4aa9443e29a8 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml @@ -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 568adb1a3855..39946abf4a06 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 0128741cbec8..4369e1f5dd7a 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml @@ -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,11 +750,11 @@ 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) 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 9e2c022e82de..294e256b7918 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli @@ -81,8 +81,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -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} @@ -171,10 +171,10 @@ val update_consensus_key : ?verbose_signing:bool -> ?simulation:bool -> ?fee:Tez.tez -> - consensus_pk:Tezos_crypto.Signature.public_key -> + consensus_pk:Tezos_crypto.Signature.V0.public_key -> manager_sk:Client_keys.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 : @@ -186,9 +186,9 @@ val drain_delegate : ?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_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 @@ -234,7 +234,7 @@ val increase_paid_storage : 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 -> @@ -572,8 +572,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> @@ -596,8 +596,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> @@ -621,8 +621,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -649,8 +649,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -674,8 +674,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -698,8 +698,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -732,8 +732,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> @@ -756,8 +756,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> @@ -785,8 +785,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> @@ -944,8 +944,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.public_key_hash -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> 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 cbfa0e1be8ac..8577a364ef46 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_fa12.mli @@ -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 7a671305c788..eda34eba7679 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 5650cc2355ea..01911b4e78a0 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.mli @@ -112,7 +112,7 @@ val call_multisig : src_sk:Client_keys.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 -> @@ -139,7 +139,7 @@ val call_multisig_on_bytes : src_sk:Client_keys.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 3f944c498f9f..b23aab87d0c3 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 8e5c87d2ef5e..a577a713a678 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 5f98e3c92286..77b458425657 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml @@ -42,7 +42,7 @@ let sign_message (cctxt : #full) ~src_sk ~block ~message = >>= fun () -> Client_keys.sign cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation src_sk bytes @@ -53,7 +53,7 @@ let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature else cctxt#message "checked content: @[%a@]" Data_encoding.Json.pp json) >>= fun () -> Client_keys.check - ~watermark:Tezos_crypto.Signature.Generic_operation + ~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 e222f1745aff..e11dde808f3e 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.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 -> @@ -36,5 +36,5 @@ val check_message : key_locator:Client_keys.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 6189bf830f4c..5b83a3c1c38b 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 @@ -259,7 +259,7 @@ let preapply (type t) (cctxt : #Protocol_client_context.full) ~chain ~block {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 e510735766bb..ab9ba6a003d4 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.mli +++ b/src/proto_015_PtLimaPt/lib_client/injection.mli @@ -106,8 +106,8 @@ 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 -> + source:Tezos_crypto.Signature.V0.Public_key_hash.t -> + src_pk:Tezos_crypto.Signature.V0.public_key -> src_sk:Client_keys.sk_uri -> fee:Tez.t Limit.t -> gas_limit:Gas.Arith.integral 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 3edbaae33415..ea85493a30de 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/mockup.ml b/src/proto_015_PtLimaPt/lib_client/mockup.ml index 4c1b93c2d77f..f09b19979c05 100644 --- a/src/proto_015_PtLimaPt/lib_client/mockup.ml +++ b/src/proto_015_PtLimaPt/lib_client/mockup.ml @@ -99,7 +99,9 @@ module Parsed_account = struct let to_bootstrap_account repr = Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key_hash = + Tezos_crypto.Signature.V0.Public_key.hash public_key + in return Parameters. { @@ -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 6941577071d5..aa12c1b8024f 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 043591e74abd..d713241c68c9 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 @@ -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 @@ -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 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 bac3b401d30d..c503db6bc242 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 @@ -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 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 50f395d6eb77..0fc7954c0cab 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 @@ -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) @@ -336,7 +336,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () in let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -370,7 +370,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () in let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -402,7 +402,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () in let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -427,7 +427,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () in let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group @@ -467,7 +467,7 @@ let commands_rw () : #Protocol_client_context.full Tezos_clic.command list = () in let* signature = Client_keys.sign cctxt sk prepared_command.bytes in - Format.printf "%a@." Tezos_crypto.Signature.pp signature ; + Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command ~group 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 df0b2eec95f3..ec6ca092f014 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 @@ -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 @@ -736,7 +736,7 @@ let commands () = let open Lwt_result_syntax in let* signature = Client_keys.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 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 387301ce4211..60fc308ae64a 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,14 +64,14 @@ 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 : Tezos_crypto.Signature.V0.secret_key; sk_uri : Client_keys.sk_uri; } @@ -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,14 +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 + Tezos_crypto.Signature.V0.Secret_key.of_b58check (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> let+ r = Tezos_signer_backends.Encrypted.decrypt cctxt sk_uri in let sk = Option.of_result r in - Option.bind sk Tezos_crypto.Signature.Of_V_latest.secret_key + Option.bind sk Tezos_crypto.Signature.V0.Of_V_latest.secret_key in let key_from_alias alias = let warning msg alias = @@ -285,7 +285,7 @@ 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 @@ -301,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 @@ -366,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 ; @@ -462,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 @@ -509,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 @@ -566,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 @@ -575,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 = @@ -611,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 @@ -637,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 @@ -1201,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 @@ -1234,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; @@ -1519,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 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 @@ -1539,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 -> @@ -1824,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 @@ -1891,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*! () = @@ -1900,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_utils_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_utils_commands.ml index 837defaed600..06f01947475d 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 @@ -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 @@ -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 6b61dc936cff..4346a31d7b03 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 @@ -72,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_015_PtLimaPt/lib_delegate/baking_commands.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml index 9d76b8745fff..c39db83d761a 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; diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_highwatermarks.ml index 4af172f183fe..c0d9e41a200a 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 30d4d6f4ea3e..59138855ba64 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 3acc87f16377..ef2ac5de1b37 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml @@ -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 2902469662c7..4ff0d10946cb 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml @@ -31,8 +31,8 @@ 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; + 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.sk_uri; } @@ -56,8 +56,10 @@ let consensus_key_encoding = }) (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 3936193bb346..61d7653b1a04 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli @@ -28,8 +28,8 @@ 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; + public_key : Tezos_crypto.Signature.V0.public_key; + public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; secret_key_uri : Client_keys.sk_uri; } @@ -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 6dc6d5e9abb1..23f95c9075e6 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 dcd4e7228e82..3301fe0c8743 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 21b58428d339..45a81bf1421b 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 acbe2bbcf5de..4ce38666a3a0 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 e6cad8f09673..a32e0799db4a 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 @@ -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; @@ -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 42a13cae3af4..2c6652a1ec2e 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 fdc0a6dc5abb..9cb9461bda97 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 @@ -107,7 +107,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 c13cc23edb60..ccfdad3bf387 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 123db4e59248..c6b659b6eeae 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 f10b60904c24..381962fee1a5 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 b6177f871e7a..35341100d2ca 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml @@ -27,8 +27,8 @@ open Protocol_client_context type signer = { alias : string; - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli index 6519834b301f..9f4a4f586a32 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli @@ -28,8 +28,8 @@ 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; + pkh : Tezos_crypto.Signature.V0.public_key_hash; + pk : Tezos_crypto.Signature.V0.public_key; sk : Client_keys.sk_uri; } @@ -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 b2e5b98bebc3..1eedc371c572 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 1c39b4ffc53a..64d90a50f0e4 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 520fce71ea2f..4f897439cce8 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 eff97a2fba4b..a907ef377b66 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml @@ -543,7 +543,7 @@ module Make (Rollup : PARAMETERS) = struct let* signature = Client_keys.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Tezos_crypto.Signature.V0.Generic_operation state.signer.sk unsigned_op_bytes in @@ -657,7 +657,7 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = Tezos_crypto.Signature.zero in + let signature = Tezos_crypto.Signature.V0.zero in let branch = Tezos_crypto.Block_hash.zero in let operation = { @@ -956,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) -> @@ -971,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 7f86e158a775..102fe5188ce7 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 aa0ae008f78f..89143ca57ecf 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 fd5a927f3a4a..abe96c84f5ef 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 f930bc38fd87..a15acce83270 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 64ef40d9afe3..1ec770d1a613 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 17f6fe9696a2..1ed09fc079e1 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 4cb885e6d277..4f6d0373f7e8 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 02d5f8c7d0c0..f96f148c9616 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 4c54c10a347c..ccb3d64f6c9e 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 d272a1538baf..ace3a64907ce 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 1f7ae6753b44..ec12b5ee131b 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 04930bd2ed66..7e24aa16026b 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 f7d6c63dab2a..46449066c26d 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 4e1eafefa0dc..dc083ab9cce8 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 e6444892c600..02802931c5bf 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 65dbd4073c72..1d7ecf55267b 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 723f26ae43c0..5f9799b4590b 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 168bbb43dac6..25511a68258b 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 fac515505e1f..d16ef42873da 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 d96033bfbcba..79268ce12bd4 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 7e59308338f7..de1f90105310 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 22acc5dfcb67..b8b174bbfe49 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 3e58da9b774a..94cc6cbdeae3 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 a8fa7b8e547b..17254e6158f8 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 d244716cc9aa..c032c40e1ce7 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 0bd2f536a376..54b91e324963 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 cbb03ebeb28a..fe6b64532d72 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 1f10336eb2b8..367d7638c59c 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 93c4b456c302..1ed5f12418a7 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 9fe85ead49c5..cd02a5e5402c 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 f852060242d4..c71e5845e8a0 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 aa4d3bb45afa..a1057282f94b 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 @@ -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 aedf33233b86..871426ec08a4 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 c2b972eed982..55872c994176 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 9580be0be296..e3e1c1de743a 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 ad764995f8fa..01e80285464b 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 dd03b4d1f8e0..7fc6ef508ec0 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 640a74bf1bd5..dcfd3149f7e5 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 fa1038f416fb..1562c0e65575 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 aca5cf883269..1ccd4bb94fbc 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 f828639aae7d..3ac42bda8082 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 e447e5bb1143..014aaaf799c1 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 3ad0af08a87c..375fdcc75665 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 06c47e5e5ac8..04fc1aee5d08 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 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 440ffd952908..7bcdf0c5487d 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 9d55fd7125bb..25848466eb97 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 7e7800af4004..41b0a376f857 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 9a758c030b67..d60870eaed66 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 245ae17b0a54..bb41400a8ba2 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 66c69757f1e4..90058068a1ee 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 0a3889d6c408..3c414d957337 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 a2368b23c186..abb579eb887b 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 767190f5ba0e..c5c000e6de9b 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 dfff16df2926..59476f6b9acd 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 23e56026d7d4..6f20280e03de 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 e3e6d0786461..35f152099d46 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 6a287c15683f..4a72ad02ee8e 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 e143b73b8ceb..8237e9efdc01 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 80c54b6d5647..575fe3a78f08 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 31a006cc418c..1f3747c13292 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_genesis/lib_client/client_proto_main.ml b/src/proto_genesis/lib_client/client_proto_main.ml index d6a9e9685a83..5875ec678693 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 -- GitLab From a9250056b265734ead131d96fa78059f167fc451 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 09:39:06 +0100 Subject: [PATCH 13/18] Proto_0*: use Client_keys.V0 Patch obtained with find src/proto_0* src/proto_genesis -iname "*.ml*" -exec sed -i -e s/Client_keys/Client_keys_v0/g {} \; make fmt-ocaml --- .../lib_client/client_proto_main.ml | 6 +- .../lib_client/client_proto_main.mli | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_context.ml | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 14 +- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- .../client_proto_context_commands.ml | 26 ++-- .../client_proto_multisig_commands.ml | 50 ++++--- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 2 +- .../lib_client/client_proto_contracts.ml | 14 +- .../client_proto_context_commands.ml | 2 +- .../client_proto_programs_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 14 +- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- .../client_proto_context_commands.ml | 34 ++--- .../client_proto_fa12_commands.ml | 4 +- .../client_proto_programs_commands.ml | 8 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 14 +- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- .../client_proto_context_commands.ml | 34 ++--- .../client_proto_fa12_commands.ml | 4 +- .../client_proto_programs_commands.ml | 8 +- .../client_proto_utils_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 14 +- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- .../client_proto_context_commands.ml | 34 ++--- .../client_proto_fa12_commands.ml | 4 +- .../client_proto_programs_commands.ml | 8 +- .../client_proto_utils_commands.ml | 4 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 16 +-- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- src/proto_011_PtHangz2/lib_client/mockup.ml | 10 +- .../client_proto_context_commands.ml | 36 ++--- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 56 ++++---- .../client_proto_programs_commands.ml | 8 +- .../client_proto_stresstest_commands.ml | 6 +- .../client_proto_utils_commands.ml | 4 +- .../client_sapling_commands.ml | 5 +- .../lib_client_sapling/wallet.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 18 +-- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- src/proto_012_Psithaca/lib_client/mockup.ml | 10 +- .../client_proto_context_commands.ml | 40 +++--- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 56 ++++---- .../client_proto_programs_commands.ml | 8 +- .../client_proto_stresstest_commands.ml | 6 +- .../client_proto_utils_commands.ml | 10 +- .../client_sapling_commands.ml | 5 +- .../lib_client_sapling/wallet.ml | 2 +- .../lib_delegate/delegate_events.ml | 8 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 46 +++---- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- src/proto_013_PtJakart/lib_client/mockup.ml | 10 +- .../client_proto_context_commands.ml | 62 ++++----- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 56 ++++---- .../client_proto_programs_commands.ml | 8 +- .../client_proto_stresstest_commands.ml | 6 +- .../client_proto_stresstest_contracts.ml | 2 +- .../client_proto_utils_commands.ml | 10 +- .../client_sapling_commands.ml | 5 +- .../lib_client_sapling/wallet.ml | 2 +- .../lib_delegate/delegate_events.ml | 8 +- src/proto_013_PtJakart/lib_injector/common.ml | 4 +- .../lib_injector/common.mli | 2 +- .../lib_injector/injector_functor.ml | 2 +- .../bin_tx_rollup_client/commands.ml | 20 +-- .../main_tx_rollup_client_014_PtKathma.ml | 2 +- .../main_tx_rollup_node_014_PtKathma.ml | 12 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 54 ++++---- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- src/proto_014_PtKathma/lib_client/mockup.ml | 10 +- .../client_proto_context_commands.ml | 70 +++++----- .../client_proto_fa12_commands.ml | 2 +- .../client_proto_multisig_commands.ml | 56 ++++---- .../client_proto_programs_commands.ml | 8 +- .../client_proto_stresstest_commands.ml | 16 +-- .../client_proto_stresstest_contracts.ml | 2 +- .../client_proto_utils_commands.ml | 10 +- .../client_sapling_commands.ml | 5 +- .../lib_client_sapling/wallet.ml | 2 +- .../lib_delegate/baking_actions.ml | 6 +- .../lib_delegate/baking_commands.ml | 6 +- .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_state.ml | 4 +- .../lib_delegate/baking_state.mli | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../test/tenderbrute/lib/tenderbrute.ml | 3 +- src/proto_014_PtKathma/lib_injector/common.ml | 4 +- .../lib_injector/common.mli | 2 +- .../lib_injector/injector_functor.ml | 2 +- .../bin_tx_rollup_client/commands.ml | 20 +-- .../main_tx_rollup_client_015_PtLimaPt.ml | 2 +- .../main_tx_rollup_node_015_PtLimaPt.ml | 12 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_context.ml | 6 +- .../lib_client/client_proto_context.mli | 62 ++++----- .../lib_client/client_proto_contracts.ml | 14 +- .../lib_client/client_proto_fa12.mli | 4 +- .../lib_client/client_proto_multisig.mli | 6 +- .../lib_client/client_proto_utils.ml | 4 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 2 +- .../lib_client/injection.mli | 6 +- .../lib_client/managed_contract.mli | 4 +- src/proto_015_PtLimaPt/lib_client/mockup.ml | 10 +- .../client_proto_context_commands.ml | 124 +++++++++--------- .../client_proto_fa12_commands.ml | 4 +- .../client_proto_multisig_commands.ml | 54 ++++---- .../client_proto_programs_commands.ml | 10 +- .../client_proto_stresstest_commands.ml | 16 +-- .../client_proto_stresstest_contracts.ml | 2 +- .../client_proto_utils_commands.ml | 10 +- .../client_sapling_commands.ml | 5 +- .../lib_client_sapling/wallet.ml | 2 +- .../lib_delegate/baking_actions.ml | 6 +- .../lib_delegate/baking_commands.ml | 6 +- .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_state.ml | 4 +- .../lib_delegate/baking_state.mli | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../test/tenderbrute/lib/tenderbrute.ml | 3 +- .../lib_injector/injector_common.ml | 4 +- .../lib_injector/injector_common.mli | 2 +- .../lib_injector/injector_functor.ml | 2 +- .../lib_client/client_proto_main.ml | 6 +- .../lib_client/client_proto_main.mli | 2 +- 220 files changed, 1100 insertions(+), 1025 deletions(-) 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 fc84185a8a19..f919ddc635ae 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml +++ b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml @@ -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 902704cb1064..d2a08cabec07 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 f11409f17b65..975db40813c8 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 e980e8d7cb99..9c7b21cd42cf 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 ed13d42a31d7..682c8d83f0c6 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_commands/client_proto_context_commands.ml b/src/proto_001_PtCJ7pwo/lib_client_commands/client_proto_context_commands.ml index 8a4762f1c775..5193a638f7ca 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 c1ecda624485..71f0ac521b72 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 @@ -303,9 +303,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 bd01313f5598..41581ac0d854 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 910080f48297..e751b37023ae 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 ed13d42a31d7..682c8d83f0c6 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_commands/client_proto_context_commands.ml b/src/proto_002_PsYLVpVv/lib_client_commands/client_proto_context_commands.ml index 8072548a515f..3d30e237fb6e 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 db0a76ad7300..6cc8b85a27f9 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 @@ -351,9 +351,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 3708813784a1..6d62e5b5dafc 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 dbdb8260bd18..604e83f44383 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 ed13d42a31d7..682c8d83f0c6 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_commands/client_proto_context_commands.ml b/src/proto_003_PsddFKi3/lib_client_commands/client_proto_context_commands.ml index 29d12e45609c..81393dd717c2 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 1d752bb7c4c5..4819e9386796 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 @@ -340,9 +340,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 a22995c83333..dbacb43060eb 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 85d929df8040..73fd63e7fb3b 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 e94bf67bc112..e7b43241555a 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_commands/client_proto_context_commands.ml b/src/proto_004_Pt24m4xi/lib_client_commands/client_proto_context_commands.ml index 29d12e45609c..81393dd717c2 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 6d754ce14a66..7cffe49be780 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 @@ -374,9 +374,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 1811f0814377..70a862de2a5c 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 edcc1f0d886d..b6ba7b9fe5fd 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 7fcc73b7bc40..9a773c603ca2 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.ml +++ b/src/proto_005_PsBabyM1/lib_client/injection.ml @@ -249,7 +249,7 @@ 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 = diff --git a/src/proto_005_PsBabyM1/lib_client/injection.mli b/src/proto_005_PsBabyM1/lib_client/injection.mli index cddaaff61aeb..73cb9d7b4e72 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 -> @@ -84,7 +84,7 @@ val inject_manager_operation : ?verbose_signing:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_005_PsBabyM1/lib_client/managed_contract.mli index 4752d3da8213..665ebf89f30d 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_commands/client_proto_context_commands.ml b/src/proto_005_PsBabyM1/lib_client_commands/client_proto_context_commands.ml index 023df86945cc..443f6f27b3fa 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 fcf83920d217..549d0002afbc 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 @@ -437,9 +437,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 1d1246af41ab..fc16fd006666 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." 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 6bea3589a6ee..2f45b33b519c 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 @@ -387,7 +387,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -401,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 32ce52d9c698..1b18732eac64 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 edcc1f0d886d..b6ba7b9fe5fd 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.mli b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.mli index e0c1bdb50925..31147781f2bf 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,7 +82,7 @@ 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.V0.t list -> @@ -106,7 +106,7 @@ 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.V0.t list -> diff --git a/src/proto_006_PsCARTHA/lib_client/injection.ml b/src/proto_006_PsCARTHA/lib_client/injection.ml index 7fcc73b7bc40..9a773c603ca2 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.ml +++ b/src/proto_006_PsCARTHA/lib_client/injection.ml @@ -249,7 +249,7 @@ 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 = diff --git a/src/proto_006_PsCARTHA/lib_client/injection.mli b/src/proto_006_PsCARTHA/lib_client/injection.mli index cddaaff61aeb..73cb9d7b4e72 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 -> @@ -84,7 +84,7 @@ val inject_manager_operation : ?verbose_signing:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_006_PsCARTHA/lib_client/managed_contract.mli index 4752d3da8213..665ebf89f30d 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_commands/client_proto_context_commands.ml b/src/proto_006_PsCARTHA/lib_client_commands/client_proto_context_commands.ml index ca008e2a86a3..1bee6defcd5e 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 -> @@ -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 39fd8b5dcfdb..5f75d64e8b2f 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 \ @@ -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,7 +384,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +414,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -437,7 +440,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +477,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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 fcf83920d217..549d0002afbc 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 @@ -437,9 +437,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 5f0d0c58684f..99609ee75208 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." 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 2122688a9a87..fe730a5950f3 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 5d05ed46df88..53f132bcae04 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_commands/client_proto_context_commands.ml b/src/proto_007_PsDELPH1/lib_client_commands/client_proto_context_commands.ml index abe19f89fd3b..beb4c7a2461b 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 ae65e7fb6be7..0fe9bb484693 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 @@ -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 3b4e2ab41192..8a633615c8c5 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." 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 e37d5fe9e5ec..37b6d9c4913a 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 @@ -462,7 +462,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -476,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 ceaa531aa598..9563d5498817 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 5d05ed46df88..53f132bcae04 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 c712af89a2dd..2b7ebe21055c 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 965eaaec1f1d..15bd3a52a821 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.ml @@ -291,7 +291,7 @@ 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 = diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.mli b/src/proto_008_PtEdo2Zk/lib_client/injection.mli index bd9ba0a588f9..70f5dc785fbc 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 -> @@ -133,7 +133,7 @@ val inject_manager_operation : ?simulation:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_008_PtEdo2Zk/lib_client/managed_contract.mli index 411faba27475..9e6076fdb192 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_commands/client_proto_context_commands.ml b/src/proto_008_PtEdo2Zk/lib_client_commands/client_proto_context_commands.ml index fcbf113a0162..81f3851ec0f2 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 @@ -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 7bac0013719d..6d30c11cd93b 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 @@ -159,7 +159,7 @@ let get_contract_caller_keys cctxt caller = | 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 818f3bf55025..8273edbfe849 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 @@ -613,9 +613,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 f3f1f7b82b7d..7ca86b823c1c 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." 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 6636081310f3..5b3e70e8593c 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 @@ -472,7 +472,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -486,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 e9f5701d078a..c0119412a5e9 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 5c3552ee8ff0..e3f711103540 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 c712af89a2dd..2b7ebe21055c 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 77b458425657..7495f6a00449 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_009_PsFLoren/lib_client/injection.ml b/src/proto_009_PsFLoren/lib_client/injection.ml index b7e6085256cf..71e263a0c28b 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.ml +++ b/src/proto_009_PsFLoren/lib_client/injection.ml @@ -252,7 +252,7 @@ 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 = diff --git a/src/proto_009_PsFLoren/lib_client/injection.mli b/src/proto_009_PsFLoren/lib_client/injection.mli index 269ee5d8bab6..721a0cec81bb 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 -> @@ -95,7 +95,7 @@ val inject_manager_operation : ?simulation:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_009_PsFLoren/lib_client/managed_contract.mli index ae532c986987..3ae3789e5de7 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_commands/client_proto_context_commands.ml b/src/proto_009_PsFLoren/lib_client_commands/client_proto_context_commands.ml index 9474612742dc..99d65369a1f3 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 @@ -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 9c4f4f5b8fce..426e2fca38c8 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 @@ -159,7 +159,7 @@ let get_contract_caller_keys cctxt caller = | 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 37385a43517d..c2a43f20cac1 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 @@ -630,9 +630,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 dcc7a2da10cc..9a07c6cbe8a7 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) @@ -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 6945d83e7ed1..cf424164afa4 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." 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 f44ee950feeb..d0c9373f6491 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 @@ -499,7 +499,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -513,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 86cddd6cab2c..eb5f6b84f688 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 4c5b1b62fcc0..d5e731034c10 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 c712af89a2dd..2b7ebe21055c 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 77b458425657..7495f6a00449 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_010_PtGRANAD/lib_client/injection.ml b/src/proto_010_PtGRANAD/lib_client/injection.ml index 76ef7fe0d0db..1acf3ac2cee5 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.ml +++ b/src/proto_010_PtGRANAD/lib_client/injection.ml @@ -258,7 +258,7 @@ 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 = diff --git a/src/proto_010_PtGRANAD/lib_client/injection.mli b/src/proto_010_PtGRANAD/lib_client/injection.mli index 269ee5d8bab6..721a0cec81bb 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 -> @@ -95,7 +95,7 @@ val inject_manager_operation : ?simulation:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_010_PtGRANAD/lib_client/managed_contract.mli index ae532c986987..3ae3789e5de7 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_commands/client_proto_context_commands.ml b/src/proto_010_PtGRANAD/lib_client_commands/client_proto_context_commands.ml index 572805951932..73e71ce22ba8 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 @@ -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 20318a5dec15..0be1e98751b7 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 @@ -153,7 +153,7 @@ let get_contract_caller_keys cctxt caller = | 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 3b8327eafdf8..b58089951a3e 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 @@ -630,9 +630,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 dcc7a2da10cc..9a07c6cbe8a7 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) @@ -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/client_proto_args.ml b/src/proto_011_PtHangz2/lib_client/client_proto_args.ml index a1b2a260eb7a..d998aa6f9fed 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." 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 4ae64c6bbf93..27b93db0aaa6 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 @@ -543,7 +543,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -557,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 f43d397e1bda..d69f8508bae7 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli @@ -62,7 +62,7 @@ val register_global_constant : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 4c5b1b62fcc0..d5e731034c10 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 c712af89a2dd..2b7ebe21055c 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.mli b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.mli index 61bc87cfbd5a..5b5217eb52e3 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,7 +109,7 @@ 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.V0.t list -> @@ -135,7 +135,7 @@ 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.V0.t list -> 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 77b458425657..7495f6a00449 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_011_PtHangz2/lib_client/injection.ml b/src/proto_011_PtHangz2/lib_client/injection.ml index e8ae5cf12b00..a908d99be6b7 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.ml +++ b/src/proto_011_PtHangz2/lib_client/injection.ml @@ -258,7 +258,7 @@ 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 = diff --git a/src/proto_011_PtHangz2/lib_client/injection.mli b/src/proto_011_PtHangz2/lib_client/injection.mli index 94851798b9ac..c2d4543ad3f1 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 -> @@ -96,7 +96,7 @@ val inject_manager_operation : ?force:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_011_PtHangz2/lib_client/managed_contract.mli index bb467b5482e8..4d44330fdcac 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 fb5741874e30..4f50d6bf9295 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,12 +612,12 @@ 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 = - Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Client_keys.public_key pk_uri >>=? fun public_key -> + 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 @@ -631,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 -> ( 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 dfc334cf0a85..1d391b6ea0e0 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 @@ -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 925806ad561d..7730f3581325 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 @@ -127,7 +127,7 @@ let get_contract_caller_keys cctxt caller = | 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 041664a0f4c6..016d67a17767 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 \ @@ -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,7 +478,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -507,7 +509,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +539,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -561,7 +565,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +602,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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 9c8a9a77f35a..bf097d068e5e 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 @@ -652,9 +652,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 6056c07d0ae2..f3f792dcd88d 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 @@ -200,7 +200,7 @@ let normalize_source cctxt = let sk_of_sk_uri sk_uri = match Tezos_crypto.Signature.V0.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( @@ -212,7 +212,7 @@ let normalize_source cctxt = 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 @@ -238,7 +238,7 @@ let normalize_source cctxt = 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 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 dcc7a2da10cc..9a07c6cbe8a7 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) @@ -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 176cea283c2d..83d70508ebab 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/wallet.ml b/src/proto_011_PtHangz2/lib_client_sapling/wallet.ml index 00eb130e8704..ca45a2863589 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_012_Psithaca/lib_client/client_proto_args.ml b/src/proto_012_Psithaca/lib_client/client_proto_args.ml index 02e2394728c2..a747f22e8bb3 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." 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 e06ed01ce480..3521d905700b 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 @@ -579,7 +579,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -593,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 bf07e948774f..9a7f82db020c 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.mli @@ -62,7 +62,7 @@ val register_global_constant : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -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 cfd1006bd2a1..0a96cc79775d 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 8022bd2d7986..dbeba43c7878 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.mli b/src/proto_012_Psithaca/lib_client/client_proto_multisig.mli index 61bc87cfbd5a..5b5217eb52e3 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,7 +109,7 @@ 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.V0.t list -> @@ -135,7 +135,7 @@ 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.V0.t list -> 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 77b458425657..7495f6a00449 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_012_Psithaca/lib_client/injection.ml b/src/proto_012_Psithaca/lib_client/injection.ml index 303154c8e372..bb6ecffd90e8 100644 --- a/src/proto_012_Psithaca/lib_client/injection.ml +++ b/src/proto_012_Psithaca/lib_client/injection.ml @@ -261,7 +261,7 @@ 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 = diff --git a/src/proto_012_Psithaca/lib_client/injection.mli b/src/proto_012_Psithaca/lib_client/injection.mli index 94851798b9ac..c2d4543ad3f1 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 -> @@ -96,7 +96,7 @@ val inject_manager_operation : ?force:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_012_Psithaca/lib_client/managed_contract.mli index bb467b5482e8..4d44330fdcac 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 243f41c0e09a..aa36f7fcf0e8 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,12 +702,12 @@ 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 = - Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Client_keys.public_key pk_uri >>=? fun public_key -> + 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 @@ -721,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 -> ( 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 c280e7109a73..2035e0217ef0 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 @@ -1854,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 @@ -1947,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 @@ -2011,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 441ee6e5540b..043565b65f0d 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 @@ -127,7 +127,7 @@ let get_contract_caller_keys cctxt caller = | 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 1c80269a2139..d03ce7e8fb56 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 \ @@ -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,7 +351,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -380,7 +382,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +412,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -434,7 +438,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +475,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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 df925f38d370..aae3b5b23d8e 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 @@ -655,9 +655,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 62c5f313801e..5ac220ef5728 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 @@ -200,7 +200,7 @@ let normalize_source cctxt = let sk_of_sk_uri sk_uri = match Tezos_crypto.Signature.V0.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( @@ -212,7 +212,7 @@ let normalize_source cctxt = 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 @@ -238,7 +238,7 @@ let normalize_source cctxt = 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 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 511bf14c5523..d4a22b0e8ea9 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) @@ -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 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 176cea283c2d..83d70508ebab 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/wallet.ml b/src/proto_012_Psithaca/lib_client_sapling/wallet.ml index 412619eec4b8..74be47fede07 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 80aaebac4174..011f0e04eee1 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_013_PtJakart/lib_client/client_proto_args.ml b/src/proto_013_PtJakart/lib_client/client_proto_args.ml index 3beb8c44acfb..cde3d18f0432 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." 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 31439e51c765..3f8c2eb0741d 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 @@ -626,7 +626,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -640,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 e5c4bb2c8d2e..5f86e0f29fd0 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.mli @@ -62,7 +62,7 @@ val register_global_constant : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -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 -> @@ -434,7 +434,7 @@ val originate_tx_rollup : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.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 @@ -458,7 +458,7 @@ val submit_tx_rollup_batch : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -483,7 +483,7 @@ val submit_tx_rollup_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 -> @@ -511,7 +511,7 @@ val submit_tx_rollup_finalize_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -536,7 +536,7 @@ val submit_tx_rollup_remove_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -560,7 +560,7 @@ val submit_tx_rollup_rejection : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -594,7 +594,7 @@ val submit_tx_rollup_return_bond : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -618,7 +618,7 @@ val tx_rollup_dispatch_tickets : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -647,7 +647,7 @@ val transfer_ticket : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 cfd1006bd2a1..0a96cc79775d 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 8022bd2d7986..dbeba43c7878 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.mli b/src/proto_013_PtJakart/lib_client/client_proto_multisig.mli index 26341ec16153..cc27aae9630f 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,7 +109,7 @@ 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.V0.t list -> @@ -135,7 +135,7 @@ 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.V0.t list -> 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 77b458425657..7495f6a00449 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_013_PtJakart/lib_client/injection.ml b/src/proto_013_PtJakart/lib_client/injection.ml index 83a674cc4714..ae3b812b3e49 100644 --- a/src/proto_013_PtJakart/lib_client/injection.ml +++ b/src/proto_013_PtJakart/lib_client/injection.ml @@ -260,7 +260,7 @@ 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 = diff --git a/src/proto_013_PtJakart/lib_client/injection.mli b/src/proto_013_PtJakart/lib_client/injection.mli index e4b03f739e2c..0aee0eef507f 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 -> @@ -110,7 +110,7 @@ val inject_manager_operation : ?force:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_013_PtJakart/lib_client/managed_contract.mli index cc40c9caa8ff..c6c1af587ef7 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 1032a418bb2a..fc7086309623 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,12 +1027,12 @@ 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 = - Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Client_keys.public_key pk_uri >>=? fun public_key -> + 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 @@ -1046,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 -> ( 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 56c7a1e22fcb..029cc38069d7 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 @@ -1988,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 @@ -2081,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 @@ -2145,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 @@ -2207,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; @@ -2310,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; @@ -2405,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; @@ -2480,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; @@ -2550,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; @@ -2621,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; @@ -2749,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; @@ -2867,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; @@ -2970,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; @@ -3056,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; @@ -3151,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 441ee6e5540b..043565b65f0d 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 @@ -127,7 +127,7 @@ let get_contract_caller_keys cctxt caller = | 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 2c7f2d31ff09..b7426789cdb7 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 \ @@ -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,7 +355,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -384,7 +386,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +416,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -438,7 +442,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +479,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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 bf526a69b2b1..699025255b86 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 @@ -665,9 +665,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 cf12288f08cd..ddbb4a024c97 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 @@ -237,7 +237,7 @@ let normalize_source cctxt = let sk_of_sk_uri sk_uri = match Tezos_crypto.Signature.V0.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( @@ -249,7 +249,7 @@ let normalize_source cctxt = 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 @@ -275,7 +275,7 @@ let normalize_source cctxt = 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 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 c75e9118d7c2..421a2bd12b7d 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 511bf14c5523..d4a22b0e8ea9 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) @@ -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 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 66bee8dfc491..a2be98a4ddbe 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 diff --git a/src/proto_013_PtJakart/lib_client_sapling/wallet.ml b/src/proto_013_PtJakart/lib_client_sapling/wallet.ml index 412619eec4b8..74be47fede07 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 912bad034cf0..274e77d9c8f6 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 e0dd9125729b..69c4376cd88d 100644 --- a/src/proto_013_PtJakart/lib_injector/common.ml +++ b/src/proto_013_PtJakart/lib_injector/common.ml @@ -29,12 +29,12 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + 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 095d43560fba..6e9cbff0c20d 100644 --- a/src/proto_013_PtJakart/lib_injector/common.mli +++ b/src/proto_013_PtJakart/lib_injector/common.mli @@ -30,7 +30,7 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) diff --git a/src/proto_013_PtJakart/lib_injector/injector_functor.ml b/src/proto_013_PtJakart/lib_injector/injector_functor.ml index 2741b594237d..dbb2eb77887a 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_functor.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_functor.ml @@ -507,7 +507,7 @@ 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.V0.Generic_operation state.signer.sk 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 4691595891d3..7c7bfe4a2dc7 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml @@ -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 bd688f020a2b..ebdf07b28fd2 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 4d6d99a785fe..d091375c6f77 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_client/client_proto_args.ml b/src/proto_014_PtKathma/lib_client/client_proto_args.ml index e055df686d92..e4d4fbf4183e 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." 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 bd235bccbf86..2435305cc820 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 @@ -659,7 +659,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -673,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 4d3c620436fc..ce1afbf2f687 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.mli @@ -62,7 +62,7 @@ val register_global_constant : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -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 -> @@ -458,7 +458,7 @@ val originate_tx_rollup : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.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 @@ -482,7 +482,7 @@ val submit_tx_rollup_batch : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -507,7 +507,7 @@ val submit_tx_rollup_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 -> @@ -535,7 +535,7 @@ val submit_tx_rollup_finalize_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -560,7 +560,7 @@ val submit_tx_rollup_remove_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -584,7 +584,7 @@ val submit_tx_rollup_rejection : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -618,7 +618,7 @@ val submit_tx_rollup_return_bond : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -642,7 +642,7 @@ val tx_rollup_dispatch_tickets : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -671,7 +671,7 @@ val transfer_ticket : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 @@ -833,7 +833,7 @@ val sc_rollup_recover_bond : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 55ac47e920fc..1ec7e0d93008 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 76800482921c..08a2cef8d74f 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.mli b/src/proto_014_PtKathma/lib_client/client_proto_multisig.mli index 01911b4e78a0..1eb71be4ddf0 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,7 +109,7 @@ 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.V0.t list -> @@ -136,7 +136,7 @@ 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.V0.t list -> 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 77b458425657..7495f6a00449 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_014_PtKathma/lib_client/injection.ml b/src/proto_014_PtKathma/lib_client/injection.ml index c1c5c0e4235c..575fa92eed8c 100644 --- a/src/proto_014_PtKathma/lib_client/injection.ml +++ b/src/proto_014_PtKathma/lib_client/injection.ml @@ -252,7 +252,7 @@ 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 = diff --git a/src/proto_014_PtKathma/lib_client/injection.mli b/src/proto_014_PtKathma/lib_client/injection.mli index ab9ba6a003d4..1ab767fb6bf2 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 -> @@ -108,7 +108,7 @@ val inject_manager_operation : ?force:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_014_PtKathma/lib_client/managed_contract.mli index e02cf3fa7aab..dda67bdbe348 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 c4ead8b612a9..82ee7b04c5fe 100644 --- a/src/proto_014_PtKathma/lib_client/mockup.ml +++ b/src/proto_014_PtKathma/lib_client/mockup.ml @@ -1160,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 @@ -1180,12 +1180,12 @@ 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 = - Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Client_keys.public_key pk_uri >>=? fun public_key -> + 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 @@ -1204,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 -> ( 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 c5c05d4a50ee..ad454af4ccbf 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 @@ -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 @@ -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 7f966829fc3e..5f4c6ad72696 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 @@ -117,7 +117,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 -> - 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 3e9ab2650bbf..72a301368561 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 \ @@ -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,7 +325,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -354,7 +356,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +386,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -405,7 +409,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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,7 +446,8 @@ 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 -> + Client_keys_v0.sign cctxt sk prepared_command.bytes + >>=? fun signature -> return @@ Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature); command ~group @@ -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 a6404a8b3070..3ec4884f9e17 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 @@ -662,9 +662,9 @@ 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 -> + Client_keys_v0.sign cctxt sk bytes >>=? fun signature -> cctxt#message "Signature: %a" Tezos_crypto.Signature.V0.pp signature >>= fun () -> return_unit); command @@ -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 2f18a0ef4124..4b2bce49ed42 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 @@ -70,9 +70,9 @@ type source = { type source_with_uri = { pkh : public_key_hash; pk : public_key; - pk_uri : Client_keys.pk_uri; + pk_uri : Client_keys_v0.pk_uri; sk : Tezos_crypto.Signature.V0.secret_key; - sk_uri : Client_keys.sk_uri; + sk_uri : Client_keys_v0.sk_uri; } type input_source = @@ -242,7 +242,7 @@ let normalize_source cctxt = let sk_of_sk_uri sk_uri = match Tezos_crypto.Signature.V0.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> ( @@ -254,7 +254,7 @@ let normalize_source cctxt = 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 @@ -280,7 +280,7 @@ let normalize_source cctxt = 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 @@ -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. *) @@ -1435,7 +1435,7 @@ let load_wallet cctxt ~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 @@ -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 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 59076da0f11b..046615615597 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 511bf14c5523..d4a22b0e8ea9 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) @@ -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 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 2ce0baff8629..a3350a3cf189 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 diff --git a/src/proto_014_PtKathma/lib_client_sapling/wallet.ml b/src/proto_014_PtKathma/lib_client_sapling/wallet.ml index ab43f45d3889..e9403f19b761 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 58d91acbc7ba..6575167f0b5e 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 d3dde1e3f1b1..916b277cf05c 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_commands.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_commands.ml @@ -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_nonces.ml b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml index 768fe48414c3..7fa8d6ba1af9 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 -> ( diff --git a/src/proto_014_PtKathma/lib_delegate/baking_state.ml b/src/proto_014_PtKathma/lib_delegate/baking_state.ml index 1fd620e43ee3..c61c4d4ba6bb 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.ml @@ -33,7 +33,7 @@ type delegate = { alias : string option; 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.sk_uri; + secret_key_uri : Client_keys_v0.sk_uri; } let delegate_encoding = @@ -50,7 +50,7 @@ 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); }) diff --git a/src/proto_014_PtKathma/lib_delegate/baking_state.mli b/src/proto_014_PtKathma/lib_delegate/baking_state.mli index acaaee934141..86a673e0d0c6 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_state.mli +++ b/src/proto_014_PtKathma/lib_delegate/baking_state.mli @@ -30,7 +30,7 @@ type delegate = { alias : string option; public_key : Tezos_crypto.Signature.V0.public_key; public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; - secret_key_uri : Client_keys.sk_uri; + secret_key_uri : Client_keys_v0.sk_uri; } val delegate_encoding : delegate Data_encoding.t 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 e4af7254d362..4d346224f60b 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) @@ -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 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 20258621dfc2..c95313d796dc 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 @@ -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 = diff --git a/src/proto_014_PtKathma/lib_injector/common.ml b/src/proto_014_PtKathma/lib_injector/common.ml index e0dd9125729b..69c4376cd88d 100644 --- a/src/proto_014_PtKathma/lib_injector/common.ml +++ b/src/proto_014_PtKathma/lib_injector/common.ml @@ -29,12 +29,12 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + 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 095d43560fba..6e9cbff0c20d 100644 --- a/src/proto_014_PtKathma/lib_injector/common.mli +++ b/src/proto_014_PtKathma/lib_injector/common.mli @@ -30,7 +30,7 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) diff --git a/src/proto_014_PtKathma/lib_injector/injector_functor.ml b/src/proto_014_PtKathma/lib_injector/injector_functor.ml index 2741b594237d..dbb2eb77887a 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_functor.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_functor.ml @@ -507,7 +507,7 @@ 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.V0.Generic_operation state.signer.sk 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 3317f80c4b79..1456382e394b 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml @@ -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 bd688f020a2b..ebdf07b28fd2 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 4d6d99a785fe..d091375c6f77 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_client/client_proto_args.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml index 4aa9443e29a8..2d13cc8e3ca5 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." 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 4369e1f5dd7a..5f3ddb053db5 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 @@ -766,7 +766,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run 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 @@ -780,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 294e256b7918..37b0b362034f 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli @@ -83,7 +83,7 @@ val register_global_constant : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> unit -> @@ -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 @@ -172,7 +172,7 @@ val update_consensus_key : ?simulation:bool -> ?fee:Tez.tez -> consensus_pk:Tezos_crypto.Signature.V0.public_key -> - manager_sk:Client_keys.sk_uri -> + manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> Tezos_crypto.Signature.V0.public_key -> Kind.update_consensus_key Kind.manager Injection.result tzresult Lwt.t @@ -185,7 +185,7 @@ val drain_delegate : ?dry_run:bool -> ?verbose_signing:bool -> ?simulation:bool -> - consensus_sk:Client_keys.sk_uri -> + 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 -> @@ -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,7 +227,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 -> @@ -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 -> @@ -574,7 +574,7 @@ val originate_tx_rollup : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.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 @@ -598,7 +598,7 @@ val submit_tx_rollup_batch : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> content:string -> tx_rollup:Tx_rollup.t -> @@ -623,7 +623,7 @@ val submit_tx_rollup_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 -> @@ -651,7 +651,7 @@ val submit_tx_rollup_finalize_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -676,7 +676,7 @@ val submit_tx_rollup_remove_commitment : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -700,7 +700,7 @@ val submit_tx_rollup_rejection : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> tx_rollup:Tx_rollup.t -> @@ -734,7 +734,7 @@ val submit_tx_rollup_return_bond : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> @@ -758,7 +758,7 @@ val tx_rollup_dispatch_tickets : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> context_hash:Tezos_crypto.Context_hash.t -> @@ -787,7 +787,7 @@ val transfer_ticket : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 @@ -946,7 +946,7 @@ val sc_rollup_recover_bond : ?counter:Z.t -> source:Tezos_crypto.Signature.V0.public_key_hash -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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 55ac47e920fc..1ec7e0d93008 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 8577a364ef46..de7fbd67e894 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 -> 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 01911b4e78a0..1eb71be4ddf0 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,7 +109,7 @@ 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.V0.t list -> @@ -136,7 +136,7 @@ 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.V0.t list -> 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 77b458425657..7495f6a00449 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.ml @@ -40,7 +40,7 @@ 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.V0.Generic_operation src_sk @@ -52,7 +52,7 @@ 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 + Client_keys_v0.check ~watermark:Tezos_crypto.Signature.V0.Generic_operation key_locator signature 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 e11dde808f3e..7393491c2dac 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli @@ -25,7 +25,7 @@ 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.V0.t tzresult Lwt.t @@ -33,7 +33,7 @@ val sign_message : 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.V0.t -> diff --git a/src/proto_015_PtLimaPt/lib_client/injection.ml b/src/proto_015_PtLimaPt/lib_client/injection.ml index 5b83a3c1c38b..6d6f8e519526 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.ml +++ b/src/proto_015_PtLimaPt/lib_client/injection.ml @@ -252,7 +252,7 @@ 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 = diff --git a/src/proto_015_PtLimaPt/lib_client/injection.mli b/src/proto_015_PtLimaPt/lib_client/injection.mli index ab9ba6a003d4..1ab767fb6bf2 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 -> @@ -108,7 +108,7 @@ val inject_manager_operation : ?force:bool -> source:Tezos_crypto.Signature.V0.Public_key_hash.t -> src_pk:Tezos_crypto.Signature.V0.public_key -> - src_sk:Client_keys.sk_uri -> + 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.mli b/src/proto_015_PtLimaPt/lib_client/managed_contract.mli index e0cc3d291769..c342e39982eb 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 f09b19979c05..c1a05a03d092 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,12 +93,12 @@ 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 = - Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> - Client_keys.public_key pk_uri >>=? fun public_key -> + 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 @@ -118,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 -> ( 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 d713241c68c9..208eba2140d4 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 @@ -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 @@ -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 c503db6bc242..42e9a04e991c 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" () @@ -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 0fc7954c0cab..57e899e78fc9 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 \ @@ -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,7 +335,9 @@ 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 + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command @@ -369,7 +371,9 @@ 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 + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command @@ -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,7 +405,9 @@ 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 + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command @@ -426,7 +432,9 @@ 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 + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command @@ -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,7 +474,9 @@ 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 + let* signature = + Client_keys_v0.sign cctxt sk prepared_command.bytes + in Format.printf "%a@." Tezos_crypto.Signature.V0.pp signature ; return_unit); command @@ -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 ec6ca092f014..d7cdf1bfac17 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" () @@ -731,10 +731,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 -> 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.V0.pp signature in @@ -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 60fc308ae64a..30b70b3765bd 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 @@ -70,9 +70,9 @@ type source = { type source_with_uri = { pkh : public_key_hash; pk : public_key; - pk_uri : Client_keys.pk_uri; + pk_uri : Client_keys_v0.pk_uri; sk : Tezos_crypto.Signature.V0.secret_key; - sk_uri : Client_keys.sk_uri; + sk_uri : Client_keys_v0.sk_uri; } type input_source = @@ -243,7 +243,7 @@ let normalize_source cctxt = let sk_of_sk_uri sk_uri = match Tezos_crypto.Signature.V0.Secret_key.of_b58check - (Uri.path (sk_uri : Client_keys.sk_uri :> Uri.t)) + (Uri.path (sk_uri : Client_keys_v0.sk_uri :> Uri.t)) with | Ok sk -> Lwt.return_some sk | Error _ -> @@ -257,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 @@ -290,7 +290,7 @@ let normalize_source cctxt = 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) -> ( @@ -1504,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. *) @@ -1522,7 +1522,7 @@ let load_wallet cctxt ~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 @@ -1815,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 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 8d67a8cc13ac..b36856565e74 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 06f01947475d..0fb6d824fdc6 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) @@ -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 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 4346a31d7b03..30f0628da78f 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 diff --git a/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml b/src/proto_015_PtLimaPt/lib_client_sapling/wallet.ml index ab43f45d3889..e9403f19b761 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 b8a6e51d07a3..d0c11618a285 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 c39db83d761a..788eae2ea480 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_commands.ml @@ -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_nonces.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml index ef2ac5de1b37..6ec9597c9ff9 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 -> ( diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml index 4ff0d10946cb..387055676d98 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml @@ -33,7 +33,7 @@ type consensus_key = { alias : string option; 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.sk_uri; + secret_key_uri : Client_keys_v0.sk_uri; } let consensus_key_encoding = @@ -50,7 +50,7 @@ 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); }) diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli index 61d7653b1a04..19437bc5b7b7 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli @@ -30,7 +30,7 @@ type consensus_key = { alias : string option; public_key : Tezos_crypto.Signature.V0.public_key; public_key_hash : Tezos_crypto.Signature.V0.public_key_hash; - secret_key_uri : Client_keys.sk_uri; + secret_key_uri : Client_keys_v0.sk_uri; } val consensus_key_encoding : consensus_key Data_encoding.t 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 a32e0799db4a..2d309f37e653 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) @@ -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 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 9cb9461bda97..205cc0e14f80 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 @@ -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 = diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml index 35341100d2ca..d742edb00e33 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml @@ -29,12 +29,12 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + 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 9f4a4f586a32..83dd948534f9 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli @@ -30,7 +30,7 @@ type signer = { alias : string; pkh : Tezos_crypto.Signature.V0.public_key_hash; pk : Tezos_crypto.Signature.V0.public_key; - sk : Client_keys.sk_uri; + sk : Client_keys_v0.sk_uri; } (** Type of chain reorganizations. *) diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml index a907ef377b66..e7d81d0a1171 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml @@ -541,7 +541,7 @@ 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.V0.Generic_operation state.signer.sk diff --git a/src/proto_genesis/lib_client/client_proto_main.ml b/src/proto_genesis/lib_client/client_proto_main.ml index 5875ec678693..ac9a4a21d33f 100644 --- a/src/proto_genesis/lib_client/client_proto_main.ml +++ b/src/proto_genesis/lib_client/client_proto_main.ml @@ -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 902704cb1064..d2a08cabec07 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 -- GitLab From 62ddfa71db6a465051c3fae01e4a2db35a0baf9a Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 15:09:38 +0100 Subject: [PATCH 14/18] Proto_0*/Benchmarks: use Crypto_samplers.V0 Patch obtained with: find src/proto_0* src/proto_genesis -iname "*.ml*" -exec sed -i -e 's/Crypto_samplers\.Finite/Crypto_samplers.V0.Finite/g; s/Crypto_samplers\.Make/Crypto_samplers.V0.Make/g' {} \; make fmt-ocaml --- src/proto_014_PtKathma/lib_benchmark/autocomp.ml | 2 +- .../lib_benchmark/michelson_mcmc_samplers.ml | 4 ++-- .../lib_benchmark/michelson_mcmc_samplers.mli | 4 ++-- src/proto_014_PtKathma/lib_benchmark/michelson_samplers.ml | 2 +- src/proto_014_PtKathma/lib_benchmark/michelson_samplers.mli | 2 +- src/proto_014_PtKathma/lib_benchmark/rules.ml | 4 ++-- .../lib_benchmark/test/test_autocompletion.ml | 2 +- .../lib_benchmark/test/test_distribution.ml | 2 +- .../lib_benchmark/test/test_sampling_code.ml | 2 +- .../lib_benchmark/test/test_sampling_data.ml | 2 +- .../lib_benchmarks_proto/interpreter_benchmarks.ml | 5 +++-- .../lib_benchmarks_proto/michelson_generation.ml | 2 +- .../test/integration/michelson/test_script_typed_ir_size.ml | 2 +- .../lib_protocol/test/pbt/test_script_comparison.ml | 2 +- src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml | 2 +- .../lib_benchmark/michelson_mcmc_samplers.ml | 4 ++-- .../lib_benchmark/michelson_mcmc_samplers.mli | 4 ++-- src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml | 2 +- src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.mli | 2 +- src/proto_015_PtLimaPt/lib_benchmark/rules.ml | 4 ++-- .../lib_benchmark/test/test_autocompletion.ml | 2 +- .../lib_benchmark/test/test_distribution.ml | 2 +- .../lib_benchmark/test/test_sampling_code.ml | 2 +- .../lib_benchmark/test/test_sampling_data.ml | 2 +- .../lib_benchmarks_proto/interpreter_benchmarks.ml | 5 +++-- .../lib_benchmarks_proto/michelson_generation.ml | 2 +- .../test/integration/michelson/test_script_typed_ir_size.ml | 2 +- .../lib_protocol/test/pbt/test_script_comparison.ml | 2 +- 28 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/proto_014_PtKathma/lib_benchmark/autocomp.ml b/src/proto_014_PtKathma/lib_benchmark/autocomp.ml index a5ffb8cf0e8b..a43161a7c3f3 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/michelson_mcmc_samplers.ml b/src/proto_014_PtKathma/lib_benchmark/michelson_mcmc_samplers.ml index 7dc0f4edd716..29704a91d5e0 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 bd67d13e3c16..66f409c121c9 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 fbe05e675e52..fe1135bca5d8 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 c6730c7312ca..60248424bebf 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/rules.ml b/src/proto_014_PtKathma/lib_benchmark/rules.ml index ce35900d5a20..45d31deda24a 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 c2f3e6c74295..91a8ed29d1cb 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 7822b5b6e08c..b7f46d1753d3 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 e5e8edf378d5..1a23352b714a 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 fb67a046d1ef..f69f30af7d3c 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 6a7b887e857e..a465c60a3089 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 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 d1422930010a..a96d9c8cea41 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_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 dad93309675f..30e162766b14 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 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 08ae159b0842..a1ef407b0062 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 @@ -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_benchmark/autocomp.ml b/src/proto_015_PtLimaPt/lib_benchmark/autocomp.ml index a5ffb8cf0e8b..a43161a7c3f3 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/michelson_mcmc_samplers.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_mcmc_samplers.ml index 7dc0f4edd716..29704a91d5e0 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 bd67d13e3c16..66f409c121c9 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 0d51700eabe1..ed701eca32ce 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 c333639b79a9..790b07559bd5 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/rules.ml b/src/proto_015_PtLimaPt/lib_benchmark/rules.ml index ce35900d5a20..45d31deda24a 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 c2f3e6c74295..91a8ed29d1cb 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 7822b5b6e08c..b7f46d1753d3 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 e5e8edf378d5..1a23352b714a 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 fb67a046d1ef..f69f30af7d3c 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 dd574bbd9b34..835e4e2035cd 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 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 d1422930010a..a96d9c8cea41 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_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 a1057282f94b..bf639d7b8e20 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 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 04fc1aee5d08..397456fd1f39 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 @@ -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 -- GitLab From 8d0ed90935ae095dfbda0cc49698743546b982dd Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 10 Jun 2022 10:09:03 +0200 Subject: [PATCH 15/18] Yes-wallet: adapt to signature versions --- .../yes_wallet/get_delegates_014_PtKathma.ml | 5 +++ .../yes_wallet/get_delegates_015_PtLimaPt.ml | 5 +++ devtools/yes_wallet/get_delegates_alpha.ml | 5 +++ devtools/yes_wallet/sigs.ml | 31 ++++++++++++++++--- devtools/yes_wallet/yes_wallet_lib.ml | 12 ++++--- 5 files changed, 49 insertions(+), 9 deletions(-) diff --git a/devtools/yes_wallet/get_delegates_014_PtKathma.ml b/devtools/yes_wallet/get_delegates_014_PtKathma.ml index 02c7f6dd4cc5..b286751b72e0 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 1d23b24db667..ebdb28f31fbe 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 230d17da0cd8..024904dd2a60 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 c2221bf854e7..928383effb73 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 bb030cab2d6c..026d5717a413 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 -- GitLab From 333769ea8b955590e4b9554a5e2047f182a2b27e Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Mon, 12 Sep 2022 23:16:10 +0200 Subject: [PATCH 16/18] Doc: changelog for signature versioning --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7b4f7b586726..7279a17b1fa5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -109,3 +109,6 @@ Rollups Miscellaneous ------------- + +- Versioning of signature module for protocol specific support and future + extensibility. -- GitLab From c4d6ebd3d4afa806dbf08ee84af5eaa5823cd3f0 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Fri, 4 Nov 2022 22:13:00 +0100 Subject: [PATCH 17/18] Test/Tezt: fix mockup test for signature versions --- tezt/tests/mockup.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tezt/tests/mockup.ml b/tezt/tests/mockup.ml index b4a0f69d1c33..416938a91315 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 -- GitLab From 5a90809416835a2849997e4be7ec065d993a33f3 Mon Sep 17 00:00:00 2001 From: Alain Mebsout Date: Tue, 22 Nov 2022 16:12:31 +0100 Subject: [PATCH 18/18] Benchmarks: use environment signature --- .../lib_benchmark_type_inference/mikhailsky.ml | 10 ++++++++-- .../lib_benchmark_type_inference/mikhailsky.mli | 4 ++-- .../lib_benchmark_type_inference/mikhailsky.ml | 10 ++++++++-- .../lib_benchmark_type_inference/mikhailsky.mli | 4 ++-- .../lib_benchmark_type_inference/mikhailsky.ml | 10 ++++++++-- .../lib_benchmark_type_inference/mikhailsky.mli | 4 ++-- 6 files changed, 30 insertions(+), 12 deletions(-) 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 5672070a26e7..8395355273ce 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 4cebbffb4467..724bfa299074 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_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml b/src/proto_015_PtLimaPt/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml index 5672070a26e7..8395355273ce 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 4cebbffb4467..724bfa299074 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_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml b/src/proto_alpha/lib_benchmark/lib_benchmark_type_inference/mikhailsky.ml index 5672070a26e7..8395355273ce 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 4cebbffb4467..724bfa299074 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 -- GitLab