From 799b45c05cebebb6fa5d8f6defc367b002914e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 22 Nov 2022 10:12:48 +0100 Subject: [PATCH 1/6] Crypto: improve namespace --- src/lib_crypto/test/test_context_hash.ml | 2 +- .../test/test_deterministic_nonce.ml | 8 +++--- src/lib_crypto/test/test_prop_signature.ml | 4 +-- src/lib_crypto/tezos_crypto.ml | 26 +++++++++++-------- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/lib_crypto/test/test_context_hash.ml b/src/lib_crypto/test/test_context_hash.ml index 778fce1af147..38188985a05a 100644 --- a/src/lib_crypto/test/test_context_hash.ml +++ b/src/lib_crypto/test/test_context_hash.ml @@ -36,7 +36,7 @@ let test_version_of_int_validation () = let expect_invalid_argument i = try - let _ = Context_hash.Version.of_int i in + let _ = Hashed.Context_hash.Version.of_int i in Alcotest.failf "%d can't be a hash version." i with Invalid_argument _ -> () in diff --git a/src/lib_crypto/test/test_deterministic_nonce.ml b/src/lib_crypto/test/test_deterministic_nonce.ml index 5c78ac3df265..946d9fe63705 100644 --- a/src/lib_crypto/test/test_deterministic_nonce.ml +++ b/src/lib_crypto/test/test_deterministic_nonce.ml @@ -32,7 +32,7 @@ (** Deterministic nonce generation using HMAC-SHA256 *) -let test_hash_matches (module X : S.SIGNATURE) () = +let test_hash_matches (module X : Intfs.SIGNATURE) () = let _, _, sk = X.generate_key () in let data = Bytes.of_string "ce input sa pun eu aici oare?" in let nonce = X.deterministic_nonce sk data in @@ -42,11 +42,11 @@ let test_hash_matches (module X : S.SIGNATURE) () = Alcotest.failf "the hash of deterministic_nonce is NOT deterministic_nonce_hash" -let ed25519 = (module Ed25519 : S.SIGNATURE) +let ed25519 = (module Ed25519 : Intfs.SIGNATURE) -let p256 = (module P256 : S.SIGNATURE) +let p256 = (module P256 : Intfs.SIGNATURE) -let secp256k1 = (module Secp256k1 : S.SIGNATURE) +let secp256k1 = (module Secp256k1 : Intfs.SIGNATURE) let tests = [ diff --git a/src/lib_crypto/test/test_prop_signature.ml b/src/lib_crypto/test/test_prop_signature.ml index 36caf2b964d8..80e067c8df7d 100644 --- a/src/lib_crypto/test/test_prop_signature.ml +++ b/src/lib_crypto/test/test_prop_signature.ml @@ -35,7 +35,7 @@ open Qcheck2_helpers open QCheck2 module type SIGNATURE = sig - include S.SIGNATURE + include Intfs.SIGNATURE val watermark_of_bytes : bytes -> watermark end @@ -74,7 +74,7 @@ struct end module type AGGREGATE_SIGNATURE = sig - include S.AGGREGATE_SIGNATURE + include Intfs.AGGREGATE_SIGNATURE val watermark_of_bytes : bytes -> watermark end diff --git a/src/lib_crypto/tezos_crypto.ml b/src/lib_crypto/tezos_crypto.ml index 1aec237a9237..022bed87d4fd 100644 --- a/src/lib_crypto/tezos_crypto.ml +++ b/src/lib_crypto/tezos_crypto.ml @@ -23,28 +23,32 @@ (* *) (*****************************************************************************) +module Intfs = S + +module Hashed = struct + module Block_hash = Block_hash + module Block_metadata_hash = Block_metadata_hash + module Context_hash = Context_hash + module Operation_hash = Operation_hash + module Operation_list_hash = Operation_list_hash + module Operation_list_list_hash = Operation_list_list_hash + module Operation_metadata_hash = Operation_metadata_hash + module Operation_metadata_list_hash = Operation_metadata_list_hash + module Operation_metadata_list_list_hash = Operation_metadata_list_list_hash + module Protocol_hash = Protocol_hash +end + module Aggregate_signature = Aggregate_signature module Base58 = Base58 module Blake2B = Blake2B -module Block_hash = Block_hash -module Block_metadata_hash = Block_metadata_hash module Bls = Bls module Chain_id = Chain_id -module Context_hash = Context_hash module Crypto_box = Crypto_box module Ed25519 = Ed25519 module Hacl = Hacl module Helpers = Helpers -module Operation_hash = Operation_hash -module Operation_list_hash = Operation_list_hash -module Operation_list_list_hash = Operation_list_list_hash -module Operation_metadata_hash = Operation_metadata_hash -module Operation_metadata_list_hash = Operation_metadata_list_hash -module Operation_metadata_list_list_hash = Operation_metadata_list_list_hash module P256 = P256 -module Protocol_hash = Protocol_hash module Rand = Rand module Secp256k1 = Secp256k1 module Signature = Signature -module S = S module Timelock = Timelock -- GitLab From 669d9a7232b73ba35f431a8f38dcfada2a421360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 22 Nov 2022 10:13:00 +0100 Subject: [PATCH 2/6] Base: export Tezos_crypto.Hashed These are common data-structures backed by the crypto library's hashes: Operation_hash, Block_hash, etc. They are used throughout the codebase. --- src/lib_base/block_header.ml | 26 ++++++++++++---------- src/lib_base/block_header.mli | 16 ++++++++------ src/lib_base/block_locator.ml | 32 +++++++++++++++------------- src/lib_base/block_locator.mli | 24 +++++++++++++-------- src/lib_base/genesis.ml | 8 +++---- src/lib_base/genesis.mli | 4 ++-- src/lib_base/mempool.ml | 19 +++++++++-------- src/lib_base/mempool.mli | 8 +++---- src/lib_base/operation.ml | 18 ++++++++-------- src/lib_base/operation.mli | 12 ++++++----- src/lib_base/p2p_peer_id.mli | 3 ++- src/lib_base/protocol.ml | 8 +++---- src/lib_base/protocol.mli | 6 ++++-- src/lib_base/test_chain_status.ml | 18 ++++++++-------- src/lib_base/test_chain_status.mli | 6 +++--- src/lib_base/tzPervasives.ml | 1 + src/lib_base/tzPervasives.mli | 12 +++++++++++ src/lib_base/unix/protocol_files.mli | 5 +++-- src/lib_base/user_activated.ml | 15 ++++++++----- src/lib_base/user_activated.mli | 5 +++-- 20 files changed, 143 insertions(+), 103 deletions(-) diff --git a/src/lib_base/block_header.ml b/src/lib_base/block_header.ml index 792ba7381d8e..bbf734b92230 100644 --- a/src/lib_base/block_header.ml +++ b/src/lib_base/block_header.ml @@ -27,13 +27,13 @@ type shell_header = { level : Int32.t; proto_level : int; (* uint8 *) - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; validation_passes : int; (* uint8 *) - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Tezos_crypto.Hashed.Operation_list_list_hash.t; fitness : Fitness.t; - context : Tezos_crypto.Context_hash.t; + context : Tezos_crypto.Hashed.Context_hash.t; } let shell_header_encoding = @@ -84,12 +84,14 @@ let shell_header_encoding = (obj8 (req "level" int32) (req "proto" uint8) - (req "predecessor" Tezos_crypto.Block_hash.encoding) + (req "predecessor" Tezos_crypto.Hashed.Block_hash.encoding) (req "timestamp" Time.Protocol.encoding) (req "validation_pass" uint8) - (req "operations_hash" Tezos_crypto.Operation_list_list_hash.encoding) + (req + "operations_hash" + Tezos_crypto.Hashed.Operation_list_list_hash.encoding) (req "fitness" Fitness.encoding) - (req "context" Tezos_crypto.Context_hash.encoding)) + (req "context" Tezos_crypto.Hashed.Context_hash.encoding)) type t = {shell : shell_header; protocol_data : Bytes.t} @@ -105,10 +107,12 @@ include Compare.Make (struct | [], _ :: _ -> 1 | x :: xs, y :: ys -> compare x y >> fun () -> list compare xs ys in - Tezos_crypto.Block_hash.compare b1.shell.predecessor b2.shell.predecessor + Tezos_crypto.Hashed.Block_hash.compare + b1.shell.predecessor + b2.shell.predecessor >> fun () -> compare b1.protocol_data b2.protocol_data >> fun () -> - Tezos_crypto.Operation_list_list_hash.compare + Tezos_crypto.Hashed.Operation_list_list_hash.compare b1.shell.operations_hash b2.shell.operations_hash >> fun () -> @@ -152,9 +156,9 @@ let of_b58check b = Option.bind (Tezos_crypto.Base58.safe_decode b) (fun s -> Data_encoding.Binary.of_string_opt encoding s) -let hash block = Tezos_crypto.Block_hash.hash_bytes [to_bytes block] +let hash block = Tezos_crypto.Hashed.Block_hash.hash_bytes [to_bytes block] -let hash_raw bytes = Tezos_crypto.Block_hash.hash_bytes [bytes] +let hash_raw bytes = Tezos_crypto.Hashed.Block_hash.hash_bytes [bytes] module LevelMap = Map.Make (struct type t = Int32.t @@ -173,7 +177,7 @@ let get_forced_protocol_upgrade ~user_activated_upgrades = let get_voted_protocol_overrides ~user_activated_protocol_overrides proto_hash = List.assoc_opt - ~equal:Tezos_crypto.Protocol_hash.equal + ~equal:Tezos_crypto.Hashed.Protocol_hash.equal proto_hash user_activated_protocol_overrides diff --git a/src/lib_base/block_header.mli b/src/lib_base/block_header.mli index 5bdd779fb84c..cd6c31bd4dc3 100644 --- a/src/lib_base/block_header.mli +++ b/src/lib_base/block_header.mli @@ -27,12 +27,13 @@ type shell_header = { level : Int32.t; (** Height of the block, from the genesis block. *) proto_level : int; (** Number (uint8) of protocol changes since genesis modulo 256. *) - predecessor : Tezos_crypto.Block_hash.t; (** Hash of the preceding block. *) + predecessor : Tezos_crypto.Hashed.Block_hash.t; + (** Hash of the preceding block. *) timestamp : Time.Protocol.t; (** Timestamp at which the block is claimed to have been created. *) validation_passes : int; (** Number (uint8) of validation passes (also number of lists of operations). *) - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Tezos_crypto.Hashed.Operation_list_list_hash.t; (** Hash of the list of lists (actually root hashes of merkle trees) of operations included in the block. There is one list of operations per validation pass. *) @@ -40,7 +41,7 @@ type shell_header = { (** A sequence of sequences of unsigned bytes, ordered by length and then lexicographically. It represents the claimed fitness of the chain ending in this block. *) - context : Tezos_crypto.Context_hash.t; + context : Tezos_crypto.Hashed.Context_hash.t; (** Hash of the state of the context either before or after application of this block depending on the protocol environment's [expected_context_hash] value. *) @@ -50,7 +51,8 @@ val shell_header_encoding : shell_header Data_encoding.t type t = {shell : shell_header; protocol_data : Bytes.t} -include S.HASHABLE with type t := t and type hash := Tezos_crypto.Block_hash.t +include + S.HASHABLE with type t := t and type hash := Tezos_crypto.Hashed.Block_hash.t val of_bytes_exn : Bytes.t -> t @@ -63,9 +65,9 @@ val bounded_encoding : ?max_size:int -> unit -> t Data_encoding.t val get_forced_protocol_upgrade : user_activated_upgrades:User_activated.upgrades -> level:Int32.t -> - Tezos_crypto.Protocol_hash.t option + Tezos_crypto.Hashed.Protocol_hash.t option val get_voted_protocol_overrides : user_activated_protocol_overrides:User_activated.protocol_overrides -> - Tezos_crypto.Protocol_hash.t -> - Tezos_crypto.Protocol_hash.t option + Tezos_crypto.Hashed.Protocol_hash.t -> + Tezos_crypto.Hashed.Protocol_hash.t option diff --git a/src/lib_base/block_locator.ml b/src/lib_base/block_locator.ml index 0cc57d2eacc5..3cc3895845e0 100644 --- a/src/lib_base/block_locator.ml +++ b/src/lib_base/block_locator.ml @@ -25,9 +25,9 @@ (*****************************************************************************) type t = { - head_hash : Tezos_crypto.Block_hash.t; + head_hash : Tezos_crypto.Hashed.Block_hash.t; head_header : Block_header.t; - history : Tezos_crypto.Block_hash.t list; + history : Tezos_crypto.Hashed.Block_hash.t list; } let pp ppf {head_hash; history; _} = @@ -43,7 +43,7 @@ let pp ppf {head_hash; history; _} = Format.fprintf ppf "%a (%i)\n%a" - Tezos_crypto.Block_hash.pp + Tezos_crypto.Hashed.Block_hash.pp hd acc pp_hash_list @@ -52,7 +52,7 @@ let pp ppf {head_hash; history; _} = Format.fprintf ppf "%a (head)\n%a" - Tezos_crypto.Block_hash.pp + Tezos_crypto.Hashed.Block_hash.pp head_hash pp_hash_list (history, -1, 1, repeats - 1) @@ -61,7 +61,7 @@ let pp_short ppf {head_hash; history; _} = Format.fprintf ppf "head: %a, %d predecessors" - Tezos_crypto.Block_hash.pp + Tezos_crypto.Hashed.Block_hash.pp head_hash (List.length history) @@ -78,7 +78,9 @@ let encoding = encoding_inj (obj2 (req "current_head" (dynamic_size Block_header.encoding)) - (req "history" (Variable.list Tezos_crypto.Block_hash.encoding))) + (req + "history" + (Variable.list Tezos_crypto.Hashed.Block_hash.encoding))) let bounded_encoding ~max_header_size ~max_length () = let open Data_encoding in @@ -92,7 +94,7 @@ let bounded_encoding ~max_header_size ~max_length () = (Block_header.bounded_encoding ~max_size:max_header_size ()))) (req "history" - (Variable.list ~max_length Tezos_crypto.Block_hash.encoding))) + (Variable.list ~max_length Tezos_crypto.Hashed.Block_hash.encoding))) type seed = {sender_id : P2p_peer.Id.t; receiver_id : P2p_peer.Id.t} @@ -108,7 +110,7 @@ type seed = {sender_id : P2p_peer.Id.t; receiver_id : P2p_peer.Id.t} module Step : sig type state - val init : seed -> Tezos_crypto.Block_hash.t -> state + val init : seed -> Tezos_crypto.Hashed.Block_hash.t -> state val next : state -> int * state end = struct @@ -126,7 +128,7 @@ end = struct [ P2p_peer.Id.to_bytes seed.sender_id; P2p_peer.Id.to_bytes seed.receiver_id; - Tezos_crypto.Block_hash.to_bytes head; + Tezos_crypto.Hashed.Block_hash.to_bytes head; ] ; (1l, 9, SHA256.finish st) @@ -169,8 +171,8 @@ let fold ~f ~init {head_hash; history; _} seed = loop state init (head_hash :: history) type step = { - block : Tezos_crypto.Block_hash.t; - predecessor : Tezos_crypto.Block_hash.t; + block : Tezos_crypto.Hashed.Block_hash.t; + predecessor : Tezos_crypto.Hashed.Block_hash.t; step : int; strict_step : bool; } @@ -216,12 +218,12 @@ let compute ~get_predecessor ~caboose ~size head_hash head_header seed = let* o = get_predecessor current_block_hash step in match o with | None -> - if Tezos_crypto.Block_hash.equal caboose current_block_hash then - Lwt.return acc + if Tezos_crypto.Hashed.Block_hash.equal caboose current_block_hash + then Lwt.return acc else Lwt.return (caboose :: acc) | Some predecessor -> - if Tezos_crypto.Block_hash.equal predecessor current_block_hash then - (* caboose or genesis reached *) + if Tezos_crypto.Hashed.Block_hash.equal predecessor current_block_hash + then (* caboose or genesis reached *) Lwt.return acc else loop (predecessor :: acc) (pred size) state predecessor in diff --git a/src/lib_base/block_locator.mli b/src/lib_base/block_locator.mli index 7ace8b3296b7..2d059ccc7a85 100644 --- a/src/lib_base/block_locator.mli +++ b/src/lib_base/block_locator.mli @@ -54,9 +54,9 @@ (** Type for sparse block locators (/à la/ Bitcoin). *) type t = { - head_hash : Tezos_crypto.Block_hash.t; + head_hash : Tezos_crypto.Hashed.Block_hash.t; head_header : Block_header.t; - history : Tezos_crypto.Block_hash.t list; + history : Tezos_crypto.Hashed.Block_hash.t list; } val pp : Format.formatter -> t -> unit @@ -83,10 +83,12 @@ val estimated_length : seed -> t -> int elements, including the caboose. *) val compute : get_predecessor: - (Tezos_crypto.Block_hash.t -> int -> Tezos_crypto.Block_hash.t option Lwt.t) -> - caboose:Tezos_crypto.Block_hash.t -> + (Tezos_crypto.Hashed.Block_hash.t -> + int -> + Tezos_crypto.Hashed.Block_hash.t option Lwt.t) -> + caboose:Tezos_crypto.Hashed.Block_hash.t -> size:int -> - Tezos_crypto.Block_hash.t -> + Tezos_crypto.Hashed.Block_hash.t -> Block_header.t -> seed -> t Lwt.t @@ -95,8 +97,8 @@ val compute : locator, and the expected difference of level between the two blocks (or an upper bounds when [strict_step = false]). *) type step = { - block : Tezos_crypto.Block_hash.t; - predecessor : Tezos_crypto.Block_hash.t; + block : Tezos_crypto.Hashed.Block_hash.t; + predecessor : Tezos_crypto.Hashed.Block_hash.t; step : int; strict_step : bool; } @@ -116,7 +118,11 @@ val to_steps : seed -> t -> step list [predecessor] of the last step as [save_point] and its field [strict] to [false]. *) val to_steps_truncate : - limit:int -> save_point:Tezos_crypto.Block_hash.t -> seed -> t -> step list + limit:int -> + save_point:Tezos_crypto.Hashed.Block_hash.t -> + seed -> + t -> + step list (** A block can either be known valid, invalid or unknown. *) type validity = Unknown | Known_valid | Known_invalid @@ -136,6 +142,6 @@ type validity = Unknown | Known_valid | Known_invalid - [(Unknown, (h, hist))] when no block is known valid nor invalid (w.r.t. [is_known]), where [(h, hist)] is the given [locator]. *) val unknown_prefix : - is_known:(Tezos_crypto.Block_hash.t -> validity Lwt.t) -> + is_known:(Tezos_crypto.Hashed.Block_hash.t -> validity Lwt.t) -> t -> (validity * t) Lwt.t diff --git a/src/lib_base/genesis.ml b/src/lib_base/genesis.ml index dfaf5f5ac71f..09a41f1aa429 100644 --- a/src/lib_base/genesis.ml +++ b/src/lib_base/genesis.ml @@ -1,8 +1,8 @@ (** The chain starts from a genesis block associated to a seed protocol *) type t = { time : Time.Protocol.t; - block : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; + block : Tezos_crypto.Hashed.Block_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; } let encoding = @@ -12,8 +12,8 @@ let encoding = (fun (time, block, protocol) -> {time; block; protocol}) (obj3 (req "timestamp" Time.Protocol.encoding) - (req "block" Tezos_crypto.Block_hash.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding)) + (req "block" Tezos_crypto.Hashed.Block_hash.encoding) + (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding)) let pp ppf genesis = Data_encoding.Json.pp ppf (Data_encoding.Json.construct encoding genesis) diff --git a/src/lib_base/genesis.mli b/src/lib_base/genesis.mli index ed3d911a3670..a80c4fc182ef 100644 --- a/src/lib_base/genesis.mli +++ b/src/lib_base/genesis.mli @@ -1,8 +1,8 @@ (** The chain starts from a genesis block associated to a seed protocol *) type t = { time : Time.Protocol.t; - block : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; + block : Tezos_crypto.Hashed.Block_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; } val encoding : t Data_encoding.t diff --git a/src/lib_base/mempool.ml b/src/lib_base/mempool.ml index 5aec011c52c1..4669249692ff 100644 --- a/src/lib_base/mempool.ml +++ b/src/lib_base/mempool.ml @@ -24,8 +24,8 @@ (*****************************************************************************) type t = { - known_valid : Tezos_crypto.Operation_hash.t list; - pending : Tezos_crypto.Operation_hash.Set.t; + known_valid : Tezos_crypto.Hashed.Operation_hash.t list; + pending : Tezos_crypto.Hashed.Operation_hash.Set.t; } type mempool = t @@ -41,31 +41,32 @@ let encoding = (fun {known_valid; pending} -> (known_valid, pending)) (fun (known_valid, pending) -> {known_valid; pending}) (obj2 - (req "known_valid" (list Tezos_crypto.Operation_hash.encoding)) + (req "known_valid" (list Tezos_crypto.Hashed.Operation_hash.encoding)) (req "pending" - (dynamic_size Tezos_crypto.Operation_hash.Set.encoding))) + (dynamic_size Tezos_crypto.Hashed.Operation_hash.Set.encoding))) let bounded_encoding ?max_operations () = match max_operations with | None -> encoding | Some max_operations -> Data_encoding.check_size - (8 + (max_operations * Tezos_crypto.Operation_hash.size)) + (8 + (max_operations * Tezos_crypto.Hashed.Operation_hash.size)) encoding -let empty = {known_valid = []; pending = Tezos_crypto.Operation_hash.Set.empty} +let empty = + {known_valid = []; pending = Tezos_crypto.Hashed.Operation_hash.Set.empty} let is_empty {known_valid; pending} = - known_valid = [] && Tezos_crypto.Operation_hash.Set.is_empty pending + known_valid = [] && Tezos_crypto.Hashed.Operation_hash.Set.is_empty pending let remove oph {known_valid; pending} = { known_valid = List.filter - (fun x -> not (Tezos_crypto.Operation_hash.equal x oph)) + (fun x -> not (Tezos_crypto.Hashed.Operation_hash.equal x oph)) known_valid; - pending = Tezos_crypto.Operation_hash.Set.remove oph pending; + pending = Tezos_crypto.Hashed.Operation_hash.Set.remove oph pending; } let cons_valid oph t = {t with known_valid = oph :: t.known_valid} diff --git a/src/lib_base/mempool.mli b/src/lib_base/mempool.mli index 7eecaec22964..6281182b5394 100644 --- a/src/lib_base/mempool.mli +++ b/src/lib_base/mempool.mli @@ -26,9 +26,9 @@ (** Tezos Shell Module - Mempool, a.k.a. the operations safe to be broadcast. *) type t = { - known_valid : Tezos_crypto.Operation_hash.t list; + known_valid : Tezos_crypto.Hashed.Operation_hash.t list; (** A valid sequence of operations on top of the current head. *) - pending : Tezos_crypto.Operation_hash.Set.t; + pending : Tezos_crypto.Hashed.Operation_hash.Set.t; (** Set of known not-invalid operation. *) } @@ -45,7 +45,7 @@ val empty : mempool val is_empty : mempool -> bool (** [cons_valid oph t] prepends [oph] to the [known_valid] field of [t]. *) -val cons_valid : Tezos_crypto.Operation_hash.t -> mempool -> mempool +val cons_valid : Tezos_crypto.Hashed.Operation_hash.t -> mempool -> mempool (** Remove an operation from all the fields of a mempool. *) -val remove : Tezos_crypto.Operation_hash.t -> mempool -> mempool +val remove : Tezos_crypto.Hashed.Operation_hash.t -> mempool -> mempool diff --git a/src/lib_base/operation.ml b/src/lib_base/operation.ml index 7654a800dc99..bac36a5b65d3 100644 --- a/src/lib_base/operation.ml +++ b/src/lib_base/operation.ml @@ -23,10 +23,10 @@ (* *) (*****************************************************************************) -type shell_header = {branch : Tezos_crypto.Block_hash.t} +type shell_header = {branch : Tezos_crypto.Hashed.Block_hash.t} let equal_shell_header {branch = b1} {branch = b2} = - Tezos_crypto.Block_hash.equal b1 b2 + Tezos_crypto.Hashed.Block_hash.equal b1 b2 let shell_header_encoding = let open Data_encoding in @@ -34,7 +34,7 @@ let shell_header_encoding = @@ conv (fun {branch} -> branch) (fun branch -> {branch}) - (obj1 (req "branch" Tezos_crypto.Block_hash.encoding)) + (obj1 (req "branch" Tezos_crypto.Hashed.Block_hash.encoding)) type t = {shell : shell_header; proto : Bytes.t} @@ -43,7 +43,7 @@ include Compare.Make (struct let compare o1 o2 = Compare.or_else - (Tezos_crypto.Block_hash.compare o1.shell.branch o2.shell.branch) + (Tezos_crypto.Hashed.Block_hash.compare o1.shell.branch o2.shell.branch) (fun () -> Bytes.compare o1.proto o2.proto) end) @@ -80,7 +80,7 @@ let bounded_list_encoding ?max_length ?max_size ?max_operation_size ?max_pass () obj2 (req "operation_hashes_path" - (Tezos_crypto.Operation_list_list_hash.bounded_path_encoding + (Tezos_crypto.Hashed.Operation_list_list_hash.bounded_path_encoding ?max_length:max_pass ())) (req "operations" op_list_encoding) @@ -90,12 +90,12 @@ let bounded_hash_list_encoding ?max_length ?max_pass () = obj2 (req "operation_hashes_path" - (Tezos_crypto.Operation_list_list_hash.bounded_path_encoding + (Tezos_crypto.Hashed.Operation_list_list_hash.bounded_path_encoding ?max_length:max_pass ())) (req "operation_hashes" - (Variable.list ?max_length Tezos_crypto.Operation_hash.encoding)) + (Variable.list ?max_length Tezos_crypto.Hashed.Operation_hash.encoding)) let pp fmt op = Data_encoding.Json.pp fmt (Data_encoding.Json.construct encoding op) @@ -106,9 +106,9 @@ let of_bytes b = Data_encoding.Binary.of_bytes_opt encoding b let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b -let hash op = Tezos_crypto.Operation_hash.hash_bytes [to_bytes op] +let hash op = Tezos_crypto.Hashed.Operation_hash.hash_bytes [to_bytes op] -let hash_raw bytes = Tezos_crypto.Operation_hash.hash_bytes [bytes] +let hash_raw bytes = Tezos_crypto.Hashed.Operation_hash.hash_bytes [bytes] let () = Data_encoding.Registration.register ~pp encoding ; diff --git a/src/lib_base/operation.mli b/src/lib_base/operation.mli index 54b75685215b..58e4ae9db15f 100644 --- a/src/lib_base/operation.mli +++ b/src/lib_base/operation.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -type shell_header = {branch : Tezos_crypto.Block_hash.t} +type shell_header = {branch : Tezos_crypto.Hashed.Block_hash.t} val equal_shell_header : shell_header -> shell_header -> bool @@ -32,7 +32,9 @@ val shell_header_encoding : shell_header Data_encoding.t type t = {shell : shell_header; proto : Bytes.t} include - S.HASHABLE with type t := t and type hash := Tezos_crypto.Operation_hash.t + S.HASHABLE + with type t := t + and type hash := Tezos_crypto.Hashed.Operation_hash.t val of_bytes_exn : Bytes.t -> t @@ -44,12 +46,12 @@ val bounded_list_encoding : ?max_operation_size:int -> ?max_pass:int -> unit -> - (Tezos_crypto.Operation_list_list_hash.path * t list) Data_encoding.t + (Tezos_crypto.Hashed.Operation_list_list_hash.path * t list) Data_encoding.t val bounded_hash_list_encoding : ?max_length:int -> ?max_pass:int -> unit -> - (Tezos_crypto.Operation_list_list_hash.path - * Tezos_crypto.Operation_hash.t list) + (Tezos_crypto.Hashed.Operation_list_list_hash.path + * Tezos_crypto.Hashed.Operation_hash.t list) Data_encoding.t diff --git a/src/lib_base/p2p_peer_id.mli b/src/lib_base/p2p_peer_id.mli index 47d585ba83fe..5a8238404427 100644 --- a/src/lib_base/p2p_peer_id.mli +++ b/src/lib_base/p2p_peer_id.mli @@ -24,4 +24,5 @@ (*****************************************************************************) include - Tezos_crypto.S.HASH with type t = Tezos_crypto.Crypto_box.Public_key_hash.t + Tezos_crypto.Intfs.HASH + with type t = Tezos_crypto.Crypto_box.Public_key_hash.t diff --git a/src/lib_base/protocol.ml b/src/lib_base/protocol.ml index 08e9fe2787da..6cbd8d4fed3b 100644 --- a/src/lib_base/protocol.ml +++ b/src/lib_base/protocol.ml @@ -145,13 +145,13 @@ let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b let of_string_exn b = Data_encoding.Binary.of_string_exn encoding b -let hash proto = Tezos_crypto.Protocol_hash.hash_bytes [to_bytes proto] +let hash proto = Tezos_crypto.Hashed.Protocol_hash.hash_bytes [to_bytes proto] -let hash_raw proto = Tezos_crypto.Protocol_hash.hash_bytes [proto] +let hash_raw proto = Tezos_crypto.Hashed.Protocol_hash.hash_bytes [proto] module Meta = struct type t = { - hash : Tezos_crypto.Protocol_hash.t option; + hash : Tezos_crypto.Hashed.Protocol_hash.t option; expected_env_version : env_version option; modules : string list; } @@ -172,7 +172,7 @@ module Meta = struct (opt "hash" ~description:"Used to force the hash of the protocol" - Tezos_crypto.Protocol_hash.encoding) + Tezos_crypto.Hashed.Protocol_hash.encoding) (opt "expected_env_version" env_version_encoding) (req "modules" diff --git a/src/lib_base/protocol.mli b/src/lib_base/protocol.mli index 842c83179340..e1a05b6d4f2d 100644 --- a/src/lib_base/protocol.mli +++ b/src/lib_base/protocol.mli @@ -51,7 +51,9 @@ val env_version_encoding : env_version Data_encoding.t val pp_ocaml : Format.formatter -> t -> unit include - S.HASHABLE with type t := t and type hash := Tezos_crypto.Protocol_hash.t + S.HASHABLE + with type t := t + and type hash := Tezos_crypto.Hashed.Protocol_hash.t val of_bytes_exn : Bytes.t -> t @@ -65,7 +67,7 @@ val module_name_of_env_version : env_version -> string module Meta : sig type t = { - hash : Tezos_crypto.Protocol_hash.t option; + hash : Tezos_crypto.Hashed.Protocol_hash.t option; expected_env_version : env_version option; modules : string list; } diff --git a/src/lib_base/test_chain_status.ml b/src/lib_base/test_chain_status.ml index ff3620bb8ae1..dee8f64d5144 100644 --- a/src/lib_base/test_chain_status.ml +++ b/src/lib_base/test_chain_status.ml @@ -26,13 +26,13 @@ type t = | Not_running | Forking of { - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } | Running of { chain_id : Tezos_crypto.Chain_id.t; - genesis : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; + genesis : Tezos_crypto.Hashed.Block_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } @@ -57,7 +57,7 @@ let encoding = ~title:"Forking" (obj3 (req "status" (constant "forking")) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) (req "expiration" Time.Protocol.encoding)) (function | Forking {protocol; expiration} -> Some ((), protocol, expiration) @@ -69,8 +69,8 @@ let encoding = (obj5 (req "status" (constant "running")) (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "genesis" Tezos_crypto.Block_hash.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) + (req "genesis" Tezos_crypto.Hashed.Block_hash.encoding) + (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) (req "expiration" Time.Protocol.encoding)) (function | Running {chain_id; genesis; protocol; expiration} -> @@ -86,7 +86,7 @@ let pp ppf = function Format.fprintf ppf "@[Forking %a (expires %a)@]" - Tezos_crypto.Protocol_hash.pp + Tezos_crypto.Hashed.Protocol_hash.pp protocol Time.System.pp_hum (Time.System.of_protocol_exn expiration) @@ -94,9 +94,9 @@ let pp ppf = function Format.fprintf ppf "@[Running %a@ Genesis: %a@ Net id: %a@ Expiration: %a@]" - Tezos_crypto.Protocol_hash.pp + Tezos_crypto.Hashed.Protocol_hash.pp protocol - Tezos_crypto.Block_hash.pp + Tezos_crypto.Hashed.Block_hash.pp genesis Tezos_crypto.Chain_id.pp chain_id diff --git a/src/lib_base/test_chain_status.mli b/src/lib_base/test_chain_status.mli index d01bfe8baa2b..ffe08742fff0 100644 --- a/src/lib_base/test_chain_status.mli +++ b/src/lib_base/test_chain_status.mli @@ -26,13 +26,13 @@ type t = | Not_running | Forking of { - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } | Running of { chain_id : Tezos_crypto.Chain_id.t; - genesis : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; + genesis : Tezos_crypto.Hashed.Block_hash.t; + protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } diff --git a/src/lib_base/tzPervasives.ml b/src/lib_base/tzPervasives.ml index 405520cc91b5..7c53afe62641 100644 --- a/src/lib_base/tzPervasives.ml +++ b/src/lib_base/tzPervasives.ml @@ -90,6 +90,7 @@ module P2p_version = P2p_version module P2p_rejection = P2p_rejection module Distributed_db_version = Distributed_db_version module Network_version = Network_version +include Tezos_crypto.Hashed include Utils.Infix include Error_monad diff --git a/src/lib_base/tzPervasives.mli b/src/lib_base/tzPervasives.mli index a8b7fb8427c8..e22aadf51a34 100644 --- a/src/lib_base/tzPervasives.mli +++ b/src/lib_base/tzPervasives.mli @@ -92,6 +92,18 @@ module P2p_version = P2p_version module P2p_rejection = P2p_rejection module Distributed_db_version = Distributed_db_version module Network_version = Network_version +module Block_hash = Tezos_crypto.Hashed.Block_hash +module Block_metadata_hash = Tezos_crypto.Hashed.Block_metadata_hash +module Context_hash = Tezos_crypto.Hashed.Context_hash +module Operation_hash = Tezos_crypto.Hashed.Operation_hash +module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash +module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash +module Operation_metadata_hash = Tezos_crypto.Hashed.Operation_metadata_hash +module Operation_metadata_list_hash = + Tezos_crypto.Hashed.Operation_metadata_list_hash +module Operation_metadata_list_list_hash = + Tezos_crypto.Hashed.Operation_metadata_list_list_hash +module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash include module type of Utils.Infix diff --git a/src/lib_base/unix/protocol_files.mli b/src/lib_base/unix/protocol_files.mli index 91ae5a57a959..3c0384b62ae0 100644 --- a/src/lib_base/unix/protocol_files.mli +++ b/src/lib_base/unix/protocol_files.mli @@ -1,10 +1,11 @@ open Error_monad val read_dir : - string -> (Tezos_crypto.Protocol_hash.t option * Protocol.t) tzresult Lwt.t + string -> + (Tezos_crypto.Hashed.Protocol_hash.t option * Protocol.t) tzresult Lwt.t val write_dir : string -> - ?hash:Tezos_crypto.Protocol_hash.t -> + ?hash:Tezos_crypto.Hashed.Protocol_hash.t -> Protocol.t -> unit tzresult Lwt.t diff --git a/src/lib_base/user_activated.ml b/src/lib_base/user_activated.ml index bfdbd1f4df83..faf737ddf2be 100644 --- a/src/lib_base/user_activated.ml +++ b/src/lib_base/user_activated.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -type upgrades = (Int32.t * Tezos_crypto.Protocol_hash.t) list +type upgrades = (Int32.t * Tezos_crypto.Hashed.Protocol_hash.t) list let upgrades_encoding = let open Data_encoding in @@ -35,10 +35,13 @@ let upgrades_encoding = (list (obj2 (req "level" int32) - (req "replacement_protocol" Tezos_crypto.Protocol_hash.encoding))) + (req + "replacement_protocol" + Tezos_crypto.Hashed.Protocol_hash.encoding))) type protocol_overrides = - (Tezos_crypto.Protocol_hash.t * Tezos_crypto.Protocol_hash.t) list + (Tezos_crypto.Hashed.Protocol_hash.t * Tezos_crypto.Hashed.Protocol_hash.t) + list let protocol_overrides_encoding = let open Data_encoding in @@ -50,8 +53,10 @@ let protocol_overrides_encoding = another." @@ list (obj2 - (req "replaced_protocol" Tezos_crypto.Protocol_hash.encoding) - (req "replacement_protocol" Tezos_crypto.Protocol_hash.encoding)) + (req "replaced_protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) + (req + "replacement_protocol" + Tezos_crypto.Hashed.Protocol_hash.encoding)) let () = Data_encoding.Registration.register upgrades_encoding ; diff --git a/src/lib_base/user_activated.mli b/src/lib_base/user_activated.mli index 8daffbdcdba1..56e0d23b7dd3 100644 --- a/src/lib_base/user_activated.mli +++ b/src/lib_base/user_activated.mli @@ -24,7 +24,7 @@ (*****************************************************************************) (** User activated upgrades: at given level, switch to given protocol. *) -type upgrades = (Int32.t * Tezos_crypto.Protocol_hash.t) list +type upgrades = (Int32.t * Tezos_crypto.Hashed.Protocol_hash.t) list val upgrades_encoding : upgrades Data_encoding.t @@ -33,6 +33,7 @@ val upgrades_encoding : upgrades Data_encoding.t An override [(a, b)] denotes that if [a] is to be activated at the end of the promotion phase, [b] shall be activated instead. *) type protocol_overrides = - (Tezos_crypto.Protocol_hash.t * Tezos_crypto.Protocol_hash.t) list + (Tezos_crypto.Hashed.Protocol_hash.t * Tezos_crypto.Hashed.Protocol_hash.t) + list val protocol_overrides_encoding : protocol_overrides Data_encoding.t -- GitLab From da5649d99ed47ee17379031e9da4484d15473c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 22 Nov 2022 10:14:42 +0100 Subject: [PATCH 3/6] Everywhere: adapt to the new crypto namespacing --- devtools/get_contracts/config.ml | 12 +- devtools/get_contracts/get_contracts.ml | 17 +- devtools/get_contracts/sigs.ml | 2 +- devtools/yes_wallet/sigs.ml | 2 +- devtools/yes_wallet/yes_wallet_lib.ml | 16 +- docs/doc_gen/node_helpers.ml | 4 +- docs/doc_gen/p2p_doc.ml | 2 +- docs/doc_gen/rpc_doc.ml | 7 +- manifest/main.ml | 2 +- src/bin_client/client_protocols_commands.ml | 19 +- src/bin_client/main_client.ml | 6 +- src/bin_dal_node/event_legacy.ml | 4 +- src/bin_dal_node/slot_manager.mli | 2 +- src/bin_node/node_identity_file.ml | 4 +- src/bin_node/node_replay_command.ml | 18 +- src/bin_node/node_run_command.ml | 2 +- src/bin_node/node_snapshot_command.ml | 2 +- src/bin_node/node_storage_command.ml | 16 +- src/bin_wasm_debugger/messages.ml | 2 +- src/lib_benchmark/crypto_samplers.ml | 2 +- src/lib_client_base/client_confirmations.ml | 44 ++--- src/lib_client_base/client_confirmations.mli | 16 +- src/lib_client_base/client_keys.ml | 4 +- src/lib_client_base_unix/client_config.ml | 14 +- .../client_context_unix.mli | 2 +- src/lib_client_base_unix/client_main_run.ml | 3 +- .../client_admin_commands.ml | 18 +- src/lib_client_commands/client_commands.ml | 10 +- src/lib_client_commands/client_commands.mli | 9 +- .../client_helpers_commands.ml | 4 +- .../client_report_commands.ml | 4 +- src/lib_context/disk/context.ml | 100 +++------- src/lib_context/disk/context.mli | 2 +- src/lib_context/encoding/context.ml | 14 +- src/lib_context/encoding/context.mli | 4 +- src/lib_context/helpers/context.ml | 8 +- src/lib_context/helpers/context.mli | 3 +- src/lib_context/memory/context.ml | 42 ++-- src/lib_context/memory/context.mli | 4 +- src/lib_context/memory/test/test.ml | 10 +- .../merkle_proof_encoding.ml | 2 +- src/lib_context/sigs/context.ml | 62 +++--- src/lib_context/test/test_context.ml | 27 +-- src/lib_context/test/test_merkle_proof.ml | 16 +- .../test/test_signature_encodings.ml | 4 +- src/lib_dal_node/dac_plugin.ml | 9 +- src/lib_dal_node/dac_plugin.mli | 2 +- src/lib_dal_node/dal_plugin.ml | 11 +- src/lib_dal_node/dal_plugin.mli | 4 +- src/lib_mockup/local_services.ml | 50 ++--- src/lib_mockup/migration.mli | 4 +- src/lib_mockup/mockup_commands.ml | 4 +- src/lib_mockup/persistence.ml | 25 ++- src/lib_mockup/persistence_intf.ml | 10 +- src/lib_mockup/registration_intf.ml | 4 +- src/lib_mockup/test/test_persistence.ml | 34 ++-- src/lib_node_config/config_file.ml | 21 +- src/lib_p2p/test/node.ml | 4 +- src/lib_p2p/test/node.mli | 2 +- src/lib_p2p/test/test_p2p_broadcast.ml | 8 +- .../bin/main_embedded_packer.ml | 4 +- src/lib_protocol_compiler/compiler.ml | 15 +- src/lib_protocol_compiler/packer.ml | 2 +- src/lib_protocol_compiler/packer.mli | 3 +- .../registerer/tezos_protocol_registerer.ml | 4 +- .../registerer/tezos_protocol_registerer.mli | 4 +- .../environment_V0.ml | 15 +- .../environment_V0.mli | 13 +- .../environment_V1.ml | 15 +- .../environment_V1.mli | 13 +- .../environment_V2.ml | 15 +- .../environment_V2.mli | 13 +- .../environment_V3.ml | 30 +-- .../environment_V3.mli | 16 +- .../environment_V4.ml | 30 +-- .../environment_V4.mli | 16 +- .../environment_V5.ml | 30 +-- .../environment_V5.mli | 16 +- .../environment_V6.ml | 30 +-- .../environment_V6.mli | 16 +- .../environment_V7.ml | 30 +-- .../environment_V7.mli | 16 +- .../environment_V8.ml | 30 +-- .../environment_V8.mli | 16 +- .../environment_V9.ml | 29 ++- .../environment_V9.mli | 15 +- .../environment_context.ml | 22 +-- .../environment_context.mli | 11 +- .../environment_context_intf.ml | 12 +- .../environment_protocol_T.ml | 18 +- .../environment_protocol_T_V0.ml | 2 +- .../environment_protocol_T_V3.ml | 4 +- .../environment_protocol_T_V6.ml | 4 +- .../environment_protocol_T_V7.ml | 32 +-- .../environment_protocol_T_test.ml | 14 +- .../shell_context/proxy_delegate_maker.ml | 4 +- .../shell_context/proxy_delegate_maker.mli | 2 +- .../shell_context/shell_context.mli | 1 - .../structs/v0_block_hash.ml | 16 +- .../structs/v0_context_hash.ml | 14 +- .../structs/v0_operation_hash.ml | 14 +- .../structs/v0_operation_list_hash.ml | 16 +- .../structs/v0_operation_list_list_hash.ml | 20 +- .../structs/v0_protocol_hash.ml | 14 +- .../test/test_cache.ml | 2 +- .../tezos_protocol_environment.ml | 2 +- .../registered_protocol.ml | 33 ++-- .../registered_protocol.mli | 32 +-- src/lib_protocol_updater/updater.ml | 12 +- src/lib_protocol_updater/updater.mli | 2 +- src/lib_protocol_updater/updater_events.ml | 2 +- src/lib_proxy/light.ml | 2 +- src/lib_proxy/light.mli | 2 +- src/lib_proxy/proxy_commands.ml | 2 +- src/lib_proxy/proxy_getter.ml | 5 +- src/lib_proxy/proxy_getter.mli | 4 +- src/lib_proxy/proxy_services.ml | 14 +- src/lib_proxy/proxy_services.mli | 6 +- src/lib_proxy/registration.ml | 19 +- src/lib_proxy/registration.mli | 6 +- src/lib_proxy/rpc/RPC_client.mli | 2 +- src/lib_scoru_wasm/durable.mli | 4 +- src/lib_scoru_wasm/fast/module_cache.ml | 2 +- src/lib_scoru_wasm/fast/test/test_fast.ml | 4 +- src/lib_scoru_wasm/helpers/wasm_utils.ml | 4 +- .../test/test_hash_consistency.ml | 3 +- src/lib_scoru_wasm/test/test_wasm_pvm.ml | 15 +- src/lib_shell/block_directory.ml | 3 +- src/lib_shell/block_validator.ml | 13 +- src/lib_shell/block_validator.mli | 8 +- src/lib_shell/block_validator_events.ml | 36 ++-- src/lib_shell/block_validator_process.ml | 31 ++- src/lib_shell/block_validator_process.mli | 8 +- src/lib_shell/bootstrap_pipeline.ml | 17 +- src/lib_shell/bootstrap_pipeline_event.ml | 20 +- src/lib_shell/chain_directory.ml | 9 +- src/lib_shell/chain_directory.mli | 3 +- src/lib_shell/chain_validator.ml | 11 +- src/lib_shell/chain_validator.mli | 2 +- src/lib_shell/chain_validator_events.ml | 12 +- src/lib_shell/distributed_db.ml | 12 +- src/lib_shell/distributed_db.mli | 22 +-- src/lib_shell/distributed_db_event.ml | 2 +- src/lib_shell/distributed_db_message.ml | 41 ++-- src/lib_shell/distributed_db_message.mli | 17 +- src/lib_shell/distributed_db_requester.ml | 42 ++-- src/lib_shell/distributed_db_requester.mli | 15 +- src/lib_shell/injection_directory.ml | 10 +- src/lib_shell/legacy_mempool_plugin.ml | 8 +- src/lib_shell/legacy_mempool_plugin.mli | 8 +- src/lib_shell/legacy_prevalidation.ml | 14 +- src/lib_shell/legacy_prevalidation.mli | 13 +- .../legacy_prevalidator_classification.ml | 80 +++----- .../legacy_prevalidator_classification.mli | 53 +++-- src/lib_shell/legacy_prevalidator_internal.ml | 117 +++++------ .../legacy_prevalidator_internal.mli | 18 +- .../legacy_prevalidator_pending_operations.ml | 5 +- ...legacy_prevalidator_pending_operations.mli | 19 +- src/lib_shell/monitor_directory.ml | 12 +- src/lib_shell/node.ml | 8 +- src/lib_shell/node.mli | 2 +- src/lib_shell/node_event.ml | 8 +- src/lib_shell/p2p_reader.ml | 12 +- src/lib_shell/p2p_reader.mli | 13 +- src/lib_shell/peer_validator.ml | 6 +- src/lib_shell/peer_validator.mli | 7 +- src/lib_shell/peer_validator_events.ml | 56 +++--- src/lib_shell/prevalidation.ml | 31 ++- src/lib_shell/prevalidation.mli | 9 +- src/lib_shell/prevalidator.ml | 14 +- src/lib_shell/prevalidator.mld | 2 +- src/lib_shell/prevalidator.mli | 8 +- src/lib_shell/prevalidator_classification.ml | 82 +++----- src/lib_shell/prevalidator_classification.mli | 57 +++--- src/lib_shell/prevalidator_events.ml | 24 +-- src/lib_shell/prevalidator_internal.ml | 107 +++++----- src/lib_shell/prevalidator_internal_common.ml | 10 +- .../prevalidator_internal_common.mli | 2 +- .../prevalidator_pending_operations.ml | 5 +- .../prevalidator_pending_operations.mli | 26 +-- src/lib_shell/protocol_directory.ml | 7 +- src/lib_shell/protocol_validator.ml | 23 +-- src/lib_shell/protocol_validator.mli | 7 +- src/lib_shell/protocol_validator_event.ml | 6 +- src/lib_shell/shell_operation.ml | 6 +- src/lib_shell/shell_operation.mli | 11 +- src/lib_shell/shell_plugin.ml | 44 ++--- src/lib_shell/shell_plugin.mli | 22 +-- src/lib_shell/test/generators.ml | 49 +++-- src/lib_shell/test/generators_tree.ml | 29 ++- src/lib_shell/test/legacy_generators.ml | 52 +++-- src/lib_shell/test/legacy_generators_tree.ml | 27 ++- .../test/legacy_test_prevalidation.ml | 21 +- .../test/legacy_test_prevalidation_t.ml | 31 ++- ...legacy_test_prevalidator_classification.ml | 127 +++++------- ..._prevalidator_classification_operations.ml | 98 ++++------ ...cy_test_prevalidator_pending_operations.ml | 2 +- src/lib_shell/test/shell_test_helpers.ml | 4 +- .../test/test_consensus_heuristic.ml | 28 +-- src/lib_shell/test/test_peer_validator.ml | 4 +- src/lib_shell/test/test_prevalidation_t.ml | 2 - .../test/test_prevalidator_classification.ml | 130 +++++-------- ..._prevalidator_classification_operations.ml | 102 ++++------ .../test_prevalidator_pending_operations.ml | 2 +- src/lib_shell/test/test_protocol_validator.ml | 12 +- src/lib_shell/test/test_shell_operation.ml | 21 +- src/lib_shell/validator.ml | 8 +- src/lib_shell/validator.mli | 2 +- src/lib_shell_benchmarks/io_benchmarks.ml | 16 +- src/lib_shell_benchmarks/io_helpers.ml | 4 +- src/lib_shell_services/block_services.ml | 133 ++++++------- src/lib_shell_services/block_services.mli | 121 ++++-------- .../block_validator_errors.ml | 100 +++++----- .../block_validator_errors.mli | 37 ++-- .../block_validator_worker_state.ml | 6 +- .../block_validator_worker_state.mli | 2 +- src/lib_shell_services/chain_services.ml | 22 +-- src/lib_shell_services/chain_services.mli | 51 ++--- .../chain_validator_worker_state.ml | 6 +- .../chain_validator_worker_state.mli | 2 +- src/lib_shell_services/injection_services.ml | 26 +-- src/lib_shell_services/injection_services.mli | 29 ++- src/lib_shell_services/monitor_services.ml | 19 +- src/lib_shell_services/monitor_services.mli | 41 ++-- .../peer_validator_worker_state.ml | 13 +- .../peer_validator_worker_state.mli | 4 +- src/lib_shell_services/preapply_result.ml | 29 ++- src/lib_shell_services/preapply_result.mli | 12 +- .../prevalidator_worker_state.ml | 70 +++---- .../prevalidator_worker_state.mli | 12 +- src/lib_shell_services/protocol_services.ml | 4 +- src/lib_shell_services/protocol_services.mli | 29 +-- src/lib_shell_services/state_events.ml | 6 +- src/lib_shell_services/store_errors.ml | 184 ++++++++---------- src/lib_shell_services/validation_errors.ml | 62 +++--- src/lib_shell_services/validation_errors.mli | 22 +-- src/lib_shell_services/validation_events.ml | 8 +- src/lib_signer_backends/unencrypted.ml | 2 +- src/lib_store/unix/snapshots.ml | 2 +- src/lib_test/assert_lib.ml | 34 ++-- src/lib_test/assert_lib.mli | 8 +- src/lib_tree_encoding/tezos_tree_encoding.mli | 2 +- src/lib_tree_encoding/tree.ml | 4 +- src/lib_tree_encoding/tree.mli | 2 +- src/lib_validation/block_validation.mli | 2 +- src/lib_validation/external_validation.ml | 2 +- .../lib_client/client_proto_main.ml | 12 +- .../lib_client/client_proto_main.mli | 2 +- src/proto_000_Ps9mPmXa/lib_protocol/dune | 2 +- .../lib_client/operation_result.ml | 12 +- src/proto_001_PtCJ7pwo/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 2 +- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 2 +- src/proto_002_PsYLVpVv/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 4 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 15 +- src/proto_003_PsddFKi3/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 4 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 15 +- src/proto_004_Pt24m4xi/lib_protocol/dune | 2 +- src/proto_005_PsBABY5H/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 15 +- src/proto_005_PsBabyM1/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 36 ++-- src/proto_006_PsCARTHA/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 4 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 15 +- src/proto_007_PsDELPH1/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 36 ++-- src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml | 4 +- src/proto_008_PtEdo2Zk/lib_protocol/dune | 2 +- src/proto_008_PtEdoTez/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 35 ++-- src/proto_009_PsFLoren/lib_plugin/plugin.ml | 4 +- src/proto_009_PsFLoren/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- .../lib_client/operation_result.ml | 12 +- .../client_proto_context_commands.ml | 35 ++-- src/proto_010_PtGRANAD/lib_plugin/plugin.ml | 4 +- src/proto_010_PtGRANAD/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- src/proto_011_PtHangz2/lib_client/mockup.ml | 8 +- .../lib_client/operation_result.ml | 12 +- src/proto_011_PtHangz2/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 35 ++-- .../client_proto_stresstest_commands.ml | 69 +++---- src/proto_011_PtHangz2/lib_plugin/plugin.ml | 4 +- src/proto_011_PtHangz2/lib_protocol/dune | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 9 +- src/proto_012_Psithaca/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_012_Psithaca/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 15 +- .../client_proto_stresstest_commands.ml | 69 +++---- .../lib_delegate/baking_events.ml | 100 +++++----- .../lib_delegate/delegate_events.ml | 68 +++---- src/proto_012_Psithaca/lib_plugin/plugin.ml | 67 +++---- src/proto_012_Psithaca/lib_protocol/dune | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 38 ++-- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 11 +- src/proto_013_PtJakart/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_013_PtJakart/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 15 +- .../client_proto_stresstest_commands.ml | 54 +++-- .../lib_delegate/baking_events.ml | 100 +++++----- .../lib_delegate/delegate_events.ml | 68 +++---- src/proto_013_PtJakart/lib_injector/common.ml | 2 +- .../lib_injector/common.mli | 12 +- .../lib_injector/disk_persistence.ml | 2 +- .../lib_injector/disk_persistence.mli | 2 +- .../lib_injector/injector_events.ml | 6 +- .../lib_injector/injector_functor.ml | 26 +-- .../lib_injector/injector_worker_types.ml | 2 +- .../lib_injector/l1_operation.mli | 2 +- src/proto_013_PtJakart/lib_plugin/plugin.ml | 67 +++---- src/proto_013_PtJakart/lib_protocol/dune | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 44 ++--- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 11 +- src/proto_014_PtKathma/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_014_PtKathma/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 15 +- .../client_proto_stresstest_commands.ml | 67 +++---- src/proto_014_PtKathma/lib_injector/common.ml | 2 +- .../lib_injector/common.mli | 12 +- .../lib_injector/disk_persistence.ml | 2 +- .../lib_injector/disk_persistence.mli | 2 +- .../lib_injector/injector_events.ml | 6 +- .../lib_injector/injector_functor.ml | 26 +-- .../lib_injector/injector_worker_types.ml | 2 +- .../lib_injector/l1_operation.mli | 2 +- src/proto_014_PtKathma/lib_plugin/RPC.ml | 2 +- src/proto_014_PtKathma/lib_protocol/dune | 2 +- .../lib_benchmark/execution_context.ml | 2 +- .../lib_benchmark/test/test_helpers.ml | 2 +- .../sc_rollup_benchmarks.ml | 4 +- .../lib_benchmarks_proto/ticket_benchmarks.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 48 ++--- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 11 +- src/proto_015_PtLimaPt/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_015_PtLimaPt/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 48 ++--- .../client_proto_stresstest_commands.ml | 67 +++---- .../lib_delegate/abstract_context_index.ml | 3 +- .../lib_delegate/abstract_context_index.mli | 3 +- .../lib_delegate/baking_cache.ml | 3 +- .../lib_delegate/baking_configuration.ml | 4 +- .../lib_delegate/baking_configuration.mli | 9 +- .../lib_delegate/baking_events.ml | 104 +++++----- .../lib_delegate/baking_lib.ml | 4 +- .../lib_delegate/baking_nonces.ml | 42 ++-- .../lib_delegate/baking_nonces.mli | 41 ++-- .../lib_delegate/baking_scheduling.ml | 8 +- .../lib_delegate/baking_simulator.ml | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- .../lib_delegate/baking_state.ml | 28 +-- .../lib_delegate/baking_state.mli | 8 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/block_forge.ml | 13 +- .../lib_delegate/client_baking_blocks.ml | 22 +-- .../lib_delegate/client_baking_blocks.mli | 18 +- .../client_baking_denunciation.ml | 17 +- .../lib_delegate/client_daemon.ml | 6 +- .../lib_delegate/delegate_events.ml | 28 +-- .../lib_delegate/logging.ml | 8 +- .../lib_delegate/node_rpc.ml | 8 +- .../lib_delegate/node_rpc.mli | 6 +- .../lib_delegate/operation_pool.ml | 2 +- .../lib_delegate/operation_selection.ml | 7 +- .../lib_delegate/operation_selection.mli | 2 +- .../lib_delegate/operation_worker.ml | 7 +- .../lib_delegate/operation_worker.mli | 2 +- .../lib_delegate/state_transitions.ml | 22 +-- .../test/mockup_simulator/faked_services.ml | 27 ++- .../test/mockup_simulator/mockup_simulator.ml | 166 ++++++---------- .../mockup_simulator/mockup_simulator.mli | 38 ++-- .../lib_injector/disk_persistence.ml | 2 +- .../lib_injector/disk_persistence.mli | 2 +- .../lib_injector/injector_common.ml | 4 +- .../lib_injector/injector_common.mli | 12 +- .../lib_injector/injector_events.ml | 6 +- .../lib_injector/injector_functor.ml | 26 +-- .../lib_injector/injector_worker_types.ml | 2 +- .../lib_injector/l1_operation.mli | 2 +- src/proto_015_PtLimaPt/lib_plugin/mempool.ml | 57 +++--- .../lib_plugin/test/generators.ml | 33 ++-- .../lib_plugin/test/test_conflict_handler.ml | 2 +- .../lib_plugin/test/test_filter_state.ml | 29 ++- .../lib_plugin/test/test_utils.ml | 12 +- src/proto_015_PtLimaPt/lib_protocol/dune | 2 +- .../lib_protocol/test/helpers/assert.ml | 14 +- .../lib_protocol/test/helpers/block.ml | 19 +- .../lib_protocol/test/helpers/block.mli | 6 +- .../lib_protocol/test/helpers/context.ml | 2 +- .../lib_protocol/test/helpers/context.mli | 7 +- .../lib_protocol/test/helpers/incremental.ml | 20 +- .../lib_protocol/test/helpers/op.ml | 6 +- .../lib_protocol/test/helpers/op.mli | 10 +- .../test/helpers/operation_generator.ml | 8 +- .../consensus/test_double_baking.ml | 4 +- .../consensus/test_double_endorsement.ml | 2 +- .../consensus/test_double_preendorsement.ml | 2 +- .../integration/operations/test_sc_rollup.ml | 8 +- .../integration/operations/test_tx_rollup.ml | 20 +- .../integration/operations/test_voting.ml | 61 +++--- .../test/integration/test_frozen_bonds.ml | 2 +- .../test/integration/test_token.ml | 3 +- .../validate/generator_descriptors.ml | 40 +--- .../validate/generator_descriptors.mli | 2 +- .../validate/manager_operation_helpers.ml | 4 +- .../test/integration/validate/test_mempool.ml | 10 +- .../integration/validate/validate_helpers.ml | 2 +- .../test/regression/test_logging.ml | 4 +- .../test/unit/test_contract_repr.ml | 2 +- .../test/unit/test_destination_repr.ml | 2 +- .../lib_protocol/test/unit/test_receipt.ml | 3 +- .../test/unit/test_sc_rollup_game.ml | 2 +- .../test/unit/test_sc_rollup_storage.ml | 6 +- .../test/unit/test_zk_rollup_storage.ml | 2 +- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml | 17 +- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli | 2 +- .../lib_tx_rollup/context.ml | 8 +- .../lib_tx_rollup/context.mli | 4 +- src/proto_015_PtLimaPt/lib_tx_rollup/error.ml | 36 ++-- .../lib_tx_rollup/error.mli | 12 +- src/proto_015_PtLimaPt/lib_tx_rollup/event.ml | 22 +-- src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml | 4 +- .../lib_tx_rollup/inbox.mli | 2 +- .../lib_tx_rollup/l2_transaction.mli | 2 +- .../lib_tx_rollup/l2block.ml | 12 +- .../lib_tx_rollup/l2block.mli | 8 +- src/proto_015_PtLimaPt/lib_tx_rollup/state.ml | 2 +- .../lib_tx_rollup/state.mli | 28 +-- .../lib_tx_rollup/stores.ml | 53 ++--- .../lib_tx_rollup/stores.mli | 14 +- .../bin_sc_rollup_node/RPC_server.ml | 5 +- .../batcher_worker_types.ml | 2 +- .../bin_sc_rollup_node/commitment.ml | 3 +- .../bin_sc_rollup_node/commitment_sig.ml | 2 +- .../bin_sc_rollup_node/configuration.ml | 2 +- .../bin_sc_rollup_node/context.ml | 2 +- .../bin_sc_rollup_node/context.mli | 2 +- .../bin_sc_rollup_node/daemon.ml | 2 +- .../bin_sc_rollup_node/daemon_event.ml | 4 +- .../bin_sc_rollup_node/daemon_event.mli | 5 +- .../bin_sc_rollup_node/dal_slots_tracker.ml | 6 +- .../bin_sc_rollup_node/dal_slots_tracker.mli | 4 +- .../dal_slots_tracker_event.ml | 4 +- .../bin_sc_rollup_node/inbox.ml | 2 +- .../bin_sc_rollup_node/inbox.mli | 7 +- .../bin_sc_rollup_node/inbox_event.ml | 2 +- .../bin_sc_rollup_node/inbox_event.mli | 2 +- .../bin_sc_rollup_node/interpreter.ml | 2 +- .../bin_sc_rollup_node/layer1.ml | 25 ++- .../bin_sc_rollup_node/layer1.mli | 6 +- .../bin_sc_rollup_node/layer1_event.ml | 2 +- .../bin_sc_rollup_node/layer1_event.mli | 2 +- .../bin_sc_rollup_node/node_context.mli | 6 +- .../sc_rollup_node_errors.ml | 14 +- .../bin_sc_rollup_node/simulation.ml | 4 +- .../bin_sc_rollup_node/simulation.mli | 2 +- .../bin_sc_rollup_node/state.ml | 7 +- .../bin_sc_rollup_node/state.mli | 11 +- .../bin_sc_rollup_node/store.ml | 28 +-- .../bin_sc_rollup_node/store.mli | 14 +- .../lib_benchmark/execution_context.ml | 2 +- .../lib_benchmark/michelson_samplers_base.ml | 1 - .../lib_benchmark/test/test_helpers.ml | 2 +- .../storage_benchmarks.ml | 2 +- .../lib_benchmarks_proto/ticket_benchmarks.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 54 ++--- .../lib_client/client_proto_utils.mli | 4 +- .../lib_client/injection.ml | 28 ++- .../lib_client/injection.mli | 11 +- src/proto_016_PtMumbai/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_016_PtMumbai/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 48 ++--- .../client_proto_stresstest_commands.ml | 67 +++---- .../lib_delegate/abstract_context_index.ml | 3 +- .../lib_delegate/abstract_context_index.mli | 3 +- .../lib_delegate/baking_cache.ml | 3 +- .../lib_delegate/baking_configuration.ml | 4 +- .../lib_delegate/baking_configuration.mli | 9 +- .../lib_delegate/baking_events.ml | 104 +++++----- .../lib_delegate/baking_lib.ml | 4 +- .../lib_delegate/baking_nonces.ml | 42 ++-- .../lib_delegate/baking_nonces.mli | 41 ++-- .../lib_delegate/baking_scheduling.ml | 8 +- .../lib_delegate/baking_simulator.ml | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- .../lib_delegate/baking_state.ml | 48 ++--- .../lib_delegate/baking_state.mli | 10 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/block_forge.ml | 9 +- .../lib_delegate/client_baking_blocks.ml | 22 +-- .../lib_delegate/client_baking_blocks.mli | 18 +- .../client_baking_denunciation.ml | 17 +- .../lib_delegate/client_daemon.ml | 6 +- .../lib_delegate/delegate_events.ml | 28 +-- .../lib_delegate/logging.ml | 8 +- .../lib_delegate/node_rpc.ml | 8 +- .../lib_delegate/node_rpc.mli | 6 +- .../lib_delegate/operation_pool.ml | 2 +- .../lib_delegate/operation_selection.ml | 7 +- .../lib_delegate/operation_selection.mli | 2 +- .../lib_delegate/operation_worker.ml | 7 +- .../lib_delegate/operation_worker.mli | 2 +- .../lib_delegate/state_transitions.ml | 22 +-- .../test/mockup_simulator/faked_services.ml | 29 ++- .../test/mockup_simulator/mockup_simulator.ml | 170 ++++++---------- .../mockup_simulator/mockup_simulator.mli | 40 ++-- .../lib_injector/disk_persistence.ml | 2 +- .../lib_injector/disk_persistence.mli | 2 +- .../lib_injector/injector_common.ml | 6 +- .../lib_injector/injector_common.mli | 18 +- .../lib_injector/injector_events.ml | 6 +- .../lib_injector/injector_functor.ml | 14 +- .../lib_injector/injector_sigs.ml | 14 +- .../lib_injector/injector_worker_types.ml | 2 +- .../lib_injector/l1_operation.mli | 2 +- .../lib_layer2_utils/layer1_services.ml | 6 +- .../lib_layer2_utils/layer1_services.mli | 2 +- src/proto_016_PtMumbai/lib_plugin/RPC.ml | 2 +- src/proto_016_PtMumbai/lib_plugin/mempool.ml | 57 +++--- .../lib_plugin/test/generators.ml | 33 ++-- .../lib_plugin/test/test_conflict_handler.ml | 2 +- .../lib_plugin/test/test_filter_state.ml | 29 ++- .../lib_plugin/test/test_utils.ml | 12 +- src/proto_016_PtMumbai/lib_protocol/dune | 2 +- .../lib_protocol/test/helpers/assert.ml | 14 +- .../lib_protocol/test/helpers/block.ml | 15 +- .../lib_protocol/test/helpers/block.mli | 6 +- .../lib_protocol/test/helpers/context.ml | 4 +- .../lib_protocol/test/helpers/context.mli | 11 +- .../lib_protocol/test/helpers/incremental.ml | 20 +- .../lib_protocol/test/helpers/op.ml | 4 +- .../lib_protocol/test/helpers/op.mli | 20 +- .../test/helpers/operation_generator.ml | 10 +- .../test/helpers/sc_rollup_helpers.ml | 20 +- .../consensus/test_double_baking.ml | 4 +- .../consensus/test_double_endorsement.ml | 2 +- .../consensus/test_double_preendorsement.ml | 2 +- .../integration/operations/test_sc_rollup.ml | 16 +- .../integration/operations/test_tx_rollup.ml | 22 +-- .../integration/operations/test_voting.ml | 63 +++--- .../test/integration/test_frozen_bonds.ml | 2 +- .../test/integration/test_sc_rollup_wasm.ml | 2 +- .../test/integration/test_token.ml | 3 +- .../validate/generator_descriptors.ml | 40 +--- .../validate/generator_descriptors.mli | 2 +- .../validate/manager_operation_helpers.ml | 4 +- .../test/integration/validate/test_mempool.ml | 10 +- .../integration/validate/validate_helpers.ml | 2 +- .../test/pbt/test_refutation_game.ml | 2 +- .../test/pbt/test_sc_rollup_encoding.ml | 2 +- .../test/regression/test_logging.ml | 4 +- .../test/unit/test_contract_repr.ml | 2 +- .../test/unit/test_destination_repr.ml | 2 +- .../test/unit/test_local_contexts.ml | 4 +- .../test/unit/test_operation_repr.ml | 2 +- .../lib_protocol/test/unit/test_receipt.ml | 3 +- .../test/unit/test_sc_rollup_arith.ml | 2 +- .../test/unit/test_sc_rollup_game.ml | 2 +- .../test/unit/test_sc_rollup_inbox.ml | 2 +- .../test/unit/test_sc_rollup_inbox_legacy.ml | 4 +- .../test/unit/test_sc_rollup_storage.ml | 12 +- .../test/unit/test_sc_rollup_wasm.ml | 2 +- .../test/unit/test_zk_rollup_storage.ml | 2 +- .../lib_sc_rollup/l2_message.mli | 2 +- .../lib_sc_rollup/sc_rollup_block.ml | 11 +- .../lib_sc_rollup/sc_rollup_block.mli | 5 +- .../lib_sc_rollup/sc_rollup_context_hash.ml | 8 +- .../lib_sc_rollup/sc_rollup_context_hash.mli | 2 +- .../lib_sc_rollup/sc_rollup_services.ml | 14 +- .../bin_sc_rollup_node/RPC_server.ml | 5 +- .../batcher_worker_types.ml | 2 +- .../bin_sc_rollup_node/commitment.ml | 3 +- .../bin_sc_rollup_node/commitment_sig.ml | 2 +- .../bin_sc_rollup_node/configuration.ml | 2 +- src/proto_alpha/bin_sc_rollup_node/context.ml | 2 +- .../bin_sc_rollup_node/context.mli | 2 +- src/proto_alpha/bin_sc_rollup_node/daemon.ml | 2 +- .../bin_sc_rollup_node/daemon_event.ml | 4 +- .../bin_sc_rollup_node/daemon_event.mli | 5 +- .../bin_sc_rollup_node/dal_slots_tracker.ml | 6 +- .../bin_sc_rollup_node/dal_slots_tracker.mli | 4 +- .../dal_slots_tracker_event.ml | 4 +- src/proto_alpha/bin_sc_rollup_node/inbox.ml | 2 +- src/proto_alpha/bin_sc_rollup_node/inbox.mli | 7 +- .../bin_sc_rollup_node/inbox_event.ml | 2 +- .../bin_sc_rollup_node/inbox_event.mli | 2 +- .../bin_sc_rollup_node/interpreter.ml | 2 +- src/proto_alpha/bin_sc_rollup_node/layer1.ml | 25 ++- src/proto_alpha/bin_sc_rollup_node/layer1.mli | 6 +- .../bin_sc_rollup_node/layer1_event.ml | 2 +- .../bin_sc_rollup_node/layer1_event.mli | 2 +- .../bin_sc_rollup_node/node_context.mli | 6 +- .../sc_rollup_node_errors.ml | 14 +- .../bin_sc_rollup_node/simulation.ml | 4 +- .../bin_sc_rollup_node/simulation.mli | 2 +- src/proto_alpha/bin_sc_rollup_node/state.ml | 7 +- src/proto_alpha/bin_sc_rollup_node/state.mli | 11 +- src/proto_alpha/bin_sc_rollup_node/store.ml | 28 +-- src/proto_alpha/bin_sc_rollup_node/store.mli | 14 +- .../lib_benchmark/execution_context.ml | 2 +- .../lib_benchmark/test/test_helpers.ml | 2 +- .../storage_benchmarks.ml | 2 +- .../lib_benchmarks_proto/ticket_benchmarks.ml | 2 +- .../lib_client/client_proto_context.ml | 4 +- .../lib_client/client_proto_context.mli | 32 +-- .../lib_client/client_proto_utils.mli | 4 +- src/proto_alpha/lib_client/injection.ml | 28 ++- src/proto_alpha/lib_client/injection.mli | 11 +- src/proto_alpha/lib_client/mockup.ml | 15 +- .../lib_client/operation_result.ml | 16 +- src/proto_alpha/lib_client/proxy.ml | 2 +- .../client_proto_context_commands.ml | 48 ++--- .../client_proto_stresstest_commands.ml | 67 +++---- .../lib_delegate/abstract_context_index.ml | 3 +- .../lib_delegate/abstract_context_index.mli | 3 +- src/proto_alpha/lib_delegate/baking_cache.ml | 3 +- .../lib_delegate/baking_configuration.ml | 4 +- .../lib_delegate/baking_configuration.mli | 9 +- src/proto_alpha/lib_delegate/baking_events.ml | 104 +++++----- src/proto_alpha/lib_delegate/baking_lib.ml | 4 +- src/proto_alpha/lib_delegate/baking_nonces.ml | 42 ++-- .../lib_delegate/baking_nonces.mli | 41 ++-- .../lib_delegate/baking_scheduling.ml | 8 +- .../lib_delegate/baking_simulator.ml | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- src/proto_alpha/lib_delegate/baking_state.ml | 48 ++--- src/proto_alpha/lib_delegate/baking_state.mli | 10 +- src/proto_alpha/lib_delegate/baking_vdf.ml | 2 +- src/proto_alpha/lib_delegate/block_forge.ml | 9 +- .../lib_delegate/client_baking_blocks.ml | 22 +-- .../lib_delegate/client_baking_blocks.mli | 18 +- .../client_baking_denunciation.ml | 17 +- src/proto_alpha/lib_delegate/client_daemon.ml | 6 +- .../lib_delegate/delegate_events.ml | 28 +-- src/proto_alpha/lib_delegate/logging.ml | 8 +- src/proto_alpha/lib_delegate/node_rpc.ml | 8 +- src/proto_alpha/lib_delegate/node_rpc.mli | 6 +- .../lib_delegate/operation_pool.ml | 2 +- .../lib_delegate/operation_selection.ml | 7 +- .../lib_delegate/operation_selection.mli | 2 +- .../lib_delegate/operation_worker.ml | 7 +- .../lib_delegate/operation_worker.mli | 2 +- .../lib_delegate/state_transitions.ml | 22 +-- .../test/mockup_simulator/faked_services.ml | 29 ++- .../test/mockup_simulator/mockup_simulator.ml | 170 ++++++---------- .../mockup_simulator/mockup_simulator.mli | 40 ++-- .../lib_injector/disk_persistence.ml | 2 +- .../lib_injector/disk_persistence.mli | 2 +- .../lib_injector/injector_common.ml | 6 +- .../lib_injector/injector_common.mli | 18 +- .../lib_injector/injector_events.ml | 6 +- .../lib_injector/injector_functor.ml | 14 +- src/proto_alpha/lib_injector/injector_sigs.ml | 14 +- .../lib_injector/injector_worker_types.ml | 2 +- src/proto_alpha/lib_injector/l1_operation.mli | 2 +- .../lib_layer2_utils/layer1_services.ml | 6 +- .../lib_layer2_utils/layer1_services.mli | 2 +- src/proto_alpha/lib_plugin/RPC.ml | 2 +- src/proto_alpha/lib_plugin/mempool.ml | 57 +++--- src/proto_alpha/lib_plugin/test/generators.ml | 33 ++-- .../lib_plugin/test/test_conflict_handler.ml | 2 +- .../lib_plugin/test/test_filter_state.ml | 29 ++- src/proto_alpha/lib_plugin/test/test_utils.ml | 12 +- src/proto_alpha/lib_protocol/dune | 2 +- .../lib_protocol/test/helpers/assert.ml | 14 +- .../lib_protocol/test/helpers/block.ml | 15 +- .../lib_protocol/test/helpers/block.mli | 6 +- .../lib_protocol/test/helpers/context.ml | 4 +- .../lib_protocol/test/helpers/context.mli | 11 +- .../lib_protocol/test/helpers/incremental.ml | 20 +- .../lib_protocol/test/helpers/op.ml | 2 +- .../lib_protocol/test/helpers/op.mli | 18 +- .../test/helpers/operation_generator.ml | 4 +- .../test/helpers/sc_rollup_helpers.ml | 20 +- .../consensus/test_double_baking.ml | 4 +- .../consensus/test_double_endorsement.ml | 2 +- .../consensus/test_double_preendorsement.ml | 2 +- .../integration/operations/test_sc_rollup.ml | 16 +- .../integration/operations/test_voting.ml | 63 +++--- .../test/integration/test_frozen_bonds.ml | 2 +- .../test/integration/test_sc_rollup_wasm.ml | 2 +- .../test/integration/test_token.ml | 3 +- .../validate/generator_descriptors.ml | 40 +--- .../validate/generator_descriptors.mli | 2 +- .../test/integration/validate/test_mempool.ml | 10 +- .../integration/validate/validate_helpers.ml | 2 +- .../test/pbt/test_refutation_game.ml | 2 +- .../test/pbt/test_sc_rollup_encoding.ml | 2 +- .../test/regression/test_logging.ml | 4 +- .../test/unit/test_contract_repr.ml | 2 +- .../test/unit/test_destination_repr.ml | 2 +- .../test/unit/test_local_contexts.ml | 4 +- .../test/unit/test_sc_rollup_arith.ml | 2 +- .../test/unit/test_sc_rollup_game.ml | 2 +- .../test/unit/test_sc_rollup_inbox.ml | 2 +- .../test/unit/test_sc_rollup_inbox_legacy.ml | 4 +- .../test/unit/test_sc_rollup_storage.ml | 12 +- .../test/unit/test_sc_rollup_wasm.ml | 2 +- .../test/unit/test_zk_rollup_storage.ml | 2 +- src/proto_alpha/lib_sc_rollup/l2_message.mli | 2 +- .../lib_sc_rollup/sc_rollup_block.ml | 11 +- .../lib_sc_rollup/sc_rollup_block.mli | 5 +- .../lib_sc_rollup/sc_rollup_context_hash.mli | 2 +- .../lib_sc_rollup/sc_rollup_services.ml | 14 +- .../lib_client/client_proto_commands.ml | 9 +- src/proto_demo_counter/lib_protocol/dune | 2 +- src/proto_demo_noops/lib_protocol/dune | 2 +- .../lib_client/client_proto_main.ml | 10 +- .../lib_client/client_proto_main.mli | 2 +- src/proto_genesis/lib_client/proxy.ml | 2 +- src/proto_genesis/lib_protocol/dune | 2 +- tezt/lib_tezos/operation_core.ml | 4 +- tezt/long_tests/qcheck_rpc.ml | 4 +- tezt/tests/baking.ml | 9 +- tezt/tests/tenderbake.ml | 2 +- 782 files changed, 5105 insertions(+), 6700 deletions(-) diff --git a/devtools/get_contracts/config.ml b/devtools/get_contracts/config.ml index 5cc0564a541a..640771aab63f 100644 --- a/devtools/get_contracts/config.ml +++ b/devtools/get_contracts/config.ml @@ -40,10 +40,10 @@ let mainnet_genesis = { time = Time.Protocol.of_notation_exn "2018-06-30T16:07:32Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } @@ -52,10 +52,10 @@ let jakartanet_genesis = { time = Time.Protocol.of_notation_exn "2022-04-27T15:00:00Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisbd16dciJxo9"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } @@ -64,10 +64,10 @@ let ghostnet_genesis = { time = Time.Protocol.of_notation_exn "2022-01-25T15:00:00Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesis1db77eJNeJ9"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } diff --git a/devtools/get_contracts/get_contracts.ml b/devtools/get_contracts/get_contracts.ml index a530eb42b972..ed3bb65a4aeb 100644 --- a/devtools/get_contracts/get_contracts.ml +++ b/devtools/get_contracts/get_contracts.ml @@ -553,11 +553,7 @@ module Make (P : Sigs.PROTOCOL) : Sigs.MAIN = struct let main ~output_dir ctxt ~head : unit tzresult Lwt.t = let open Lwt_result_syntax in let head_hash, head_level = Tezos_store.Store.Block.descriptor head in - Format.printf - "Head is %a, level %ld\n%!" - Tezos_crypto.Block_hash.pp - head_hash - head_level ; + Format.printf "Head is %a, level %ld\n%!" Block_hash.pp head_hash head_level ; let predecessor_timestamp = Tezos_store.Store.Block.timestamp head in let timestamp = Time.Protocol.add predecessor_timestamp 10000L in print_endline "Preparing raw context..." ; @@ -726,14 +722,14 @@ let get_main proto_hash = match List.find (fun (module Proto : Sigs.PROTOCOL) -> - Tezos_crypto.Protocol_hash.(Proto.hash = proto_hash)) + Protocol_hash.(Proto.hash = proto_hash)) (Known_protocols.get_all ()) with | None -> Format.kasprintf invalid_arg "Unknown protocol: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto_hash | Some (module Proto) -> let module Main = Make (Proto) in @@ -786,15 +782,12 @@ let commands = let*! head = Tezos_store.Store.Chain.current_head chain_store in Format.printf "Head block: %a\n%!" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Tezos_store.Store.Block.hash head) ; let* proto_hash = Tezos_store.Store.Block.protocol_hash chain_store head in - Format.printf - "Protocol hash: %a\n%!" - Tezos_crypto.Protocol_hash.pp - proto_hash ; + Format.printf "Protocol hash: %a\n%!" Protocol_hash.pp proto_hash ; let*! ctxt = Tezos_store.Store.Block.context_exn chain_store head in print_endline "Pre-preparing raw context..." ; let (module Main : Sigs.MAIN) = get_main proto_hash in diff --git a/devtools/get_contracts/sigs.ml b/devtools/get_contracts/sigs.ml index 3e91b2b9d9c7..77773763d21d 100644 --- a/devtools/get_contracts/sigs.ml +++ b/devtools/get_contracts/sigs.ml @@ -34,7 +34,7 @@ module type MAIN = sig end module type PROTOCOL = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t module Context : sig type t diff --git a/devtools/yes_wallet/sigs.ml b/devtools/yes_wallet/sigs.ml index 928383effb73..afbbdac14e06 100644 --- a/devtools/yes_wallet/sigs.ml +++ b/devtools/yes_wallet/sigs.ml @@ -79,7 +79,7 @@ module type PROTOCOL = sig context -> Signature.public_key_hash -> bool tzresult Lwt.t end - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t val prepare_context : Tezos_protocol_environment.Context.t -> diff --git a/devtools/yes_wallet/yes_wallet_lib.ml b/devtools/yes_wallet/yes_wallet_lib.ml index 026d5717a413..3429824041d1 100644 --- a/devtools/yes_wallet/yes_wallet_lib.ml +++ b/devtools/yes_wallet/yes_wallet_lib.ml @@ -34,8 +34,7 @@ - creates a 'yes-wallet' directory to be passed to tezos-client -d option *) -let pp_protocol ppf (module P : Sigs.PROTOCOL) = - Tezos_crypto.Protocol_hash.pp ppf P.hash +let pp_protocol ppf (module P : Sigs.PROTOCOL) = Protocol_hash.pp ppf P.hash let pkh_json (alias, pkh, _pk) = Ezjsonm.(dict [("name", string alias); ("value", string pkh)]) @@ -230,8 +229,7 @@ let get_delegates (module P : Sigs.PROTOCOL) context let protocol_of_hash protocol_hash = List.find - (fun (module P : Sigs.PROTOCOL) -> - Tezos_crypto.Protocol_hash.equal P.hash protocol_hash) + (fun (module P : Sigs.PROTOCOL) -> Protocol_hash.equal P.hash protocol_hash) (Known_protocols.get_all ()) (** [load_mainnet_bakers_public_keys base_dir active_backers_only] checkouts @@ -251,10 +249,10 @@ let load_mainnet_bakers_public_keys base_dir active_bakers_only { Genesis.time = Time.Protocol.of_notation_exn "2018-06-30T16:07:32Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } in @@ -270,7 +268,7 @@ let load_mainnet_bakers_public_keys base_dir active_bakers_only let*! block = Tezos_store.Store.Chain.current_head main_chain_store in Format.printf "@[Head block:@;<17 0>%a@]@." - Tezos_crypto.Block_hash.pp + Block_hash.pp (Tezos_store.Store.Block.hash block) ; let header = Store.Block.header block in let*! context = @@ -284,12 +282,12 @@ let load_mainnet_bakers_public_keys base_dir active_bakers_only | None -> Error_monad.failwith "Unknown protocol hash: %a.@;Known protocols are: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol_hash Format.( pp_print_list ~pp_sep:(fun fmt () -> pp_print_string fmt ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) (List.map (fun (module P : Sigs.PROTOCOL) -> P.hash) @@ Known_protocols.get_all ()) | Some protocol -> diff --git a/docs/doc_gen/node_helpers.ml b/docs/doc_gen/node_helpers.ml index 94e1fc9f2277..642144700ca1 100644 --- a/docs/doc_gen/node_helpers.ml +++ b/docs/doc_gen/node_helpers.ml @@ -27,10 +27,10 @@ let genesis : Genesis.t = { time = Time.Protocol.of_notation_exn "2018-04-17T11:46:23Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisa52f8bUWPcg"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im"; } diff --git a/docs/doc_gen/p2p_doc.ml b/docs/doc_gen/p2p_doc.ml index 4c74aee57948..dbe39a52365f 100644 --- a/docs/doc_gen/p2p_doc.ml +++ b/docs/doc_gen/p2p_doc.ml @@ -56,7 +56,7 @@ let main () = (Data_encoding.Binary.describe Operation.encoding) ; List.iter (fun (_name, hash) -> - let hash = Tezos_crypto.Protocol_hash.of_b58check_exn hash in + let hash = Protocol_hash.of_b58check_exn hash in let (module Proto) = match Registered_protocol.get hash with | None -> assert false diff --git a/docs/doc_gen/rpc_doc.ml b/docs/doc_gen/rpc_doc.ml index b532b05f305c..6c10d89e5beb 100644 --- a/docs/doc_gen/rpc_doc.ml +++ b/docs/doc_gen/rpc_doc.ml @@ -383,17 +383,14 @@ let make_index node required_version = let protocol_dirs = List.map (fun (version, name, intro, hash) -> - let hash = Tezos_crypto.Protocol_hash.of_b58check_exn hash in + let hash = Protocol_hash.of_b58check_exn hash in let (module Proto) = match Registered_protocol.get hash with | None -> (* This is probably an indication that a line for the requested protocol is missing in the dune file of this repository *) - Format.eprintf - "Hash not found: %a" - Tezos_crypto.Protocol_hash.pp - hash ; + Format.eprintf "Hash not found: %a" Protocol_hash.pp hash ; assert false | Some proto -> proto in diff --git a/manifest/main.ml b/manifest/main.ml index 6150545ca4da..e0fd02bd9b0c 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -4061,7 +4061,7 @@ include Tezos_protocol_environment.V%d.Make(Name)() S (sf {| -let hash = Tezos_crypto.Protocol_hash.of_b58check_exn "%s" +let hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn "%s" let name = Tezos_protocol_environment_%s.Name.name include Tezos_raw_protocol_%s include Tezos_raw_protocol_%s.Main diff --git a/src/bin_client/client_protocols_commands.ml b/src/bin_client/client_protocols_commands.ml index 54f20a0d5518..e5e967625962 100644 --- a/src/bin_client/client_protocols_commands.ml +++ b/src/bin_client/client_protocols_commands.ml @@ -31,7 +31,7 @@ let proto_param ~name ~desc t = ~name ~desc (Tezos_clic.parameter (fun _ str -> - Lwt.return (Tezos_crypto.Protocol_hash.of_b58check str))) + Lwt.return (Protocol_hash.of_b58check str))) t let commands () = @@ -51,9 +51,7 @@ let commands () = (fun () (cctxt : #Client_context.full) -> let* protos = Shell_services.Protocol.list cctxt in let*! () = - List.iter_s - (fun ph -> cctxt#message "%a" Tezos_crypto.Protocol_hash.pp ph) - protos + List.iter_s (fun ph -> cctxt#message "%a" Protocol_hash.pp ph) protos in return_unit); command @@ -80,7 +78,7 @@ let commands () = let*! () = cctxt#message "Injected protocol %a successfully" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp hash in return_unit @@ -107,15 +105,12 @@ let commands () = let* proto = Shell_services.Protocol.contents cctxt ph in let* () = Tezos_base_unix.Protocol_files.write_dir - (Tezos_crypto.Protocol_hash.to_short_b58check ph) + (Protocol_hash.to_short_b58check ph) ~hash:ph proto in let*! () = - cctxt#message - "Extracted protocol %a" - Tezos_crypto.Protocol_hash.pp_short - ph + cctxt#message "Extracted protocol %a" Protocol_hash.pp_short ph in return_unit); command @@ -130,7 +125,7 @@ let commands () = let*! () = cctxt#message "Protocol %a uses environment %s" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol_hash (Protocol.module_name_of_env_version env) in @@ -149,7 +144,7 @@ let commands () = let*! () = cctxt#message "Protocol %a successfully fetched." - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short hash in return_unit diff --git a/src/bin_client/main_client.ml b/src/bin_client/main_client.ml index 8574f3481d61..6f02d400f1e1 100644 --- a/src/bin_client/main_client.ml +++ b/src/bin_client/main_client.ml @@ -141,15 +141,15 @@ let get_commands_for_version ~timeout ctxt network chain block protocol = return (Some version, Client_commands.commands_for_version version network) | Some given_version -> - if not (Tezos_crypto.Protocol_hash.equal version given_version) then + if not (Protocol_hash.equal version given_version) then Format.eprintf "@[@{@{Warning@}@}@,\ The protocol provided via `--protocol` (%a)@,\ is not the one retrieved from the node (%a).@]@\n\ @." - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short given_version - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short version ; return ( Some version, diff --git a/src/bin_dal_node/event_legacy.ml b/src/bin_dal_node/event_legacy.ml index 3fe531229427..e8e02d990259 100644 --- a/src/bin_dal_node/event_legacy.ml +++ b/src/bin_dal_node/event_legacy.ml @@ -110,7 +110,7 @@ let layer1_node_new_head = ~name:"dal_node_layer_1_new_head" ~msg:"Head of layer 1's node updated to {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) let layer1_node_tracking_started = @@ -172,7 +172,7 @@ let dac_account_cannot_sign = ("tz4_account", Tezos_crypto.Aggregate_signature.Public_key_hash.encoding) let proto_short_hash_string hash = - Format.asprintf "%a" Tezos_crypto.Protocol_hash.pp_short hash + Format.asprintf "%a" Protocol_hash.pp_short hash let emit_protocol_plugin_resolved ~plugin_name hash = emit protocol_plugin_resolved (plugin_name, proto_short_hash_string hash) diff --git a/src/bin_dal_node/slot_manager.mli b/src/bin_dal_node/slot_manager.mli index 4f5a70d52d3e..f47e4ad751d1 100644 --- a/src/bin_dal_node/slot_manager.mli +++ b/src/bin_dal_node/slot_manager.mli @@ -72,7 +72,7 @@ val get_commitment_slot : baked at level [block_level]. *) val store_slot_headers : block_level:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> (Dal_plugin.slot_header * Dal_plugin.operation_application_result) list -> Store.node_store -> unit Lwt.t diff --git a/src/bin_node/node_identity_file.ml b/src/bin_node/node_identity_file.ml index 84303040b8de..89e9224baf87 100644 --- a/src/bin_node/node_identity_file.ml +++ b/src/bin_node/node_identity_file.ml @@ -186,8 +186,8 @@ let write file identity = let dummy_genesis = { Genesis.time = Time.Protocol.epoch; - block = Tezos_crypto.Block_hash.zero; - protocol = Tezos_crypto.Protocol_hash.zero; + block = Block_hash.zero; + protocol = Protocol_hash.zero; } in let* () = diff --git a/src/bin_node/node_replay_command.ml b/src/bin_node/node_replay_command.ml index 05c9ac7dde67..27bacc9c5e51 100644 --- a/src/bin_node/node_replay_command.ml +++ b/src/bin_node/node_replay_command.ml @@ -39,8 +39,8 @@ module Event = struct | None -> () | Some alias -> Format.fprintf fmt "%s: " alias) ("alias", Data_encoding.(option string)) - ~pp2:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp2:Block_hash.pp + ("hash", Block_hash.encoding) ~pp3:(fun fmt level -> Format.fprintf fmt "%ld" level) ("level", Data_encoding.int32) @@ -61,10 +61,10 @@ module Event = struct "inconsistent context hash - expected: {expected}, replay result: \ {replay_result}" ~level:Error - ~pp1:Tezos_crypto.Context_hash.pp - ("expected", Tezos_crypto.Context_hash.encoding) - ~pp2:Tezos_crypto.Context_hash.pp - ("replay_result", Tezos_crypto.Context_hash.encoding) + ~pp1:Context_hash.pp + ("expected", Context_hash.encoding) + ~pp2:Context_hash.pp + ("replay_result", Context_hash.encoding) let pp_json ppf json = Format.fprintf @@ -117,8 +117,8 @@ module Event = struct "unexpected receipts layout for block {hash} - expected: {expected}, \ replay result: {replay_result}" ~level:Error - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) ~pp2:pp_list_lengths ("expected", Data_encoding.(list int31)) ~pp3:pp_list_lengths @@ -260,7 +260,7 @@ let replay_one_block strict main_chain_store validator_process block = let* () = when_ (not - (Tezos_crypto.Context_hash.equal + (Context_hash.equal expected_context_hash result.validation_store.resulting_context_hash)) (fun () -> diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index 87d83891dbc6..f14b9e4773b2 100644 --- a/src/bin_node/node_run_command.ml +++ b/src/bin_node/node_run_command.ml @@ -628,7 +628,7 @@ let process sandbox verbosity target singleprocess force_history_mode_switch let target = match l with | [block_hash; level] -> - ( Tezos_crypto.Block_hash.of_b58check_exn block_hash, + ( Block_hash.of_b58check_exn block_hash, Int32.of_string level ) | _ -> assert false in diff --git a/src/bin_node/node_snapshot_command.ml b/src/bin_node/node_snapshot_command.ml index 6f1e7245f6ec..06a9e4e7237d 100644 --- a/src/bin_node/node_snapshot_command.ml +++ b/src/bin_node/node_snapshot_command.ml @@ -272,7 +272,7 @@ module Term = struct let* block = match block with | Some s -> ( - match Tezos_crypto.Block_hash.of_b58check_opt s with + match Block_hash.of_b58check_opt s with | Some bh -> return_some bh | None -> failwith "%s is not a valid block identifier." s) | None -> return_none diff --git a/src/bin_node/node_storage_command.ml b/src/bin_node/node_storage_command.ml index 38d65d9e8187..0bfa353d3518 100644 --- a/src/bin_node/node_storage_command.ml +++ b/src/bin_node/node_storage_command.ml @@ -42,11 +42,11 @@ module Event = struct "running integrity check on inodes for block {block_hash} (level \ {block_level}) with context hash {context_hash}" ~level:Notice - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ("block_level", Data_encoding.int32) - ~pp3:Tezos_crypto.Context_hash.pp - ("context_hash", Tezos_crypto.Context_hash.encoding) + ~pp3:Context_hash.pp + ("context_hash", Context_hash.encoding) end let () = @@ -211,9 +211,7 @@ module Term = struct let* block = resolve_block chain_store block in let*! () = Store.close_store store in let context_hash = Store.Block.context_hash block in - let context_hash_str = - Tezos_crypto.Context_hash.to_b58check context_hash - in + let context_hash_str = Context_hash.to_b58check context_hash in let*! () = Event.( emit @@ -276,9 +274,7 @@ module Term = struct (* This output isn't particularly useful for most users, it will typically be used to inspect context directories using Irmin tooling *) - let () = - Format.printf "%a@." Tezos_crypto.Context_hash.pp head_context_hash - in + let () = Format.printf "%a@." Context_hash.pp head_context_hash in return_unit) let auto_repair = diff --git a/src/bin_wasm_debugger/messages.ml b/src/bin_wasm_debugger/messages.ml index 071a1cb5c6c9..b31dc0e95460 100644 --- a/src/bin_wasm_debugger/messages.ml +++ b/src/bin_wasm_debugger/messages.ml @@ -134,7 +134,7 @@ let pp_input ppf bytes = "Info_per_level {predecessor_timestamp = %a; predecessor = %a}" Timestamp.pp predecessor_timestamp - Tezos_crypto.Block_hash.pp + Block_hash.pp predecessor | External msg -> Format.fprintf ppf "%a" Hex.pp (Hex.of_string msg) in diff --git a/src/lib_benchmark/crypto_samplers.ml b/src/lib_benchmark/crypto_samplers.ml index c48149f5b83d..305e41b93ce0 100644 --- a/src/lib_benchmark/crypto_samplers.ml +++ b/src/lib_benchmark/crypto_samplers.ml @@ -50,7 +50,7 @@ module type P_Finite_key_pool_S = sig end module type Signature_S = sig - include Tezos_crypto.S.SIGNATURE + include Tezos_crypto.Intfs.SIGNATURE type algo diff --git a/src/lib_client_base/client_confirmations.ml b/src/lib_client_base/client_confirmations.ml index abca8ba1ed6a..3eecb9fabe73 100644 --- a/src/lib_client_base/client_confirmations.ml +++ b/src/lib_client_base/client_confirmations.ml @@ -30,15 +30,14 @@ let in_block operation_hash operations = (fun i ops -> List.iteri (fun j op -> - if Tezos_crypto.Operation_hash.equal operation_hash op then - raise (Found (i, j))) + if Operation_hash.equal operation_hash op then raise (Found (i, j))) ops) operations ; None with Found (i, j) -> Some (i, j) type operation_status = - | Confirmed of (Tezos_crypto.Block_hash.t * int * int) + | Confirmed of (Block_hash.t * int * int) | Pending | Still_not_found @@ -46,22 +45,20 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain ?(predecessors = 10) ?(confirmations = 1) ?branch operation_hash = let open Lwt_result_syntax in let exception WrapError of error list in - let exception Outdated of Tezos_crypto.Operation_hash.t in + let exception Outdated of Operation_hash.t in (* Table of known blocks: - None: if neither the block or its predecessors contains the operation - (Some ((hash, i, j), n)): if the `hash` contains the operation in list `i` at position `j` and if `hash` denotes the `n-th` predecessors of the block. *) - let blocks : - ((Tezos_crypto.Block_hash.t * int * int) * int) option - Tezos_crypto.Block_hash.Table.t = - Tezos_crypto.Block_hash.Table.create ~random:true confirmations + let blocks : ((Block_hash.t * int * int) * int) option Block_hash.Table.t = + Block_hash.Table.create ~random:true confirmations in (* Fetch _all_ the 'unknown' predecessors af a block. *) let fetch_predecessors (hash, header) = let rec loop acc (_hash, header) = let predecessor = header.Block_header.predecessor in - if Tezos_crypto.Block_hash.Table.mem blocks predecessor then return acc + if Block_hash.Table.mem blocks predecessor then return acc else let* shell = Chain_services.Blocks.Header.shell_header @@ -93,7 +90,7 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain let predecessor = header.Tezos_base.Block_header.predecessor in let pred_block = WithExceptions.Option.to_exn ~none:Not_found - @@ Tezos_crypto.Block_hash.Table.find blocks predecessor + @@ Block_hash.Table.find blocks predecessor in match pred_block with | Some (block_with_op, n) -> @@ -101,13 +98,10 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain ctxt#answer "Operation received %d confirmations as of block: %a" (n + 1) - Tezos_crypto.Block_hash.pp + Block_hash.pp hash in - Tezos_crypto.Block_hash.Table.add - blocks - hash - (Some (block_with_op, n + 1)) ; + Block_hash.Table.add blocks hash (Some (block_with_op, n + 1)) ; if n + 1 < confirmations then return Pending else return (Confirmed block_with_op) | None -> ( @@ -120,21 +114,18 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain in match in_block operation_hash operations with | None -> - Tezos_crypto.Block_hash.Table.add blocks hash None ; + Block_hash.Table.add blocks hash None ; return Still_not_found | Some (i, j) -> let*! () = ctxt#answer "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash i j in - Tezos_crypto.Block_hash.Table.add - blocks - hash - (Some ((hash, i, j), 0)) ; + Block_hash.Table.add blocks hash (Some ((hash, i, j), 0)) ; if confirmations <= 0 then return (Confirmed (hash, i, j)) else return Pending) in @@ -147,15 +138,14 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain in match r with | Ok live_blocks -> - if Tezos_crypto.Block_hash.Set.mem branch_hash live_blocks then - Lwt.return_unit + if Block_hash.Set.mem branch_hash live_blocks then Lwt.return_unit else let*! () = ctxt#error "The operation %a is outdated and may never be included in \ the chain.@,\ We recommend to use an external block explorer." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp operation_hash in Lwt.fail (Outdated operation_hash) @@ -208,7 +198,7 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain | None -> failwith "..." | Some (hash, _) -> ( stop () ; - match Tezos_crypto.Block_hash.Table.find blocks hash with + match Block_hash.Table.find blocks hash with | None | Some None -> assert false | Some (Some (hash, _)) -> return hash) in @@ -249,7 +239,7 @@ let wait_for_operation_inclusion (ctxt : #Client_context.full) ~chain ~block:(`Hash (head, block_hook + 1)) () in - Tezos_crypto.Block_hash.Table.add blocks oldest None ; + Block_hash.Table.add blocks oldest None ; loop block_hook let lookup_operation_in_previous_block ctxt chain operation_hash i = @@ -306,7 +296,7 @@ let wait_for_bootstrapped ?(retry = fun f x -> f x) if !display then ctxt#message "Current head: %a (timestamp: %a, validation: %a)" - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short hash Time.System.pp_hum (Time.System.of_protocol_exn time) diff --git a/src/lib_client_base/client_confirmations.mli b/src/lib_client_base/client_confirmations.mli index 76f60ebb13c7..725f2288c44a 100644 --- a/src/lib_client_base/client_confirmations.mli +++ b/src/lib_client_base/client_confirmations.mli @@ -35,9 +35,9 @@ val wait_for_operation_inclusion : chain:Chain_services.chain -> ?predecessors:int -> ?confirmations:int -> - ?branch:Tezos_crypto.Block_hash.t -> - Tezos_crypto.Operation_hash.t -> - (Tezos_crypto.Block_hash.t * int * int) tzresult Lwt.t + ?branch:Block_hash.t -> + Operation_hash.t -> + (Block_hash.t * int * int) tzresult Lwt.t (** lookup an operation in [predecessors] previous blocks, starting from head *) @@ -45,8 +45,8 @@ val lookup_operation_in_previous_blocks : #Client_context.full -> chain:Block_services.chain -> predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> - (Tezos_crypto.Block_hash.t * int * int) option tzresult Lwt.t + Operation_list_hash.elt -> + (Block_hash.t * int * int) option tzresult Lwt.t (** returns when the node consider itself as bootstrapped. @@ -57,13 +57,11 @@ val lookup_operation_in_previous_blocks : val wait_for_bootstrapped : ?retry: (((#Client_context.full as 'a) -> - ((Tezos_crypto.Block_hash.t * Time.Protocol.t) Lwt_stream.t - * Tezos_rpc.Context.stopper) + ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t) -> 'a -> - ((Tezos_crypto.Block_hash.t * Time.Protocol.t) Lwt_stream.t - * Tezos_rpc.Context.stopper) + ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t) -> 'a -> diff --git a/src/lib_client_base/client_keys.ml b/src/lib_client_base/client_keys.ml index 4be72df4c2ef..38be6d62cfa7 100644 --- a/src/lib_client_base/client_keys.ml +++ b/src/lib_client_base/client_keys.ml @@ -413,7 +413,7 @@ module type AGGREGATE_SIGNER = sig end module Make_common_type (S : sig - include Tezos_crypto.S.COMMON_SIGNATURE + include Tezos_crypto.Intfs.COMMON_SIGNATURE type pk_uri @@ -443,7 +443,7 @@ end) module type Signature_S = sig include - Tezos_crypto.S.SIGNATURE + Tezos_crypto.Intfs.SIGNATURE with type watermark = Tezos_crypto.Signature.watermark val concat : Bytes.t -> t -> Bytes.t diff --git a/src/lib_client_base_unix/client_config.ml b/src/lib_client_base_unix/client_config.ml index a7a4a6e57745..4cb6406aa77e 100644 --- a/src/lib_client_base_unix/client_config.ml +++ b/src/lib_client_base_unix/client_config.ml @@ -32,7 +32,7 @@ type cli_args = { confirmations : int option; sources : Tezos_proxy.Light.sources_config option; password_filename : string option; - protocol : Tezos_crypto.Protocol_hash.t option; + protocol : Protocol_hash.t option; print_timings : bool; log_requests : bool; better_errors : bool; @@ -407,9 +407,7 @@ let protocol_parameter () = match Seq.filter (fun (hash, _commands) -> - String.has_prefix - ~prefix:arg - (Tezos_crypto.Protocol_hash.to_b58check hash)) + String.has_prefix ~prefix:arg (Protocol_hash.to_b58check hash)) (Client_commands.get_versions ()) @@ () with @@ -688,8 +686,7 @@ let config_show_client (cctxt : #Client_context.full) (config_file : string) cfg (* The implementation of ["config"; "show"] when --mode is "mockup" *) let config_show_mockup (cctxt : #Client_context.full) - (protocol_hash_opt : Tezos_crypto.Protocol_hash.t option) - (base_dir : string) = + (protocol_hash_opt : Protocol_hash.t option) (base_dir : string) = let open Lwt_result_syntax in let* () = fail_on_non_mockup_dir cctxt in let* mockup, _ = @@ -781,8 +778,7 @@ let config_init_mockup cctxt protocol_hash_opt bootstrap_accounts_file return_unit let commands config_file cfg (client_mode : client_mode) - (protocol_hash_opt : Tezos_crypto.Protocol_hash.t option) - (base_dir : string) = + (protocol_hash_opt : Protocol_hash.t option) (base_dir : string) = let open Tezos_clic in let group = { @@ -1243,7 +1239,7 @@ type t = * Shell_services.chain * Shell_services.block * int option option - * Tezos_crypto.Protocol_hash.t option option + * Protocol_hash.t option option * bool * bool * string option diff --git a/src/lib_client_base_unix/client_context_unix.mli b/src/lib_client_base_unix/client_context_unix.mli index 757c01523709..97adf9ab4092 100644 --- a/src/lib_client_base_unix/client_context_unix.mli +++ b/src/lib_client_base_unix/client_context_unix.mli @@ -57,7 +57,7 @@ class unix_mockup : class unix_proxy : base_dir:string - -> ?protocol:Tezos_crypto.Protocol_hash.t + -> ?protocol:Protocol_hash.t -> chain:Shell_services.chain -> block:Shell_services.block -> confirmations:int option diff --git a/src/lib_client_base_unix/client_main_run.ml b/src/lib_client_base_unix/client_main_run.ml index 86db94288c89..989de57b3389 100644 --- a/src/lib_client_base_unix/client_main_run.ml +++ b/src/lib_client_base_unix/client_main_run.ml @@ -39,8 +39,7 @@ let builtin_commands = (fun () (cctxt : #Client_context.full) -> let* () = Seq.iter_s - (fun (ver, _) -> - cctxt#message "%a" Tezos_crypto.Protocol_hash.pp_short ver) + (fun (ver, _) -> cctxt#message "%a" Protocol_hash.pp_short ver) (Client_commands.get_versions ()) in return_ok_unit); diff --git a/src/lib_client_commands/client_admin_commands.ml b/src/lib_client_commands/client_admin_commands.ml index a93c18501a28..004f6d9391aa 100644 --- a/src/lib_client_commands/client_admin_commands.ml +++ b/src/lib_client_commands/client_admin_commands.ml @@ -28,8 +28,7 @@ let block_param ~name ~desc t = Tezos_clic.param ~name ~desc - (Tezos_clic.parameter (fun _ str -> - Lwt.return (Tezos_crypto.Block_hash.of_b58check str))) + (Tezos_clic.parameter (fun _ str -> Lwt.return (Block_hash.of_b58check str))) t let operation_param ~name ~desc t = @@ -37,7 +36,7 @@ let operation_param ~name ~desc t = ~name ~desc (Tezos_clic.parameter (fun _ str -> - Lwt.return (Tezos_crypto.Operation_hash.of_b58check str))) + Lwt.return (Operation_hash.of_b58check str))) t let commands () = @@ -66,7 +65,7 @@ let commands () = let*! () = cctxt#message "Block %a no longer marked invalid." - Tezos_crypto.Block_hash.pp + Block_hash.pp block in return_unit) @@ -84,7 +83,7 @@ let commands () = let*! () = cctxt#message "Block %a no longer marked invalid." - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short hash in return_unit) @@ -103,7 +102,7 @@ let commands () = let*! () = cctxt#message "@[<v 0>Checkpoint: %a@,Checkpoint level: %ld@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp checkpoint_hash checkpoint_level in @@ -125,10 +124,7 @@ let commands () = Shell_services.Mempool.ban_operation cctxt ~chain:cctxt#chain op_hash in let*! () = - cctxt#message - "Operation %a is now banned." - Tezos_crypto.Operation_hash.pp - op_hash + cctxt#message "Operation %a is now banned." Operation_hash.pp op_hash in return ()); command @@ -150,7 +146,7 @@ let commands () = let*! () = cctxt#message "Operation %a is now unbanned." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash in return ()); diff --git a/src/lib_client_commands/client_commands.ml b/src/lib_client_commands/client_commands.ml index 18c2d4f29deb..c7bc47d017df 100644 --- a/src/lib_client_commands/client_commands.ml +++ b/src/lib_client_commands/client_commands.ml @@ -31,18 +31,18 @@ type network = [`Mainnet | `Testnet] exception Version_not_found -let versions = Tezos_crypto.Protocol_hash.Table.create 7 +let versions = Protocol_hash.Table.create 7 -let get_versions () = Tezos_crypto.Protocol_hash.Table.to_seq versions +let get_versions () = Protocol_hash.Table.to_seq versions let register name commands = let previous = Option.value ~default:(fun _network_opt -> []) - @@ Tezos_crypto.Protocol_hash.Table.find versions name + @@ Protocol_hash.Table.find versions name in - Tezos_crypto.Protocol_hash.Table.replace versions name (fun network_opt -> + Protocol_hash.Table.replace versions name (fun network_opt -> commands network_opt @ previous network_opt) let commands_for_version version = WithExceptions.Option.to_exn ~none:Version_not_found - @@ Tezos_crypto.Protocol_hash.Table.find versions version + @@ Protocol_hash.Table.find versions version diff --git a/src/lib_client_commands/client_commands.mli b/src/lib_client_commands/client_commands.mli index 4bc970b47c82..650b9ab101b2 100644 --- a/src/lib_client_commands/client_commands.mli +++ b/src/lib_client_commands/client_commands.mli @@ -31,12 +31,9 @@ type network = [`Mainnet | `Testnet] exception Version_not_found -val register : - Tezos_crypto.Protocol_hash.t -> (network option -> command list) -> unit +val register : Protocol_hash.t -> (network option -> command list) -> unit -val commands_for_version : - Tezos_crypto.Protocol_hash.t -> network option -> command list +val commands_for_version : Protocol_hash.t -> network option -> command list val get_versions : - unit -> - (Tezos_crypto.Protocol_hash.t * (network option -> command list)) Seq.t + unit -> (Protocol_hash.t * (network option -> command list)) Seq.t diff --git a/src/lib_client_commands/client_helpers_commands.ml b/src/lib_client_commands/client_helpers_commands.ml index 82a865c1203a..bbf11e95a601 100644 --- a/src/lib_client_commands/client_helpers_commands.ml +++ b/src/lib_client_commands/client_helpers_commands.ml @@ -72,9 +72,7 @@ let commands () = ~desc:"the block hash from which to compute the chain id" @@ stop) (fun () block_hash_str (cctxt : #Client_context.full) -> - let* block_hash = - Lwt.return (Tezos_crypto.Block_hash.of_b58check block_hash_str) - in + let* block_hash = Lwt.return (Block_hash.of_b58check block_hash_str) in let chain_id = Tezos_crypto.Chain_id.of_block_hash block_hash in let*! () = cctxt#message "%a" Tezos_crypto.Chain_id.pp chain_id in return_unit); diff --git a/src/lib_client_commands/client_report_commands.ml b/src/lib_client_commands/client_report_commands.ml index 950c30bc1cd4..b9330a418903 100644 --- a/src/lib_client_commands/client_report_commands.ml +++ b/src/lib_client_commands/client_report_commands.ml @@ -29,7 +29,7 @@ let print_invalid_blocks ppf (b : Shell_services.Chain.invalid_block) = Format.fprintf ppf "@[<v 2>Hash: %a@ Level: %ld@ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.hash b.level pp_print_trace @@ -66,7 +66,7 @@ let commands () = Format.fprintf ppf "@[<v>%a@]@." - (Format.pp_print_list Tezos_crypto.Block_hash.pp) + (Format.pp_print_list Block_hash.pp) (List.concat heads) ; return_unit); command diff --git a/src/lib_context/disk/context.ml b/src/lib_context/disk/context.ml index f69d5b864eb1..4028701e8e48 100644 --- a/src/lib_context/disk/context.ml +++ b/src/lib_context/disk/context.ml @@ -109,7 +109,7 @@ module type TEZOS_CONTEXT_UNIX = sig (** Rebuild a context from a given snapshot. *) val restore_context : index -> - expected_context_hash:Tezos_crypto.Context_hash.t -> + expected_context_hash:Context_hash.t -> nb_context_elements:int -> fd:Lwt_unix.file_descr -> in_memory:bool -> @@ -167,8 +167,8 @@ module Events = struct ~level:Info ~name:"starting_gc" ~msg:"starting context garbage collection for commit {context_hash}" - ~pp1:Tezos_crypto.Context_hash.pp - ("context_hash", Tezos_crypto.Context_hash.encoding) + ~pp1:Context_hash.pp + ("context_hash", Context_hash.encoding) let ending_gc = declare_2 @@ -313,11 +313,11 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct ()) children) - let get_hash_version _c = Tezos_crypto.Context_hash.Version.of_int 0 + let get_hash_version _c = Context_hash.Version.of_int 0 let set_hash_version c v = let open Lwt_result_syntax in - if Tezos_crypto.Context_hash.Version.(of_int 0 = v) then return c + if Context_hash.Version.(of_int 0 = v) then return c else tzfail (Tezos_context_helpers.Context.Unsupported_context_hash_version v) @@ -356,17 +356,11 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct in match commit_opt with | None -> - Fmt.failwith - "%a: unknown context hash" - Tezos_crypto.Context_hash.pp - context_hash + Fmt.failwith "%a: unknown context hash" Context_hash.pp context_hash | Some commit -> ( let* () = Events.(emit starting_gc) context_hash in Logs.info (fun m -> - m - "Launch GC for commit %a@." - Tezos_crypto.Context_hash.pp - context_hash) ; + m "Launch GC for commit %a@." Context_hash.pp context_hash) ; let finished = function | Ok (stats : Irmin_pack_unix.Stats.Latest_gc.stats) -> let total_duration = @@ -409,10 +403,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct in match commit_opt with | None -> - Fmt.failwith - "%a: unknown context hash" - Tezos_crypto.Context_hash.pp - context_hash + Fmt.failwith "%a: unknown context hash" Context_hash.pp context_hash | Some commit -> let h = Store.Commit.key commit in Store.create_one_commit_store index.repo h path @@ -658,10 +649,10 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let data = WithExceptions.Option.to_exn_f ~none:(fun () -> assert false) o in - Tezos_crypto.Protocol_hash.of_bytes_exn data + Protocol_hash.of_bytes_exn data let add_protocol t v = - let v = Tezos_crypto.Protocol_hash.to_bytes v in + let v = Protocol_hash.to_bytes v in Tree.add t current_protocol_key v let get_test_chain t = @@ -694,9 +685,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct | None -> return_none | Some data -> ( match - Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Block_metadata_hash.encoding - data + Data_encoding.Binary.of_bytes_opt Block_metadata_hash.encoding data with | None -> raise @@ -707,9 +696,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let add_predecessor_block_metadata_hash t hash = let data = - Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Block_metadata_hash.encoding - hash + Data_encoding.Binary.to_bytes_exn Block_metadata_hash.encoding hash in Tree.add t current_predecessor_block_metadata_hash_key data @@ -721,7 +708,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct | Some data -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Operation_metadata_list_list_hash.encoding + Operation_metadata_list_list_hash.encoding data with | None -> @@ -734,7 +721,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let add_predecessor_ops_metadata_hash t hash = let data = Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Operation_metadata_list_list_hash.encoding + Operation_metadata_list_list_hash.encoding hash in Tree.add t current_predecessor_ops_metadata_hash_key data @@ -828,17 +815,11 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct return (Hash.to_context_hash (Store.Commit.hash commit)) let compute_testchain_chain_id genesis = - let genesis_hash = - Tezos_crypto.Block_hash.hash_bytes - [Tezos_crypto.Block_hash.to_bytes genesis] - in + let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in Tezos_crypto.Chain_id.of_block_hash genesis_hash let compute_testchain_genesis forked_block = - let genesis = - Tezos_crypto.Block_hash.hash_bytes - [Tezos_crypto.Block_hash.to_bytes forked_block] - in + let genesis = Block_hash.hash_bytes [Block_hash.to_bytes forked_block] in genesis let commit_test_chain_genesis ctxt (forked_header : Block_header.t) = @@ -855,9 +836,9 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct { forked_header.shell with proto_level = succ forked_header.shell.proto_level; - predecessor = Tezos_crypto.Block_hash.zero; + predecessor = Block_hash.zero; validation_passes = 0; - operations_hash = Tezos_crypto.Operation_list_list_hash.empty; + operations_hash = Operation_list_list_hash.empty; context = Hash.to_context_hash (Store.Commit.hash commit); } in @@ -913,21 +894,13 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let kind_encoding = string_enum [("node", `Node); ("blob", `Blob)] in conv (function - | `Blob h -> - ( `Blob, - Tezos_crypto.Context_hash.to_bytes (Hash.to_context_hash h) ) - | `Node h -> - ( `Node, - Tezos_crypto.Context_hash.to_bytes (Hash.to_context_hash h) )) + | `Blob h -> (`Blob, Context_hash.to_bytes (Hash.to_context_hash h)) + | `Node h -> (`Node, Context_hash.to_bytes (Hash.to_context_hash h))) (function | `Blob, h -> - `Blob - (Hash.of_context_hash - (Tezos_crypto.Context_hash.of_bytes_exn h)) + `Blob (Hash.of_context_hash (Context_hash.of_bytes_exn h)) | `Node, h -> - `Node - (Hash.of_context_hash - (Tezos_crypto.Context_hash.of_bytes_exn h))) + `Node (Hash.of_context_hash (Context_hash.of_bytes_exn h))) (obj2 (req "kind" kind_encoding) (req "value" bytes)) end @@ -962,7 +935,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct (fun k -> P.Commit.Key.to_hash k |> Hash.to_context_hash) parents in - List.sort Tezos_crypto.Context_hash.compare parents + List.sort Context_hash.compare parents | _ -> assert false let context_info = function @@ -973,7 +946,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let set_context ~info ~parents ctxt context_hash = let open Lwt_syntax in - let parents = List.sort Tezos_crypto.Context_hash.compare parents in + let parents = List.sort Context_hash.compare parents in let parents = (* All commit objects in the context are indexed, so it's safe to build a hash-only key referencing them. *) @@ -984,7 +957,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct in let+ c = Store.Commit.v ctxt.index.repo ~info ~parents ctxt.tree in let h = Store.Commit.hash c in - Tezos_crypto.Context_hash.equal context_hash (Hash.to_context_hash h) + Context_hash.equal context_hash (Hash.to_context_hash h) let context_tree ctxt = ctxt.tree @@ -999,30 +972,21 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct conv (function | Contents (h, ()) -> - ( `Contents, - Tezos_crypto.Context_hash.to_bytes (Hash.to_context_hash h) ) - | Node h -> - ( `Node, - Tezos_crypto.Context_hash.to_bytes (Hash.to_context_hash h) )) + (`Contents, Context_hash.to_bytes (Hash.to_context_hash h)) + | Node h -> (`Node, Context_hash.to_bytes (Hash.to_context_hash h))) (function | `Contents, h -> - let h = - Hash.of_context_hash - (Tezos_crypto.Context_hash.of_bytes_exn h) - in + let h = Hash.of_context_hash (Context_hash.of_bytes_exn h) in Contents (h, ()) | `Node, h -> - Node - (Hash.of_context_hash - (Tezos_crypto.Context_hash.of_bytes_exn h))) + Node (Hash.of_context_hash (Context_hash.of_bytes_exn h))) (obj2 (req "kind" kind_encoding) (req "value" bytes)) let hash_encoding : hash Data_encoding.t = let open Data_encoding in conv - (fun h -> Tezos_crypto.Context_hash.to_bytes (Hash.to_context_hash h)) - (fun h -> - Hash.of_context_hash (Tezos_crypto.Context_hash.of_bytes_exn h)) + (fun h -> Context_hash.to_bytes (Hash.to_context_hash h)) + (fun h -> Hash.of_context_hash (Context_hash.of_bytes_exn h)) bytes let entry_encoding : entry Data_encoding.t = @@ -1151,7 +1115,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let*! _ = Store.save_tree ~clear:true repo x y tree in return_some tree - module Commit_hash = Tezos_crypto.Context_hash + module Commit_hash = Context_hash module Block_header = Block_header end diff --git a/src/lib_context/disk/context.mli b/src/lib_context/disk/context.mli index afb28cd97605..0abd034ad2ef 100644 --- a/src/lib_context/disk/context.mli +++ b/src/lib_context/disk/context.mli @@ -52,7 +52,7 @@ module type TEZOS_CONTEXT_UNIX = sig (** Rebuild a context from a given snapshot. *) val restore_context : index -> - expected_context_hash:Tezos_crypto.Context_hash.t -> + expected_context_hash:Context_hash.t -> nb_context_elements:int -> fd:Lwt_unix.file_descr -> in_memory:bool -> diff --git a/src/lib_context/encoding/context.ml b/src/lib_context/encoding/context.ml index aae455d198c7..9463ecf42874 100644 --- a/src/lib_context/encoding/context.ml +++ b/src/lib_context/encoding/context.ml @@ -44,9 +44,9 @@ module Hash : sig val to_raw_string : t -> string - val to_context_hash : t -> Tezos_crypto.Context_hash.t + val to_context_hash : t -> Context_hash.t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end = struct module H = Digestif.Make_BLAKE2B (struct let digest_size = 32 @@ -58,16 +58,14 @@ end = struct let unsafe_of_raw_string s = H.of_raw_string s - let of_context_hash s = - H.of_raw_string (Tezos_crypto.Context_hash.to_string s) + let of_context_hash s = H.of_raw_string (Context_hash.to_string s) - let to_context_hash h = - Tezos_crypto.Context_hash.of_string_exn (H.to_raw_string h) + let to_context_hash h = Context_hash.of_string_exn (H.to_raw_string h) - let pp ppf t = Tezos_crypto.Context_hash.pp ppf (to_context_hash t) + let pp ppf t = Context_hash.pp ppf (to_context_hash t) let of_string x = - match Tezos_crypto.Context_hash.of_b58check x with + match Context_hash.of_b58check x with | Ok x -> Ok (of_context_hash x) | Error err -> Error diff --git a/src/lib_context/encoding/context.mli b/src/lib_context/encoding/context.mli index bb28ea240ac1..68cfe1ff6bab 100644 --- a/src/lib_context/encoding/context.mli +++ b/src/lib_context/encoding/context.mli @@ -30,9 +30,9 @@ module Hash : sig val to_raw_string : t -> string - val to_context_hash : t -> Tezos_crypto.Context_hash.t + val to_context_hash : t -> Context_hash.t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end module Conf : Irmin_pack.Conf.S diff --git a/src/lib_context/helpers/context.ml b/src/lib_context/helpers/context.ml index aec343981c41..73125bd95b0b 100644 --- a/src/lib_context/helpers/context.ml +++ b/src/lib_context/helpers/context.ml @@ -386,8 +386,7 @@ struct Store.Tree.verify_stream proof f end -type error += - | Unsupported_context_hash_version of Tezos_crypto.Context_hash.Version.t +type error += Unsupported_context_hash_version of Context_hash.Version.t let () = register_error_kind @@ -400,10 +399,9 @@ let () = ppf "@[Context hash version %a is not supported.@,\ You might need to update the shell.@]" - Tezos_crypto.Context_hash.Version.pp + Context_hash.Version.pp version) - Data_encoding.( - obj1 (req "version" Tezos_crypto.Context_hash.Version.encoding)) + Data_encoding.(obj1 (req "version" Context_hash.Version.encoding)) (function | Unsupported_context_hash_version version -> Some version | _ -> None) (fun version -> Unsupported_context_hash_version version) diff --git a/src/lib_context/helpers/context.mli b/src/lib_context/helpers/context.mli index 2f86bb923849..5fc7e5951cfb 100644 --- a/src/lib_context/helpers/context.mli +++ b/src/lib_context/helpers/context.mli @@ -111,8 +111,7 @@ module Make_config (Conf : Irmin_pack.Conf.S) : sig val config : 'a -> Tezos_context_sigs.Config.t end -type error += - | Unsupported_context_hash_version of Tezos_crypto.Context_hash.Version.t +type error += Unsupported_context_hash_version of Context_hash.Version.t (** See [Tezos_context_sigs.Context.Proof_types.t] *) type proof_version_expanded = {is_stream : bool; is_binary : bool} diff --git a/src/lib_context/memory/context.ml b/src/lib_context/memory/context.ml index b05fd333f860..8b2ae76c4b6c 100644 --- a/src/lib_context/memory/context.ml +++ b/src/lib_context/memory/context.ml @@ -33,8 +33,8 @@ module type TEZOS_CONTEXT_MEMORY = sig Tezos_context_sigs.Context.TEZOS_CONTEXT with type memory_context_tree := tree and type tree := tree - and type value_key = Tezos_crypto.Context_hash.t - and type node_key = Tezos_crypto.Context_hash.t + and type value_key = Context_hash.t + and type node_key = Context_hash.t (** Exception raised by [find_tree] and [add_tree] when applied to shallow trees. It is exposed so that it can be catched by the proxy where such @@ -56,9 +56,9 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct module Info = Store.Info module P = Store.Backend - type node_key = Tezos_crypto.Context_hash.t + type node_key = Context_hash.t - type value_key = Tezos_crypto.Context_hash.t + type value_key = Context_hash.t type kinded_key = [`Value of value_key | `Node of node_key] @@ -154,11 +154,11 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct ()) children) - let get_hash_version _c = Tezos_crypto.Context_hash.Version.of_int 0 + let get_hash_version _c = Context_hash.Version.of_int 0 let set_hash_version c v = let open Lwt_result_syntax in - if Tezos_crypto.Context_hash.Version.(of_int 0 = v) then return c + if Context_hash.Version.(of_int 0 = v) then return c else tzfail (Tezos_context_helpers.Context.Unsupported_context_hash_version v) @@ -407,10 +407,10 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let data = WithExceptions.Option.to_exn_f ~none:(fun () -> assert false) o in - Tezos_crypto.Protocol_hash.of_bytes_exn data + Protocol_hash.of_bytes_exn data let add_protocol t v = - let v = Tezos_crypto.Protocol_hash.to_bytes v in + let v = Protocol_hash.to_bytes v in Tree.add t current_protocol_key v let get_test_chain t = @@ -443,9 +443,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct | None -> return_none | Some data -> ( match - Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Block_metadata_hash.encoding - data + Data_encoding.Binary.of_bytes_opt Block_metadata_hash.encoding data with | None -> raise @@ -456,9 +454,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let add_predecessor_block_metadata_hash t hash = let data = - Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Block_metadata_hash.encoding - hash + Data_encoding.Binary.to_bytes_exn Block_metadata_hash.encoding hash in Tree.add t current_predecessor_block_metadata_hash_key data @@ -470,7 +466,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct | Some data -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Operation_metadata_list_list_hash.encoding + Operation_metadata_list_list_hash.encoding data with | None -> @@ -483,7 +479,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let add_predecessor_ops_metadata_hash t hash = let data = Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Operation_metadata_list_list_hash.encoding + Operation_metadata_list_list_hash.encoding hash in Tree.add t current_predecessor_ops_metadata_hash_key data @@ -598,17 +594,11 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct concrete_encoding let compute_testchain_chain_id genesis = - let genesis_hash = - Tezos_crypto.Block_hash.hash_bytes - [Tezos_crypto.Block_hash.to_bytes genesis] - in + let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in Tezos_crypto.Chain_id.of_block_hash genesis_hash let compute_testchain_genesis forked_block = - let genesis = - Tezos_crypto.Block_hash.hash_bytes - [Tezos_crypto.Block_hash.to_bytes forked_block] - in + let genesis = Block_hash.hash_bytes [Block_hash.to_bytes forked_block] in genesis let commit_test_chain_genesis ctxt (forked_header : Block_header.t) = @@ -625,9 +615,9 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct { forked_header.shell with proto_level = succ forked_header.shell.proto_level; - predecessor = Tezos_crypto.Block_hash.zero; + predecessor = Block_hash.zero; validation_passes = 0; - operations_hash = Tezos_crypto.Operation_list_list_hash.empty; + operations_hash = Operation_list_list_hash.empty; context = Hash.to_context_hash (Store.Commit.hash commit); } in diff --git a/src/lib_context/memory/context.mli b/src/lib_context/memory/context.mli index 6be42e538ad7..f7bf64f66eab 100644 --- a/src/lib_context/memory/context.mli +++ b/src/lib_context/memory/context.mli @@ -31,8 +31,8 @@ module type TEZOS_CONTEXT_MEMORY = sig Tezos_context_sigs.Context.TEZOS_CONTEXT with type memory_context_tree := tree and type tree := tree - and type value_key = Tezos_crypto.Context_hash.t - and type node_key = Tezos_crypto.Context_hash.t + and type value_key = Context_hash.t + and type node_key = Context_hash.t (** Exception raised by [find_tree] and [add_tree] when applied to shallow trees. It is exposed so that it can be catched by the proxy where such diff --git a/src/lib_context/memory/test/test.ml b/src/lib_context/memory/test/test.ml index 30ba771aa714..4f7baf6aa93c 100644 --- a/src/lib_context/memory/test/test.ml +++ b/src/lib_context/memory/test/test.ml @@ -30,11 +30,11 @@ module C = struct (** Basic blocks *) let genesis_block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisGeneskvg68z" let genesis_protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp" let genesis_time = Time.Protocol.of_seconds 0L @@ -97,14 +97,14 @@ let test_hash = let module M = Make (M) in let* ch = C.hash_of_dir n in let* mh = M.hash_of_dir n in - if not @@ Tezos_crypto.Context_hash.equal ch mh then + if not @@ Context_hash.equal ch mh then Stdlib.failwith (Format.asprintf "hash mismatch: n=%d context: %a memory: %a" n - Tezos_crypto.Context_hash.pp + Context_hash.pp ch - Tezos_crypto.Context_hash.pp + Context_hash.pp mh) else Lwt.return () in diff --git a/src/lib_context/merkle_proof_encoding/merkle_proof_encoding.ml b/src/lib_context/merkle_proof_encoding/merkle_proof_encoding.ml index eb4a800746c3..42bdc6d940e6 100644 --- a/src/lib_context/merkle_proof_encoding/merkle_proof_encoding.ml +++ b/src/lib_context/merkle_proof_encoding/merkle_proof_encoding.ml @@ -48,7 +48,7 @@ struct Bytes.unsafe_to_string (Bounded.bytes 255 (* 1 byte for the length *)) - let hash_encoding = Tezos_crypto.Context_hash.encoding + let hash_encoding = Context_hash.encoding let index_encoding = uint8 diff --git a/src/lib_context/sigs/context.ml b/src/lib_context/sigs/context.ml index 4821514fe5d8..4bab8855fd31 100644 --- a/src/lib_context/sigs/context.ml +++ b/src/lib_context/sigs/context.ml @@ -169,7 +169,7 @@ module type TREE = sig val of_value : t -> value -> tree Lwt.t (** [hash t] is [t]'s Merkle hash. *) - val hash : tree -> Tezos_crypto.Context_hash.t + val hash : tree -> Context_hash.t (** [equal x y] is true iff [x] and [y] have the same Merkle hash. *) val equal : tree -> tree -> bool @@ -186,9 +186,9 @@ module type HASH_VERSION = sig (** The type for context views. *) type t - val get_hash_version : t -> Tezos_crypto.Context_hash.Version.t + val get_hash_version : t -> Context_hash.Version.t - val set_hash_version : t -> Tezos_crypto.Context_hash.Version.t -> t Lwt.t + val set_hash_version : t -> Context_hash.Version.t -> t Lwt.t end (** Tezos-specific proof types, as opposed to proofs provided by Irmin. @@ -263,7 +263,7 @@ module Proof_types = struct type index = int (** The type for hashes. *) - type hash = Tezos_crypto.Context_hash.t + type hash = Context_hash.t (** The type for (internal) inode proofs. @@ -676,11 +676,9 @@ module type TEZOS_CONTEXT = sig (** Close the index. Does not fail when the context is already closed. *) val close : index -> unit Lwt.t - val compute_testchain_chain_id : - Tezos_crypto.Block_hash.t -> Tezos_crypto.Chain_id.t + val compute_testchain_chain_id : Block_hash.t -> Tezos_crypto.Chain_id.t - val compute_testchain_genesis : - Tezos_crypto.Block_hash.t -> Tezos_crypto.Block_hash.t + val compute_testchain_genesis : Block_hash.t -> Block_hash.t (** Build an empty context from an index. The resulting context should not be committed. *) @@ -693,8 +691,8 @@ module type TEZOS_CONTEXT = sig index -> chain_id:Tezos_crypto.Chain_id.t -> time:Time.Protocol.t -> - protocol:Tezos_crypto.Protocol_hash.t -> - Tezos_crypto.Context_hash.t tzresult Lwt.t + protocol:Protocol_hash.t -> + Context_hash.t tzresult Lwt.t val commit_test_chain_genesis : context -> Block_header.t -> Block_header.t Lwt.t @@ -725,20 +723,16 @@ module type TEZOS_CONTEXT = sig (** {2 Accessing and Updating Versions} *) - val exists : index -> Tezos_crypto.Context_hash.t -> bool Lwt.t + val exists : index -> Context_hash.t -> bool Lwt.t - val checkout : index -> Tezos_crypto.Context_hash.t -> context option Lwt.t + val checkout : index -> Context_hash.t -> context option Lwt.t - val checkout_exn : index -> Tezos_crypto.Context_hash.t -> context Lwt.t + val checkout_exn : index -> Context_hash.t -> context Lwt.t - val hash : - time:Time.Protocol.t -> ?message:string -> t -> Tezos_crypto.Context_hash.t + val hash : time:Time.Protocol.t -> ?message:string -> t -> Context_hash.t val commit : - time:Time.Protocol.t -> - ?message:string -> - context -> - Tezos_crypto.Context_hash.t Lwt.t + time:Time.Protocol.t -> ?message:string -> context -> Context_hash.t Lwt.t (** [gc index commit_hash] removes from disk all the data older than the [commit_hash]. Operations needing to checkout commits @@ -750,7 +744,7 @@ module type TEZOS_CONTEXT = sig [commit_hash] as a root commit. This prefix file is considered as standalone as all the data referenced by that commit is contained in that file. *) - val gc : index -> Tezos_crypto.Context_hash.t -> unit Lwt.t + val gc : index -> Context_hash.t -> unit Lwt.t (** [wait_gc_completion index] will return a blocking thread if an Irmin GC is currently ongoing. @@ -798,33 +792,29 @@ module type TEZOS_CONTEXT = sig Note: there is no associated [import_snapshot] function as the import consist in copying the exported store. *) - val export_snapshot : - index -> Tezos_crypto.Context_hash.t -> path:string -> unit Lwt.t + val export_snapshot : index -> Context_hash.t -> path:string -> unit Lwt.t val set_head : - index -> - Tezos_crypto.Chain_id.t -> - Tezos_crypto.Context_hash.t -> - unit Lwt.t + index -> Tezos_crypto.Chain_id.t -> Context_hash.t -> unit Lwt.t - val set_master : index -> Tezos_crypto.Context_hash.t -> unit Lwt.t + val set_master : index -> Context_hash.t -> unit Lwt.t (** {2 Hash version} *) (** Get the hash version used for the context *) - val get_hash_version : context -> Tezos_crypto.Context_hash.Version.t + val get_hash_version : context -> Context_hash.Version.t (** Set the hash version used for the context. It may recalculate the hashes of the whole context, which can be a long process. Returns an [Error] if the hash version is unsupported. *) val set_hash_version : - context -> Tezos_crypto.Context_hash.Version.t -> context tzresult Lwt.t + context -> Context_hash.Version.t -> context tzresult Lwt.t (** {2 Predefined Fields} *) - val get_protocol : context -> Tezos_crypto.Protocol_hash.t Lwt.t + val get_protocol : context -> Protocol_hash.t Lwt.t - val add_protocol : context -> Tezos_crypto.Protocol_hash.t -> context Lwt.t + val add_protocol : context -> Protocol_hash.t -> context Lwt.t val get_test_chain : context -> Test_chain_status.t Lwt.t @@ -834,23 +824,23 @@ module type TEZOS_CONTEXT = sig val fork_test_chain : context -> - protocol:Tezos_crypto.Protocol_hash.t -> + protocol:Protocol_hash.t -> expiration:Time.Protocol.t -> context Lwt.t val clear_test_chain : index -> Tezos_crypto.Chain_id.t -> unit Lwt.t val find_predecessor_block_metadata_hash : - context -> Tezos_crypto.Block_metadata_hash.t option Lwt.t + context -> Block_metadata_hash.t option Lwt.t val add_predecessor_block_metadata_hash : - context -> Tezos_crypto.Block_metadata_hash.t -> context Lwt.t + context -> Block_metadata_hash.t -> context Lwt.t val find_predecessor_ops_metadata_hash : - context -> Tezos_crypto.Operation_metadata_list_list_hash.t option Lwt.t + context -> Operation_metadata_list_list_hash.t option Lwt.t val add_predecessor_ops_metadata_hash : - context -> Tezos_crypto.Operation_metadata_list_list_hash.t -> context Lwt.t + context -> Operation_metadata_list_list_hash.t -> context Lwt.t end (** Functor `With_get_data` adds a `get_data` function to modules of signature `S`. diff --git a/src/lib_context/test/test_context.ml b/src/lib_context/test/test_context.ml index 1dbbbd341338..9affde951717 100644 --- a/src/lib_context/test/test_context.ml +++ b/src/lib_context/test/test_context.ml @@ -34,13 +34,7 @@ module Assert_lib = Lib_test_extra.Assert_lib module Assert = Assert let equal_context_hash ?loc ?msg l1 l2 = - Assert.equal - ?loc - ~eq:Tezos_crypto.Context_hash.( = ) - ~pp:Tezos_crypto.Context_hash.pp - ?msg - l1 - l2 + Assert.equal ?loc ~eq:Context_hash.( = ) ~pp:Context_hash.pp ?msg l1 l2 let ( let* ) = Lwt.bind @@ -60,11 +54,11 @@ open Filename.Infix (** Basic blocks *) let genesis_block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisGeneskvg68z" let genesis_protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp" let genesis_time = Time.Protocol.of_seconds 0L @@ -119,10 +113,10 @@ struct type t = { idx : Context.index; - genesis : Tezos_crypto.Context_hash.t; - block2 : Tezos_crypto.Context_hash.t; - block3a : Tezos_crypto.Context_hash.t; - block3b : Tezos_crypto.Context_hash.t; + genesis : Context_hash.t; + block2 : Context_hash.t; + block3a : Context_hash.t; + block3b : Context_hash.t; } type init_config = {indexing_strategy : [`Always | `Minimal]} @@ -493,14 +487,14 @@ struct let* h = commit ctxt in equal_context_hash ~loc:__LOC__ - (Tezos_crypto.Context_hash.of_b58check_exn + (Context_hash.of_b58check_exn "CoWJsL2ehZ39seTr8inBCJb5tVjW8KGNweJ5cvuVq51mAASrRmim") h ; let* ctxt = add ctxt [string 255] foo2 in let* h = commit ctxt in equal_context_hash ~loc:__LOC__ - (Tezos_crypto.Context_hash.of_b58check_exn + (Context_hash.of_b58check_exn "CoVexcEHMXmSA2k42aNc5MCDtVJFRs3CC6vcQWYwFoj7EFsBPw1c") h ; Lwt.return () @@ -554,8 +548,7 @@ struct (fun wrong_version -> let* ctxt = Context.checkout_exn idx block2 in let+ r = - set_hash_version ctxt - @@ Tezos_crypto.Context_hash.Version.of_int wrong_version + set_hash_version ctxt @@ Context_hash.Version.of_int wrong_version in match r with | Ok _ -> diff --git a/src/lib_context/test/test_merkle_proof.ml b/src/lib_context/test/test_merkle_proof.ml index f60e32b10957..8a468a19e7a8 100644 --- a/src/lib_context/test/test_merkle_proof.ml +++ b/src/lib_context/test/test_merkle_proof.ml @@ -37,8 +37,8 @@ module Gen = struct Bytes.unsafe_of_string s let hash = - let+ s = string_size ~gen:char (return Tezos_crypto.Context_hash.size) in - Tezos_crypto.Context_hash.of_string_exn s + let+ s = string_size ~gen:char (return Context_hash.size) in + Context_hash.of_string_exn s let rec comb n xs = match (n, xs) with @@ -194,8 +194,7 @@ module Proof32 (Encoding : Tezos_context_sigs.Context.PROOF_ENCODING) = struct let bytes s = Bytes.of_string s in let tree_a : tree = Value (bytes "a") in let ch = - Tezos_crypto.Context_hash.of_bytes_exn - (bytes "01234567890123456789012345678901") + Context_hash.of_bytes_exn (bytes "01234567890123456789012345678901") in let tree_b = Extender @@ -225,8 +224,7 @@ module Proof32 (Encoding : Tezos_context_sigs.Context.PROOF_ENCODING) = struct let bytes s = Bytes.of_string s in let tree_a c : tree = Value (bytes @@ "a" ^ c) in let ch = - Tezos_crypto.Context_hash.of_bytes_exn - (bytes "01234567890123456789012345678901") + Context_hash.of_bytes_exn (bytes "01234567890123456789012345678901") in let inode_tree i : inode_tree = let c = string_of_int i in @@ -413,8 +411,7 @@ module Proof2 (Encoding : Tezos_context_sigs.Context.PROOF_ENCODING) = struct let bytes s = Bytes.of_string s in let tree_a : tree = Value (bytes "a") in let ch = - Tezos_crypto.Context_hash.of_bytes_exn - (bytes "01234567890123456789012345678901") + Context_hash.of_bytes_exn (bytes "01234567890123456789012345678901") in let tree_b = Extender @@ -451,8 +448,7 @@ module Proof2 (Encoding : Tezos_context_sigs.Context.PROOF_ENCODING) = struct let bytes s = Bytes.of_string s in let tree_a c : tree = Value (bytes @@ "a" ^ c) in let ch = - Tezos_crypto.Context_hash.of_bytes_exn - (bytes "01234567890123456789012345678901") + Context_hash.of_bytes_exn (bytes "01234567890123456789012345678901") in let inode_tree i : inode_tree = let c = string_of_int i in diff --git a/src/lib_crypto/test/test_signature_encodings.ml b/src/lib_crypto/test/test_signature_encodings.ml index dc7568ec6ceb..6e0c17bcf6d6 100644 --- a/src/lib_crypto/test/test_signature_encodings.ml +++ b/src/lib_crypto/test/test_signature_encodings.ml @@ -35,11 +35,11 @@ module type B58CHECK = sig val pp : Format.formatter -> t -> unit - include S.B58_DATA with type t := t + include Intfs.B58_DATA with type t := t end module Make_tests - (P : S.SIGNATURE) (T : sig + (P : Intfs.SIGNATURE) (T : sig val name : string val pkh_vectors : (string * string) list diff --git a/src/lib_dal_node/dac_plugin.ml b/src/lib_dal_node/dac_plugin.ml index 7b298b3f8a2a..7855f44b86f7 100644 --- a/src/lib_dal_node/dac_plugin.ml +++ b/src/lib_dal_node/dac_plugin.ml @@ -37,11 +37,10 @@ module type T = sig end end -let table : (module T) Tezos_crypto.Protocol_hash.Table.t = - Tezos_crypto.Protocol_hash.Table.create 5 +let table : (module T) Protocol_hash.Table.t = Protocol_hash.Table.create 5 let register (module Plugin : T) = - assert (not (Tezos_crypto.Protocol_hash.Table.mem table Plugin.Proto.hash)) ; - Tezos_crypto.Protocol_hash.Table.add table Plugin.Proto.hash (module Plugin) + assert (not (Protocol_hash.Table.mem table Plugin.Proto.hash)) ; + Protocol_hash.Table.add table Plugin.Proto.hash (module Plugin) -let get hash = Tezos_crypto.Protocol_hash.Table.find table hash +let get hash = Protocol_hash.Table.find table hash diff --git a/src/lib_dal_node/dac_plugin.mli b/src/lib_dal_node/dac_plugin.mli index 4de3ee0faeb5..ae40fb0169ea 100644 --- a/src/lib_dal_node/dac_plugin.mli +++ b/src/lib_dal_node/dac_plugin.mli @@ -39,4 +39,4 @@ end val register : (module T) -> unit -val get : Tezos_crypto.Protocol_hash.Table.key -> (module T) option +val get : Protocol_hash.Table.key -> (module T) option diff --git a/src/lib_dal_node/dal_plugin.ml b/src/lib_dal_node/dal_plugin.ml index 8319ceca61a1..bd9d755b99f0 100644 --- a/src/lib_dal_node/dal_plugin.ml +++ b/src/lib_dal_node/dal_plugin.ml @@ -70,17 +70,16 @@ module type T = sig (int * int) Tezos_crypto.Signature.Public_key_hash.Map.t tzresult Lwt.t val attested_slot_headers : - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info -> number_of_slots:int -> slot_index list tzresult end -let table : (module T) Tezos_crypto.Protocol_hash.Table.t = - Tezos_crypto.Protocol_hash.Table.create 5 +let table : (module T) Protocol_hash.Table.t = Protocol_hash.Table.create 5 let register (module Plugin : T) = - assert (not (Tezos_crypto.Protocol_hash.Table.mem table Plugin.Proto.hash)) ; - Tezos_crypto.Protocol_hash.Table.add table Plugin.Proto.hash (module Plugin) + assert (not (Protocol_hash.Table.mem table Plugin.Proto.hash)) ; + Protocol_hash.Table.add table Plugin.Proto.hash (module Plugin) -let get hash = Tezos_crypto.Protocol_hash.Table.find table hash +let get hash = Protocol_hash.Table.find table hash diff --git a/src/lib_dal_node/dal_plugin.mli b/src/lib_dal_node/dal_plugin.mli index 31b430af3f00..7d74966f45ca 100644 --- a/src/lib_dal_node/dal_plugin.mli +++ b/src/lib_dal_node/dal_plugin.mli @@ -96,7 +96,7 @@ module type T = sig Fails with [Cannot_read_block_metadata] if [block_info]'s metadata are stripped. *) val attested_slot_headers : - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info -> number_of_slots:int -> slot_index list tzresult @@ -104,4 +104,4 @@ end val register : (module T) -> unit -val get : Tezos_crypto.Protocol_hash.Table.key -> (module T) option +val get : Protocol_hash.Table.key -> (module T) option diff --git a/src/lib_mockup/local_services.ml b/src/lib_mockup/local_services.ml index bdd3ac4ad092..192e154a7021 100644 --- a/src/lib_mockup/local_services.ml +++ b/src/lib_mockup/local_services.ml @@ -139,7 +139,7 @@ module Make (E : MENV) = struct Directory.register Directory.empty service (fun _prefix () () -> let current_protocol = if Compare.Int32.(E.rpc_context.block_header.level = 0l) then - Tezos_crypto.Protocol_hash.zero + Protocol_hash.zero else protocol_hash in Lwt.return @@ -370,11 +370,11 @@ module Make (E : MENV) = struct let pending_operations = { E.Block_services.Mempool.applied; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; - unprocessed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; + unprocessed = Operation_hash.Map.empty; } in return pending_operations @@ -421,9 +421,7 @@ module Make (E : MENV) = struct E.Block_services.S.live_blocks (fun (((), chain), _block) () () -> with_chain ~caller_name:"live blocks" chain (fun () -> - let set = - Tezos_crypto.Block_hash.Set.singleton E.rpc_context.block_hash - in + let set = Block_hash.Set.singleton E.rpc_context.block_hash in Tezos_rpc.Answer.return set)) let simulate_operation (state, preapply_result) op = @@ -446,7 +444,7 @@ module Make (E : MENV) = struct { preapply_result with refused = - Tezos_crypto.Operation_hash.Map.add + Operation_hash.Map.add hash (op_t, e) preapply_result.refused; @@ -511,11 +509,10 @@ module Make (E : MENV) = struct (* Similar to lib_shell.Prevalidation.preapply *) let operations_hash = let open Preapply_result in - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute @@ List.rev_map (fun x -> - Tezos_crypto.Operation_list_hash.compute - @@ List.map fst x.applied) + Operation_list_hash.compute @@ List.map fst x.applied) preapply_results in let timestamp = @@ -537,9 +534,7 @@ module Make (E : MENV) = struct operations_hash; validation_passes; fitness = validation_result.fitness; - context = - Tezos_crypto.Context_hash.zero - (* TODO: is that correct ? *); + context = Context_hash.zero (* TODO: is that correct ? *); } in return (shell_header, List.rev preapply_results) @@ -607,7 +602,7 @@ module Make (E : MENV) = struct let equal_op (a_shell_header, a_operation_data) (b_shell_header, b_operation_data) = - Tezos_crypto.Block_hash.equal + Block_hash.equal a_shell_header.Operation.branch b_shell_header.Operation.branch && (* FIXME: the protocol should export equality/comparison functions for @@ -630,7 +625,7 @@ module Make (E : MENV) = struct (proto_state, Preapply_result.empty) operations in - if Tezos_crypto.Operation_hash.Map.is_empty preapply_result.refused then + if Operation_hash.Map.is_empty preapply_result.refused then let* _ = finalize_validation_and_application proto_state None in return `Applicable else return `Refused @@ -770,7 +765,7 @@ module Make (E : MENV) = struct (* See injection_directory.ml for vanilla implementation *) (fun () _ (bytes, operations) -> (* assert (Files.Mempool.exists ~dirname:E.base_dir) ; *) - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in match Block_header.of_bytes bytes with | None -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Some block_header -> ( @@ -814,28 +809,21 @@ module Make (E : MENV) = struct let h = Operation.hash {Operation.shell = shell_header; proto} in - return @@ Tezos_crypto.Operation_hash.Map.add h v map) - Tezos_crypto.Operation_hash.Map.empty + return @@ Operation_hash.Map.add h v map) + Operation_hash.Map.empty mempool_operations in let refused_map = List.fold_left (List.fold_left (fun mempool op -> - Tezos_crypto.Operation_hash.Map.remove - (Operation.hash op) - mempool)) + Operation_hash.Map.remove (Operation.hash op) mempool)) mempool_map operations in let* () = - unless - (Tezos_crypto.Operation_hash.Map.is_empty refused_map) - (fun () -> + unless (Operation_hash.Map.is_empty refused_map) (fun () -> let refused_ops = - Tezos_crypto.Operation_hash.Map.fold - (fun _k v l -> v :: l) - refused_map - [] + Operation_hash.Map.fold (fun _k v l -> v :: l) refused_map [] in let*! () = L.(S.emit warn_trashpool_append) refused_ops in Trashpool.append refused_ops) diff --git a/src/lib_mockup/migration.mli b/src/lib_mockup/migration.mli index 0fc4656831af..c646dc91848e 100644 --- a/src/lib_mockup/migration.mli +++ b/src/lib_mockup/migration.mli @@ -27,6 +27,6 @@ The effect is protocol-dependent. *) val migrate_mockup : cctxt:Tezos_client_base.Client_context.full -> - protocol_hash:Tezos_crypto.Protocol_hash.t option -> - next_protocol_hash:Tezos_crypto.Protocol_hash.t -> + protocol_hash:Protocol_hash.t option -> + next_protocol_hash:Protocol_hash.t -> unit tzresult Lwt.t diff --git a/src/lib_mockup/mockup_commands.ml b/src/lib_mockup/mockup_commands.ml index 1cd06cf40a73..7e3ae309494d 100644 --- a/src/lib_mockup/mockup_commands.ml +++ b/src/lib_mockup/mockup_commands.ml @@ -34,7 +34,7 @@ let list_mockup_command_handler _ _ = List.iter (fun (mockup : (module Registration.MOCKUP)) -> let module Mockup = (val mockup) in - Format.printf "%a@." Tezos_crypto.Protocol_hash.pp Mockup.protocol_hash) + Format.printf "%a@." Protocol_hash.pp Mockup.protocol_hash) available ; Lwt_result_syntax.return_unit @@ -50,7 +50,7 @@ let list_mockup_command : let migrate_mockup_command_handler () next_protococol_hash (cctxt : Tezos_client_base.Client_context.full) = - match Tezos_crypto.Protocol_hash.of_b58check next_protococol_hash with + match Protocol_hash.of_b58check next_protococol_hash with | Error _ as result -> Lwt.return result | Ok next_protocol_hash -> Migration.migrate_mockup ~cctxt ~protocol_hash:None ~next_protocol_hash diff --git a/src/lib_mockup/persistence.ml b/src/lib_mockup/persistence.ml index 83845c1c926a..e0762b91be83 100644 --- a/src/lib_mockup/persistence.ml +++ b/src/lib_mockup/persistence.ml @@ -46,13 +46,13 @@ module Make (Registration : Registration.S) = struct (fun (block_hash, block_header, context) -> {block_hash; block_header; context}) (obj3 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "shell_header" Block_header.shell_header_encoding) (req "context" Memory_context.encoding)) module Persistent_mockup_environment = struct type t = { - protocol_hash : Tezos_crypto.Protocol_hash.t; + protocol_hash : Protocol_hash.t; chain_id : Tezos_crypto.Chain_id.t; rpc_context : Tezos_protocol_environment.rpc_context; protocol_data : bytes; @@ -66,7 +66,7 @@ module Make (Registration : Registration.S) = struct (fun (protocol_hash, chain_id, rpc_context, protocol_data) -> {protocol_hash; chain_id; rpc_context; protocol_data}) (obj4 - (req "protocol_hash" Tezos_crypto.Protocol_hash.encoding) + (req "protocol_hash" Protocol_hash.encoding) (req "chain_id" Tezos_crypto.Chain_id.encoding) (req "context" rpc_context_encoding) (req "protocol_data" Variable.bytes)) @@ -76,8 +76,7 @@ module Make (Registration : Registration.S) = struct let of_json = Data_encoding.Json.destruct encoding end - let get_registered_mockup - (protocol_hash_opt : Tezos_crypto.Protocol_hash.t option) + let get_registered_mockup (protocol_hash_opt : Protocol_hash.t option) (printer : #Tezos_client_base.Client_context.printer) : Registration.mockup_environment tzresult Lwt.t = let open Lwt_result_syntax in @@ -85,11 +84,11 @@ module Make (Registration : Registration.S) = struct let hash_is_of_mockup hash (module Mockup : Registration.MOCKUP) = match hash with | Some protocol_hash -> - Tezos_crypto.Protocol_hash.equal protocol_hash Mockup.protocol_hash + Protocol_hash.equal protocol_hash Mockup.protocol_hash | None -> Re.Str.string_match is_proto_alpha_regexp - (Tezos_crypto.Protocol_hash.to_b58check Mockup.protocol_hash) + (Protocol_hash.to_b58check Mockup.protocol_hash) 0 in let*! () = @@ -108,7 +107,7 @@ module Make (Registration : Registration.S) = struct | Some requested -> Format.asprintf "Requested protocol with hash %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp requested | None -> "Default protocol Alpha (no requested protocol)" in @@ -124,7 +123,7 @@ module Make (Registration : Registration.S) = struct Format.( pp_print_list ~pp_sep:(fun fmt () -> fprintf fmt ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) protocol_hashes let default_mockup_context : @@ -146,7 +145,7 @@ module Make (Registration : Registration.S) = struct let init_mockup_context_by_protocol_hash : cctxt:Tezos_client_base.Client_context.printer -> - protocol_hash:Tezos_crypto.Protocol_hash.t -> + protocol_hash:Protocol_hash.t -> constants_overrides_json:Data_encoding.json option -> bootstrap_accounts_json:Data_encoding.json option -> (Registration.mockup_environment * Registration.mockup_context) tzresult @@ -239,7 +238,7 @@ module Make (Registration : Registration.S) = struct match protocol_hash with | None -> return_unit | Some desired_protocol - when Tezos_crypto.Protocol_hash.equal + when Protocol_hash.equal Mockup_environment.protocol_hash desired_protocol -> return_unit @@ -247,10 +246,10 @@ module Make (Registration : Registration.S) = struct failwith "Protocol %a was requested via --protocol\n\ yet the mockup at %s was initialized with %a" - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short desired_protocol base_dir - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Mockup_environment.protocol_hash in return res diff --git a/src/lib_mockup/persistence_intf.ml b/src/lib_mockup/persistence_intf.ml index c5bbabc97f03..9743eb2ec48e 100644 --- a/src/lib_mockup/persistence_intf.ml +++ b/src/lib_mockup/persistence_intf.ml @@ -25,7 +25,7 @@ module type S = sig val get_registered_mockup : - Tezos_crypto.Protocol_hash.t option -> + Protocol_hash.t option -> #Tezos_client_base.Client_context.printer -> Registration.mockup_environment tzresult Lwt.t @@ -39,7 +39,7 @@ module type S = sig (** Returns a mockup environment for the specified protocol hash. *) val init_mockup_context_by_protocol_hash : cctxt:Tezos_client_base.Client_context.printer -> - protocol_hash:Tezos_crypto.Protocol_hash.t -> + protocol_hash:Protocol_hash.t -> constants_overrides_json:Data_encoding.json option -> bootstrap_accounts_json:Data_encoding.json option -> (Registration.mockup_environment * Registration.mockup_context) tzresult @@ -50,7 +50,7 @@ module type S = sig loaded environment agrees with it. *) val get_mockup_context_from_disk : base_dir:string -> - protocol_hash:Tezos_crypto.Protocol_hash.t option -> + protocol_hash:Protocol_hash.t option -> #Tezos_client_base.Client_context.printer -> (Registration.mockup_environment * Registration.mockup_context) tzresult Lwt.t @@ -59,7 +59,7 @@ module type S = sig protocol. *) val create_mockup : cctxt:Tezos_client_base.Client_context.full -> - protocol_hash:Tezos_crypto.Protocol_hash.t -> + protocol_hash:Protocol_hash.t -> constants_overrides_json:Data_encoding.json option -> bootstrap_accounts_json:Data_encoding.json option -> asynchronous:bool -> @@ -67,7 +67,7 @@ module type S = sig (** Overwrites an on-disk mockup environment. *) val overwrite_mockup : - protocol_hash:Tezos_crypto.Protocol_hash.t -> + protocol_hash:Protocol_hash.t -> chain_id:Tezos_crypto.Chain_id.t -> rpc_context:Tezos_protocol_environment.rpc_context -> protocol_data:bytes -> diff --git a/src/lib_mockup/registration_intf.ml b/src/lib_mockup/registration_intf.ml index 6efe791a34d4..43c474e977d4 100644 --- a/src/lib_mockup/registration_intf.ml +++ b/src/lib_mockup/registration_intf.ml @@ -33,7 +33,7 @@ type t = { type mockup_context = t module type PROTOCOL = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t include Tezos_protocol_environment.PROTOCOL end @@ -60,7 +60,7 @@ module type MOCKUP = sig val default_bootstrap_accounts : Tezos_client_base.Client_context.full -> string tzresult Lwt.t - val protocol_hash : Tezos_crypto.Protocol_hash.t + val protocol_hash : Protocol_hash.t module Protocol : PROTOCOL diff --git a/src/lib_mockup/test/test_persistence.ml b/src/lib_mockup/test/test_persistence.ml index 54dc35bb87da..7b96c9446fe8 100644 --- a/src/lib_mockup/test/test_persistence.ml +++ b/src/lib_mockup/test/test_persistence.ml @@ -91,7 +91,7 @@ module Mock_protocol : Registration.PROTOCOL = struct open Tezos_protocol_environment.Internal_for_tests include Environment_protocol_T_test.Mock_all_unit - let hash = Tezos_crypto.Protocol_hash.hash_string [""] + let hash = Protocol_hash.hash_string [""] end module Mock_mockup : Registration.MOCKUP = struct @@ -124,7 +124,7 @@ module Mock_mockup : Registration.MOCKUP = struct let migrate _ = assert false end -let mock_mockup_module (protocol_hash' : Tezos_crypto.Protocol_hash.t) : +let mock_mockup_module (protocol_hash' : Protocol_hash.t) : (module Registration.MOCKUP) = (module struct include Mock_mockup @@ -179,9 +179,9 @@ let test_get_registered_mockup_not_found = (fun () -> let module Registration = Registration.Internal_for_tests.Make () in let module Persistence = Persistence.Internal_for_tests.Make (Registration) in - let proto_hash_1 = Tezos_crypto.Protocol_hash.hash_string ["mock1"] in - let proto_hash_2 = Tezos_crypto.Protocol_hash.hash_string ["mock2"] in - let proto_hash_3 = Tezos_crypto.Protocol_hash.hash_string ["mock3"] in + let proto_hash_1 = Protocol_hash.hash_string ["mock1"] in + let proto_hash_2 = Protocol_hash.hash_string ["mock2"] in + let proto_hash_3 = Protocol_hash.hash_string ["mock3"] in Registration.register_mockup_environment (mock_mockup_module proto_hash_1) ; Registration.register_mockup_environment (mock_mockup_module proto_hash_2) ; let*! r = @@ -197,11 +197,11 @@ let test_get_registered_mockup_not_found = Format.asprintf "Requested protocol with hash %a not found in available mockup \ environments. Available protocol hashes: [%a, %a]" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto_hash_3 - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto_hash_2 - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto_hash_1 in return @@ -222,21 +222,19 @@ let test_get_registered_mockup_take_alpha = let module Registration = Registration.Internal_for_tests.Make () in let module Persistence = Persistence.Internal_for_tests.Make (Registration) in let printer = mock_printer () in - let proto_hash_1 = Tezos_crypto.Protocol_hash.hash_string ["mock1"] in + let proto_hash_1 = Protocol_hash.hash_string ["mock1"] in let proto_hash_alpha = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK" in - let proto_hash_3 = Tezos_crypto.Protocol_hash.hash_string ["mock3"] in + let proto_hash_3 = Protocol_hash.hash_string ["mock3"] in Registration.register_mockup_environment (mock_mockup_module proto_hash_1) ; Registration.register_mockup_environment (mock_mockup_module proto_hash_alpha) ; Registration.register_mockup_environment (mock_mockup_module proto_hash_3) ; let+ (module Result) = Persistence.get_registered_mockup None printer in Alcotest.check' - (Alcotest.testable - Tezos_crypto.Protocol_hash.pp - Tezos_crypto.Protocol_hash.equal) + (Alcotest.testable Protocol_hash.pp Protocol_hash.equal) ~msg:"The Alpha protocol is returned" ~expected:proto_hash_alpha ~actual:Result.protocol_hash ; @@ -256,17 +254,15 @@ let test_get_registered_mockup_take_requested = (fun () -> let module Registration = Registration.Internal_for_tests.Make () in let module Persistence = Persistence.Internal_for_tests.Make (Registration) in - let proto_hash_1 = Tezos_crypto.Protocol_hash.hash_string ["mock1"] in - let proto_hash_2 = Tezos_crypto.Protocol_hash.hash_string ["mock2"] in + let proto_hash_1 = Protocol_hash.hash_string ["mock1"] in + let proto_hash_2 = Protocol_hash.hash_string ["mock2"] in Registration.register_mockup_environment (mock_mockup_module proto_hash_1) ; Registration.register_mockup_environment (mock_mockup_module proto_hash_2) ; let+ (module Result) = Persistence.get_registered_mockup (Some proto_hash_1) (mock_printer ()) in Alcotest.check' - (Alcotest.testable - Tezos_crypto.Protocol_hash.pp - Tezos_crypto.Protocol_hash.equal) + (Alcotest.testable Protocol_hash.pp Protocol_hash.equal) ~msg:"The requested protocol is returned" ~expected:proto_hash_1 ~actual:Result.protocol_hash) diff --git a/src/lib_node_config/config_file.ml b/src/lib_node_config/config_file.ml index 84bc685e7907..1bf7c2cf5039 100644 --- a/src/lib_node_config/config_file.ml +++ b/src/lib_node_config/config_file.ml @@ -70,13 +70,12 @@ let make_blockchain_network ~alias ~chain_name ?old_chain_name sandboxed_chain_name = of_string sandboxed_chain_name; user_activated_upgrades = List.map - (fun (l, h) -> (l, Tezos_crypto.Protocol_hash.of_b58check_exn h)) + (fun (l, h) -> (l, Protocol_hash.of_b58check_exn h)) user_activated_upgrades; user_activated_protocol_overrides = List.map (fun (a, b) -> - ( Tezos_crypto.Protocol_hash.of_b58check_exn a, - Tezos_crypto.Protocol_hash.of_b58check_exn b )) + (Protocol_hash.of_b58check_exn a, Protocol_hash.of_b58check_exn b)) user_activated_protocol_overrides; default_bootstrap_peers; } @@ -103,10 +102,10 @@ let blockchain_network_mainnet = { time = Time.Protocol.of_notation_exn "2018-06-30T16:07:32Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } ~chain_name:"TEZOS_MAINNET" @@ -132,10 +131,10 @@ let blockchain_network_ghostnet = { time = Time.Protocol.of_notation_exn "2022-01-25T15:00:00Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesis1db77eJNeJ9"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } ~genesis_parameters: @@ -174,10 +173,10 @@ let blockchain_network_limanet = { time = Time.Protocol.of_notation_exn "2022-10-13T15:00:00Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BL3LAGwnWoNFM2H5ZA3Mbd622CVWMe8Kzfkksws4roKDD9WwBmf"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P"; } ~genesis_parameters: @@ -209,10 +208,10 @@ let blockchain_network_sandbox = { time = Time.Protocol.of_notation_exn "2018-06-30T16:07:32Z"; block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisf79b5d1CoW2"; protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im"; } ~genesis_parameters: diff --git a/src/lib_p2p/test/node.ml b/src/lib_p2p/test/node.ml index 7cbea77a3fac..c07a8166d91f 100644 --- a/src/lib_p2p/test/node.ml +++ b/src/lib_p2p/test/node.ml @@ -70,7 +70,7 @@ module Event = struct let bye = declare_0 ~section ~name:"bye" ~msg:"Bye." ~level:Info () end -type message = Ping | BigPing of Tezos_crypto.Operation_hash.t list +type message = Ping | BigPing of Operation_hash.t list let msg_config : message P2p_params.message_config = let open Data_encoding in @@ -89,7 +89,7 @@ let msg_config : message P2p_params.message_config = case ~tag:0x11 ~title:"BigPing" - (list Tezos_crypto.Operation_hash.encoding) + (list Operation_hash.encoding) (function BigPing l -> Some l | _ -> None) (fun l -> BigPing l); ]; diff --git a/src/lib_p2p/test/node.mli b/src/lib_p2p/test/node.mli index effc538ec0fe..48e175051003 100644 --- a/src/lib_p2p/test/node.mli +++ b/src/lib_p2p/test/node.mli @@ -37,7 +37,7 @@ - [BigPing] is used to add arbitrary long data (similar to mempools sent in the actual network) to test bandwidth and chunks splitting.*) -type message = Ping | BigPing of Tezos_crypto.Operation_hash.t list +type message = Ping | BigPing of Operation_hash.t list type metadata = Metadata diff --git a/src/lib_p2p/test/test_p2p_broadcast.ml b/src/lib_p2p/test/test_p2p_broadcast.ml index e7e257bd23d6..5b5fbf4dab01 100644 --- a/src/lib_p2p/test/test_p2p_broadcast.ml +++ b/src/lib_p2p/test/test_p2p_broadcast.ml @@ -120,7 +120,7 @@ module Simple = struct List.map (fun _ -> List.map - (fun _ -> Tezos_crypto.Operation_hash.of_bytes_exn (Bytes.create 32)) + (fun _ -> Operation_hash.of_bytes_exn (Bytes.create 32)) (1 -- !nb_oph)) (if !no_check then 0 -- 1 else 0 -- !repeat) @@ -130,10 +130,8 @@ module Simple = struct else List.fold_left2_e ~when_different_lengths:(Error_monad.TzTrace.make Wrong_message_count) - (fun () - (m1 : Tezos_crypto.Operation_hash.t) - (m2 : Tezos_crypto.Operation_hash.t) -> - if Tezos_crypto.Operation_hash.equal m1 m2 then Ok () + (fun () (m1 : Operation_hash.t) (m2 : Operation_hash.t) -> + if Operation_hash.equal m1 m2 then Ok () else tzfail Wrong_message_received) () m1 diff --git a/src/lib_protocol_compiler/bin/main_embedded_packer.ml b/src/lib_protocol_compiler/bin/main_embedded_packer.ml index bdc40c1cb8fc..b7e7fef7e2ce 100644 --- a/src/lib_protocol_compiler/bin/main_embedded_packer.ml +++ b/src/lib_protocol_compiler/bin/main_embedded_packer.ml @@ -74,11 +74,11 @@ let () = {| module Source = struct let hash = - Some (Tezos_crypto.Protocol_hash.of_b58check_exn %S) + Some (Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn %S) let sources = Tezos_base.Protocol.%a end @.|} - (Tezos_crypto.Protocol_hash.to_b58check hash) + (Protocol_hash.to_b58check hash) Protocol.pp_ocaml sources diff --git a/src/lib_protocol_compiler/compiler.ml b/src/lib_protocol_compiler/compiler.ml index 515bb2052f89..d606156c0942 100644 --- a/src/lib_protocol_compiler/compiler.ml +++ b/src/lib_protocol_compiler/compiler.ml @@ -206,22 +206,21 @@ let main {compile_ml; pack_objects; link_shared} = in let computed_hash = Protocol.hash protocol in if !hash_only then ( - Format.printf "%a@." Tezos_crypto.Protocol_hash.pp computed_hash ; + Format.printf "%a@." Protocol_hash.pp computed_hash ; exit 0) ; let hash = match stored_hash_opt with | None -> computed_hash | Some stored_hash when !check_protocol_hash - && not (Tezos_crypto.Protocol_hash.equal computed_hash stored_hash) - -> + && not (Protocol_hash.equal computed_hash stored_hash) -> Format.eprintf "Inconsistent hash for protocol in TEZOS_PROTOCOL.@\n\ Computed hash: %a@\n\ Stored in TEZOS_PROTOCOL: %a@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp computed_hash - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp stored_hash ; exit 2 | Some hash -> hash @@ -237,7 +236,7 @@ let main {compile_ml; pack_objects; link_shared} = let output = match !output_file with | Some output -> output - | None -> Format.asprintf "proto_%a" Tezos_crypto.Protocol_hash.pp hash + | None -> Format.asprintf "proto_%a" Protocol_hash.pp hash in Lwt_main.run (Lwt_utils_unix.create_dir ~perm:0o755 build_dir) ; Lwt_main.run (Lwt_utils_unix.create_dir ~perm:0o755 (Filename.dirname output)) ; @@ -281,7 +280,7 @@ let main {compile_ml; pack_objects; link_shared} = "module Name = struct let name = %S end\n\ \ let () = Tezos_protocol_registerer.register Name.name (%s (module \ %s.Make))" - (Tezos_crypto.Protocol_hash.to_b58check hash) + (Protocol_hash.to_b58check hash) (Protocol.module_name_of_env_version protocol.expected_env) functor_unit) ; let register_object = compile_ml ~for_pack register_file in @@ -304,4 +303,4 @@ let main {compile_ml; pack_objects; link_shared} = Format.printf "let src_digest = %S ;;\n" (Digest.to_hex dsrc) ; Format.printf "let impl_digest = %S ;;\n" (Digest.to_hex dimpl) ; Format.printf "let intf_digest = %S ;;\n" (Digest.to_hex dintf)) ; - Format.printf "Success: %a.@." Tezos_crypto.Protocol_hash.pp hash + Format.printf "Success: %a.@." Protocol_hash.pp hash diff --git a/src/lib_protocol_compiler/packer.ml b/src/lib_protocol_compiler/packer.ml index 2fe279833e46..552dbec1f7b8 100644 --- a/src/lib_protocol_compiler/packer.ml +++ b/src/lib_protocol_compiler/packer.ml @@ -120,7 +120,7 @@ let dump oc version hash files = Printf.fprintf oc "let hash = Protocol_hash.of_b58check_exn %S;;\n" - (Tezos_crypto.Protocol_hash.to_b58check hash) ; + (Protocol_hash.to_b58check hash) ; for i = 0 to Array.length files - 1 do include_ml oc files.(i) done ; diff --git a/src/lib_protocol_compiler/packer.mli b/src/lib_protocol_compiler/packer.mli index 83818e77f3ca..421565c695a2 100644 --- a/src/lib_protocol_compiler/packer.mli +++ b/src/lib_protocol_compiler/packer.mli @@ -23,5 +23,4 @@ (* *) (*****************************************************************************) -val dump : - out_channel -> string -> Tezos_crypto.Protocol_hash.t -> string array -> unit +val dump : out_channel -> string -> Protocol_hash.t -> string array -> unit diff --git a/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.ml b/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.ml index 537935fb43e1..f58d8bed4c42 100644 --- a/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.ml +++ b/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.ml @@ -63,7 +63,7 @@ module type PROTOCOL_V9 = functor (Env : Tezos_protocol_environment_sigs.V9.T) -> Env.Updater.PROTOCOL -module VersionTable = Tezos_crypto.Protocol_hash.Table +module VersionTable = Protocol_hash.Table type proto_env = | V0 of (module PROTOCOL_V0) @@ -80,7 +80,7 @@ type proto_env = let versions : proto_env VersionTable.t = VersionTable.create 20 let register hash proto = - let hash = Tezos_crypto.Protocol_hash.of_b58check_exn hash in + let hash = Protocol_hash.of_b58check_exn hash in VersionTable.add versions hash proto let mem hash = VersionTable.mem versions hash diff --git a/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.mli b/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.mli index 3e9ccc13e77d..5eb3a307a5d0 100644 --- a/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.mli +++ b/src/lib_protocol_compiler/registerer/tezos_protocol_registerer.mli @@ -77,6 +77,6 @@ type proto_env = val register : string -> proto_env -> unit -val mem : Tezos_crypto.Protocol_hash.t -> bool +val mem : Protocol_hash.t -> bool -val get : Tezos_crypto.Protocol_hash.t -> proto_env option +val get : Protocol_hash.t -> proto_env option diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index cf82f789c24b..bf58842618d9 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -36,14 +36,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type MBytes.t = Tezos_protocol_environment_structs.V0.MBytes.t and type Operation.shell_header = Operation.shell_header @@ -185,7 +186,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index 2d66950b8e1b..f30fbde15323 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -36,14 +36,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type MBytes.t = Tezos_protocol_environment_structs.V0.MBytes.t and type Operation.shell_header = Operation.shell_header diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index 7fb677cebec6..c2b3b6754ced 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -37,14 +37,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -171,7 +172,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index 715250ce08a5..305e0f0b9670 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -36,14 +36,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index d73776da6daa..998d6543fe06 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -37,14 +37,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -177,7 +178,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index 5607402867b6..b7706975d94f 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -36,14 +36,15 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index 8f3263cd232f..ebbebc6c0eb6 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -37,17 +37,19 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -282,7 +284,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -681,12 +683,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index ef96e8b967a1..43af86b16d0f 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -36,17 +36,19 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index d6edac7bcf8f..503005c31964 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -41,17 +41,19 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -316,7 +318,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -712,12 +714,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index 482b7d7dff37..9ebad90f478f 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -36,17 +36,19 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index f09cefb20bd8..7874c0561a0d 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -281,7 +283,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -685,12 +687,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index 2e6239a7b24b..9d05a9a0c5b0 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -45,19 +45,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index 2b98d4089d00..73be2c671d0b 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -283,7 +285,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -687,12 +689,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V6.mli b/src/lib_protocol_environment/environment_V6.mli index 4ab46ce7473f..d115e3a6e9d6 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -45,19 +45,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 53da5215fd67..4449b0d8f458 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -283,7 +285,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -696,12 +698,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V7.mli b/src/lib_protocol_environment/environment_V7.mli index c966ad824611..0cf4fa6cc7b7 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index ded7c6a081a1..1307c38dc5d3 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -312,7 +314,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -737,12 +739,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Tezos_crypto.Hashed.Block_hash + module Operation_hash = Tezos_crypto.Hashed.Operation_hash + module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash + module Operation_list_list_hash = Tezos_crypto.Hashed.Operation_list_list_hash + module Context_hash = Tezos_crypto.Hashed.Context_hash + module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V8.mli b/src/lib_protocol_environment/environment_V8.mli index 6ef25c44fc1b..092661d9544d 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -44,19 +44,21 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t + and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t + and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t + and type Operation_list_hash.t = + Tezos_crypto.Hashed.Operation_list_hash.t and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + Tezos_crypto.Hashed.Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Tezos_crypto.Hashed.Context_hash.t + and type Context_hash.Version.t = + Tezos_crypto.Hashed.Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Tezos_crypto.Hashed.Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_V9.ml b/src/lib_protocol_environment/environment_V9.ml index 0f4d85a56776..b42232904df8 100644 --- a/src/lib_protocol_environment/environment_V9.ml +++ b/src/lib_protocol_environment/environment_V9.ml @@ -44,19 +44,18 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t - and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + and type Block_hash.t = Block_hash.t + and type Operation_hash.t = Operation_hash.t + and type Operation_list_hash.t = Operation_list_hash.t + and type Operation_list_list_hash.t = Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Context_hash.t + and type Context_hash.Version.t = Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t @@ -312,7 +311,7 @@ struct module type HASHABLE = Tezos_base.S.HASHABLE - module type MINIMAL_HASH = Tezos_crypto.S.MINIMAL_HASH + module type MINIMAL_HASH = Tezos_crypto.Intfs.MINIMAL_HASH module type B58_DATA = sig type t @@ -737,12 +736,12 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r module Chain_id = Tezos_crypto.Chain_id - module Block_hash = Tezos_crypto.Block_hash - module Operation_hash = Tezos_crypto.Operation_hash - module Operation_list_hash = Tezos_crypto.Operation_list_hash - module Operation_list_list_hash = Tezos_crypto.Operation_list_list_hash - module Context_hash = Tezos_crypto.Context_hash - module Protocol_hash = Tezos_crypto.Protocol_hash + module Block_hash = Block_hash + module Operation_hash = Operation_hash + module Operation_list_hash = Operation_list_hash + module Operation_list_list_hash = Operation_list_list_hash + module Context_hash = Context_hash + module Protocol_hash = Protocol_hash module Blake2B = Tezos_crypto.Blake2B module Fitness = Fitness module Operation = Operation diff --git a/src/lib_protocol_environment/environment_V9.mli b/src/lib_protocol_environment/environment_V9.mli index 87620c30a99c..7b10ba049a43 100644 --- a/src/lib_protocol_environment/environment_V9.mli +++ b/src/lib_protocol_environment/environment_V9.mli @@ -44,19 +44,18 @@ module type T = sig and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result and type Chain_id.t = Tezos_crypto.Chain_id.t - and type Block_hash.t = Tezos_crypto.Block_hash.t - and type Operation_hash.t = Tezos_crypto.Operation_hash.t - and type Operation_list_hash.t = Tezos_crypto.Operation_list_hash.t - and type Operation_list_list_hash.t = - Tezos_crypto.Operation_list_list_hash.t + and type Block_hash.t = Block_hash.t + and type Operation_hash.t = Operation_hash.t + and type Operation_list_hash.t = Operation_list_hash.t + and type Operation_list_list_hash.t = Operation_list_list_hash.t and type Context.t = Context.t and type Context.cache_key = Environment_context.Context.cache_key and type Context.cache_value = Environment_context.Context.cache_value - and type Context_hash.t = Tezos_crypto.Context_hash.t - and type Context_hash.Version.t = Tezos_crypto.Context_hash.Version.t + and type Context_hash.t = Context_hash.t + and type Context_hash.Version.t = Context_hash.Version.t and type Context.config = Tezos_context_sigs.Config.t and module Context.Proof = Environment_context.Context.Proof - and type Protocol_hash.t = Tezos_crypto.Protocol_hash.t + and type Protocol_hash.t = Protocol_hash.t and type Time.t = Time.Protocol.t and type Operation.shell_header = Operation.shell_header and type Operation.t = Operation.t diff --git a/src/lib_protocol_environment/environment_context.ml b/src/lib_protocol_environment/environment_context.ml index fc9e76006595..36384c991606 100644 --- a/src/lib_protocol_environment/environment_context.ml +++ b/src/lib_protocol_environment/environment_context.ml @@ -385,13 +385,16 @@ module Context = struct type cache_key = Environment_cache.key - type block_cache = {context_hash : Tezos_crypto.Context_hash.t; cache : cache} + type block_cache = { + context_hash : Tezos_crypto.Hashed.Context_hash.t; + cache : cache; + } type source_of_cache = [ `Force_load | `Load | `Lazy - | `Inherited of block_cache * Tezos_crypto.Context_hash.t ] + | `Inherited of block_cache * Tezos_crypto.Hashed.Context_hash.t ] type builder = Environment_cache.key -> cache_value tzresult Lwt.t @@ -657,7 +660,10 @@ module Context = struct let open Lwt_syntax in match mode with | `Inherited ({context_hash; cache}, predecessor_context_hash) -> - if Tezos_crypto.Context_hash.equal context_hash predecessor_context_hash + if + Tezos_crypto.Hashed.Context_hash.equal + context_hash + predecessor_context_hash then (* @@ -702,13 +708,7 @@ module Context = struct *) module Cache_cache = - Aches_lwt.Lache.Make_result (Aches.Rache.SingletonTransferMap (struct - type t = Tezos_crypto.Block_hash.t - - let equal = Tezos_crypto.Block_hash.equal - - let hash = Tezos_crypto.Block_hash.hash - end)) + Aches_lwt.Lache.Make_result (Aches.Rache.SingletonTransferMap (Block_hash)) let cache_cache : (cache, error trace) Cache_cache.t = (* The cache is a singleton cache, this is set during the instantiation of @@ -780,7 +780,7 @@ type validation_result = { type quota = {max_size : int; max_op : int option} type rpc_context = { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Tezos_crypto.Hashed.Block_hash.t; block_header : Block_header.shell_header; context : Context.t; } diff --git a/src/lib_protocol_environment/environment_context.mli b/src/lib_protocol_environment/environment_context.mli index 8d5c46031880..1974fd024bac 100644 --- a/src/lib_protocol_environment/environment_context.mli +++ b/src/lib_protocol_environment/environment_context.mli @@ -122,7 +122,10 @@ module Context : sig (** A cache is a block-dependent value: to know whether a cache can be reused or recycled in a given block, we need the block that produces it. *) - type block_cache = {context_hash : Tezos_crypto.Context_hash.t; cache : cache} + type block_cache = { + context_hash : Tezos_crypto.Hashed.Context_hash.t; + cache : cache; + } (** During its loading, a cache can be populated in two different ways: @@ -171,7 +174,7 @@ module Context : sig and the cache cannot be inherited (as in the next case). *) - | `Inherited of block_cache * Tezos_crypto.Context_hash.t + | `Inherited of block_cache * Tezos_crypto.Hashed.Context_hash.t (** When we already have some [block_cache.cache] in memory coming from the validation of some block [block_cache.context_hash], we can reuse or recycle its entries to reconstruct a cache to @@ -203,7 +206,7 @@ module Context : sig key. In other words, the construction of cache should be reproducible. For this reason, an error in [builder] is fatal. *) val load_cache : - Tezos_crypto.Block_hash.t -> + Tezos_crypto.Hashed.Block_hash.t -> t -> source_of_cache -> builder -> @@ -229,7 +232,7 @@ type validation_result = { type quota = {max_size : int; max_op : int option} type rpc_context = { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Tezos_crypto.Hashed.Block_hash.t; block_header : Block_header.shell_header; context : Context.t; } diff --git a/src/lib_protocol_environment/environment_context_intf.ml b/src/lib_protocol_environment/environment_context_intf.ml index bf8838c75bb8..9c907feabc53 100644 --- a/src/lib_protocol_environment/environment_context_intf.ml +++ b/src/lib_protocol_environment/environment_context_intf.ml @@ -98,20 +98,20 @@ end module type CORE = sig type t - val set_protocol : t -> Tezos_crypto.Protocol_hash.t -> t Lwt.t + val set_protocol : t -> Tezos_crypto.Hashed.Protocol_hash.t -> t Lwt.t - val get_protocol : t -> Tezos_crypto.Protocol_hash.t Lwt.t + val get_protocol : t -> Tezos_crypto.Hashed.Protocol_hash.t Lwt.t val fork_test_chain : t -> - protocol:Tezos_crypto.Protocol_hash.t -> + protocol:Tezos_crypto.Hashed.Protocol_hash.t -> expiration:Time.Protocol.t -> t Lwt.t val set_hash_version : - t -> Tezos_crypto.Context_hash.Version.t -> t tzresult Lwt.t + t -> Tezos_crypto.Hashed.Context_hash.Version.t -> t tzresult Lwt.t - val get_hash_version : t -> Tezos_crypto.Context_hash.Version.t + val get_hash_version : t -> Tezos_crypto.Hashed.Context_hash.Version.t end module type TREE_CORE = sig @@ -131,7 +131,7 @@ module type TREE_CORE = sig val of_value : t -> value -> tree Lwt.t - val hash : tree -> Tezos_crypto.Context_hash.t + val hash : tree -> Tezos_crypto.Hashed.Context_hash.t val equal : tree -> tree -> bool diff --git a/src/lib_protocol_environment/environment_protocol_T.ml b/src/lib_protocol_environment/environment_protocol_T.ml index d5bdb4c87060..581f775c127f 100644 --- a/src/lib_protocol_environment/environment_protocol_T.ml +++ b/src/lib_protocol_environment/environment_protocol_T.ml @@ -86,12 +86,12 @@ module V0toV7 | Application of block_header | Partial_validation of block_header | Construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; block_header_data : block_header_data; } | Partial_construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; } @@ -188,19 +188,19 @@ module V0toV7 type validation_info = unit type conflict_handler = - existing_operation:Tezos_crypto.Operation_hash.t * operation -> - new_operation:Tezos_crypto.Operation_hash.t * operation -> + existing_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> + new_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> [`Keep | `Replace] type operation_conflict = | Operation_conflict of { - existing : Tezos_crypto.Operation_hash.t; - new_operation : Tezos_crypto.Operation_hash.t; + existing : Tezos_crypto.Hashed.Operation_hash.t; + new_operation : Tezos_crypto.Hashed.Operation_hash.t; } type add_result = | Added - | Replaced of {removed : Tezos_crypto.Operation_hash.t} + | Replaced of {removed : Tezos_crypto.Hashed.Operation_hash.t} | Unchanged type add_error = @@ -222,7 +222,7 @@ module V0toV7 let merge ?conflict_handler:_ () () = Ok () - let operations () = Tezos_crypto.Operation_hash.Map.empty + let operations () = Tezos_crypto.Hashed.Operation_hash.Map.empty end end @@ -273,7 +273,7 @@ module type PROTOCOL = sig val init : Context.t -> Tezos_crypto.Chain_id.t -> - head_hash:Tezos_crypto.Block_hash.t -> + head_hash:Tezos_crypto.Hashed.Block_hash.t -> head:Block_header.shell_header -> cache:Context.source_of_cache -> (validation_info * t) tzresult Lwt.t diff --git a/src/lib_protocol_environment/environment_protocol_T_V0.ml b/src/lib_protocol_environment/environment_protocol_T_V0.ml index 2fbe1c6ab1b9..f39328d9955b 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V0.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V0.ml @@ -102,7 +102,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> ?protocol_data:block_header_data -> unit -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V3.ml b/src/lib_protocol_environment/environment_protocol_T_V3.ml index 2757418214d2..381d5e394536 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V3.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V3.ml @@ -101,7 +101,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> ?protocol_data:block_header_data -> unit -> @@ -132,7 +132,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> (cache_key -> cache_value tzresult Lwt.t) tzresult Lwt.t end diff --git a/src/lib_protocol_environment/environment_protocol_T_V6.ml b/src/lib_protocol_environment/environment_protocol_T_V6.ml index 100cdee8acb2..f3e51984f625 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V6.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V6.ml @@ -101,7 +101,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> ?protocol_data:block_header_data -> unit -> @@ -135,7 +135,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> (cache_key -> cache_value tzresult Lwt.t) tzresult Lwt.t end diff --git a/src/lib_protocol_environment/environment_protocol_T_V7.ml b/src/lib_protocol_environment/environment_protocol_T_V7.ml index 2d419e840417..4c999e88e6e6 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V7.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V7.ml @@ -78,8 +78,8 @@ module type T = sig val acceptable_pass : operation -> int option val compare_operations : - Tezos_crypto.Operation_hash.t * operation -> - Tezos_crypto.Operation_hash.t * operation -> + Tezos_crypto.Hashed.Operation_hash.t * operation -> + Tezos_crypto.Hashed.Operation_hash.t * operation -> int type validation_state @@ -90,12 +90,12 @@ module type T = sig | Application of block_header | Partial_validation of block_header | Construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; block_header_data : block_header_data; } | Partial_construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; } @@ -109,7 +109,7 @@ module type T = sig val validate_operation : ?check_signature:bool -> validation_state -> - Tezos_crypto.Operation_hash.t -> + Tezos_crypto.Hashed.Operation_hash.t -> operation -> validation_state tzresult Lwt.t @@ -124,7 +124,7 @@ module type T = sig val apply_operation : application_state -> - Tezos_crypto.Operation_hash.t -> + Tezos_crypto.Hashed.Operation_hash.t -> operation -> (application_state * operation_receipt) tzresult Lwt.t @@ -151,7 +151,7 @@ module type T = sig predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Tezos_crypto.Hashed.Block_hash.t -> timestamp:Time.Protocol.t -> (cache_key -> cache_value tzresult Lwt.t) tzresult Lwt.t @@ -161,19 +161,19 @@ module type T = sig type validation_info type conflict_handler = - existing_operation:Tezos_crypto.Operation_hash.t * operation -> - new_operation:Tezos_crypto.Operation_hash.t * operation -> + existing_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> + new_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> [`Keep | `Replace] type operation_conflict = | Operation_conflict of { - existing : Tezos_crypto.Operation_hash.t; - new_operation : Tezos_crypto.Operation_hash.t; + existing : Tezos_crypto.Hashed.Operation_hash.t; + new_operation : Tezos_crypto.Hashed.Operation_hash.t; } type add_result = | Added - | Replaced of {removed : Tezos_crypto.Operation_hash.t} + | Replaced of {removed : Tezos_crypto.Hashed.Operation_hash.t} | Unchanged type add_error = @@ -187,7 +187,7 @@ module type T = sig val init : context -> Tezos_crypto.Chain_id.t -> - head_hash:Tezos_crypto.Block_hash.t -> + head_hash:Tezos_crypto.Hashed.Block_hash.t -> head:Block_header.shell_header -> (validation_info * t) tzresult Lwt.t @@ -198,14 +198,14 @@ module type T = sig ?conflict_handler:conflict_handler -> validation_info -> t -> - Tezos_crypto.Operation_hash.t * operation -> + Tezos_crypto.Hashed.Operation_hash.t * operation -> (t * add_result, add_error) result Lwt.t - val remove_operation : t -> Tezos_crypto.Operation_hash.t -> t + val remove_operation : t -> Tezos_crypto.Hashed.Operation_hash.t -> t val merge : ?conflict_handler:conflict_handler -> t -> t -> (t, merge_error) result - val operations : t -> operation Tezos_crypto.Operation_hash.Map.t + val operations : t -> operation Tezos_crypto.Hashed.Operation_hash.Map.t end end diff --git a/src/lib_protocol_environment/environment_protocol_T_test.ml b/src/lib_protocol_environment/environment_protocol_T_test.ml index da6bc2b21cae..a26360ef8c2a 100644 --- a/src/lib_protocol_environment/environment_protocol_T_test.ml +++ b/src/lib_protocol_environment/environment_protocol_T_test.ml @@ -68,12 +68,12 @@ module Mock_all_unit : | Application of block_header | Partial_validation of block_header | Construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; block_header_data : block_header_data; } | Partial_construction of { - predecessor_hash : Tezos_crypto.Block_hash.t; + predecessor_hash : Tezos_crypto.Hashed.Block_hash.t; timestamp : Time.Protocol.t; } @@ -127,19 +127,19 @@ module Mock_all_unit : type validation_info = unit type conflict_handler = - existing_operation:Tezos_crypto.Operation_hash.t * operation -> - new_operation:Tezos_crypto.Operation_hash.t * operation -> + existing_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> + new_operation:Tezos_crypto.Hashed.Operation_hash.t * operation -> [`Keep | `Replace] type operation_conflict = | Operation_conflict of { - existing : Tezos_crypto.Operation_hash.t; - new_operation : Tezos_crypto.Operation_hash.t; + existing : Tezos_crypto.Hashed.Operation_hash.t; + new_operation : Tezos_crypto.Hashed.Operation_hash.t; } type add_result = | Added - | Replaced of {removed : Tezos_crypto.Operation_hash.t} + | Replaced of {removed : Tezos_crypto.Hashed.Operation_hash.t} | Unchanged type add_error = diff --git a/src/lib_protocol_environment/shell_context/proxy_delegate_maker.ml b/src/lib_protocol_environment/shell_context/proxy_delegate_maker.ml index 3934e5be4040..eb0633553912 100644 --- a/src/lib_protocol_environment/shell_context/proxy_delegate_maker.ml +++ b/src/lib_protocol_environment/shell_context/proxy_delegate_maker.ml @@ -65,7 +65,7 @@ let make_index ~(context_path : string) : Tezos_context.Context.index Lwt.t = Tezos_context.Context.init ~readonly:true context_path let of_index ~(index : Tezos_context.Context.index) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Tezos_crypto.Hashed.Context_hash.t) : Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t = let open Lwt_syntax in let* ctxt = Tezos_context.Context.checkout index hash in @@ -73,7 +73,7 @@ let of_index ~(index : Tezos_context.Context.index) | None -> failwith "Couldn't check out the hash %s" - (Tezos_crypto.Context_hash.to_string hash) + (Tezos_crypto.Hashed.Context_hash.to_string hash) | Some ctxt -> let proxy_data_dir : Tezos_protocol_environment.Proxy_delegate.t = (module struct diff --git a/src/lib_protocol_environment/shell_context/proxy_delegate_maker.mli b/src/lib_protocol_environment/shell_context/proxy_delegate_maker.mli index 00abaf304edb..5a6345741ac4 100644 --- a/src/lib_protocol_environment/shell_context/proxy_delegate_maker.mli +++ b/src/lib_protocol_environment/shell_context/proxy_delegate_maker.mli @@ -60,5 +60,5 @@ val make_index : context_path:string -> Tezos_context.Context.index Lwt.t to obtain an [index], you need a full-fledged context on disk. *) val of_index : index:Tezos_context.Context.index -> - Tezos_crypto.Context_hash.t -> + Tezos_crypto.Hashed.Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t diff --git a/src/lib_protocol_environment/shell_context/shell_context.mli b/src/lib_protocol_environment/shell_context/shell_context.mli index 647a7688b9fe..8f10c51b192f 100644 --- a/src/lib_protocol_environment/shell_context/shell_context.mli +++ b/src/lib_protocol_environment/shell_context/shell_context.mli @@ -47,7 +47,6 @@ making them less amenable to testing for example. *) open Tezos_protocol_environment -open Tezos_crypto (** The additional kind identifying {!Shell_context} values. Used to detect at runtime when a shell context is expected, to disambiguate diff --git a/src/lib_protocol_environment/structs/v0_block_hash.ml b/src/lib_protocol_environment/structs/v0_block_hash.ml index cfe1d6b6d163..0cd39ee80fae 100644 --- a/src/lib_protocol_environment/structs/v0_block_hash.ml +++ b/src/lib_protocol_environment/structs/v0_block_hash.ml @@ -23,31 +23,32 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Block_hash +include Tezos_crypto.Hashed.Block_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Block_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Block_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.Block_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Block_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Block_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Block_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) - Data_encoding.(list (tup2 Tezos_crypto.Block_hash.encoding arg_encoding)) + Data_encoding.( + list (tup2 Tezos_crypto.Hashed.Block_hash.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Block_hash + include Tezos_crypto.Hashed.Block_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -66,5 +67,6 @@ module Table = struct let h = create (List.length l) in List.iter (fun (k, v) -> add h k v) l ; h) - Data_encoding.(list (tup2 Tezos_crypto.Block_hash.encoding arg_encoding)) + Data_encoding.( + list (tup2 Tezos_crypto.Hashed.Block_hash.encoding arg_encoding)) end diff --git a/src/lib_protocol_environment/structs/v0_context_hash.ml b/src/lib_protocol_environment/structs/v0_context_hash.ml index e93c7706ab9e..b81cefe4eede 100644 --- a/src/lib_protocol_environment/structs/v0_context_hash.ml +++ b/src/lib_protocol_environment/structs/v0_context_hash.ml @@ -23,32 +23,32 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Context_hash +include Tezos_crypto.Hashed.Context_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Context_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Context_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.Context_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Context_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Context_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Context_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Context_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Context_hash.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Context_hash + include Tezos_crypto.Hashed.Context_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -68,5 +68,5 @@ module Table = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Context_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Context_hash.encoding arg_encoding)) end diff --git a/src/lib_protocol_environment/structs/v0_operation_hash.ml b/src/lib_protocol_environment/structs/v0_operation_hash.ml index e5a16df1094c..d98cb3f526a5 100644 --- a/src/lib_protocol_environment/structs/v0_operation_hash.ml +++ b/src/lib_protocol_environment/structs/v0_operation_hash.ml @@ -23,32 +23,32 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Operation_hash +include Tezos_crypto.Hashed.Operation_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Operation_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Operation_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.Operation_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Operation_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Operation_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Operation_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Operation_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Operation_hash.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Operation_hash + include Tezos_crypto.Hashed.Operation_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -68,5 +68,5 @@ module Table = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Operation_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Operation_hash.encoding arg_encoding)) end diff --git a/src/lib_protocol_environment/structs/v0_operation_list_hash.ml b/src/lib_protocol_environment/structs/v0_operation_list_hash.ml index 8e024fd908db..3ebcff9a9326 100644 --- a/src/lib_protocol_environment/structs/v0_operation_list_hash.ml +++ b/src/lib_protocol_environment/structs/v0_operation_list_hash.ml @@ -23,32 +23,33 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Operation_list_hash +include Tezos_crypto.Hashed.Operation_list_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Operation_list_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Operation_list_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.Operation_list_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Operation_list_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Operation_list_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Operation_list_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Operation_list_hash.encoding arg_encoding)) + list + (tup2 Tezos_crypto.Hashed.Operation_list_hash.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Operation_list_hash + include Tezos_crypto.Hashed.Operation_list_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -68,5 +69,6 @@ module Table = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Operation_list_hash.encoding arg_encoding)) + list + (tup2 Tezos_crypto.Hashed.Operation_list_hash.encoding arg_encoding)) end diff --git a/src/lib_protocol_environment/structs/v0_operation_list_list_hash.ml b/src/lib_protocol_environment/structs/v0_operation_list_list_hash.ml index 4536de3cf428..8b2cdaf26ad1 100644 --- a/src/lib_protocol_environment/structs/v0_operation_list_list_hash.ml +++ b/src/lib_protocol_environment/structs/v0_operation_list_list_hash.ml @@ -23,32 +23,35 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Operation_list_list_hash +include Tezos_crypto.Hashed.Operation_list_list_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Operation_list_list_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Operation_list_list_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.Operation_list_list_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Operation_list_list_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Operation_list_list_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Operation_list_list_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Operation_list_list_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Hashed.Operation_list_list_hash.encoding + arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Operation_list_list_hash + include Tezos_crypto.Hashed.Operation_list_list_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -68,5 +71,8 @@ module Table = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Operation_list_list_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Hashed.Operation_list_list_hash.encoding + arg_encoding)) end diff --git a/src/lib_protocol_environment/structs/v0_protocol_hash.ml b/src/lib_protocol_environment/structs/v0_protocol_hash.ml index 7bd35801d702..dc8dc749e2ab 100644 --- a/src/lib_protocol_environment/structs/v0_protocol_hash.ml +++ b/src/lib_protocol_environment/structs/v0_protocol_hash.ml @@ -23,32 +23,32 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Protocol_hash +include Tezos_crypto.Hashed.Protocol_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Protocol_hash) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Protocol_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.Protocol_hash.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Protocol_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Protocol_hash) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Protocol_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Protocol_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Protocol_hash.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Protocol_hash + include Tezos_crypto.Hashed.Protocol_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -68,5 +68,5 @@ module Table = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Protocol_hash.encoding arg_encoding)) + list (tup2 Tezos_crypto.Hashed.Protocol_hash.encoding arg_encoding)) end diff --git a/src/lib_protocol_environment/test/test_cache.ml b/src/lib_protocol_environment/test/test_cache.ml index b9e74553db04..dcaa13569ca1 100644 --- a/src/lib_protocol_environment/test/test_cache.ml +++ b/src/lib_protocol_environment/test/test_cache.ml @@ -677,7 +677,7 @@ let load_cache_correctly_restores_cache_in_memory builder mode let*! ctxt0 = Context.Cache.sync ctxt ~cache_nonce:Bytes.empty in (* We want to avoid a cache hit in the cache of caches. *) let block = - Tezos_crypto.Block_hash.hash_string [string_of_int (Random.bits ())] + Tezos_crypto.Hashed.Block_hash.hash_string [string_of_int (Random.bits ())] in let ctxt0 = Context.Cache.clear ctxt0 in let* ctxt1 = Context.load_cache block ctxt0 mode (builder entries) in diff --git a/src/lib_protocol_environment/tezos_protocol_environment.ml b/src/lib_protocol_environment/tezos_protocol_environment.ml index bc4bc8192c37..5f4212723b57 100644 --- a/src/lib_protocol_environment/tezos_protocol_environment.ml +++ b/src/lib_protocol_environment/tezos_protocol_environment.ml @@ -41,7 +41,7 @@ type validation_result = Environment_context.validation_result = { type quota = Environment_context.quota = {max_size : int; max_op : int option} type rpc_context = Environment_context.rpc_context = { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Tezos_crypto.Hashed.Block_hash.t; block_header : Block_header.shell_header; context : Context.t; } diff --git a/src/lib_protocol_updater/registered_protocol.ml b/src/lib_protocol_updater/registered_protocol.ml index c67b6a856694..8b37445ccbe7 100644 --- a/src/lib_protocol_updater/registered_protocol.ml +++ b/src/lib_protocol_updater/registered_protocol.ml @@ -24,7 +24,7 @@ (*****************************************************************************) module type T = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t include Tezos_protocol_environment.PROTOCOL @@ -40,7 +40,7 @@ let build hash = | Some (V0 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V0.Make (Name) () in Some @@ -60,7 +60,7 @@ let build hash = | Some (V1 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V1.Make (Name) () in Some @@ -80,7 +80,7 @@ let build hash = | Some (V2 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V2.Make (Name) () in Some @@ -100,7 +100,7 @@ let build hash = | Some (V3 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V3.Make (Name) () in Some @@ -120,7 +120,7 @@ let build hash = | Some (V4 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V4.Make (Name) () in Some @@ -140,7 +140,7 @@ let build hash = | Some (V5 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V5.Make (Name) () in Some @@ -160,7 +160,7 @@ let build hash = | Some (V6 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V6.Make (Name) () in Some @@ -180,7 +180,7 @@ let build hash = | Some (V7 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V7.Make (Name) () in Some @@ -200,7 +200,7 @@ let build hash = | Some (V8 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V8.Make (Name) () in Some @@ -220,7 +220,7 @@ let build hash = | Some (V9 protocol) -> let (module F) = protocol in let module Name = struct - let name = Tezos_crypto.Protocol_hash.to_b58check hash + let name = Protocol_hash.to_b58check hash end in let module Env = Tezos_protocol_environment.V9.Make (Name) () in Some @@ -238,7 +238,7 @@ let build hash = let complete_b58prefix = Env.Context.complete end : T) -module VersionTable = Tezos_crypto.Protocol_hash.Table +module VersionTable = Protocol_hash.Table let versions : (module T) VersionTable.t = VersionTable.create 20 @@ -265,7 +265,7 @@ let get hash = Some proto | None -> None) -type error += Unregistered_protocol of Tezos_crypto.Protocol_hash.t +type error += Unregistered_protocol of Protocol_hash.t let () = register_error_kind @@ -277,10 +277,9 @@ let () = Format.fprintf fmt "@[<hov>No registered protocol with hash:@ %a@]" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp hash) - Data_encoding.( - obj1 (req "protocol_hash" Tezos_crypto.Protocol_hash.encoding)) + Data_encoding.(obj1 (req "protocol_hash" Protocol_hash.encoding)) (function Unregistered_protocol hash -> Some hash | _ -> None) (fun hash -> Unregistered_protocol hash) @@ -297,7 +296,7 @@ let seq_embedded () = VersionTable.to_seq_keys sources let get_embedded_sources hash = VersionTable.find sources hash module type Source_sig = sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end diff --git a/src/lib_protocol_updater/registered_protocol.mli b/src/lib_protocol_updater/registered_protocol.mli index eb4b1bf0b81e..a16794a30e4a 100644 --- a/src/lib_protocol_updater/registered_protocol.mli +++ b/src/lib_protocol_updater/registered_protocol.mli @@ -24,7 +24,7 @@ (*****************************************************************************) module type T = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t include Tezos_protocol_environment.PROTOCOL @@ -34,26 +34,26 @@ end type t = (module T) -val mem : Tezos_crypto.Protocol_hash.t -> bool +val mem : Protocol_hash.t -> bool val seq : unit -> t Seq.t (** [get hash] searches the protocol of the given hash in the registered protocols. This function also activates the logging facilty of the returned protocol. *) -val get : Tezos_crypto.Protocol_hash.t -> t option +val get : Protocol_hash.t -> t option (** Same as [get] but with the result return type. *) -val get_result : Tezos_crypto.Protocol_hash.t -> t tzresult Lwt.t +val get_result : Protocol_hash.t -> t tzresult Lwt.t -val seq_embedded : unit -> Tezos_crypto.Protocol_hash.t Seq.t +val seq_embedded : unit -> Protocol_hash.t Seq.t -val get_embedded_sources : Tezos_crypto.Protocol_hash.t -> Protocol.t option +val get_embedded_sources : Protocol_hash.t -> Protocol.t option module Register_embedded_V0 (Env : Tezos_protocol_environment.V0.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -66,7 +66,7 @@ module Register_embedded_V0 module Register_embedded_V1 (Env : Tezos_protocol_environment.V1.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -79,7 +79,7 @@ module Register_embedded_V1 module Register_embedded_V2 (Env : Tezos_protocol_environment.V2.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -93,7 +93,7 @@ module Register_embedded_V2 module Register_embedded_V3 (Env : Tezos_protocol_environment.V3.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -107,7 +107,7 @@ module Register_embedded_V3 module Register_embedded_V4 (Env : Tezos_protocol_environment.V4.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -121,7 +121,7 @@ module Register_embedded_V4 module Register_embedded_V5 (Env : Tezos_protocol_environment.V5.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -135,7 +135,7 @@ module Register_embedded_V5 module Register_embedded_V6 (Env : Tezos_protocol_environment.V6.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -149,7 +149,7 @@ module Register_embedded_V6 module Register_embedded_V7 (Env : Tezos_protocol_environment.V7.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -163,7 +163,7 @@ module Register_embedded_V7 module Register_embedded_V8 (Env : Tezos_protocol_environment.V8.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : @@ -177,7 +177,7 @@ module Register_embedded_V8 module Register_embedded_V9 (Env : Tezos_protocol_environment.V9.T) (Proto : Env.Updater.PROTOCOL) (Source : sig - val hash : Tezos_crypto.Protocol_hash.t option + val hash : Protocol_hash.t option val sources : Protocol.t end) : diff --git a/src/lib_protocol_updater/updater.ml b/src/lib_protocol_updater/updater.ml index a4c03e7a70d3..68beed662058 100644 --- a/src/lib_protocol_updater/updater.ml +++ b/src/lib_protocol_updater/updater.ml @@ -45,16 +45,12 @@ let compiler_name = "octez-protocol-compiler" let do_compile hash p = let open Lwt_syntax in let* datadir = get_datadir () in - let source_dir = - datadir // Tezos_crypto.Protocol_hash.to_short_b58check hash // "src" - in - let log_file = - datadir // Tezos_crypto.Protocol_hash.to_short_b58check hash // "LOG" - in + let source_dir = datadir // Protocol_hash.to_short_b58check hash // "src" in + let log_file = datadir // Protocol_hash.to_short_b58check hash // "LOG" in let plugin_file = datadir - // Tezos_crypto.Protocol_hash.to_short_b58check hash - // Format.asprintf "protocol_%a" Tezos_crypto.Protocol_hash.pp hash + // Protocol_hash.to_short_b58check hash + // Format.asprintf "protocol_%a" Protocol_hash.pp hash in try Dynlink.loadfile_private (plugin_file ^ ".cmxs") ; diff --git a/src/lib_protocol_updater/updater.mli b/src/lib_protocol_updater/updater.mli index 73e8998bd594..d0cb5d5f5d4d 100644 --- a/src/lib_protocol_updater/updater.mli +++ b/src/lib_protocol_updater/updater.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -val compile : Tezos_crypto.Protocol_hash.t -> Protocol.t -> bool Lwt.t +val compile : Protocol_hash.t -> Protocol.t -> bool Lwt.t val init : string -> unit diff --git a/src/lib_protocol_updater/updater_events.ml b/src/lib_protocol_updater/updater_events.ml index 5849472ab694..2db933671b27 100644 --- a/src/lib_protocol_updater/updater_events.ml +++ b/src/lib_protocol_updater/updater_events.ml @@ -87,4 +87,4 @@ let internal_error = ~level ~name:"internal_error" ~msg:"internal error while compiling {protocol}" - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ("protocol", Protocol_hash.encoding) diff --git a/src/lib_proxy/light.ml b/src/lib_proxy/light.ml index 927b904d7f9c..1d8f4ad409c0 100644 --- a/src/lib_proxy/light.ml +++ b/src/lib_proxy/light.ml @@ -82,7 +82,7 @@ let sources_config_to_sources rpc_context_builder {min_agreement; uris} = {min_agreement; endpoints} let hash_of_block (block : Tezos_shell_services.Block_services.block) : - Tezos_crypto.Block_hash.t option = + Block_hash.t option = match block with | `Hash (h, 0) -> Some h | `Alias (_, _) | `Genesis | `Head _ | `Level _ | `Hash (_, _) -> None diff --git a/src/lib_proxy/light.mli b/src/lib_proxy/light.mli index 49acf6166caa..e604659cb653 100644 --- a/src/lib_proxy/light.mli +++ b/src/lib_proxy/light.mli @@ -72,4 +72,4 @@ val sources_config_to_sources : (** [None] if the given block is symbolic, otherwise its concrete hash. *) val hash_of_block : - Tezos_shell_services.Block_services.block -> Tezos_crypto.Block_hash.t option + Tezos_shell_services.Block_services.block -> Block_hash.t option diff --git a/src/lib_proxy/proxy_commands.ml b/src/lib_proxy/proxy_commands.ml index 94c3ffc9baea..00b559612293 100644 --- a/src/lib_proxy/proxy_commands.ml +++ b/src/lib_proxy/proxy_commands.ml @@ -31,7 +31,7 @@ let group : Tezos_clic.group = let list_proxy_command_handler _ _ = List.iter (fun (module Proxy : Registration.Proxy_sig) -> - Format.printf "%a@." Tezos_crypto.Protocol_hash.pp Proxy.protocol_hash) + Format.printf "%a@." Protocol_hash.pp Proxy.protocol_hash) @@ Registration.get_all_registered () ; Lwt_result_syntax.return_unit diff --git a/src/lib_proxy/proxy_getter.ml b/src/lib_proxy/proxy_getter.ml index fd784fe2350a..e23914b5ce7e 100644 --- a/src/lib_proxy/proxy_getter.ml +++ b/src/lib_proxy/proxy_getter.ml @@ -125,7 +125,7 @@ type proxy_m = (module M) type proxy_builder = | Of_rpc of (Proxy_proto.proto_rpc -> proxy_m Lwt.t) | Of_data_dir of - (Tezos_crypto.Context_hash.t -> + (Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t) type rpc_context_args = { @@ -140,8 +140,7 @@ type rpc_context_args = { module StringMap = String.Map let make_delegate (ctx : rpc_context_args) - (proto_rpc : (module Proxy_proto.PROTO_RPC)) - (hash : Tezos_crypto.Context_hash.t) : + (proto_rpc : (module Proxy_proto.PROTO_RPC)) (hash : Context_hash.t) : Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t = match ctx.proxy_builder with | Of_rpc f -> diff --git a/src/lib_proxy/proxy_getter.mli b/src/lib_proxy/proxy_getter.mli index 04494cfa7801..dc12bab56cc6 100644 --- a/src/lib_proxy/proxy_getter.mli +++ b/src/lib_proxy/proxy_getter.mli @@ -97,7 +97,7 @@ type proxy_builder = | Of_rpc of (Proxy_proto.proto_rpc -> proxy_m Lwt.t) (** Build a proxy that uses network requests for all data. *) | Of_data_dir of - (Tezos_crypto.Context_hash.t -> + (Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t) (** Build a proxy that looks up data in a running node's data dir. *) @@ -126,7 +126,7 @@ type rpc_context_args = { val make_delegate : rpc_context_args -> (module Proxy_proto.PROTO_RPC) -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t (** Functor to obtain the implementation of [M] for the proxy diff --git a/src/lib_proxy/proxy_services.ml b/src/lib_proxy/proxy_services.ml index 21536ea420ac..3ac4fba51aef 100644 --- a/src/lib_proxy/proxy_services.ml +++ b/src/lib_proxy/proxy_services.ml @@ -59,7 +59,7 @@ type mode = sleep : float -> unit Lwt.t; sym_block_caching_time : Ptime.span option; on_disk_proxy_builder : - (Tezos_crypto.Context_hash.t -> + (Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t) option; } @@ -76,19 +76,17 @@ let get_protocols ?expected_protocol rpc_context chain block = match expected_protocol with | None -> return protocols | Some proto_hash -> - if Tezos_crypto.Protocol_hash.equal next_protocol proto_hash then - return protocols + if Protocol_hash.equal next_protocol proto_hash then return protocols else failwith "Protocol passed to the proxy (%a) and protocol of the node (%a) \ differ." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto_hash - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp next_protocol -type env_cache_key = - Tezos_shell_services.Chain_services.chain * Tezos_crypto.Block_hash.t +type env_cache_key = Tezos_shell_services.Chain_services.chain * Block_hash.t module Env_cache_key_hashed_type : Stdlib.Hashtbl.HashedType with type t = env_cache_key = struct @@ -96,7 +94,7 @@ module Env_cache_key_hashed_type : let equal ((lchain, lblock) : t) ((rchain, rblock) : t) = (* Avoid using polymorphic equality *) - lchain = rchain && Tezos_crypto.Block_hash.equal lblock rblock + lchain = rchain && Block_hash.equal lblock rblock let hash = Hashtbl.hash end diff --git a/src/lib_proxy/proxy_services.mli b/src/lib_proxy/proxy_services.mli index 149f67a59681..8f5307c1cdc0 100644 --- a/src/lib_proxy/proxy_services.mli +++ b/src/lib_proxy/proxy_services.mli @@ -42,7 +42,7 @@ type mode = sleep : float -> unit Lwt.t; sym_block_caching_time : Ptime.span option; on_disk_proxy_builder : - (Tezos_crypto.Context_hash.t -> + (Context_hash.t -> Tezos_protocol_environment.Proxy_delegate.t tzresult Lwt.t) option; } @@ -50,7 +50,7 @@ type mode = by {!Lwt_unix.sleep}. We don't want to depend on it directly (for compiling to Javascript), hence this field. The [Ptime.span option] field is the value of argument [--sym-block-caching-time]. The - [(Tezos_crypto.Context_hash.t -> Proxy_delegate.t tzresult Lwt.t) option] + [(Context_hash.t -> Proxy_delegate.t tzresult Lwt.t) option] value is constructed from argument [--data-dir]: if the argument is present, this value represents how data is looked up in the data-dir of a running node. *) @@ -68,5 +68,5 @@ val build_directory : Tezos_client_base.Client_context.printer -> Tezos_rpc.Context.generic -> mode -> - Tezos_crypto.Protocol_hash.t option -> + Protocol_hash.t option -> unit Tezos_rpc.Directory.t diff --git a/src/lib_proxy/registration.ml b/src/lib_proxy/registration.ml index a039c8aa6782..aeabe2b0c5cc 100644 --- a/src/lib_proxy/registration.ml +++ b/src/lib_proxy/registration.ml @@ -26,7 +26,7 @@ open Tezos_shell_services module type Proxy_sig = sig - val protocol_hash : Tezos_crypto.Protocol_hash.t + val protocol_hash : Protocol_hash.t (** RPCs provided by the protocol *) val directory : Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.t @@ -34,7 +34,7 @@ module type Proxy_sig = sig (** How to build the context to execute RPCs on *) val initial_context : Proxy_getter.rpc_context_args -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> Tezos_protocol_environment.Context.t tzresult Lwt.t val time_between_blocks : @@ -55,28 +55,27 @@ let register_proxy_context m = if List.exists (fun (module P : Proxy_sig) -> - Tezos_crypto.Protocol_hash.(P.protocol_hash = INCOMING_P.protocol_hash)) + Protocol_hash.(P.protocol_hash = INCOMING_P.protocol_hash)) !registered then raise @@ Invalid_argument (Format.asprintf "A proxy environment for protocol %a is registered already" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp INCOMING_P.protocol_hash) else registered := m :: !registered let get_all_registered () : proxy_environment list = !registered let get_registered_proxy (printer : Tezos_client_base.Client_context.printer) - (protocol_hash : Tezos_crypto.Protocol_hash.t) : - proxy_environment tzresult Lwt.t = + (protocol_hash : Protocol_hash.t) : proxy_environment tzresult Lwt.t = let open Lwt_result_syntax in let available = !registered in let proxy_opt = List.find_opt (fun (module Proxy : Proxy_sig) -> - Tezos_crypto.Protocol_hash.equal protocol_hash Proxy.protocol_hash) + Protocol_hash.equal protocol_hash Proxy.protocol_hash) available in match proxy_opt with @@ -97,14 +96,14 @@ let get_registered_proxy (printer : Tezos_client_base.Client_context.printer) Proceeding with the first available protocol (%a). This will \ work if the mismatch is harmless, otherwise deserialization is \ the failure most likely to happen." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol_hash (Format.pp_print_list ~pp_sep:Format.pp_print_space - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) ((List.map (fun (module P : Proxy_sig) -> P.protocol_hash)) available) - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp fst_available_proto in return fst_available) diff --git a/src/lib_proxy/registration.mli b/src/lib_proxy/registration.mli index c6abf652f1b9..96493398b918 100644 --- a/src/lib_proxy/registration.mli +++ b/src/lib_proxy/registration.mli @@ -29,7 +29,7 @@ open Tezos_shell_services prepared protocol-side and registered here to become available to the proxy facility. *) module type Proxy_sig = sig - val protocol_hash : Tezos_crypto.Protocol_hash.t + val protocol_hash : Protocol_hash.t (** RPCs provided by the protocol *) val directory : Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.t @@ -44,7 +44,7 @@ module type Proxy_sig = sig *) val initial_context : Proxy_getter.rpc_context_args -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> Tezos_protocol_environment.Context.t tzresult Lwt.t (** The [time_between_blocks] constant for the given block, if any. *) @@ -72,5 +72,5 @@ val get_all_registered : unit -> proxy_environment list (** Returns a proxy environment for the given protocol. *) val get_registered_proxy : Tezos_client_base.Client_context.printer -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> proxy_environment tzresult Lwt.t diff --git a/src/lib_proxy/rpc/RPC_client.mli b/src/lib_proxy/rpc/RPC_client.mli index 2c1178c2bb85..4e47edf417f8 100644 --- a/src/lib_proxy/rpc/RPC_client.mli +++ b/src/lib_proxy/rpc/RPC_client.mli @@ -33,5 +33,5 @@ class http_local_ctxt : Tezos_client_base.Client_context.printer -> Tezos_rpc.Context.generic -> Tezos_proxy.Proxy_services.mode - -> Tezos_crypto.Protocol_hash.t option + -> Protocol_hash.t option -> Tezos_rpc.Context.generic diff --git a/src/lib_scoru_wasm/durable.mli b/src/lib_scoru_wasm/durable.mli index b61c98da7207..822679362a18 100644 --- a/src/lib_scoru_wasm/durable.mli +++ b/src/lib_scoru_wasm/durable.mli @@ -121,14 +121,14 @@ val delete : ?edit_readonly:bool -> t -> key -> t Lwt.t (** [hash durable key] retrieves the tree hash of the value at the given [key]. This is not the same as the hash of the value. *) -val hash : t -> key -> Tezos_crypto.Context_hash.t option Lwt.t +val hash : t -> key -> Context_hash.t option Lwt.t (** [hash_exn durable key] retrieves the tree hash of the value at the given [key]. This is not the same as the hash of the value. @raise Value_not_found when [key] is not found *) -val hash_exn : t -> key -> Tezos_crypto.Context_hash.t Lwt.t +val hash_exn : t -> key -> Context_hash.t Lwt.t (** [set_value_exn durable key str] installs the value [str] in [durable] under [key], replacing any previous contents under this diff --git a/src/lib_scoru_wasm/fast/module_cache.ml b/src/lib_scoru_wasm/fast/module_cache.ml index b964dde92d42..77d5a705984c 100644 --- a/src/lib_scoru_wasm/fast/module_cache.ml +++ b/src/lib_scoru_wasm/fast/module_cache.ml @@ -27,7 +27,7 @@ module Wasmer = Tezos_wasmer module Lazy_containers = Tezos_lazy_containers module Kernel_cache = Cache.Make (struct - module Key = Tezos_crypto.Context_hash + module Key = Context_hash type value = Wasmer.Module.t diff --git a/src/lib_scoru_wasm/fast/test/test_fast.ml b/src/lib_scoru_wasm/fast/test/test_fast.ml index b20b50589d3c..704d72bf2186 100644 --- a/src/lib_scoru_wasm/fast/test/test_fast.ml +++ b/src/lib_scoru_wasm/fast/test/test_fast.ml @@ -125,7 +125,7 @@ let test_against_both ?images ~from_binary ~kernel ~messages () = let* fast_hashes = run_with (apply_fast ?images) in let* slow_hashes = run_with (fun _ -> apply_slow ?images) in - assert (List.equal Tezos_crypto.Context_hash.equal slow_hashes fast_hashes) ; + assert (List.equal Context_hash.equal slow_hashes fast_hashes) ; Lwt_result_syntax.return_unit @@ -430,7 +430,7 @@ let test_compute_step_many_pauses_at_snapshot_when_flag_set = in let hash_fast = Tezos_context_memory.Context_binary.Tree.hash fast_tree in let hash_slow = Tezos_context_memory.Context_binary.Tree.hash slow_tree in - assert (Tezos_crypto.Context_hash.equal hash_fast hash_slow) ; + assert (Context_hash.equal hash_fast hash_slow) ; return ()) let tests = diff --git a/src/lib_scoru_wasm/helpers/wasm_utils.ml b/src/lib_scoru_wasm/helpers/wasm_utils.ml index 6a65604fa708..21878d41a338 100644 --- a/src/lib_scoru_wasm/helpers/wasm_utils.ml +++ b/src/lib_scoru_wasm/helpers/wasm_utils.ml @@ -174,12 +174,12 @@ let set_sol_input level tree = Wasm.set_input_step (input_info level Z.zero) sol_input tree let set_info_per_level_input level tree = - let block_hash = Tezos_crypto.Block_hash.zero in + let block_hash = Block_hash.zero in let timestamp = Time.Protocol.epoch in let info_res = Data_encoding.( Binary.to_string - (tup2 Time.Protocol.encoding Tezos_crypto.Block_hash.encoding) + (tup2 Time.Protocol.encoding Block_hash.encoding) (timestamp, block_hash)) in match info_res with diff --git a/src/lib_scoru_wasm/test/test_hash_consistency.ml b/src/lib_scoru_wasm/test/test_hash_consistency.ml index 0261e92caaa1..594269d1b121 100644 --- a/src/lib_scoru_wasm/test/test_hash_consistency.ml +++ b/src/lib_scoru_wasm/test/test_hash_consistency.ml @@ -50,8 +50,7 @@ let test_execution_correspondance skip count () = let*! tree_ref, _ = Wasm.compute_step_many ~max_steps:n tree in let*! tree' = Wasm.compute_step tree' in assert ( - Tezos_crypto.Context_hash.( - Context.Tree.hash tree_ref = Context.Tree.hash tree')) ; + Context_hash.(Context.Tree.hash tree_ref = Context.Tree.hash tree')) ; if n < count then explore tree' (Int64.succ n) else return_unit in explore tree 1L) diff --git a/src/lib_scoru_wasm/test/test_wasm_pvm.ml b/src/lib_scoru_wasm/test/test_wasm_pvm.ml index 36f1b117393b..fe461ac2a13e 100644 --- a/src/lib_scoru_wasm/test/test_wasm_pvm.ml +++ b/src/lib_scoru_wasm/test/test_wasm_pvm.ml @@ -716,8 +716,7 @@ let test_rebuild_snapshotable_state () = (* Both hash should be exactly the same. *) let hash_tree_after_eval = Encodings_util.Tree.hash tree_after_eval in let hash_rebuilded_tree = Encodings_util.Tree.hash rebuilded_tree in - assert ( - Tezos_crypto.Context_hash.equal hash_tree_after_eval hash_rebuilded_tree) ; + assert (Context_hash.equal hash_tree_after_eval hash_rebuilded_tree) ; (* The hash of the tree rebuilded from the evaluated one without the "wasm" part should also be exactly the same. *) @@ -725,9 +724,7 @@ let test_rebuild_snapshotable_state () = Encodings_util.Tree.hash rebuilded_tree_without_wasm in assert ( - Tezos_crypto.Context_hash.equal - hash_tree_after_eval - hash_rebuilded_tree_without_wasm) ; + Context_hash.equal hash_tree_after_eval hash_rebuilded_tree_without_wasm) ; (* To be sure, let's try to evaluate a new input from these two, either by the regular tree or the snapshoted one. *) @@ -744,9 +741,7 @@ let test_rebuild_snapshotable_state () = in assert ( - Tezos_crypto.Context_hash.equal - hash_input_tree_after_eval - hash_input_rebuilded_tree) ; + Context_hash.equal hash_input_tree_after_eval hash_input_rebuilded_tree) ; return_unit let test_unkown_host_function_truncated () = @@ -813,9 +808,7 @@ let test_bulk_noops () = let rec goto_snapshot ticks tree_slow = let* tree_fast, _ = Wasm.compute_step_many ~max_steps:ticks base_tree in let* tree_slow = Wasm.compute_step tree_slow in - assert ( - Tezos_crypto.Context_hash.( - Encodings_util.Tree.(hash tree_fast = hash tree_slow))) ; + assert (Context_hash.(Encodings_util.Tree.(hash tree_fast = hash tree_slow))) ; let* stuck_flag = has_stuck_flag tree_fast in assert (not stuck_flag) ; diff --git a/src/lib_shell/block_directory.ml b/src/lib_shell/block_directory.ml index 3a733510788e..271660fc559e 100644 --- a/src/lib_shell/block_directory.ml +++ b/src/lib_shell/block_directory.ml @@ -62,8 +62,7 @@ let read_partial_context = let build_raw_header_rpc_directory (module Proto : Block_services.PROTO) = let open Lwt_result_syntax in let dir : - (Store.chain_store * Tezos_crypto.Block_hash.t * Block_header.t) - Tezos_rpc.Directory.t + (Store.chain_store * Block_hash.t * Block_header.t) Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in diff --git a/src/lib_shell/block_validator.ml b/src/lib_shell/block_validator.ml index 38f8dd604e6b..a5a5506051f4 100644 --- a/src/lib_shell/block_validator.ml +++ b/src/lib_shell/block_validator.ml @@ -40,12 +40,11 @@ type validation_result = type new_block = { block : Store.Block.t; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } module Block_hash_ring = - Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) (Block_hash) module Name = struct type t = unit @@ -83,7 +82,7 @@ module Request = struct notify_new_block : new_block -> unit; canceler : Lwt_canceler.t option; peer : P2p_peer.Id.t option; - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.t list list; precheck_and_notify : bool; @@ -475,12 +474,12 @@ let validate w ?canceler ?peer ?(notify_new_block = fun _ -> ()) let open Lwt_result_syntax in let hashes = List.map (List.map Operation.hash) operations in let computed_hash = - Tezos_crypto.Operation_list_list_hash.compute - (List.map Tezos_crypto.Operation_list_hash.compute hashes) + Operation_list_list_hash.compute + (List.map Operation_list_hash.compute hashes) in let* () = fail_when - (Tezos_crypto.Operation_list_list_hash.compare + (Operation_list_list_hash.compare computed_hash header.shell.operations_hash <> 0) diff --git a/src/lib_shell/block_validator.mli b/src/lib_shell/block_validator.mli index 3975836503ff..b06cbcbcf5f8 100644 --- a/src/lib_shell/block_validator.mli +++ b/src/lib_shell/block_validator.mli @@ -31,7 +31,7 @@ type t (** Type of a validated block *) type new_block = { block : Store.Block.t; (** The block itself. *) - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; (** The context hash resulting of [block]'s application. It may be the same one as contained in its header depending @@ -108,7 +108,7 @@ val validate : ?notify_new_block:(new_block -> unit) -> ?precheck_and_notify:bool -> Distributed_db.chain_db -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t list list -> block_validity Lwt.t @@ -139,7 +139,7 @@ val fetch_and_compile_protocol : t -> ?peer:P2p_peer.Id.t -> ?timeout:Time.System.Span.t -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Registered_protocol.t tzresult Lwt.t (** [context_garbage_collection bv index chain_store context_hash @@ -152,7 +152,7 @@ val fetch_and_compile_protocol : val context_garbage_collection : t -> Context_ops.index -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> gc_lockfile_path:string -> unit tzresult Lwt.t diff --git a/src/lib_shell/block_validator_events.ml b/src/lib_shell/block_validator_events.ml index 2bd367064c2a..e64dd16e4bd9 100644 --- a/src/lib_shell/block_validator_events.ml +++ b/src/lib_shell/block_validator_events.ml @@ -33,9 +33,9 @@ let validation_success = ~name:"validation_success" ~msg:"block {block} validated {worker_status}" ~level:Notice - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:Worker_types.pp_status - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) let validation_failure = @@ -44,10 +44,10 @@ let validation_failure = ~name:"validation_failed" ~msg:"validation of block {block} failed, {worker_status}: {errors}" ~level:Notice - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:Worker_types.pp_status ~pp3:pp_print_top_error_of_trace - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) ("errors", Error_monad.trace_encoding) @@ -57,8 +57,8 @@ let previously_validated = ~name:"previously_validated" ~msg:"previously validated block {hash} (after pipe)" ~level:Debug - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) let validating_block = declare_1 @@ -66,8 +66,8 @@ let validating_block = ~name:"validating_block" ~msg:"validating block {hash}" ~level:Debug - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) let preapplication_success = declare_2 @@ -103,10 +103,10 @@ let validation_failure_after_precheck = ~msg: "validation of block {block} failed but precheck succeeded, \ {worker_status}: {errors}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:Worker_types.pp_status ~pp3:pp_print_top_error_of_trace - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) ("errors", Tezos_rpc.Error.encoding) @@ -116,10 +116,10 @@ let precheck_failure = ~name:"precheck_failure" ~level:Notice ~msg:"precheck of block {block} failed, {worker_status}: {errors}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:Worker_types.pp_status ~pp3:pp_print_top_error_of_trace - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) ("errors", Tezos_rpc.Error.encoding) @@ -129,8 +129,8 @@ let prechecked_block = ~name:"prechecked_block" ~level:Notice ~msg:"prechecked block {hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) let prechecking_block = declare_1 @@ -138,8 +138,8 @@ let prechecking_block = ~name:"prechecking_block" ~level:Debug ~msg:"prechecking block {hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) let could_not_find_context = declare_1 @@ -147,5 +147,5 @@ let could_not_find_context = ~name:"could_not_find_context" ~level:Debug ~msg:"could not find context for block {hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("hash", Block_hash.encoding) diff --git a/src/lib_shell/block_validator_process.ml b/src/lib_shell/block_validator_process.ml index 5ac3cfcec45e..e588c5e6d076 100644 --- a/src/lib_shell/block_validator_process.ml +++ b/src/lib_shell/block_validator_process.ml @@ -71,15 +71,14 @@ module type S = sig chain_id:Tezos_crypto.Chain_id.t -> timestamp:Time.Protocol.t -> protocol_data:bytes -> - live_blocks:Tezos_crypto.Block_hash.Set.t -> - live_operations:Tezos_crypto.Operation_hash.Set.t -> + live_blocks:Block_hash.Set.t -> + live_operations:Operation_hash.Set.t -> predecessor_shell_header:Block_header.shell_header -> - predecessor_hash:Tezos_crypto.Block_hash.t -> + predecessor_hash:Block_hash.t -> predecessor_max_operations_ttl:int -> - predecessor_block_metadata_hash:Tezos_crypto.Block_metadata_hash.t option -> - predecessor_ops_metadata_hash: - Tezos_crypto.Operation_metadata_list_list_hash.t option -> - predecessor_resulting_context_hash:Tezos_crypto.Context_hash.t -> + predecessor_block_metadata_hash:Block_metadata_hash.t option -> + predecessor_ops_metadata_hash:Operation_metadata_list_list_hash.t option -> + predecessor_resulting_context_hash:Context_hash.t -> Operation.t list list -> (Block_header.shell_header * error Preapply_result.t list) tzresult Lwt.t @@ -88,23 +87,21 @@ module type S = sig Store.chain_store -> predecessor:Store.Block.t -> Block_header.t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Operation.t trace trace -> unit tzresult Lwt.t val context_garbage_collection : t -> Context_ops.index -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> gc_lockfile_path:string -> unit tzresult Lwt.t val context_split : t -> Context_ops.index -> unit tzresult Lwt.t val commit_genesis : - t -> - chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Context_hash.t tzresult Lwt.t + t -> chain_id:Tezos_crypto.Chain_id.t -> Context_hash.t tzresult Lwt.t (** [init_test_chain] must only be called on a forking block. *) val init_test_chain : @@ -146,8 +143,8 @@ module Internal_validator_process = struct ~level:Debug ~name:"seq_validation_request" ~msg:"requesting validation of {block} for chain {chain}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:Tezos_crypto.Chain_id.pp ("chain", Tezos_crypto.Chain_id.encoding) @@ -157,8 +154,8 @@ module Internal_validator_process = struct ~level:Debug ~name:"seq_validation_success" ~msg:"block {block} successfully validated in {timespan}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:Time.System.Span.pp_hum ("timespan", Time.System.Span.encoding) @@ -898,7 +895,7 @@ module External_validator_process = struct let commit_genesis validator ~chain_id = let request = External_validation.Commit_genesis {chain_id} in - send_request validator request Tezos_crypto.Context_hash.encoding + send_request validator request Context_hash.encoding let init_test_chain validator chain_id forking_block = let forked_header = Store.Block.header forking_block in diff --git a/src/lib_shell/block_validator_process.mli b/src/lib_shell/block_validator_process.mli index 4042cff30bdd..6321ded3cf6c 100644 --- a/src/lib_shell/block_validator_process.mli +++ b/src/lib_shell/block_validator_process.mli @@ -111,7 +111,7 @@ val precheck_block : Store.chain_store -> predecessor:Store.Block.t -> Block_header.t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Operation.t trace trace -> unit tzresult Lwt.t @@ -121,7 +121,7 @@ val precheck_block : val context_garbage_collection : t -> Context_ops.index -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> gc_lockfile_path:string -> unit tzresult Lwt.t @@ -130,9 +130,7 @@ val context_garbage_collection : val context_split : t -> Context_ops.index -> unit tzresult Lwt.t val commit_genesis : - t -> - chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Context_hash.t tzresult Lwt.t + t -> chain_id:Tezos_crypto.Chain_id.t -> Context_hash.t tzresult Lwt.t (** [init_test_chain] must only be called on a forking block. *) val init_test_chain : diff --git a/src/lib_shell/bootstrap_pipeline.ml b/src/lib_shell/bootstrap_pipeline.ml index 79d4d3fa8247..bf2dbc627fe9 100644 --- a/src/lib_shell/bootstrap_pipeline.ml +++ b/src/lib_shell/bootstrap_pipeline.ml @@ -127,12 +127,9 @@ type t = { locator : Block_locator.t; block_validator : Block_validator.t; notify_new_block : Block_validator.new_block -> unit; - fetched_headers : - (Tezos_crypto.Block_hash.t * Block_header.t) list Lwt_pipe.Bounded.t; + fetched_headers : (Block_hash.t * Block_header.t) list Lwt_pipe.Bounded.t; fetched_blocks : - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list tzresult Lwt.t) + (Block_hash.t * Block_header.t * Operation.t list list tzresult Lwt.t) Lwt_pipe.Bounded.t; (* HACK, a worker should be able to return the 'error'. *) @@ -170,7 +167,7 @@ let assert_acceptable_header pipeline hash (header : Block_header.t) = let* () = fail_when (Compare.Int32.(header.shell.level = checkpoint_level) - && not (Tezos_crypto.Block_hash.equal hash checkpoint_hash)) + && not (Block_hash.equal hash checkpoint_hash)) (Checkpoint_error (hash, Some pipeline.peer_id)) in let*! current_head = Store.Chain.current_head chain_store in @@ -221,7 +218,7 @@ let fetch_step pipeline (step : Block_locator.step) = Bootstrap_pipeline_event.(emit step_too_long) pipeline.peer_id in tzfail (Invalid_locator (pipeline.peer_id, pipeline.locator)) - else if Tezos_crypto.Block_hash.equal hash step.predecessor then + else if Block_hash.equal hash step.predecessor then if step.strict_step && cpt <> step.step then let*! () = Bootstrap_pipeline_event.(emit step_too_short) pipeline.peer_id @@ -588,7 +585,7 @@ let create ?(notify_new_block = fun _ -> ()) ~block_header_timeout "bootstrap_pipeline-headers_fetch.%a.%a" P2p_peer.Id.pp_short peer_id - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short locator.Block_locator.head_hash) ~on_event:Internal_event.Lwt_worker_logger.on_event ~run:(fun () -> headers_fetch_worker_loop pipeline) @@ -599,7 +596,7 @@ let create ?(notify_new_block = fun _ -> ()) ~block_header_timeout "bootstrap_pipeline-operations_fetch.%a.%a" P2p_peer.Id.pp_short peer_id - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short locator.head_hash) ~on_event:Internal_event.Lwt_worker_logger.on_event ~run:(fun () -> operations_fetch_worker_loop pipeline) @@ -610,7 +607,7 @@ let create ?(notify_new_block = fun _ -> ()) ~block_header_timeout "bootstrap_pipeline-validation.%a.%a" P2p_peer.Id.pp_short peer_id - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short locator.head_hash) ~on_event:Internal_event.Lwt_worker_logger.on_event ~run:(fun () -> validation_worker_loop pipeline) diff --git a/src/lib_shell/bootstrap_pipeline_event.ml b/src/lib_shell/bootstrap_pipeline_event.ml index b75565607d60..d2383901e429 100644 --- a/src/lib_shell/bootstrap_pipeline_event.ml +++ b/src/lib_shell/bootstrap_pipeline_event.ml @@ -66,8 +66,8 @@ let fetching_step_from_peer = ("step_number", Data_encoding.int31) ("number_of_steps", Data_encoding.int31) ("step_length", Data_encoding.int31) - ("block", Tezos_crypto.Block_hash.encoding) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) let fetching_block_header_from_peer = @@ -76,7 +76,7 @@ let fetching_block_header_from_peer = ~name:"fetching_block_header_from_peer" ~msg:"fetched header {block} from {peer_id} {block_fetched}/{step_length}" ~level:Debug - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) ("block_fetched", Data_encoding.int31) ("step_length", Data_encoding.int31) @@ -97,7 +97,7 @@ let fetching_operations = ~name:"fetching_operations" ~msg:"fetching operations of block {block_hash} from peer {peer_id}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) let fetched_operations = @@ -106,7 +106,7 @@ let fetched_operations = ~name:"fetched_operations" ~msg:"fetched operations of block {block_hash} from peer {peer_id}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) let requesting_validation = @@ -115,7 +115,7 @@ let requesting_validation = ~name:"requesting_validation" ~msg:"requesting validation for block {block_hash} from peer {peer_id}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) let validated_block = @@ -124,7 +124,7 @@ let validated_block = ~name:"validated_block" ~msg:"validated block {block_hash} from peer {peer_id}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) (* warning level events *) @@ -137,7 +137,7 @@ let request_operations_timeout = "request for operations {block_hash}:{operations_index_tag} from peer \ {peer_id} timed out" ~level:Warning - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("operations_index_tag", Data_encoding.int31) ("peer_id", P2p_peer.Id.encoding) @@ -163,7 +163,7 @@ let header_request_timeout = ~name:"header_request_timeout" ~msg:"request for header {block_hash} from peer {peer_id} timed out" ~level:Warning - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) let locator_contains_future_block = @@ -172,7 +172,7 @@ let locator_contains_future_block = ~name:"locator_contains_future_block" ~msg:"block locator {block_hash} from peer {peer_id} contains future blocks" ~level:Warning - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) ("time", Time.System.encoding) ("block_time", Time.Protocol.encoding) diff --git a/src/lib_shell/chain_directory.ml b/src/lib_shell/chain_directory.ml index 0e3ee53ba38e..1d1748dbe719 100644 --- a/src/lib_shell/chain_directory.ml +++ b/src/lib_shell/chain_directory.ml @@ -63,8 +63,7 @@ let predecessors chain_store ignored length head = match o with | None -> return (List.rev acc) | Some pred -> - if Tezos_crypto.Block_hash.Set.mem block ignored then - return (List.rev acc) + if Block_hash.Set.mem block ignored then return (List.rev acc) else loop (pred :: acc) (length - 1) pred in let head_hash = Store.Block.hash head in @@ -107,12 +106,12 @@ let list_blocks chain_store ?(length = 1) ?min_date blocks = let* predecessors = predecessors chain_store ignored length block in let ignored = List.fold_left - (fun acc v -> Tezos_crypto.Block_hash.Set.add v acc) + (fun acc v -> Block_hash.Set.add v acc) ignored predecessors in return (ignored, predecessors :: acc)) - (Tezos_crypto.Block_hash.Set.empty, []) + (Block_hash.Set.empty, []) requested_blocks in return (List.rev blocks) @@ -186,7 +185,7 @@ let rpc_directory validator = register0 S.Invalid_blocks.list (fun chain_store () () -> let convert (hash, {Store_types.level; errors}) = {hash; level; errors} in let*! invalid_blocks_map = Store.Block.read_invalid_blocks chain_store in - let blocks = Tezos_crypto.Block_hash.Map.bindings invalid_blocks_map in + let blocks = Block_hash.Map.bindings invalid_blocks_map in return (List.map convert blocks)) ; register1 S.Invalid_blocks.get (fun chain_store hash () () -> let*! o = Store.Block.read_invalid_block_opt chain_store hash in diff --git a/src/lib_shell/chain_directory.mli b/src/lib_shell/chain_directory.mli index 20b82984748c..d24746095339 100644 --- a/src/lib_shell/chain_directory.mli +++ b/src/lib_shell/chain_directory.mli @@ -33,8 +33,7 @@ val get_chain_id_opt : val get_chain_store_exn : Store.t -> Chain_services.chain -> Store.chain_store Lwt.t -val get_checkpoint : - Store.t -> Chain_services.chain -> Tezos_crypto.Block_hash.t Lwt.t +val get_checkpoint : Store.t -> Chain_services.chain -> Block_hash.t Lwt.t val rpc_directory : Validator.t -> Store.chain_store Tezos_rpc.Directory.t diff --git a/src/lib_shell/chain_validator.ml b/src/lib_shell/chain_validator.ml index cd473150b59a..0076d3bc153e 100644 --- a/src/lib_shell/chain_validator.ml +++ b/src/lib_shell/chain_validator.ml @@ -46,12 +46,12 @@ module Request = struct peer : P2p_peer_id.t option; (* The peer who sent the block if it was not injected locally. *) block : Store.Block.t; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } -> (update, error trace) t | Notify_branch : P2p_peer.Id.t * Block_locator.t -> (unit, Empty.t) t | Notify_head : - P2p_peer.Id.t * Tezos_crypto.Block_hash.t * Block_header.t * Mempool.t + P2p_peer.Id.t * Block_hash.t * Block_header.t * Mempool.t -> (unit, Empty.t) t | Disconnection : P2p_peer.Id.t -> (unit, Empty.t) t @@ -241,8 +241,7 @@ let may_switch_test_chain w active_chains spawn_child block = | Some (child, _) -> let child_chain_store = child.parameters.chain_store in let child_genesis = Store.Chain.genesis child_chain_store in - Lwt.return - (Tezos_crypto.Block_hash.equal child_genesis.block genesis_hash) + Lwt.return (Block_hash.equal child_genesis.block genesis_hash) in let expired = expiration < block_header.shell.timestamp in if expired && activated then @@ -380,7 +379,7 @@ let safe_get_prevalidator_filter hash = (* This should not happen: it should be handled in the validator. *) failwith "chain_validator: missing protocol '%a' for the current block." - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short hash | Some protocol -> let* () = Events.(emit prevalidator_filter_not_found) hash in @@ -545,7 +544,7 @@ let on_validation_request w peer start_testchain active_chains spawn_child block in Lwt_watcher.notify nv.new_head_input block ; let is_head_increment = - Tezos_crypto.Block_hash.equal head_hash block_header.shell.predecessor + Block_hash.equal head_hash block_header.shell.predecessor in let event = if is_head_increment then Head_increment else Branch_switch in let* () = diff --git a/src/lib_shell/chain_validator.mli b/src/lib_shell/chain_validator.mli index 94e05ce5aa7c..47d1379cf246 100644 --- a/src/lib_shell/chain_validator.mli +++ b/src/lib_shell/chain_validator.mli @@ -69,7 +69,7 @@ val reconfigure_event_logging : val validate_block : t -> ?force:bool -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t list list -> unit tzresult Lwt.t diff --git a/src/lib_shell/chain_validator_events.ml b/src/lib_shell/chain_validator_events.ml index 20f9c4df2d26..cb4e08dd1074 100644 --- a/src/lib_shell/chain_validator_events.ml +++ b/src/lib_shell/chain_validator_events.ml @@ -34,9 +34,9 @@ let updated_to_checkpoint = ~name:"updated_to_checkpoint" ~msg:"updated to checkpoint {block_hash} (running in mode {history_mode})" ~level:Notice - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:History_mode.Legacy.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("history_mode", History_mode.Legacy.encoding) let prevalidator_filter_not_found = @@ -45,8 +45,8 @@ let prevalidator_filter_not_found = ~name:"prevalidator_filter_not_found" ~msg:"no prevalidator filter found for protocol {protocol_hash}" ~level:Warning - ~pp1:Tezos_crypto.Protocol_hash.pp - ("protocol_hash", Tezos_crypto.Protocol_hash.encoding) + ~pp1:Protocol_hash.pp + ("protocol_hash", Protocol_hash.encoding) let prevalidator_reinstantiation_failure = declare_1 @@ -72,8 +72,8 @@ let loading_protocol = ~name:"loading_protocol" ~level:Notice ~msg:"loading non-embedded protocol {protocol} from disk" - ~pp1:Tezos_crypto.Protocol_hash.pp - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ~pp1:Protocol_hash.pp + ("protocol", Protocol_hash.encoding) let bootstrapped = declare_0 diff --git a/src/lib_shell/distributed_db.ml b/src/lib_shell/distributed_db.ml index 2eff16335b51..61f9af1dec95 100644 --- a/src/lib_shell/distributed_db.ml +++ b/src/lib_shell/distributed_db.ml @@ -260,7 +260,7 @@ let clear_block chain_db hash n = let commit_block chain_db hash block_header operations result = let open Lwt_result_syntax in - assert (Tezos_crypto.Block_hash.equal hash (Block_header.hash block_header)) ; + assert (Block_hash.equal hash (Block_header.hash block_header)) ; assert ( Compare.List_length_with.(operations = block_header.shell.validation_passes)) ; let* res = @@ -275,7 +275,7 @@ let commit_block chain_db hash block_header operations result = let commit_invalid_block chain_db hash header errors = let open Lwt_result_syntax in - assert (Tezos_crypto.Block_hash.equal hash (Block_header.hash header)) ; + assert (Block_hash.equal hash (Block_header.hash header)) ; let* () = Store.Block.mark_invalid chain_db.reader_chain_db.chain_store @@ -287,7 +287,7 @@ let commit_invalid_block chain_db hash header errors = return_unit let inject_operation chain_db h op = - assert (Tezos_crypto.Operation_hash.equal h (Operation.hash op)) ; + assert (Operation_hash.equal h (Operation.hash op)) ; Distributed_db_requester.Raw_operation.inject chain_db.reader_chain_db.operation_db h @@ -355,7 +355,7 @@ module Block_header = struct end) : Requester.REQUESTER with type t := chain_db - and type key := Tezos_crypto.Block_hash.t + and type key := Block_hash.t and type value := Block_header.t and type param := unit) end @@ -382,7 +382,7 @@ module Operation = struct end) : Requester.REQUESTER with type t := chain_db - and type key := Tezos_crypto.Operation_hash.t + and type key := Operation_hash.t and type value := Operation.t and type param := unit) end @@ -400,7 +400,7 @@ module Protocol = struct end) : Requester.REQUESTER with type t := db - and type key := Tezos_crypto.Protocol_hash.t + and type key := Protocol_hash.t and type value := Protocol.t and type param := unit) end diff --git a/src/lib_shell/distributed_db.mli b/src/lib_shell/distributed_db.mli index 53f3ef35591f..060b7f797a33 100644 --- a/src/lib_shell/distributed_db.mli +++ b/src/lib_shell/distributed_db.mli @@ -170,7 +170,7 @@ module Block_header : sig include Requester.REQUESTER with type t := chain_db - and type key := Tezos_crypto.Block_hash.t + and type key := Block_hash.t and type value := Block_header.t and type param := unit end @@ -185,14 +185,14 @@ end module Operations : Requester.REQUESTER with type t := chain_db - and type key = Tezos_crypto.Block_hash.t * int + and type key = Block_hash.t * int and type value = Operation.t list - and type param := Tezos_crypto.Operation_list_list_hash.t + and type param := Operation_list_list_hash.t (** Store on disk all the data associated to a valid block. *) val commit_block : chain_db -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t list list -> Block_validation.result -> @@ -201,7 +201,7 @@ val commit_block : (** Store on disk all the data associated to an invalid block. *) val commit_invalid_block : chain_db -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Error_monad.error list -> unit tzresult Lwt.t @@ -209,8 +209,7 @@ val commit_invalid_block : (** {2 Operations index} *) (** Inject a new operation in the local index (memory only). *) -val inject_operation : - chain_db -> Tezos_crypto.Operation_hash.t -> Operation.t -> bool Lwt.t +val inject_operation : chain_db -> Operation_hash.t -> Operation.t -> bool Lwt.t (** Inject a prechecked block in the [precheck_blocks] memory table. This is to ensure the data availability of the operations once the @@ -220,7 +219,7 @@ val inject_operation : memory table. The table is handled as an LRU cache. *) val inject_prechecked_block : chain_db -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t @@ -229,7 +228,7 @@ val inject_prechecked_block : module Operation : Requester.REQUESTER with type t := chain_db - and type key := Tezos_crypto.Operation_hash.t + and type key := Operation_hash.t and type value := Operation.t and type param := unit @@ -242,11 +241,10 @@ module Protocol : sig include Requester.REQUESTER with type t := db - and type key := Tezos_crypto.Protocol_hash.t + and type key := Protocol_hash.t and type value := Protocol.t and type param := unit end (** Store on disk protocol sources. *) -val commit_protocol : - db -> Tezos_crypto.Protocol_hash.t -> Protocol.t -> bool tzresult Lwt.t +val commit_protocol : db -> Protocol_hash.t -> Protocol.t -> bool tzresult Lwt.t diff --git a/src/lib_shell/distributed_db_event.ml b/src/lib_shell/distributed_db_event.ml index 6d6aea5a8739..5574d3d6af80 100644 --- a/src/lib_shell/distributed_db_event.ml +++ b/src/lib_shell/distributed_db_event.ml @@ -56,6 +56,6 @@ module P2p_reader_event = struct ~name:"received_future_block" ~msg:"received future block {block_hash} from peer {peer_id}" ~level:Notice - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("peer_id", P2p_peer.Id.encoding) end diff --git a/src/lib_shell/distributed_db_message.ml b/src/lib_shell/distributed_db_message.ml index 18f29c13b60e..1913785fc058 100644 --- a/src/lib_shell/distributed_db_message.ml +++ b/src/lib_shell/distributed_db_message.ml @@ -192,26 +192,23 @@ type t = | Deactivate of Tezos_crypto.Chain_id.t | Get_current_head of Tezos_crypto.Chain_id.t | Current_head of Tezos_crypto.Chain_id.t * Block_header.t * Mempool.t - | Get_block_headers of Tezos_crypto.Block_hash.t list + | Get_block_headers of Block_hash.t list | Block_header of Block_header.t - | Get_operations of Tezos_crypto.Operation_hash.t list + | Get_operations of Operation_hash.t list | Operation of Operation.t - | Get_protocols of Tezos_crypto.Protocol_hash.t list + | Get_protocols of Protocol_hash.t list | Protocol of Protocol.t - | Get_operations_for_blocks of (Tezos_crypto.Block_hash.t * int) list + | Get_operations_for_blocks of (Block_hash.t * int) list | Operations_for_block of - Tezos_crypto.Block_hash.t - * int - * Operation.t list - * Tezos_crypto.Operation_list_list_hash.path + Block_hash.t * int * Operation.t list * Operation_list_list_hash.path | Get_checkpoint of Tezos_crypto.Chain_id.t | Checkpoint of Tezos_crypto.Chain_id.t * Block_header.t | Get_protocol_branch of Tezos_crypto.Chain_id.t * int (* proto_level: uint8 *) | Protocol_branch of Tezos_crypto.Chain_id.t * int (* proto_level: uint8 *) * Block_locator.t - | Get_predecessor_header of Tezos_crypto.Block_hash.t * int32 - | Predecessor_header of Tezos_crypto.Block_hash.t * int32 * Block_header.t + | Get_predecessor_header of Block_hash.t * int32 + | Predecessor_header of Block_hash.t * int32 * Block_header.t let encoding = let open Data_encoding in @@ -263,10 +260,7 @@ let encoding = case ~tag:0x20 ~title:"Get_block_headers" - (obj1 - (req - "get_block_headers" - (list ~max_length:10 Tezos_crypto.Block_hash.encoding))) + (obj1 (req "get_block_headers" (list ~max_length:10 Block_hash.encoding))) (function Get_block_headers bhs -> Some bhs | _ -> None) (fun bhs -> Get_block_headers bhs); case @@ -279,9 +273,7 @@ let encoding = ~tag:0x30 ~title:"Get_operations" (obj1 - (req - "get_operations" - (list ~max_length:10 Tezos_crypto.Operation_hash.encoding))) + (req "get_operations" (list ~max_length:10 Operation_hash.encoding))) (function Get_operations bhs -> Some bhs | _ -> None) (fun bhs -> Get_operations bhs); case @@ -293,10 +285,7 @@ let encoding = case ~tag:0x40 ~title:"Get_protocols" - (obj1 - (req - "get_protocols" - (list ~max_length:10 Tezos_crypto.Protocol_hash.encoding))) + (obj1 (req "get_protocols" (list ~max_length:10 Protocol_hash.encoding))) (function Get_protocols protos -> Some protos | _ -> None) (fun protos -> Get_protocols protos); case @@ -314,7 +303,7 @@ let encoding = (list ~max_length:10 (obj2 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "validation_pass" int8))))) (function Get_operations_for_blocks keys -> Some keys | _ -> None) (fun keys -> Get_operations_for_blocks keys); @@ -326,7 +315,7 @@ let encoding = (req "operations_for_block" (obj2 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "validation_pass" int8)))) Bounded_encoding.operation_list) (function @@ -388,9 +377,7 @@ let encoding = (obj1 (req "get_predecessor_header" - (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "offset" int32)))) + (obj2 (req "block" Block_hash.encoding) (req "offset" int32)))) (function | Get_predecessor_header (block, offset) -> Some (block, offset) | _ -> None) @@ -402,7 +389,7 @@ let encoding = (req "predecessor_header" (obj3 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "offset" int32) (req "header" Bounded_encoding.block_header)))) (function diff --git a/src/lib_shell/distributed_db_message.mli b/src/lib_shell/distributed_db_message.mli index 07b4c768075c..25dc7d101915 100644 --- a/src/lib_shell/distributed_db_message.mli +++ b/src/lib_shell/distributed_db_message.mli @@ -34,24 +34,21 @@ type t = | Deactivate of Tezos_crypto.Chain_id.t | Get_current_head of Tezos_crypto.Chain_id.t | Current_head of Tezos_crypto.Chain_id.t * Block_header.t * Mempool.t - | Get_block_headers of Tezos_crypto.Block_hash.t list + | Get_block_headers of Block_hash.t list | Block_header of Block_header.t - | Get_operations of Tezos_crypto.Operation_hash.t list + | Get_operations of Operation_hash.t list | Operation of Operation.t - | Get_protocols of Tezos_crypto.Protocol_hash.t list + | Get_protocols of Protocol_hash.t list | Protocol of Protocol.t - | Get_operations_for_blocks of (Tezos_crypto.Block_hash.t * int) list + | Get_operations_for_blocks of (Block_hash.t * int) list | Operations_for_block of - Tezos_crypto.Block_hash.t - * int - * Operation.t list - * Tezos_crypto.Operation_list_list_hash.path + Block_hash.t * int * Operation.t list * Operation_list_list_hash.path | Get_checkpoint of Tezos_crypto.Chain_id.t | Checkpoint of Tezos_crypto.Chain_id.t * Block_header.t | Get_protocol_branch of Tezos_crypto.Chain_id.t * int | Protocol_branch of Tezos_crypto.Chain_id.t * int * Block_locator.t - | Get_predecessor_header of Tezos_crypto.Block_hash.t * int32 - | Predecessor_header of Tezos_crypto.Block_hash.t * int32 * Block_header.t + | Get_predecessor_header of Block_hash.t * int32 + | Predecessor_header of Block_hash.t * int32 * Block_header.t val encoding : t P2p_params.app_message_encoding list diff --git a/src/lib_shell/distributed_db_requester.ml b/src/lib_shell/distributed_db_requester.ml index b9e112f8c7b3..b62ad7ba3d2e 100644 --- a/src/lib_shell/distributed_db_requester.ml +++ b/src/lib_shell/distributed_db_requester.ml @@ -43,7 +43,7 @@ end module type EXTENDED_REQUESTER_2 = sig include EXTENDED_REQUESTER - val clear_all : t -> Tezos_crypto.Block_hash.t -> int -> unit + val clear_all : t -> Block_hash.t -> int -> unit end module type REQUEST_MESSAGE = sig @@ -174,12 +174,12 @@ end module Raw_operation = Make_raw (struct - include Tezos_crypto.Operation_hash + include Operation_hash let name = "operation" end) (Fake_operation_storage) - (Tezos_crypto.Operation_hash.Table) + (Operation_hash.Table) (struct type param = unit @@ -233,12 +233,12 @@ end module Raw_block_header = Make_raw (struct - include Tezos_crypto.Block_hash + include Block_hash let name = "block_header" end) (Block_header_storage) - (Tezos_crypto.Block_hash.Table) + (Block_hash.Table) (struct type param = unit @@ -257,7 +257,7 @@ module Raw_block_header = end) module Operations_table = Hashtbl.MakeSeeded (struct - type t = Tezos_crypto.Block_hash.t * int + type t = Block_hash.t * int (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -268,7 +268,7 @@ module Operations_table = Hashtbl.MakeSeeded (struct [@@@ocaml.warning "+32"] - let equal (b1, i1) (b2, i2) = Tezos_crypto.Block_hash.equal b1 b2 && i1 = i2 + let equal (b1, i1) (b2, i2) = Block_hash.equal b1 b2 && i1 = i2 end) module Operations_storage = struct @@ -299,18 +299,15 @@ module Raw_operations = struct include Make_raw (struct - type t = Tezos_crypto.Block_hash.t * int + type t = Block_hash.t * int let name = "operations" - let pp ppf (h, n) = - Format.fprintf ppf "%a:%d" Tezos_crypto.Block_hash.pp h n + let pp ppf (h, n) = Format.fprintf ppf "%a:%d" Block_hash.pp h n let encoding = let open Data_encoding in - obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "index" uint16) + obj2 (req "block" Block_hash.encoding) (req "index" uint16) end) (Operations_storage) (Operations_table) @@ -324,24 +321,19 @@ module Raw_operations = struct let forge () keys = Message.Get_operations_for_blocks keys end) (struct - type param = Tezos_crypto.Operation_list_list_hash.t + type param = Operation_list_list_hash.t - type notified_value = - Operation.t list * Tezos_crypto.Operation_list_list_hash.path + type notified_value = Operation.t list * Operation_list_list_hash.path let probe (_block, expected_ofs) expected_hash (ops, path) = let received_hash, received_ofs = - Tezos_crypto.Operation_list_list_hash.check_path + Operation_list_list_hash.check_path path - (Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash ops)) + (Operation_list_hash.compute (List.map Operation.hash ops)) in if received_ofs = expected_ofs - && Tezos_crypto.Operation_list_list_hash.compare - expected_hash - received_hash - = 0 + && Operation_list_list_hash.compare expected_hash received_hash = 0 then Some ops else None end) @@ -368,12 +360,12 @@ end module Raw_protocol = Make_raw (struct - include Tezos_crypto.Protocol_hash + include Protocol_hash let name = "protocol" end) (Protocol_storage) - (Tezos_crypto.Protocol_hash.Table) + (Protocol_hash.Table) (struct type param = unit diff --git a/src/lib_shell/distributed_db_requester.mli b/src/lib_shell/distributed_db_requester.mli index 15bea043d1e5..e653561cb67a 100644 --- a/src/lib_shell/distributed_db_requester.mli +++ b/src/lib_shell/distributed_db_requester.mli @@ -49,12 +49,12 @@ end module type EXTENDED_REQUESTER_2 = sig include EXTENDED_REQUESTER - val clear_all : t -> Tezos_crypto.Block_hash.t -> int -> unit + val clear_all : t -> Block_hash.t -> int -> unit end module Raw_protocol : EXTENDED_REQUESTER - with type key = Tezos_crypto.Protocol_hash.t + with type key = Protocol_hash.t and type param = unit and type request_param = unit request_param and type store = Store.t @@ -63,7 +63,7 @@ module Raw_protocol : module Raw_operation : EXTENDED_REQUESTER - with type key = Tezos_crypto.Operation_hash.t + with type key = Operation_hash.t and type param = unit and type request_param = unit request_param and type store = Store.chain_store @@ -72,7 +72,7 @@ module Raw_operation : module Raw_block_header : EXTENDED_REQUESTER - with type key = Tezos_crypto.Block_hash.t + with type key = Block_hash.t and type param = unit and type request_param = unit request_param and type store = Store.chain_store @@ -81,14 +81,13 @@ module Raw_block_header : module Raw_operations : EXTENDED_REQUESTER_2 - with type key = Tezos_crypto.Block_hash.t * int + with type key = Block_hash.t * int and type request_param = unit request_param (* root of merkle tree for this block, used to check the notified value. *) - and type param = Tezos_crypto.Operation_list_list_hash.t + and type param = Operation_list_list_hash.t and type store = Store.chain_store and type value = Operation.t list (* notified value contain the queried value, plus the merkle tree hashes needed to recompute the merkle tree root. *) - and type notified_value = - Operation.t list * Tezos_crypto.Operation_list_list_hash.path + and type notified_value = Operation.t list * Operation_list_list_hash.path diff --git a/src/lib_shell/injection_directory.ml b/src/lib_shell/injection_directory.ml index 2b8e49f49de3..eae255426ae5 100644 --- a/src/lib_shell/injection_directory.ml +++ b/src/lib_shell/injection_directory.ml @@ -100,22 +100,18 @@ let inject_operations validator ~force ?chain bytes_list = let inject_protocol store proto = let open Lwt_result_syntax in let proto_bytes = Data_encoding.Binary.to_bytes_exn Protocol.encoding proto in - let hash = Tezos_crypto.Protocol_hash.hash_bytes [proto_bytes] in + let hash = Protocol_hash.hash_bytes [proto_bytes] in let validation = let*! b = Updater.compile hash proto in match b with - | false -> - failwith - "Compilation failed (%a)" - Tezos_crypto.Protocol_hash.pp_short - hash + | false -> failwith "Compilation failed (%a)" Protocol_hash.pp_short hash | true -> ( let*! o = Store.Protocol.store store hash proto in match o with | None -> failwith "Previously registered protocol (%a)" - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short hash | Some _ -> return_unit) in diff --git a/src/lib_shell/legacy_mempool_plugin.ml b/src/lib_shell/legacy_mempool_plugin.ml index cabf30d120a8..aa0e0357555c 100644 --- a/src/lib_shell/legacy_mempool_plugin.ml +++ b/src/lib_shell/legacy_mempool_plugin.ml @@ -51,13 +51,13 @@ module type FILTER = sig unit -> state tzresult Lwt.t - val remove : filter_state:state -> Tezos_crypto.Operation_hash.t -> state + val remove : filter_state:state -> Operation_hash.t -> state val precheck : config -> filter_state:state -> validation_state:Proto.validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Proto.operation -> nb_successful_prechecks:int -> [ `Passed_precheck of @@ -65,8 +65,8 @@ module type FILTER = sig * Proto.validation_state * [ `No_replace | `Replace of - Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification ] + Operation_hash.t * Prevalidator_classification.error_classification + ] | `Undecided | Prevalidator_classification.error_classification ] Lwt.t diff --git a/src/lib_shell/legacy_mempool_plugin.mli b/src/lib_shell/legacy_mempool_plugin.mli index 8c85ccf59808..6cd83a08f0f6 100644 --- a/src/lib_shell/legacy_mempool_plugin.mli +++ b/src/lib_shell/legacy_mempool_plugin.mli @@ -63,7 +63,7 @@ module type FILTER = sig (** [remove ~filter_state oph] removes the operation manager linked to [oph] from the state of the filter *) - val remove : filter_state:state -> Tezos_crypto.Operation_hash.t -> state + val remove : filter_state:state -> Operation_hash.t -> state (** [precheck config ~filter_state ~validation_state oph op ~nb_successful_prechecks] @@ -89,7 +89,7 @@ module type FILTER = sig config -> filter_state:state -> validation_state:Proto.validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Proto.operation -> nb_successful_prechecks:int -> [ `Passed_precheck of @@ -97,8 +97,8 @@ module type FILTER = sig * Proto.validation_state * [ `No_replace | `Replace of - Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification ] + Operation_hash.t * Prevalidator_classification.error_classification + ] | `Undecided | Prevalidator_classification.error_classification ] Lwt.t diff --git a/src/lib_shell/legacy_prevalidation.ml b/src/lib_shell/legacy_prevalidation.ml index e2262a80025a..eb366cfa4003 100644 --- a/src/lib_shell/legacy_prevalidation.ml +++ b/src/lib_shell/legacy_prevalidation.ml @@ -39,7 +39,7 @@ open Validation_errors type 'protocol_operation operation = { - hash : Tezos_crypto.Operation_hash.t; + hash : Operation_hash.t; raw : Operation.t; protocol : 'protocol_operation; count_successful_prechecks : int; @@ -82,9 +82,7 @@ module type T = sig type t val parse : - Tezos_crypto.Operation_hash.t -> - Operation.t -> - protocol_operation operation tzresult + Operation_hash.t -> Operation.t -> protocol_operation operation tzresult val increment_successful_precheck : protocol_operation operation -> protocol_operation operation @@ -92,7 +90,7 @@ module type T = sig val create : chain_store -> predecessor:Store.Block.t -> - live_operations:Tezos_crypto.Operation_hash.Set.t -> + live_operations:Operation_hash.Set.t -> timestamp:Time.Protocol.t -> unit -> t tzresult Lwt.t @@ -146,7 +144,7 @@ module MakeAbstract validation_state : validation_state; application_state : Proto.application_state; applied : (protocol_operation operation * Proto.operation_receipt) list; - live_operations : Tezos_crypto.Operation_hash.Set.t; + live_operations : Operation_hash.Set.t; } type result = @@ -220,7 +218,7 @@ module MakeAbstract let apply_operation pv op = let open Lwt_syntax in - if Tezos_crypto.Operation_hash.Set.mem op.hash pv.live_operations then + if Operation_hash.Set.mem op.hash pv.live_operations then (* As of November 2021, it is dubious that this case can happen. If it can, it is more likely to be because of a consensus operation; hence the returned error. *) @@ -245,7 +243,7 @@ module MakeAbstract application_state; applied = (op, receipt) :: pv.applied; live_operations = - Tezos_crypto.Operation_hash.Set.add op.hash pv.live_operations; + Operation_hash.Set.add op.hash pv.live_operations; } in match diff --git a/src/lib_shell/legacy_prevalidation.mli b/src/lib_shell/legacy_prevalidation.mli index 4e7758a2b04f..e2fd77dafcad 100644 --- a/src/lib_shell/legacy_prevalidation.mli +++ b/src/lib_shell/legacy_prevalidation.mli @@ -41,7 +41,7 @@ prevalidation_state. *) type 'protocol_operation operation = private { - hash : Tezos_crypto.Operation_hash.t; (** Hash of an operation. *) + hash : Operation_hash.t; (** Hash of an operation. *) raw : Operation.t; (** Raw representation of an operation (from the point view of the shell). *) @@ -87,9 +87,7 @@ module type T = sig data within [op] is too large (to protect against DoS attacks), and - {!Validation_errors.Parse_error} if serialized data cannot be parsed. *) val parse : - Tezos_crypto.Operation_hash.t -> - Operation.t -> - protocol_operation operation tzresult + Operation_hash.t -> Operation.t -> protocol_operation operation tzresult (** [increment_successful_precheck op] increments the field [count_successful_prechecks] of the given operation [op]. It is supposed @@ -104,7 +102,7 @@ module type T = sig val create : chain_store -> predecessor:Store.Block.t -> - live_operations:Tezos_crypto.Operation_hash.Set.t -> + live_operations:Operation_hash.Set.t -> timestamp:Time.Protocol.t -> unit -> t tzresult Lwt.t @@ -156,12 +154,11 @@ module Internal_for_tests : sig val to_raw : _ operation -> Operation.t (** The hash of an {!operation} *) - val hash_of : _ operation -> Tezos_crypto.Operation_hash.t + val hash_of : _ operation -> Operation_hash.t (** A constructor for the [operation] datatype. It by-passes the checks done by the [parse] function. *) - val make_operation : - Operation.t -> Tezos_crypto.Operation_hash.t -> 'a -> 'a operation + val make_operation : Operation.t -> Operation_hash.t -> 'a -> 'a operation (** [safe_binary_of_bytes encoding bytes] parses [bytes] using [encoding]. Any error happening during parsing becomes {!Parse_error}. diff --git a/src/lib_shell/legacy_prevalidator_classification.ml b/src/lib_shell/legacy_prevalidator_classification.ml index a250d3393a0f..73235679b8e6 100644 --- a/src/lib_shell/legacy_prevalidator_classification.ml +++ b/src/lib_shell/legacy_prevalidator_classification.ml @@ -47,7 +47,7 @@ module Event = struct ~name:"predecessor_less_block" ~msg:"Observing that a parent of block {blk_h} has no predecessor" ~level:Warning - ("blk_h", Tezos_crypto.Block_hash.encoding) + ("blk_h", Block_hash.encoding) end type error_classification = @@ -58,7 +58,7 @@ type error_classification = type classification = [`Applied | `Prechecked | error_classification] -module Map = Tezos_crypto.Operation_hash.Map +module Map = Operation_hash.Map module Sized_map = Tezos_base.Sized.MakeSizedMap (Map) (** This type wraps together: @@ -69,7 +69,7 @@ module Sized_map = Tezos_base.Sized.MakeSizedMap (Map) All operations must maintain integrity between the 2! *) type 'protocol_data bounded_map = { - ring : Tezos_crypto.Operation_hash.t Ringo.Ring.t; + ring : Operation_hash.t Ringo.Ring.t; mutable map : ('protocol_data Prevalidation.operation * error list) Map.t; } @@ -85,7 +85,7 @@ let mk_empty_bounded_map ring_size = type parameters = { map_size_limit : int; - on_discarded_operation : Tezos_crypto.Operation_hash.t -> unit; + on_discarded_operation : Operation_hash.t -> unit; } (** Note that [applied] and [in_mempool] are intentionally unbounded. @@ -100,7 +100,7 @@ type 'protocol_data t = { branch_delayed : 'protocol_data bounded_map; mutable applied_rev : 'protocol_data Prevalidation.operation list; mutable prechecked : 'protocol_data Prevalidation.operation Sized_map.t; - mutable unparsable : Tezos_crypto.Operation_hash.Set.t; + mutable unparsable : Operation_hash.Set.t; mutable in_mempool : ('protocol_data Prevalidation.operation * classification) Map.t; } @@ -113,7 +113,7 @@ let create parameters = branch_refused = mk_empty_bounded_map parameters.map_size_limit; branch_delayed = mk_empty_bounded_map parameters.map_size_limit; prechecked = Sized_map.empty; - unparsable = Tezos_crypto.Operation_hash.Set.empty; + unparsable = Operation_hash.Set.empty; in_mempool = Map.empty; applied_rev = []; } @@ -137,13 +137,13 @@ let is_empty [in_mempool] is the union of all other fields (see the MLI for detailed documentation of this invariant) except unparsable operations which are not classified yet. *) - Map.is_empty in_mempool && Tezos_crypto.Operation_hash.Set.is_empty unparsable + Map.is_empty in_mempool && Operation_hash.Set.is_empty unparsable let set_of_bounded_map bounded_map = Map.fold - (fun oph _ acc -> Tezos_crypto.Operation_hash.Set.add oph acc) + (fun oph _ acc -> Operation_hash.Set.add oph acc) bounded_map.map - Tezos_crypto.Operation_hash.Set.empty + Operation_hash.Set.empty let flush (classes : 'protocol_data t) ~handle_branch_refused = let remove_map_from_in_mempool map = @@ -170,13 +170,13 @@ let flush (classes : 'protocol_data t) ~handle_branch_refused = remove_list_from_in_mempool classes.applied_rev ; classes.applied_rev <- [] ; remove_map_from_in_mempool (Sized_map.to_map classes.prechecked) ; - classes.unparsable <- Tezos_crypto.Operation_hash.Set.empty ; + classes.unparsable <- Operation_hash.Set.empty ; classes.prechecked <- Sized_map.empty let is_in_mempool oph classes = Map.find oph classes.in_mempool let is_known_unparsable oph classes = - Tezos_crypto.Operation_hash.Set.mem oph classes.unparsable + Operation_hash.Set.mem oph classes.unparsable (* Removing an operation is currently used for operations which are banned (this can only be achieved by the adminstrator of the @@ -208,8 +208,7 @@ let remove oph classes = | `Applied -> classes.applied_rev <- List.filter - (fun op -> - Tezos_crypto.Operation_hash.(op.Prevalidation.hash <> oph)) + (fun op -> Operation_hash.(op.Prevalidation.hash <> oph)) classes.applied_rev) ; Some (op, classification) @@ -257,8 +256,7 @@ let handle_error oph op classification classes = classes.in_mempool <- Map.add oph (op, classification) classes.in_mempool let add_unparsable oph classes = - classes.unparsable <- - Tezos_crypto.Operation_hash.Set.add oph classes.unparsable ; + classes.unparsable <- Operation_hash.Set.add oph classes.unparsable ; classes.parameters.on_discarded_operation oph let add classification op classes = @@ -302,14 +300,14 @@ let to_map ~applied ~prechecked ~branch_delayed ~branch_refused ~refused +> if outdated then classes.outdated.map else Map.empty type 'block block_tools = { - hash : 'block -> Tezos_crypto.Block_hash.t; + hash : 'block -> Block_hash.t; operations : 'block -> Operation.t list list; - all_operation_hashes : 'block -> Tezos_crypto.Operation_hash.t list list; + all_operation_hashes : 'block -> Operation_hash.t list list; } type 'block chain_tools = { - clear_or_cancel : Tezos_crypto.Operation_hash.t -> unit; - inject_operation : Tezos_crypto.Operation_hash.t -> Operation.t -> unit Lwt.t; + clear_or_cancel : Operation_hash.t -> unit; + inject_operation : Operation_hash.t -> Operation.t -> unit Lwt.t; new_blocks : from_block:'block -> to_block:'block -> ('block * 'block list) Lwt.t; read_predecessor_opt : 'block -> 'block option Lwt.t; @@ -318,15 +316,15 @@ type 'block chain_tools = { (* There's detailed documentation in the mli *) let handle_live_operations ~classes ~(block_store : 'block block_tools) ~(chain : 'block chain_tools) ~(from_branch : 'block) ~(to_branch : 'block) - ~(is_branch_alive : Tezos_crypto.Block_hash.t -> bool) + ~(is_branch_alive : Block_hash.t -> bool) ~(parse : - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t -> 'protocol_data Prevalidation.operation option) old_mempool = let open Lwt_syntax in let rec pop_block ancestor (block : 'block) mempool = let hash = block_store.hash block in - if Tezos_crypto.Block_hash.equal hash ancestor then Lwt.return mempool + if Block_hash.equal hash ancestor then Lwt.return mempool else let operations = block_store.operations block in let* mempool = @@ -355,8 +353,7 @@ let handle_live_operations ~classes ~(block_store : 'block block_tools) unparsable and it is ok. *) add_unparsable oph classes ; mempool - | Some parsed_op -> - Tezos_crypto.Operation_hash.Map.add oph parsed_op mempool)) + | Some parsed_op -> Operation_hash.Map.add oph parsed_op mempool)) mempool operations in @@ -380,8 +377,7 @@ let handle_live_operations ~classes ~(block_store : 'block block_tools) let operations = block_store.all_operation_hashes block in List.iter (List.iter chain.clear_or_cancel) operations ; List.fold_left - (List.fold_left (fun mempool h -> - Tezos_crypto.Operation_hash.Map.remove h mempool)) + (List.fold_left (fun mempool h -> Operation_hash.Map.remove h mempool)) mempool operations in @@ -412,8 +408,7 @@ let recycle_operations ~from_branch ~to_branch ~live_blocks ~classes ~parse ~chain ~from_branch ~to_branch - ~is_branch_alive:(fun branch -> - Tezos_crypto.Block_hash.Set.mem branch live_blocks) + ~is_branch_alive:(fun branch -> Block_hash.Set.mem branch live_blocks) ~parse (Map.union (fun _key v _ -> Some v) @@ -437,7 +432,7 @@ module Internal_for_tests = struct (** [copy_bounded_map bm] returns a deep copy of [bm] *) let copy_bounded_map (bm : 'protocol_data bounded_map) : 'protocol_data bounded_map = - let copy_ring (ring : Tezos_crypto.Operation_hash.t Ringo.Ring.t) = + let copy_ring (ring : Operation_hash.t Ringo.Ring.t) = let result = Ringo.Ring.capacity ring |> Ringo.Ring.create in List.iter (Ringo.Ring.add result) (Ringo.Ring.elements ring) ; result @@ -463,10 +458,7 @@ module Internal_for_tests = struct let[@coverage off] bounded_map_pp ppf bounded_map = bounded_map.map |> Map.bindings |> List.map (fun (key, _value) -> key) - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) let[@coverage off] pp ppf { @@ -483,31 +475,19 @@ module Internal_for_tests = struct let applied_pp ppf applied = applied |> List.map (fun op -> op.Prevalidation.hash) - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let in_mempool_pp ppf in_mempool = in_mempool |> Map.bindings |> List.map fst - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let prechecked_pp ppf prechecked = prechecked |> Sized_map.bindings |> List.map fst - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let unparsable_pp ppf unparsable = - unparsable |> Tezos_crypto.Operation_hash.Set.elements - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + unparsable |> Operation_hash.Set.elements + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in Format.fprintf ppf diff --git a/src/lib_shell/legacy_prevalidator_classification.mli b/src/lib_shell/legacy_prevalidator_classification.mli index 12b3142f74c0..de4b005df959 100644 --- a/src/lib_shell/legacy_prevalidator_classification.mli +++ b/src/lib_shell/legacy_prevalidator_classification.mli @@ -51,21 +51,20 @@ type 'protocol_data bounded_map (** [map bounded_map] gets the underling map of the [bounded_map]. *) val map : 'protocol_data bounded_map -> - ('protocol_data Prevalidation.operation * tztrace) - Tezos_crypto.Operation_hash.Map.t + ('protocol_data Prevalidation.operation * tztrace) Operation_hash.Map.t (** [cardinal bounded_map] gets the cardinal of the underling map of the [bounded_map] *) val cardinal : 'protocol_data bounded_map -> int type parameters = { map_size_limit : int; - on_discarded_operation : Tezos_crypto.Operation_hash.t -> unit; + on_discarded_operation : Operation_hash.t -> unit; } module Sized_map : Tezos_base.Sized.SizedMap - with type 'a map := 'a Tezos_crypto.Operation_hash.Map.t - and type key = Tezos_crypto.Operation_hash.t + with type 'a map := 'a Operation_hash.Map.t + and type key = Operation_hash.t (** Invariants ensured by this module, provided that the caller does not {!add} an operation which is already present in [t]: @@ -97,10 +96,10 @@ type 'protocol_data t = private { branch_delayed : 'protocol_data bounded_map; mutable applied_rev : 'protocol_data Prevalidation.operation list; mutable prechecked : 'protocol_data Prevalidation.operation Sized_map.t; - mutable unparsable : Tezos_crypto.Operation_hash.Set.t; + mutable unparsable : Operation_hash.Set.t; mutable in_mempool : ('protocol_data Prevalidation.operation * classification) - Tezos_crypto.Operation_hash.Map.t; + Operation_hash.Map.t; } (** [create parameters] returns an empty {!t} whose bounded maps hold @@ -119,15 +118,14 @@ val is_empty : 'protocol_data t -> bool in field [in_mempool] of [classes]. It returns the corresponding operation and its classification if present, and None otherwise. *) val is_in_mempool : - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data t -> ('protocol_data Prevalidation.operation * classification) option (** [is_known_unparsable oph] returns [true] if the [oph] is associated to an operation which is known to be unparsable. [false] otherwise. *) -val is_known_unparsable : - Tezos_crypto.Operation_hash.t -> 'protocol_data t -> bool +val is_known_unparsable : Operation_hash.t -> 'protocol_data t -> bool (** [remove oph classes] removes operation of hash [oph] from all fields of [classes]. If the [oph] was classified as [Applied], the @@ -143,7 +141,7 @@ val is_known_unparsable : this may invalidate the classification of all the other operations. It is left to the caller to restore a consistent state. *) val remove : - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data t -> ('protocol_data Prevalidation.operation * classification) option @@ -182,14 +180,14 @@ val add : operation. [unparsable] operations are removed automatically by the [recycle_operations] function. [on_discard_operation] is also called on those operations. *) -val add_unparsable : Tezos_crypto.Operation_hash.t -> 'protocol_data t -> unit +val add_unparsable : Operation_hash.t -> 'protocol_data t -> unit (** Functions to query data on a polymorphic block-like type ['block]. *) type 'block block_tools = { - hash : 'block -> Tezos_crypto.Block_hash.t; (** The hash of a block *) + hash : 'block -> Block_hash.t; (** The hash of a block *) operations : 'block -> Operation.t list list; (** The list of operations of a block ordered by their validation pass *) - all_operation_hashes : 'block -> Tezos_crypto.Operation_hash.t list list; + all_operation_hashes : 'block -> Operation_hash.t list list; (** The list of hashes of operations of a block ordered by their validation pass. Could be implemented using {!operations} but this lets an alternative implementation @@ -199,9 +197,9 @@ type 'block block_tools = { (** A wrapper over chain-related modules, to make client code easier to emulate, and hence to test *) type 'block chain_tools = { - clear_or_cancel : Tezos_crypto.Operation_hash.t -> unit; + clear_or_cancel : Operation_hash.t -> unit; (** Removes the operation from the distributed database. *) - inject_operation : Tezos_crypto.Operation_hash.t -> Operation.t -> unit Lwt.t; + inject_operation : Operation_hash.t -> Operation.t -> unit Lwt.t; (** Puts the operation in the distributed database. Returns [false] if the [hash] is already in the distributed database *) new_blocks : @@ -238,18 +236,17 @@ type 'block chain_tools = { val recycle_operations : from_branch:'block -> to_branch:'block -> - live_blocks:Tezos_crypto.Block_hash.Set.t -> + live_blocks:Block_hash.Set.t -> classes:'protocol_data t -> parse: - (Tezos_crypto.Operation_hash.t -> + (Operation_hash.t -> Operation.t -> 'protocol_data Prevalidation.operation option) -> - pending: - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t -> + pending:'protocol_data Prevalidation.operation Operation_hash.Map.t -> block_store:'block block_tools -> chain:'block chain_tools -> handle_branch_refused:bool -> - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t Lwt.t + 'protocol_data Prevalidation.operation Operation_hash.Map.t Lwt.t (**/**) @@ -263,8 +260,7 @@ module Internal_for_tests : sig val copy : 'protocol_data t -> 'protocol_data t (** [set_of_bounded_map m] returns all the operation hashes in [m]. *) - val set_of_bounded_map : - 'protocol_data bounded_map -> Tezos_crypto.Operation_hash.Set.t + val set_of_bounded_map : 'protocol_data bounded_map -> Operation_hash.Set.t (** [pp_t_sizes t] prints the [map_size_limit] parameter of [t] and the sizes of its fields (number of elements in the map and @@ -283,7 +279,7 @@ module Internal_for_tests : sig refused:bool -> outdated:bool -> 'protocol_data t -> - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t + 'protocol_data Prevalidation.operation Operation_hash.Map.t (** [flush classes ~handle_branch_refused] partially resets [classes]: - fields [applied_rev], [branch_delayed] and [unparsable] are emptied; @@ -329,12 +325,11 @@ module Internal_for_tests : sig chain:'block chain_tools -> from_branch:'block -> to_branch:'block -> - is_branch_alive:(Tezos_crypto.Block_hash.t -> bool) -> + is_branch_alive:(Block_hash.t -> bool) -> parse: - (Tezos_crypto.Operation_hash.t -> + (Operation_hash.t -> Operation.t -> 'protocol_data Prevalidation.operation option) -> - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t -> - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t - Lwt.t + 'protocol_data Prevalidation.operation Operation_hash.Map.t -> + 'protocol_data Prevalidation.operation Operation_hash.Map.t Lwt.t end diff --git a/src/lib_shell/legacy_prevalidator_internal.ml b/src/lib_shell/legacy_prevalidator_internal.ml index c439968208a7..9fb6f5473e65 100644 --- a/src/lib_shell/legacy_prevalidator_internal.ml +++ b/src/lib_shell/legacy_prevalidator_internal.ml @@ -78,7 +78,7 @@ module Tools = struct (** Lower-level tools provided by {!Prevalidator_classification} *) create : predecessor:Store.Block.t -> - live_operations:Tezos_crypto.Operation_hash.Set.t -> + live_operations:Operation_hash.Set.t -> timestamp:Time.Protocol.t -> unit -> 'prevalidation_t tzresult Lwt.t; @@ -87,20 +87,19 @@ module Tools = struct fetch : ?peer:P2p_peer.Id.t -> ?timeout:Time.System.Span.t -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t tzresult Lwt.t; (** [fetch ?peer ?timeout oph] returns the value when it is known. It can fail with [Requester.Timeout] if [timeout] is provided and the value isn't known before the timeout expires. It can fail with [Requester.Cancel] if the request is canceled. *) - read_block : Tezos_crypto.Block_hash.t -> Store.Block.t tzresult Lwt.t; + read_block : Block_hash.t -> Store.Block.t tzresult Lwt.t; (** [read_block bh] tries to read the block [bh] from the chain store. *) send_get_current_head : ?peer:P2p_peer_id.t -> unit -> unit; (** [send_get_current_head ?peer ()] sends a [Get_Current_head] to a given peer, or to all known active peers for the chain considered. Expected answer is a [Get_current_head] message *) - set_mempool : - head:Tezos_crypto.Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; + set_mempool : head:Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; (** [set_mempool ~head mempool] sets the [mempool] of the [chain_store] of the chain considered. Does nothing if [head] differs from current_head which might happen when a new head concurrently arrives just @@ -133,13 +132,13 @@ type ('protocol_data, 'a) types_state_shell = { parameters : 'a parameters; mutable predecessor : Store.Block.t; mutable timestamp : Time.System.t; - mutable live_blocks : Tezos_crypto.Block_hash.Set.t; - mutable live_operations : Tezos_crypto.Operation_hash.Set.t; - mutable fetching : Tezos_crypto.Operation_hash.Set.t; + mutable live_blocks : Block_hash.Set.t; + mutable live_operations : Operation_hash.Set.t; + mutable fetching : Operation_hash.Set.t; mutable pending : 'protocol_data Pending_ops.t; mutable mempool : Mempool.t; mutable advertisement : [`Pending of Mempool.t | `None]; - mutable banned_operations : Tezos_crypto.Operation_hash.Set.t; + mutable banned_operations : Operation_hash.Set.t; worker : Tools.worker_tools; } @@ -217,7 +216,7 @@ module type S = sig val may_fetch_operation : (protocol_operation, prevalidation_t) types_state_shell -> P2p_peer_id.t option -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> unit Lwt.t (** The function called after every call to a function of {!API}. *) @@ -235,19 +234,18 @@ module type S = sig val on_arrived : types_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t -> (unit, Empty.t) result Lwt.t - val on_ban : - types_state -> Tezos_crypto.Operation_hash.t -> unit tzresult Lwt.t + val on_ban : types_state -> Operation_hash.t -> unit tzresult Lwt.t val on_flush : handle_branch_refused:bool -> types_state -> Store.Block.t -> - Tezos_crypto.Block_hash.Set.t -> - Tezos_crypto.Operation_hash.Set.t -> + Block_hash.Set.t -> + Operation_hash.Set.t -> unit tzresult Lwt.t val on_inject : @@ -302,14 +300,14 @@ module Make_s (* This function is in [Lwt] only for logging. *) let already_handled ~origin shell oph = let open Lwt_syntax in - if Tezos_crypto.Operation_hash.Set.mem oph shell.banned_operations then + if Operation_hash.Set.mem oph shell.banned_operations then let+ () = Events.(emit ban_operation_encountered) (origin, oph) in true else Lwt.return (Pending_ops.mem oph shell.pending - || Tezos_crypto.Operation_hash.Set.mem oph shell.fetching - || Tezos_crypto.Operation_hash.Set.mem oph shell.live_operations + || Operation_hash.Set.mem oph shell.fetching + || Operation_hash.Set.mem oph shell.live_operations || Classification.is_in_mempool oph shell.classification <> None || Classification.is_known_unparsable oph shell.classification) @@ -321,8 +319,7 @@ module Make_s `Pending { known_valid = known_valid @ mempool.Mempool.known_valid; - pending = - Tezos_crypto.Operation_hash.Set.union pending mempool.pending; + pending = Operation_hash.Set.union pending mempool.pending; } | `None -> shell.advertisement <- `Pending mempool ; @@ -710,12 +707,10 @@ module Make_s ignore (Lwt.finalize (fun () -> - shell.fetching <- - Tezos_crypto.Operation_hash.Set.add oph shell.fetching ; + shell.fetching <- Operation_hash.Set.add oph shell.fetching ; fetch_operation shell ?peer oph) (fun () -> - shell.fetching <- - Tezos_crypto.Operation_hash.Set.remove oph shell.fetching ; + shell.fetching <- Operation_hash.Set.remove oph shell.fetching ; Lwt.return_unit)) ; Lwt.return_unit @@ -750,7 +745,7 @@ module Make_s | (`High | `Medium | `Low _) as prio -> if not - (Tezos_crypto.Block_hash.Set.mem + (Block_hash.Set.mem op.Operation.shell.branch pv.shell.live_blocks) then ( @@ -784,7 +779,7 @@ module Make_s | Error err -> failwith "Invalid operation %a: %a." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Error_monad.pp_print_trace err @@ -798,15 +793,15 @@ module Make_s return_unit) else if not - (Tezos_crypto.Block_hash.Set.mem + (Block_hash.Set.mem op.Operation.shell.branch pv.shell.live_blocks) then failwith "Operation %a is branched on a block %a which is too old" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.Operation.shell.branch else let*? validation_state = @@ -837,7 +832,7 @@ module Make_s List.find_opt (function | ({hash; _} : protocol_operation operation), _ -> - Tezos_crypto.Operation_hash.equal hash oph) + Operation_hash.equal hash oph) to_handle in match op_status with @@ -870,7 +865,7 @@ module Make_s Lwt.return @@ error_with "Error while applying operation %a:@ %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph pp_print_trace e @@ -879,7 +874,7 @@ module Make_s failwith "Unexpected error while injecting operation %a. Operation \ not found after classifying it." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) let on_notify (shell : ('operation_data, _) types_state_shell) peer mempool @@ -889,7 +884,7 @@ module Make_s let* () = List.iter_s may_fetch_operation mempool.Mempool.known_valid in Seq.iter_s may_fetch_operation - (Tezos_crypto.Operation_hash.Set.to_seq mempool.Mempool.pending) + (Operation_hash.Set.to_seq mempool.Mempool.pending) let on_flush ~handle_branch_refused pv new_predecessor new_live_blocks new_live_operations = @@ -935,10 +930,10 @@ module Make_s ~chain:pv.shell.parameters.tools.chain_tools ~handle_branch_refused in - (* Could be implemented as Tezos_crypto.Operation_hash.Map.filter_s which + (* Could be implemented as Operation_hash.Map.filter_s which does not exist for the moment. *) let*! new_pending_operations, nb_pending = - Tezos_crypto.Operation_hash.Map.fold_s + Operation_hash.Map.fold_s (fun _oph op (pending, nb_pending) -> let*! v = pre_filter @@ -987,12 +982,11 @@ module Make_s pv.shell.advertisement <- remove_from_advertisement oph pv.shell.advertisement ; pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.add oph pv.shell.banned_operations ; + Operation_hash.Set.add oph pv.shell.banned_operations ; match Classification.remove oph pv.shell.classification with | None -> pv.shell.pending <- Pending_ops.remove oph pv.shell.pending ; - pv.shell.fetching <- - Tezos_crypto.Operation_hash.Set.remove oph pv.shell.fetching ; + pv.shell.fetching <- Operation_hash.Set.remove oph pv.shell.fetching ; return_unit | Some (_op, classification) -> ( match (classification, flush_if_prechecked) with @@ -1023,9 +1017,7 @@ module Make_s let on_ban pv oph_to_ban = pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.add - oph_to_ban - pv.shell.banned_operations ; + Operation_hash.Set.add oph_to_ban pv.shell.banned_operations ; remove ~flush_if_prechecked:true pv oph_to_ban end end @@ -1176,9 +1168,7 @@ module Make (Proto_services.S.Mempool.unban_operation Tezos_rpc.Path.open_root) (fun pv () oph -> pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.remove - oph - pv.shell.banned_operations ; + Operation_hash.Set.remove oph pv.shell.banned_operations ; return_unit) ; (* Unban all operations: clear the set pv.banned_operations. *) dir := @@ -1187,7 +1177,7 @@ module Make (Proto_services.S.Mempool.unban_all_operations Tezos_rpc.Path.open_root) (fun pv () () -> - pv.shell.banned_operations <- Tezos_crypto.Operation_hash.Set.empty ; + pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := Tezos_rpc.Directory.gen_register @@ -1209,8 +1199,7 @@ module Make in Classification.Sized_map.to_map pv.shell.classification.prechecked - |> Tezos_crypto.Operation_hash.Map.to_seq - |> Seq.append applied_seq + |> Operation_hash.Map.to_seq |> Seq.append applied_seq |> Seq.filter_map (fun (oph, op) -> if filter_validation_passes @@ -1222,7 +1211,7 @@ module Make else [] in let process_map map = - let open Tezos_crypto.Operation_hash in + let open Operation_hash in Map.filter_map (fun _oph (op, error) -> if @@ -1236,28 +1225,28 @@ module Make let refused = if params#refused then process_map (Classification.map pv.shell.classification.refused) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let outdated = if params#outdated then process_map (Classification.map pv.shell.classification.outdated) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let branch_refused = if params#branch_refused then process_map (Classification.map pv.shell.classification.branch_refused) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let branch_delayed = if params#branch_delayed then process_map (Classification.map pv.shell.classification.branch_delayed) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let unprocessed = - Tezos_crypto.Operation_hash.Map.filter_map + Operation_hash.Map.filter_map (fun _ Prevalidation.{protocol; _} -> if filter_validation_passes params#validation_passes protocol then Some protocol @@ -1309,13 +1298,13 @@ module Make if params#applied then Classification.Sized_map.to_map pv.shell.classification.prechecked - |> Tezos_crypto.Operation_hash.Map.to_seq + |> Operation_hash.Map.to_seq |> Seq.map (fun (hash, Prevalidation.{protocol; _}) -> ((hash, protocol), None)) else Seq.empty in let process_error_map map = - let open Tezos_crypto.Operation_hash in + let open Operation_hash in map |> Map.to_seq |> Seq.map (fun (hash, (op, error)) -> ((hash, op.Prevalidation.protocol), Some error)) @@ -1448,7 +1437,7 @@ module Make let on_close w = let pv = Worker.state w in Lwt_watcher.shutdown_input pv.operation_stream ; - Tezos_crypto.Operation_hash.Set.iter + Operation_hash.Set.iter pv.shell.parameters.tools.chain_tools.clear_or_cancel pv.shell.fetching ; Lwt.return_unit @@ -1522,8 +1511,8 @@ module Make in let fetching = List.fold_left - (fun s h -> Tezos_crypto.Operation_hash.Set.add h s) - Tezos_crypto.Operation_hash.Set.empty + (fun s h -> Operation_hash.Set.add h s) + Operation_hash.Set.empty mempool.known_valid in let classification_parameters = @@ -1548,7 +1537,7 @@ module Make fetching; pending = Pending_ops.empty; advertisement = `None; - banned_operations = Tezos_crypto.Operation_hash.Set.empty; + banned_operations = Operation_hash.Set.empty; worker = mk_worker_tools w; } in @@ -1597,7 +1586,7 @@ module Make let*! () = Seq.iter_s (may_fetch_operation pv.shell None) - (Tezos_crypto.Operation_hash.Set.to_seq fetching) + (Operation_hash.Set.to_seq fetching) in return pv @@ -1680,12 +1669,12 @@ module Internal_for_tests = struct {map_size_limit = 32; on_discarded_operation = Fun.const ()} in let advertisement = `None in - let banned_operations = Tezos_crypto.Operation_hash.Set.empty in + let banned_operations = Operation_hash.Set.empty in let classification = Classification.create c_parameters in - let fetching = Tezos_crypto.Operation_hash.Set.empty in + let fetching = Operation_hash.Set.empty in let mempool = Mempool.empty in - let live_blocks = Tezos_crypto.Block_hash.Set.empty in - let live_operations = Tezos_crypto.Operation_hash.Set.empty in + let live_blocks = Block_hash.Set.empty in + let live_operations = Operation_hash.Set.empty in let pending = Pending_ops.empty in let timestamp = Tezos_base.Time.System.now () in { diff --git a/src/lib_shell/legacy_prevalidator_internal.mli b/src/lib_shell/legacy_prevalidator_internal.mli index e00d725e9580..0897197ff21e 100644 --- a/src/lib_shell/legacy_prevalidator_internal.mli +++ b/src/lib_shell/legacy_prevalidator_internal.mli @@ -59,19 +59,18 @@ module Internal_for_tests : sig chain_tools : Store.Block.t Legacy_prevalidator_classification.chain_tools; create : predecessor:Store.Block.t -> - live_operations:Tezos_crypto.Operation_hash.Set.t -> + live_operations:Operation_hash.Set.t -> timestamp:Time.Protocol.t -> unit -> 'prevalidation_t tzresult Lwt.t; fetch : ?peer:P2p_peer.Id.t -> ?timeout:Time.System.Span.t -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t tzresult Lwt.t; - read_block : Tezos_crypto.Block_hash.t -> Store.Block.t tzresult Lwt.t; + read_block : Block_hash.t -> Store.Block.t tzresult Lwt.t; send_get_current_head : ?peer:P2p_peer_id.t -> unit -> unit; - set_mempool : - head:Tezos_crypto.Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; + set_mempool : head:Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; } (** Documented in the ml file, because this is only exported for tests. *) @@ -128,19 +127,18 @@ module Internal_for_tests : sig val on_arrived : types_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t -> (unit, Empty.t) result Lwt.t - val on_ban : - types_state -> Tezos_crypto.Operation_hash.t -> unit tzresult Lwt.t + val on_ban : types_state -> Operation_hash.t -> unit tzresult Lwt.t val on_flush : handle_branch_refused:bool -> types_state -> Store.Block.t -> - Tezos_crypto.Block_hash.Set.t -> - Tezos_crypto.Operation_hash.Set.t -> + Block_hash.Set.t -> + Operation_hash.Set.t -> unit tzresult Lwt.t val on_inject : diff --git a/src/lib_shell/legacy_prevalidator_pending_operations.ml b/src/lib_shell/legacy_prevalidator_pending_operations.ml index 25d72bd1556e..86939ff274e0 100644 --- a/src/lib_shell/legacy_prevalidator_pending_operations.ml +++ b/src/lib_shell/legacy_prevalidator_pending_operations.ml @@ -62,9 +62,8 @@ module Priority_map : Map.S with type key = priority = Map.Make (struct | `Medium, `Low _ -> -1 end) -module Map = Tezos_crypto.Operation_hash.Map -module Sized_set = - Tezos_base.Sized.MakeSizedSet (Tezos_crypto.Operation_hash.Set) +module Map = Operation_hash.Map +module Sized_set = Tezos_base.Sized.MakeSizedSet (Operation_hash.Set) (* The type below is used for representing pending operations data of the diff --git a/src/lib_shell/legacy_prevalidator_pending_operations.mli b/src/lib_shell/legacy_prevalidator_pending_operations.mli index c56838f5718d..e1b2504cb2d0 100644 --- a/src/lib_shell/legacy_prevalidator_pending_operations.mli +++ b/src/lib_shell/legacy_prevalidator_pending_operations.mli @@ -49,18 +49,18 @@ type priority = [`High | `Medium | `Low of Q.t list] type 'protocol_data t module Sized_set : - Tezos_base.Sized.SizedSet with type set := Tezos_crypto.Operation_hash.Set.t + Tezos_base.Sized.SizedSet with type set := Operation_hash.Set.t (** The empty structure of pending operations. *) val empty : 'protocol_data t (** [hashes p] returns the set of hashes contained in [p] *) -val hashes : 'protocol_data t -> Tezos_crypto.Operation_hash.Set.t +val hashes : 'protocol_data t -> Operation_hash.Set.t (** [operations p] returns the Map of bindings [oph -> op] contained in [p] *) val operations : 'protocol_data t -> - 'protocol_data Prevalidation.operation Tezos_crypto.Operation_hash.Map.t + 'protocol_data Prevalidation.operation Operation_hash.Map.t (** [is_empty p] returns [true] if [p] has operations, [false] otherwise. *) val is_empty : 'protocol_data t -> bool @@ -70,7 +70,7 @@ val is_empty : 'protocol_data t -> bool Complexity is O(log(n)), where n is the number of operations (hashes) in the structure. *) -val mem : Tezos_crypto.Operation_hash.t -> 'protocol_data t -> bool +val mem : Operation_hash.t -> 'protocol_data t -> bool (** [add oph op p prio] records the operation [op] whose hash is [oph] and whose priority is [prio] in [p]. @@ -93,8 +93,7 @@ val add : Complexity is O(log(n)), where n is the number of operations (hashes) in the structure. *) -val remove : - Tezos_crypto.Operation_hash.t -> 'protocol_data t -> 'protocol_data t +val remove : Operation_hash.t -> 'protocol_data t -> 'protocol_data t (** [cardinal p] returns the number of operations (hashes) in [p]. @@ -109,12 +108,12 @@ val cardinal : 'protocol_data t -> int We iterate on operations with `High priority first, then on those with `Low priority. For operations with the same priority, the iteration order is - defined [Tezos_crypto.Operation_hash.compare] function (operations with small hashes are + defined [Operation_hash.compare] function (operations with small hashes are processed first). *) val fold : (priority -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data Prevalidation.operation -> 'a -> 'a) -> @@ -125,7 +124,7 @@ val fold : (** [iter f p] is similar to [fold] where [acc] is unit *) val iter : (priority -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data Prevalidation.operation -> unit) -> 'protocol_data t -> @@ -136,7 +135,7 @@ val iter : value [Error e] is returned by [f] *) val fold_es : (priority -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data Prevalidation.operation -> 'a -> ('a, 'b) result Lwt.t) -> diff --git a/src/lib_shell/monitor_directory.ml b/src/lib_shell/monitor_directory.ml index 21d44f8e3dbf..b3a3f9312446 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -89,9 +89,7 @@ let build_rpc_directory validator mainchain_validator = let* context = Store.Block.context_exn chain_store pred in let* protocol = Context_ops.get_protocol context in Lwt.return - (List.exists - (Tezos_crypto.Protocol_hash.equal protocol) - protocols)) + (List.exists (Protocol_hash.equal protocol) protocols)) in let in_next_protocols (chain_store, block) = match q#next_protocols with @@ -100,9 +98,7 @@ let build_rpc_directory validator mainchain_validator = let* context = Store.Block.context_exn chain_store block in let* next_protocol = Context_ops.get_protocol context in Lwt.return - (List.exists - (Tezos_crypto.Protocol_hash.equal next_protocol) - protocols) + (List.exists (Protocol_hash.equal next_protocol) protocols) in let stream = Lwt_stream.filter_map_s @@ -138,9 +134,7 @@ let build_rpc_directory validator mainchain_validator = let* context = Store.Block.context_exn chain_store block in let* next_protocol = Context_ops.get_protocol context in Lwt.return - (List.exists - (Tezos_crypto.Protocol_hash.equal next_protocol) - protocols) + (List.exists (Protocol_hash.equal next_protocol) protocols) in let stream = Lwt_stream.filter_map_s diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index 47fd7afdb32f..f3bba45bf454 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -132,7 +132,7 @@ type config = { Tezos_protocol_environment.Context.t tzresult Lwt.t) option; p2p : (P2p.config * P2p_limits.t) option; - target : (Tezos_crypto.Block_hash.t * int32) option; + target : (Block_hash.t * int32) option; disable_mempool : bool; enable_testchain : bool; dal : Tezos_crypto_dal.Cryptobox.Config.t; @@ -142,7 +142,7 @@ type config = { do not have their actual hash on purpose. *) let test_protocol_hashes = List.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [ "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"; "ProtoDemoCounterDemoCounterDemoCounterDemoCou4LSpdT"; @@ -162,10 +162,10 @@ let store_known_protocols store = | None -> Node_event.(emit store_protocol_missing_files) protocol_hash | Some protocol -> ( let hash = Protocol.hash protocol in - if not (Tezos_crypto.Protocol_hash.equal hash protocol_hash) then + if not (Protocol_hash.equal hash protocol_hash) then if List.mem - ~equal:Tezos_crypto.Protocol_hash.equal + ~equal:Protocol_hash.equal protocol_hash test_protocol_hashes then Lwt.return_unit diff --git a/src/lib_shell/node.mli b/src/lib_shell/node.mli index c89c8e468b20..007859051178 100644 --- a/src/lib_shell/node.mli +++ b/src/lib_shell/node.mli @@ -42,7 +42,7 @@ type config = { Tezos_protocol_environment.Context.t tzresult Lwt.t) option; p2p : (P2p.config * P2p_limits.t) option; - target : (Tezos_crypto.Block_hash.t * int32) option; + target : (Block_hash.t * int32) option; disable_mempool : bool; (** If [true], all non-empty mempools will be ignored. *) enable_testchain : bool; diff --git a/src/lib_shell/node_event.ml b/src/lib_shell/node_event.ml index a94acccbb972..74b4f0f0fe8d 100644 --- a/src/lib_shell/node_event.ml +++ b/src/lib_shell/node_event.ml @@ -47,7 +47,7 @@ let store_protocol_already_included = ~name:"store_protocol_already_included" ~msg:"protocol {protocol} is already in store: nothing to do" ~level:Debug - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ("protocol", Protocol_hash.encoding) let store_protocol_missing_files = declare_1 @@ -55,7 +55,7 @@ let store_protocol_missing_files = ~name:"store_protocol_missing_files" ~msg:"protocol {protocol} won't be stored: missing source files" ~level:Warning - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ("protocol", Protocol_hash.encoding) let store_protocol_incorrect_hash = declare_1 @@ -63,7 +63,7 @@ let store_protocol_incorrect_hash = ~name:"store_protocol_incorrect_hash" ~msg:"protocol {protocol} won't be stored: wrong hash" ~level:Warning - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ("protocol", Protocol_hash.encoding) let store_protocol_success = declare_1 @@ -71,7 +71,7 @@ let store_protocol_success = ~name:"store_successful_store" ~msg:"protocol {protocol} successfully stored" ~level:Info - ("protocol", Tezos_crypto.Protocol_hash.encoding) + ("protocol", Protocol_hash.encoding) let section = section_root @ ["storage_consistency"] diff --git a/src/lib_shell/p2p_reader.ml b/src/lib_shell/p2p_reader.ml index 4d5243d35d19..dae8bc04613d 100644 --- a/src/lib_shell/p2p_reader.ml +++ b/src/lib_shell/p2p_reader.ml @@ -35,18 +35,12 @@ type connection = type callback = { notify_branch : P2p_peer.Id.t -> Block_locator.t -> unit; notify_head : - P2p_peer.Id.t -> - Tezos_crypto.Block_hash.t -> - Block_header.t -> - Mempool.t -> - unit; + P2p_peer.Id.t -> Block_hash.t -> Block_header.t -> Mempool.t -> unit; disconnection : P2p_peer.Id.t -> unit; } -module Block_hash_cache : - Aches.Vache.MAP with type key = Tezos_crypto.Block_hash.t = - Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) +module Block_hash_cache : Aches.Vache.MAP with type key = Block_hash.t = + Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) (Block_hash) type chain_db = { chain_store : Store.Chain.t; diff --git a/src/lib_shell/p2p_reader.mli b/src/lib_shell/p2p_reader.mli index 8fa92c9c13ec..60bea541bff3 100644 --- a/src/lib_shell/p2p_reader.mli +++ b/src/lib_shell/p2p_reader.mli @@ -141,8 +141,7 @@ type t module Message = Distributed_db_message -module Block_hash_cache : - Aches.Vache.MAP with type key = Tezos_crypto.Block_hash.t +module Block_hash_cache : Aches.Vache.MAP with type key = Block_hash.t type p2p = (Message.t, Peer_metadata.t, Connection_metadata.t) P2p.net @@ -153,11 +152,7 @@ type callback = { notify_branch : P2p_peer.Id.t -> Block_locator.t -> unit; (** callback function called on reception of a [Current_branch] message *) notify_head : - P2p_peer.Id.t -> - Tezos_crypto.Block_hash.t -> - Block_header.t -> - Mempool.t -> - unit; + P2p_peer.Id.t -> Block_hash.t -> Block_header.t -> Mempool.t -> unit; (** callback function called on reception of a [Current_head] message *) disconnection : P2p_peer.Id.t -> unit; } @@ -175,9 +170,7 @@ type chain_db = { (** Lookup for block header in any active chains *) val read_block_header : - t -> - Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Chain_id.t * Block_header.t) option Lwt.t + t -> Block_hash.t -> (Tezos_crypto.Chain_id.t * Block_header.t) option Lwt.t (** [run ~register ~unregister p2p state protocol_db active_chains peer_id conn] runs an answering worker on a p2p connection [connection]. [peer_id] is diff --git a/src/lib_shell/peer_validator.ml b/src/lib_shell/peer_validator.ml index 19667230c907..2f2ebe8f9357 100644 --- a/src/lib_shell/peer_validator.ml +++ b/src/lib_shell/peer_validator.ml @@ -53,9 +53,7 @@ module Request = struct include Request type (_, _) t = - | New_head : - Tezos_crypto.Block_hash.t * Block_header.t - -> (unit, error trace) t + | New_head : Block_hash.t * Block_header.t -> (unit, error trace) t | New_branch : Block_locator.t * Block_locator.seed -> (unit, error trace) t let view (type a b) (req : (a, b) t) : view = @@ -404,7 +402,7 @@ let on_error (type a b) w st (request : (a, b) Request.t) (err : b) : ( pv.peer_id, Format.asprintf "missing protocol: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol ) in let* () = Events.(emit request_error) (request_view, st, err) in diff --git a/src/lib_shell/peer_validator.mli b/src/lib_shell/peer_validator.mli index 409d2d93c0ed..50a591b5ea10 100644 --- a/src/lib_shell/peer_validator.mli +++ b/src/lib_shell/peer_validator.mli @@ -41,7 +41,7 @@ val shutdown : t -> unit Lwt.t val notify_branch : t -> Block_locator.t -> unit -val notify_head : t -> Tezos_crypto.Block_hash.t -> Block_header.t -> unit +val notify_head : t -> Block_hash.t -> Block_header.t -> unit val running_workers : unit -> ((Tezos_crypto.Chain_id.t * P2p_peer.Id.t) * t) list @@ -59,8 +59,5 @@ val pipeline_length : t -> Peer_validator_worker_state.pipeline_length module Internal_for_tests : sig val validate_new_head : - t -> - Tezos_crypto.Block_hash.t -> - Block_header.t -> - (unit, error trace) result Lwt.t + t -> Block_hash.t -> Block_header.t -> (unit, error trace) result Lwt.t end diff --git a/src/lib_shell/peer_validator_events.ml b/src/lib_shell/peer_validator_events.ml index e5200973e7bd..c117976d37c8 100644 --- a/src/lib_shell/peer_validator_events.ml +++ b/src/lib_shell/peer_validator_events.ml @@ -46,9 +46,9 @@ let new_branch_validated = ~msg:"branch from {peer} validated with head {hash}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetching_operations_for_head = declare_2 @@ -57,9 +57,9 @@ let fetching_operations_for_head = ~msg:"fetching operaitons from {peer} for head {hash}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let requesting_new_head_validation = declare_2 @@ -68,9 +68,9 @@ let requesting_new_head_validation = ~msg:"requesting new head validation from {peer} for head {hash}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let new_head_validation_end = declare_2 @@ -79,9 +79,9 @@ let new_head_validation_end = ~msg:"new head validation from {peer} for head {hash} ended" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_head = declare_2 @@ -90,9 +90,9 @@ let ignoring_head = ~msg:"ignoring head {hash} from peer {peer} with non-increasing fitness" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_previously_validated_block = declare_2 @@ -101,9 +101,9 @@ let ignoring_previously_validated_block = ~msg:"ignoring previously validated head {hash} from {peer}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_invalid_block = declare_2 @@ -112,9 +112,9 @@ let ignoring_invalid_block = ~msg:"ignoring invalid block {hash} from {peer}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_valid_block = declare_2 @@ -123,9 +123,9 @@ let ignoring_valid_block = ~msg:"ignoring prechecked head {hash} from {peer}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_prechecked_invalid_block = declare_2 @@ -134,9 +134,9 @@ let ignoring_prechecked_invalid_block = ~msg:"ignoring invalid block {hash} from {peer}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let missing_new_head_predecessor = declare_2 @@ -145,9 +145,9 @@ let missing_new_head_predecessor = ~msg:"missing new head's predecessor {hash} from {peer}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_branch_with_invalid_locator = declare_2 @@ -156,9 +156,9 @@ let ignoring_branch_with_invalid_locator = ~msg:"ignoring branch with head {hash} from {peer} (invalid locator)" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let ignoring_branch_without_common_ancestor = declare_2 @@ -167,9 +167,9 @@ let ignoring_branch_without_common_ancestor = ~msg:"ignoring branch with head {hash} from {peer} (no common ancestor)" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let no_new_head_from_peer = declare_2 @@ -189,9 +189,9 @@ let processing_new_head = ~msg:"processing new head fron peer {peer}: {hash}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let processing_new_branch = declare_2 @@ -200,9 +200,9 @@ let processing_new_branch = ~msg:"processing new branch fron peer {peer}: {hash}" ~level:Debug ~pp1:P2p_peer.Id.pp - ~pp2:Tezos_crypto.Block_hash.pp + ~pp2:Block_hash.pp ("peer", P2p_peer.Id.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let terminating_worker = declare_2 diff --git a/src/lib_shell/prevalidation.ml b/src/lib_shell/prevalidation.ml index 1801fd33dd36..38b689170bc2 100644 --- a/src/lib_shell/prevalidation.ml +++ b/src/lib_shell/prevalidation.ml @@ -39,10 +39,10 @@ open Shell_operation type error += | Operation_replacement of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } - | Operation_conflict of {new_hash : Tezos_crypto.Operation_hash.t} + | Operation_conflict of {new_hash : Operation_hash.t} let () = register_error_kind @@ -54,13 +54,13 @@ let () = Format.fprintf ppf "The operation %a has been replaced with %a." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Operation_replacement {old_hash; new_hash} -> Some (old_hash, new_hash) | _ -> None) @@ -78,10 +78,9 @@ let () = "The operation %a cannot be added because the mempool already contains \ a conflicting operation that should not be replaced (e.g. an \ operation from the same manager with better fees)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) - (Data_encoding.obj1 - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.obj1 (Data_encoding.req "new_hash" Operation_hash.encoding)) (function Operation_conflict {new_hash} -> Some new_hash | _ -> None) (fun new_hash -> Operation_conflict {new_hash}) @@ -131,9 +130,7 @@ module type T = sig Lwt.t type replacement = - (Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification) - option + (Operation_hash.t * Prevalidator_classification.error_classification) option type add_result = t @@ -144,11 +141,10 @@ module type T = sig val add_operation : t -> filter_config -> protocol_operation operation -> add_result Lwt.t - val remove_operation : t -> Tezos_crypto.Operation_hash.t -> t + val remove_operation : t -> Operation_hash.t -> t module Internal_for_tests : sig - val get_valid_operations : - t -> protocol_operation Tezos_crypto.Operation_hash.Map.t + val get_valid_operations : t -> protocol_operation Operation_hash.Map.t val get_filter_state : t -> filter_state @@ -237,8 +233,7 @@ module MakeAbstract (Chain_store : CHAIN_STORE) (Filter : Shell_plugin.FILTER) : type classification = Prevalidator_classification.classification - type replacement = - (Tezos_crypto.Operation_hash.t * error_classification) option + type replacement = (Operation_hash.t * error_classification) option type add_result = t * operation * classification * replacement diff --git a/src/lib_shell/prevalidation.mli b/src/lib_shell/prevalidation.mli index cd598a32e0d6..4234b51a8d97 100644 --- a/src/lib_shell/prevalidation.mli +++ b/src/lib_shell/prevalidation.mli @@ -103,9 +103,7 @@ module type T = sig operation, then this type contains its hash and its new classification. If there is no replaced operation, this is [None]. *) type replacement = - (Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification) - option + (Operation_hash.t * Prevalidator_classification.error_classification) option (** Result of {!add_operation}. @@ -140,13 +138,12 @@ module type T = sig The state remains unchanged when the operation was not present. *) - val remove_operation : t -> Tezos_crypto.Operation_hash.t -> t + val remove_operation : t -> Operation_hash.t -> t module Internal_for_tests : sig (** Return the map of operations currently present in the protocol representation of the mempool. *) - val get_valid_operations : - t -> protocol_operation Tezos_crypto.Operation_hash.Map.t + val get_valid_operations : t -> protocol_operation Operation_hash.Map.t (** Return the filter_state component of the state. *) val get_filter_state : t -> filter_state diff --git a/src/lib_shell/prevalidator.ml b/src/lib_shell/prevalidator.ml index fb3e77128312..2fa096a23823 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -28,10 +28,10 @@ include Prevalidator_internal_common open Prevalidator_worker_state module ChainProto_registry = Map.Make (struct - type t = Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t + type t = Tezos_crypto.Chain_id.t * Protocol_hash.t let compare (c1, p1) (c2, p2) = - let pc = Tezos_crypto.Protocol_hash.compare p1 p2 in + let pc = Protocol_hash.compare p1 p2 in if pc = 0 then Tezos_crypto.Chain_id.compare c1 c2 else pc end) @@ -156,11 +156,11 @@ let empty_rpc_directory : unit Tezos_rpc.Directory.t = let pending_operations = { Block_services.Empty.Mempool.applied = []; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; - unprocessed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; + unprocessed = Operation_hash.Map.empty; } in Block_services.Empty.Mempool.pending_operations_version_dispatcher diff --git a/src/lib_shell/prevalidator.mld b/src/lib_shell/prevalidator.mld index c6003e74a54a..48aa4d24cd07 100644 --- a/src/lib_shell/prevalidator.mld +++ b/src/lib_shell/prevalidator.mld @@ -162,7 +162,7 @@ new [live_blocks] and [live_operations], triggering also a {{!Tezos_shell.module-Prevalidator.flush} flush} of the mempool: every operation classified as {{!Tezos_shell.module-Prevalidation.T.result.Applied} Applied} or {{!Tezos_shell.module-Prevalidation.T.result.Branch_delayed} Branch_delayed} -which is anchored (to the {{!Tezos_crypto.module-Tezos_crypto.Block_hash.type-t} block_hash} +which is anchored (to the {{!module-Block_hash.type-t} block_hash} on which the operation is based on when it was created) on a [live block] and which is not in the [live operations] (operations which are included in [live_blocks]) is set diff --git a/src/lib_shell/prevalidator.mli b/src/lib_shell/prevalidator.mli index 68756c2aabde..3865c4cbb6d3 100644 --- a/src/lib_shell/prevalidator.mli +++ b/src/lib_shell/prevalidator.mli @@ -76,15 +76,15 @@ val inject_operation : t -> force:bool -> Operation.t -> unit tzresult Lwt.t val flush : t -> Chain_validator_worker_state.update -> - Tezos_crypto.Block_hash.t -> - Tezos_crypto.Block_hash.Set.t -> - Tezos_crypto.Operation_hash.Set.t -> + Block_hash.t -> + Block_hash.Set.t -> + Operation_hash.Set.t -> unit tzresult Lwt.t (** Returns the list of prevalidation contexts running and their associated chain *) val running_workers : - unit -> (Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t * t) list + unit -> (Tezos_crypto.Chain_id.t * Protocol_hash.t * t) list (** Worker status and events *) diff --git a/src/lib_shell/prevalidator_classification.ml b/src/lib_shell/prevalidator_classification.ml index 580c26d9a634..f37f674482fa 100644 --- a/src/lib_shell/prevalidator_classification.ml +++ b/src/lib_shell/prevalidator_classification.ml @@ -46,7 +46,7 @@ module Event = struct ~name:"predecessor_less_block" ~msg:"Observing that a parent of block {blk_h} has no predecessor" ~level:Warning - ("blk_h", Tezos_crypto.Block_hash.encoding) + ("blk_h", Block_hash.encoding) end type error_classification = @@ -57,7 +57,7 @@ type error_classification = type classification = [`Applied | `Prechecked | error_classification] -module Map = Tezos_crypto.Operation_hash.Map +module Map = Operation_hash.Map module Sized_map = Tezos_base.Sized.MakeSizedMap (Map) (** This type wraps together: @@ -68,7 +68,7 @@ module Sized_map = Tezos_base.Sized.MakeSizedMap (Map) All operations must maintain integrity between the 2! *) type 'protocol_data bounded_map = { - ring : Tezos_crypto.Operation_hash.t Ringo.Ring.t; + ring : Operation_hash.t Ringo.Ring.t; mutable map : ('protocol_data operation * error list) Map.t; } @@ -84,7 +84,7 @@ let mk_empty_bounded_map ring_size = type parameters = { map_size_limit : int; - on_discarded_operation : Tezos_crypto.Operation_hash.t -> unit; + on_discarded_operation : Operation_hash.t -> unit; } (** Note that [applied] and [in_mempool] are intentionally unbounded. @@ -99,7 +99,7 @@ type 'protocol_data t = { branch_delayed : 'protocol_data bounded_map; mutable applied_rev : 'protocol_data operation list; mutable prechecked : 'protocol_data operation Sized_map.t; - mutable unparsable : Tezos_crypto.Operation_hash.Set.t; + mutable unparsable : Operation_hash.Set.t; mutable in_mempool : ('protocol_data operation * classification) Map.t; } @@ -111,7 +111,7 @@ let create parameters = branch_refused = mk_empty_bounded_map parameters.map_size_limit; branch_delayed = mk_empty_bounded_map parameters.map_size_limit; prechecked = Sized_map.empty; - unparsable = Tezos_crypto.Operation_hash.Set.empty; + unparsable = Operation_hash.Set.empty; in_mempool = Map.empty; applied_rev = []; } @@ -135,13 +135,13 @@ let is_empty [in_mempool] is the union of all other fields (see the MLI for detailed documentation of this invariant) except unparsable operations which are not classified yet. *) - Map.is_empty in_mempool && Tezos_crypto.Operation_hash.Set.is_empty unparsable + Map.is_empty in_mempool && Operation_hash.Set.is_empty unparsable let set_of_bounded_map bounded_map = Map.fold - (fun oph _ acc -> Tezos_crypto.Operation_hash.Set.add oph acc) + (fun oph _ acc -> Operation_hash.Set.add oph acc) bounded_map.map - Tezos_crypto.Operation_hash.Set.empty + Operation_hash.Set.empty let flush (classes : 'protocol_data t) ~handle_branch_refused = let remove_map_from_in_mempool map = @@ -168,13 +168,13 @@ let flush (classes : 'protocol_data t) ~handle_branch_refused = remove_list_from_in_mempool classes.applied_rev ; classes.applied_rev <- [] ; remove_map_from_in_mempool (Sized_map.to_map classes.prechecked) ; - classes.unparsable <- Tezos_crypto.Operation_hash.Set.empty ; + classes.unparsable <- Operation_hash.Set.empty ; classes.prechecked <- Sized_map.empty let is_in_mempool oph classes = Map.find oph classes.in_mempool let is_known_unparsable oph classes = - Tezos_crypto.Operation_hash.Set.mem oph classes.unparsable + Operation_hash.Set.mem oph classes.unparsable (* Removing an operation is currently used for operations which are banned (this can only be achieved by the adminstrator of the @@ -206,7 +206,7 @@ let remove oph classes = | `Applied -> classes.applied_rev <- List.filter - (fun op -> Tezos_crypto.Operation_hash.(op.hash <> oph)) + (fun op -> Operation_hash.(op.hash <> oph)) classes.applied_rev) ; Some (op, classification) @@ -254,8 +254,7 @@ let handle_error oph op classification classes = classes.in_mempool <- Map.add oph (op, classification) classes.in_mempool let add_unparsable oph classes = - classes.unparsable <- - Tezos_crypto.Operation_hash.Set.add oph classes.unparsable ; + classes.unparsable <- Operation_hash.Set.add oph classes.unparsable ; classes.parameters.on_discarded_operation oph let add classification op classes = @@ -299,14 +298,14 @@ let to_map ~applied ~prechecked ~branch_delayed ~branch_refused ~refused +> if outdated then classes.outdated.map else Map.empty type 'block block_tools = { - bhash : 'block -> Tezos_crypto.Block_hash.t; + bhash : 'block -> Block_hash.t; operations : 'block -> Operation.t list list; - all_operation_hashes : 'block -> Tezos_crypto.Operation_hash.t list list; + all_operation_hashes : 'block -> Operation_hash.t list list; } type 'block chain_tools = { - clear_or_cancel : Tezos_crypto.Operation_hash.t -> unit; - inject_operation : Tezos_crypto.Operation_hash.t -> Operation.t -> unit Lwt.t; + clear_or_cancel : Operation_hash.t -> unit; + inject_operation : Operation_hash.t -> Operation.t -> unit Lwt.t; new_blocks : from_block:'block -> to_block:'block -> ('block * 'block list) Lwt.t; read_predecessor_opt : 'block -> 'block option Lwt.t; @@ -315,15 +314,14 @@ type 'block chain_tools = { (* There's detailed documentation in the mli *) let handle_live_operations ~classes ~(block_store : 'block block_tools) ~(chain : 'block chain_tools) ~(from_branch : 'block) ~(to_branch : 'block) - ~(is_branch_alive : Tezos_crypto.Block_hash.t -> bool) + ~(is_branch_alive : Block_hash.t -> bool) ~(parse : - Tezos_crypto.Operation_hash.t -> - Operation.t -> - 'protocol_data operation option) old_mempool = + Operation_hash.t -> Operation.t -> 'protocol_data operation option) + old_mempool = let open Lwt_syntax in let rec pop_block ancestor (block : 'block) mempool = let hash = block_store.bhash block in - if Tezos_crypto.Block_hash.equal hash ancestor then Lwt.return mempool + if Block_hash.equal hash ancestor then Lwt.return mempool else let operations = block_store.operations block in let* mempool = @@ -352,8 +350,7 @@ let handle_live_operations ~classes ~(block_store : 'block block_tools) unparsable and it is ok. *) add_unparsable oph classes ; mempool - | Some parsed_op -> - Tezos_crypto.Operation_hash.Map.add oph parsed_op mempool)) + | Some parsed_op -> Operation_hash.Map.add oph parsed_op mempool)) mempool operations in @@ -377,8 +374,7 @@ let handle_live_operations ~classes ~(block_store : 'block block_tools) let operations = block_store.all_operation_hashes block in List.iter (List.iter chain.clear_or_cancel) operations ; List.fold_left - (List.fold_left (fun mempool h -> - Tezos_crypto.Operation_hash.Map.remove h mempool)) + (List.fold_left (fun mempool h -> Operation_hash.Map.remove h mempool)) mempool operations in @@ -408,8 +404,7 @@ let recycle_operations ~from_branch ~to_branch ~live_blocks ~classes ~parse ~chain ~from_branch ~to_branch - ~is_branch_alive:(fun branch -> - Tezos_crypto.Block_hash.Set.mem branch live_blocks) + ~is_branch_alive:(fun branch -> Block_hash.Set.mem branch live_blocks) ~parse (Map.union (fun _key v _ -> Some v) @@ -433,7 +428,7 @@ module Internal_for_tests = struct (** [copy_bounded_map bm] returns a deep copy of [bm] *) let copy_bounded_map (bm : 'protocol_data bounded_map) : 'protocol_data bounded_map = - let copy_ring (ring : Tezos_crypto.Operation_hash.t Ringo.Ring.t) = + let copy_ring (ring : Operation_hash.t Ringo.Ring.t) = let result = Ringo.Ring.capacity ring |> Ringo.Ring.create in List.iter (Ringo.Ring.add result) (Ringo.Ring.elements ring) ; result @@ -459,10 +454,7 @@ module Internal_for_tests = struct let[@coverage off] bounded_map_pp ppf bounded_map = bounded_map.map |> Map.bindings |> List.map (fun (key, _value) -> key) - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) let[@coverage off] pp ppf { @@ -479,31 +471,19 @@ module Internal_for_tests = struct let applied_pp ppf applied = applied |> List.map (fun op -> op.hash) - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let in_mempool_pp ppf in_mempool = in_mempool |> Map.bindings |> List.map fst - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let prechecked_pp ppf prechecked = prechecked |> Sized_map.bindings |> List.map fst - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in let unparsable_pp ppf unparsable = - unparsable |> Tezos_crypto.Operation_hash.Set.elements - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + unparsable |> Operation_hash.Set.elements + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in Format.fprintf ppf diff --git a/src/lib_shell/prevalidator_classification.mli b/src/lib_shell/prevalidator_classification.mli index 59e98c2fcb04..c678bbddd11d 100644 --- a/src/lib_shell/prevalidator_classification.mli +++ b/src/lib_shell/prevalidator_classification.mli @@ -50,20 +50,20 @@ type 'protocol_data bounded_map (** [map bounded_map] gets the underling map of the [bounded_map]. *) val map : 'protocol_data bounded_map -> - ('protocol_data operation * tztrace) Tezos_crypto.Operation_hash.Map.t + ('protocol_data operation * tztrace) Operation_hash.Map.t (** [cardinal bounded_map] gets the cardinal of the underling map of the [bounded_map] *) val cardinal : 'protocol_data bounded_map -> int type parameters = { map_size_limit : int; - on_discarded_operation : Tezos_crypto.Operation_hash.t -> unit; + on_discarded_operation : Operation_hash.t -> unit; } module Sized_map : Tezos_base.Sized.SizedMap - with type 'a map := 'a Tezos_crypto.Operation_hash.Map.t - and type key = Tezos_crypto.Operation_hash.t + with type 'a map := 'a Operation_hash.Map.t + and type key = Operation_hash.t (** Invariants ensured by this module, provided that the caller does not {!add} an operation which is already present in [t]: @@ -95,10 +95,9 @@ type 'protocol_data t = private { branch_delayed : 'protocol_data bounded_map; mutable applied_rev : 'protocol_data operation list; mutable prechecked : 'protocol_data operation Sized_map.t; - mutable unparsable : Tezos_crypto.Operation_hash.Set.t; + mutable unparsable : Operation_hash.Set.t; mutable in_mempool : - ('protocol_data operation * classification) - Tezos_crypto.Operation_hash.Map.t; + ('protocol_data operation * classification) Operation_hash.Map.t; } (** [create parameters] returns an empty {!t} whose bounded maps hold @@ -117,15 +116,14 @@ val is_empty : 'protocol_data t -> bool in field [in_mempool] of [classes]. It returns the corresponding operation and its classification if present, and None otherwise. *) val is_in_mempool : - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data t -> ('protocol_data operation * classification) option (** [is_known_unparsable oph] returns [true] if the [oph] is associated to an operation which is known to be unparsable. [false] otherwise. *) -val is_known_unparsable : - Tezos_crypto.Operation_hash.t -> 'protocol_data t -> bool +val is_known_unparsable : Operation_hash.t -> 'protocol_data t -> bool (** [remove oph classes] removes operation of hash [oph] from all fields of [classes]. If the [oph] was classified as [Applied], the @@ -141,7 +139,7 @@ val is_known_unparsable : this may invalidate the classification of all the other operations. It is left to the caller to restore a consistent state. *) val remove : - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data t -> ('protocol_data operation * classification) option @@ -176,14 +174,14 @@ val add : classification -> 'protocol_data operation -> 'protocol_data t -> unit operation. [unparsable] operations are removed automatically by the [recycle_operations] function. [on_discard_operation] is also called on those operations. *) -val add_unparsable : Tezos_crypto.Operation_hash.t -> 'protocol_data t -> unit +val add_unparsable : Operation_hash.t -> 'protocol_data t -> unit (** Functions to query data on a polymorphic block-like type ['block]. *) type 'block block_tools = { - bhash : 'block -> Tezos_crypto.Block_hash.t; (** The hash of a block *) + bhash : 'block -> Block_hash.t; (** The hash of a block *) operations : 'block -> Operation.t list list; (** The list of operations of a block ordered by their validation pass *) - all_operation_hashes : 'block -> Tezos_crypto.Operation_hash.t list list; + all_operation_hashes : 'block -> Operation_hash.t list list; (** The list of hashes of operations of a block ordered by their validation pass. Could be implemented using {!operations} but this lets an alternative implementation @@ -193,9 +191,9 @@ type 'block block_tools = { (** A wrapper over chain-related modules, to make client code easier to emulate, and hence to test *) type 'block chain_tools = { - clear_or_cancel : Tezos_crypto.Operation_hash.t -> unit; + clear_or_cancel : Operation_hash.t -> unit; (** Removes the operation from the distributed database. *) - inject_operation : Tezos_crypto.Operation_hash.t -> Operation.t -> unit Lwt.t; + inject_operation : Operation_hash.t -> Operation.t -> unit Lwt.t; (** Puts the operation in the distributed database. Returns [false] if the [hash] is already in the distributed database *) new_blocks : @@ -232,17 +230,14 @@ type 'block chain_tools = { val recycle_operations : from_branch:'block -> to_branch:'block -> - live_blocks:Tezos_crypto.Block_hash.Set.t -> + live_blocks:Block_hash.Set.t -> classes:'protocol_data t -> - parse: - (Tezos_crypto.Operation_hash.t -> - Operation.t -> - 'protocol_data operation option) -> - pending:'protocol_data operation Tezos_crypto.Operation_hash.Map.t -> + parse:(Operation_hash.t -> Operation.t -> 'protocol_data operation option) -> + pending:'protocol_data operation Operation_hash.Map.t -> block_store:'block block_tools -> chain:'block chain_tools -> handle_branch_refused:bool -> - 'protocol_data operation Tezos_crypto.Operation_hash.Map.t Lwt.t + 'protocol_data operation Operation_hash.Map.t Lwt.t (**/**) @@ -256,8 +251,7 @@ module Internal_for_tests : sig val copy : 'protocol_data t -> 'protocol_data t (** [set_of_bounded_map m] returns all the operation hashes in [m]. *) - val set_of_bounded_map : - 'protocol_data bounded_map -> Tezos_crypto.Operation_hash.Set.t + val set_of_bounded_map : 'protocol_data bounded_map -> Operation_hash.Set.t (** [pp_t_sizes t] prints the [map_size_limit] parameter of [t] and the sizes of its fields (number of elements in the map and @@ -276,7 +270,7 @@ module Internal_for_tests : sig refused:bool -> outdated:bool -> 'protocol_data t -> - 'protocol_data operation Tezos_crypto.Operation_hash.Map.t + 'protocol_data operation Operation_hash.Map.t (** [flush classes ~handle_branch_refused] partially resets [classes]: - fields [applied_rev], [branch_delayed] and [unparsable] are emptied; @@ -322,11 +316,8 @@ module Internal_for_tests : sig chain:'block chain_tools -> from_branch:'block -> to_branch:'block -> - is_branch_alive:(Tezos_crypto.Block_hash.t -> bool) -> - parse: - (Tezos_crypto.Operation_hash.t -> - Operation.t -> - 'protocol_data operation option) -> - 'protocol_data operation Tezos_crypto.Operation_hash.Map.t -> - 'protocol_data operation Tezos_crypto.Operation_hash.Map.t Lwt.t + is_branch_alive:(Block_hash.t -> bool) -> + parse:(Operation_hash.t -> Operation.t -> 'protocol_data operation option) -> + 'protocol_data operation Operation_hash.Map.t -> + 'protocol_data operation Operation_hash.Map.t Lwt.t end diff --git a/src/lib_shell/prevalidator_events.ml b/src/lib_shell/prevalidator_events.ml index 29a0f78f438b..fde31b78c5b5 100644 --- a/src/lib_shell/prevalidator_events.ml +++ b/src/lib_shell/prevalidator_events.ml @@ -62,8 +62,8 @@ let unparsable_operation = ~name:"unparsable_operation" ~msg:"unparsable operation {oph}" ~level:Debug - ~pp1:Tezos_crypto.Operation_hash.pp - ("oph", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("oph", Operation_hash.encoding) let processing_operations = declare_0 @@ -79,8 +79,8 @@ let fetching_operation = ~name:"fetching_operation" ~msg:"fetching operation {oph}" ~level:Debug - ~pp1:Tezos_crypto.Operation_hash.pp - ("oph", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("oph", Operation_hash.encoding) let operation_included = declare_1 @@ -88,8 +88,8 @@ let operation_included = ~name:"operation_included" ~msg:"operation {oph} included before being prevalidated" ~level:Debug - ~pp1:Tezos_crypto.Operation_hash.pp - ("oph", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("oph", Operation_hash.encoding) let operations_to_reclassify = declare_1 @@ -106,8 +106,8 @@ let operation_reclassified = ~name:"operation_reclassified" ~msg:"operation {oph} reclassified" ~level:Debug - ~pp1:Tezos_crypto.Operation_hash.pp - ("oph", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("oph", Operation_hash.encoding) let request_completed_notice = declare_2 @@ -184,9 +184,9 @@ let ban_operation_encountered = ~msg:"{origin}: banned {oph} encountered" ~level:Notice ~pp1:pp_origin - ~pp2:Tezos_crypto.Operation_hash.pp + ~pp2:Operation_hash.pp ("origin", origin_encoding) - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let operation_not_fetched = declare_1 @@ -194,5 +194,5 @@ let operation_not_fetched = ~name:"operation_not_fetched" ~msg:"Operation {oph} was not fetched" ~level:Debug - ~pp1:Tezos_crypto.Operation_hash.pp - ("oph", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("oph", Operation_hash.encoding) diff --git a/src/lib_shell/prevalidator_internal.ml b/src/lib_shell/prevalidator_internal.ml index 662e9451d4f7..e9a7cb26e497 100644 --- a/src/lib_shell/prevalidator_internal.ml +++ b/src/lib_shell/prevalidator_internal.ml @@ -85,20 +85,19 @@ module Tools = struct fetch : ?peer:P2p_peer.Id.t -> ?timeout:Time.System.Span.t -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t tzresult Lwt.t; (** [fetch ?peer ?timeout oph] returns the value when it is known. It can fail with [Requester.Timeout] if [timeout] is provided and the value isn't known before the timeout expires. It can fail with [Requester.Cancel] if the request is canceled. *) - read_block : Tezos_crypto.Block_hash.t -> Store.Block.t tzresult Lwt.t; + read_block : Block_hash.t -> Store.Block.t tzresult Lwt.t; (** [read_block bh] tries to read the block [bh] from the chain store. *) send_get_current_head : ?peer:P2p_peer_id.t -> unit -> unit; (** [send_get_current_head ?peer ()] sends a [Get_Current_head] to a given peer, or to all known active peers for the chain considered. Expected answer is a [Get_current_head] message *) - set_mempool : - head:Tezos_crypto.Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; + set_mempool : head:Block_hash.t -> Mempool.t -> unit tzresult Lwt.t; (** [set_mempool ~head mempool] sets the [mempool] of the [chain_store] of the chain considered. Does nothing if [head] differs from current_head which might happen when a new head concurrently arrives just @@ -131,13 +130,13 @@ type ('protocol_data, 'a) types_state_shell = { parameters : 'a parameters; mutable predecessor : Store.Block.t; mutable timestamp : Time.System.t; - mutable live_blocks : Tezos_crypto.Block_hash.Set.t; - mutable live_operations : Tezos_crypto.Operation_hash.Set.t; - mutable fetching : Tezos_crypto.Operation_hash.Set.t; + mutable live_blocks : Block_hash.Set.t; + mutable live_operations : Operation_hash.Set.t; + mutable fetching : Operation_hash.Set.t; mutable pending : 'protocol_data Pending_ops.t; mutable mempool : Mempool.t; mutable advertisement : [`Pending of Mempool.t | `None]; - mutable banned_operations : Tezos_crypto.Operation_hash.Set.t; + mutable banned_operations : Operation_hash.Set.t; worker : Tools.worker_tools; } @@ -215,7 +214,7 @@ module type S = sig val may_fetch_operation : (protocol_operation, prevalidation_t) types_state_shell -> P2p_peer_id.t option -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> unit Lwt.t (** The function called after every call to a function of {!API}. *) @@ -233,19 +232,18 @@ module type S = sig val on_arrived : types_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Operation.t -> (unit, Empty.t) result Lwt.t - val on_ban : - types_state -> Tezos_crypto.Operation_hash.t -> unit tzresult Lwt.t + val on_ban : types_state -> Operation_hash.t -> unit tzresult Lwt.t val on_flush : handle_branch_refused:bool -> types_state -> Store.Block.t -> - Tezos_crypto.Block_hash.Set.t -> - Tezos_crypto.Operation_hash.Set.t -> + Block_hash.Set.t -> + Operation_hash.Set.t -> unit tzresult Lwt.t val on_inject : @@ -296,14 +294,14 @@ module Make_s (* This function is in [Lwt] only for logging. *) let already_handled ~origin shell oph = let open Lwt_syntax in - if Tezos_crypto.Operation_hash.Set.mem oph shell.banned_operations then + if Operation_hash.Set.mem oph shell.banned_operations then let+ () = Events.(emit ban_operation_encountered) (origin, oph) in true else Lwt.return (Pending_ops.mem oph shell.pending - || Tezos_crypto.Operation_hash.Set.mem oph shell.fetching - || Tezos_crypto.Operation_hash.Set.mem oph shell.live_operations + || Operation_hash.Set.mem oph shell.fetching + || Operation_hash.Set.mem oph shell.live_operations || Classification.is_in_mempool oph shell.classification <> None || Classification.is_known_unparsable oph shell.classification) @@ -315,8 +313,7 @@ module Make_s `Pending { known_valid = known_valid @ mempool.Mempool.known_valid; - pending = - Tezos_crypto.Operation_hash.Set.union pending mempool.pending; + pending = Operation_hash.Set.union pending mempool.pending; } | `None -> shell.advertisement <- `Pending mempool ; @@ -571,12 +568,10 @@ module Make_s ignore (Lwt.finalize (fun () -> - shell.fetching <- - Tezos_crypto.Operation_hash.Set.add oph shell.fetching ; + shell.fetching <- Operation_hash.Set.add oph shell.fetching ; fetch_operation shell ?peer oph) (fun () -> - shell.fetching <- - Tezos_crypto.Operation_hash.Set.remove oph shell.fetching ; + shell.fetching <- Operation_hash.Set.remove oph shell.fetching ; Lwt.return_unit)) ; Lwt.return_unit @@ -612,7 +607,7 @@ module Make_s | (`High | `Medium | `Low _) as prio -> if not - (Tezos_crypto.Block_hash.Set.mem + (Block_hash.Set.mem op.Operation.shell.branch pv.shell.live_blocks) then ( @@ -646,7 +641,7 @@ module Make_s | Error err -> failwith "Invalid operation %a: %a." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Error_monad.pp_print_trace err @@ -660,15 +655,15 @@ module Make_s return_unit) else if not - (Tezos_crypto.Block_hash.Set.mem + (Block_hash.Set.mem op.Operation.shell.branch pv.shell.live_blocks) then failwith "Operation %a is branched on a block %a which is too old" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.Operation.shell.branch else let notifier = mk_notifier pv.operation_stream in @@ -688,7 +683,7 @@ module Make_s List.find_opt (function | ({hash; _} : protocol_operation operation), _ -> - Tezos_crypto.Operation_hash.equal hash oph) + Operation_hash.equal hash oph) to_handle in match op_status with @@ -720,7 +715,7 @@ module Make_s Lwt.return @@ error_with "Error while applying operation %a:@ %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph pp_print_trace e @@ -729,7 +724,7 @@ module Make_s failwith "Unexpected error while injecting operation %a. Operation \ not found after classifying it." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) let on_notify (shell : ('operation_data, _) types_state_shell) peer mempool @@ -739,7 +734,7 @@ module Make_s let* () = List.iter_s may_fetch_operation mempool.Mempool.known_valid in Seq.iter_s may_fetch_operation - (Tezos_crypto.Operation_hash.Set.to_seq mempool.Mempool.pending) + (Operation_hash.Set.to_seq mempool.Mempool.pending) let on_flush ~handle_branch_refused pv new_predecessor new_live_blocks new_live_operations = @@ -772,10 +767,10 @@ module Make_s ~chain:pv.shell.parameters.tools.chain_tools ~handle_branch_refused in - (* Could be implemented as Tezos_crypto.Operation_hash.Map.filter_s which + (* Could be implemented as Operation_hash.Map.filter_s which does not exist for the moment. *) let*! new_pending_operations, nb_pending = - Tezos_crypto.Operation_hash.Map.fold_s + Operation_hash.Map.fold_s (fun _oph op (pending, nb_pending) -> let*! v = pre_filter pv ~notifier:(mk_notifier pv.operation_stream) op @@ -818,12 +813,11 @@ module Make_s pv.shell.advertisement <- remove_from_advertisement oph pv.shell.advertisement ; pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.add oph pv.shell.banned_operations ; + Operation_hash.Set.add oph pv.shell.banned_operations ; match Classification.remove oph pv.shell.classification with | None -> pv.shell.pending <- Pending_ops.remove oph pv.shell.pending ; - pv.shell.fetching <- - Tezos_crypto.Operation_hash.Set.remove oph pv.shell.fetching ; + pv.shell.fetching <- Operation_hash.Set.remove oph pv.shell.fetching ; return_unit | Some (_op, classification) -> ( match (classification, flush_if_prechecked) with @@ -854,9 +848,7 @@ module Make_s let on_ban pv oph_to_ban = pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.add - oph_to_ban - pv.shell.banned_operations ; + Operation_hash.Set.add oph_to_ban pv.shell.banned_operations ; remove ~flush_if_prechecked:true pv oph_to_ban end end @@ -1001,9 +993,7 @@ module Make (Proto_services.S.Mempool.unban_operation Tezos_rpc.Path.open_root) (fun pv () oph -> pv.shell.banned_operations <- - Tezos_crypto.Operation_hash.Set.remove - oph - pv.shell.banned_operations ; + Operation_hash.Set.remove oph pv.shell.banned_operations ; return_unit) ; (* Unban all operations: clear the set pv.banned_operations. *) dir := @@ -1012,7 +1002,7 @@ module Make (Proto_services.S.Mempool.unban_all_operations Tezos_rpc.Path.open_root) (fun pv () () -> - pv.shell.banned_operations <- Tezos_crypto.Operation_hash.Set.empty ; + pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := Tezos_rpc.Directory.gen_register @@ -1034,8 +1024,7 @@ module Make in Classification.Sized_map.to_map pv.shell.classification.prechecked - |> Tezos_crypto.Operation_hash.Map.to_seq - |> Seq.append applied_seq + |> Operation_hash.Map.to_seq |> Seq.append applied_seq |> Seq.filter_map (fun (oph, op) -> if filter_validation_passes @@ -1047,7 +1036,7 @@ module Make else [] in let process_map map = - let open Tezos_crypto.Operation_hash in + let open Operation_hash in Map.filter_map (fun _oph (op, error) -> if @@ -1061,28 +1050,28 @@ module Make let refused = if params#refused then process_map (Classification.map pv.shell.classification.refused) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let outdated = if params#outdated then process_map (Classification.map pv.shell.classification.outdated) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let branch_refused = if params#branch_refused then process_map (Classification.map pv.shell.classification.branch_refused) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let branch_delayed = if params#branch_delayed then process_map (Classification.map pv.shell.classification.branch_delayed) - else Tezos_crypto.Operation_hash.Map.empty + else Operation_hash.Map.empty in let unprocessed = - Tezos_crypto.Operation_hash.Map.filter_map + Operation_hash.Map.filter_map (fun _ {protocol; _} -> if filter_validation_passes params#validation_passes protocol then Some protocol @@ -1133,13 +1122,13 @@ module Make if params#applied then Classification.Sized_map.to_map pv.shell.classification.prechecked - |> Tezos_crypto.Operation_hash.Map.to_seq + |> Operation_hash.Map.to_seq |> Seq.map (fun (hash, {protocol; _}) -> ((hash, protocol), None)) else Seq.empty in let process_error_map map = - let open Tezos_crypto.Operation_hash in + let open Operation_hash in map |> Map.to_seq |> Seq.map (fun (hash, (op, error)) -> ((hash, op.protocol), Some error)) @@ -1271,7 +1260,7 @@ module Make let on_close w = let pv = Worker.state w in Lwt_watcher.shutdown_input pv.operation_stream ; - Tezos_crypto.Operation_hash.Set.iter + Operation_hash.Set.iter pv.shell.parameters.tools.chain_tools.clear_or_cancel pv.shell.fetching ; Lwt.return_unit @@ -1331,8 +1320,8 @@ module Make in let fetching = List.fold_left - (fun s h -> Tezos_crypto.Operation_hash.Set.add h s) - Tezos_crypto.Operation_hash.Set.empty + (fun s h -> Operation_hash.Set.add h s) + Operation_hash.Set.empty mempool.known_valid in let classification_parameters = @@ -1357,7 +1346,7 @@ module Make fetching; pending = Pending_ops.empty; advertisement = `None; - banned_operations = Tezos_crypto.Operation_hash.Set.empty; + banned_operations = Operation_hash.Set.empty; worker = mk_worker_tools w; } in @@ -1400,7 +1389,7 @@ module Make let*! () = Seq.iter_s (may_fetch_operation pv.shell None) - (Tezos_crypto.Operation_hash.Set.to_seq fetching) + (Operation_hash.Set.to_seq fetching) in return pv diff --git a/src/lib_shell/prevalidator_internal_common.ml b/src/lib_shell/prevalidator_internal_common.ml index 44af56d356a9..d1d7e0345309 100644 --- a/src/lib_shell/prevalidator_internal_common.ml +++ b/src/lib_shell/prevalidator_internal_common.ml @@ -27,12 +27,10 @@ let advertisement_delay = 0.1 module Name = struct - type t = Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t + type t = Tezos_crypto.Chain_id.t * Protocol_hash.t let encoding = - Data_encoding.tup2 - Tezos_crypto.Chain_id.encoding - Tezos_crypto.Protocol_hash.encoding + Data_encoding.tup2 Tezos_crypto.Chain_id.encoding Protocol_hash.encoding let base = ["prevalidator"] @@ -42,11 +40,11 @@ module Name = struct "%a:%a" Tezos_crypto.Chain_id.pp_short chain_id - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short proto_hash let equal (c1, p1) (c2, p2) = - Tezos_crypto.Chain_id.equal c1 c2 && Tezos_crypto.Protocol_hash.equal p1 p2 + Tezos_crypto.Chain_id.equal c1 c2 && Protocol_hash.equal p1 p2 end open Prevalidator_worker_state diff --git a/src/lib_shell/prevalidator_internal_common.mli b/src/lib_shell/prevalidator_internal_common.mli index e58326b0a475..5f1a82416a94 100644 --- a/src/lib_shell/prevalidator_internal_common.mli +++ b/src/lib_shell/prevalidator_internal_common.mli @@ -35,7 +35,7 @@ val advertisement_delay : float the prevalidator worker. *) module Name : Tezos_base.Worker_intf.NAME - with type t = Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t + with type t = Tezos_crypto.Chain_id.t * Protocol_hash.t open Prevalidator_worker_state diff --git a/src/lib_shell/prevalidator_pending_operations.ml b/src/lib_shell/prevalidator_pending_operations.ml index 9f6762fec385..63fc079f482d 100644 --- a/src/lib_shell/prevalidator_pending_operations.ml +++ b/src/lib_shell/prevalidator_pending_operations.ml @@ -61,9 +61,8 @@ module Priority_map : Map.S with type key = priority = Map.Make (struct | `Medium, `Low _ -> -1 end) -module Map = Tezos_crypto.Operation_hash.Map -module Sized_set = - Tezos_base.Sized.MakeSizedSet (Tezos_crypto.Operation_hash.Set) +module Map = Operation_hash.Map +module Sized_set = Tezos_base.Sized.MakeSizedSet (Operation_hash.Set) (* The type below is used for representing pending operations data of the diff --git a/src/lib_shell/prevalidator_pending_operations.mli b/src/lib_shell/prevalidator_pending_operations.mli index 0e2d9f7b3589..6edc03352a50 100644 --- a/src/lib_shell/prevalidator_pending_operations.mli +++ b/src/lib_shell/prevalidator_pending_operations.mli @@ -48,17 +48,17 @@ type priority = [`High | `Medium | `Low of Q.t list] type 'protocol_data t module Sized_set : - Tezos_base.Sized.SizedSet with type set := Tezos_crypto.Operation_hash.Set.t + Tezos_base.Sized.SizedSet with type set := Operation_hash.Set.t (** The empty structure of pending operations. *) val empty : 'protocol_data t (** [hashes p] returns the set of hashes contained in [p] *) -val hashes : 'protocol_data t -> Tezos_crypto.Operation_hash.Set.t +val hashes : 'protocol_data t -> Operation_hash.Set.t (** [operations p] returns the Map of bindings [oph -> op] contained in [p] *) val operations : - 'protocol_data t -> 'protocol_data operation Tezos_crypto.Operation_hash.Map.t + 'protocol_data t -> 'protocol_data operation Operation_hash.Map.t (** [is_empty p] returns [true] if [p] has operations, [false] otherwise. *) val is_empty : 'protocol_data t -> bool @@ -68,7 +68,7 @@ val is_empty : 'protocol_data t -> bool Complexity is O(log(n)), where n is the number of operations (hashes) in the structure. *) -val mem : Tezos_crypto.Operation_hash.t -> 'protocol_data t -> bool +val mem : Operation_hash.t -> 'protocol_data t -> bool (** [add oph op p prio] records the operation [op] whose hash is [oph] and whose priority is [prio] in [p]. @@ -88,8 +88,7 @@ val add : Complexity is O(log(n)), where n is the number of operations (hashes) in the structure. *) -val remove : - Tezos_crypto.Operation_hash.t -> 'protocol_data t -> 'protocol_data t +val remove : Operation_hash.t -> 'protocol_data t -> 'protocol_data t (** [cardinal p] returns the number of operations (hashes) in [p]. @@ -104,25 +103,18 @@ val cardinal : 'protocol_data t -> int We iterate on operations with `High priority first, then on those with `Low priority. For operations with the same priority, the iteration order is - defined [Tezos_crypto.Operation_hash.compare] function (operations with small hashes are + defined [Operation_hash.compare] function (operations with small hashes are processed first). *) val fold : - (priority -> - Tezos_crypto.Operation_hash.t -> - 'protocol_data operation -> - 'a -> - 'a) -> + (priority -> Operation_hash.t -> 'protocol_data operation -> 'a -> 'a) -> 'protocol_data t -> 'a -> 'a (** [iter f p] is similar to [fold] where [acc] is unit *) val iter : - (priority -> - Tezos_crypto.Operation_hash.t -> - 'protocol_data operation -> - unit) -> + (priority -> Operation_hash.t -> 'protocol_data operation -> unit) -> 'protocol_data t -> unit @@ -131,7 +123,7 @@ val iter : value [Error e] is returned by [f] *) val fold_es : (priority -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> 'protocol_data operation -> 'a -> ('a, 'b) result Lwt.t) -> diff --git a/src/lib_shell/protocol_directory.ml b/src/lib_shell/protocol_directory.ml index d1701b112c75..c9b241850362 100644 --- a/src/lib_shell/protocol_directory.ml +++ b/src/lib_shell/protocol_directory.ml @@ -36,12 +36,9 @@ let build_rpc_directory block_validator store = gen_register0 Protocol_services.S.list (fun () () -> let set = Store.Protocol.all store in let protocols = - Tezos_crypto.Protocol_hash.Set.add_seq - (Registered_protocol.seq_embedded ()) - set + Protocol_hash.Set.add_seq (Registered_protocol.seq_embedded ()) set in - Tezos_rpc.Answer.return - (Tezos_crypto.Protocol_hash.Set.elements protocols)) ; + Tezos_rpc.Answer.return (Protocol_hash.Set.elements protocols)) ; register1 Protocol_services.S.contents (fun hash () () -> match Registered_protocol.get_embedded_sources hash with | Some p -> return p diff --git a/src/lib_shell/protocol_validator.ml b/src/lib_shell/protocol_validator.ml index a2c08b701d8d..2297222eeb24 100644 --- a/src/lib_shell/protocol_validator.ml +++ b/src/lib_shell/protocol_validator.ml @@ -35,7 +35,7 @@ type t = { (Protocol.t * Registered_protocol.t tzresult Lwt.t * Registered_protocol.t tzresult Lwt.u) - Tezos_crypto.Protocol_hash.Map.t; + Protocol_hash.Map.t; canceler : Lwt_canceler.t; } @@ -44,12 +44,12 @@ type t = { let rec worker_loop bv = let open Lwt_result_syntax in let*! r = - match Tezos_crypto.Protocol_hash.Map.choose bv.pending with + match Protocol_hash.Map.choose bv.pending with | None -> let*! v = Lwt_condition.wait bv.request in return v | Some (hash, (protocol, _, wakener)) -> - bv.pending <- Tezos_crypto.Protocol_hash.Map.remove hash bv.pending ; + bv.pending <- Protocol_hash.Map.remove hash bv.pending ; let*! valid = Updater.compile hash protocol in if valid then ( let* _ = Distributed_db.commit_protocol bv.db hash protocol in @@ -80,13 +80,11 @@ let rec worker_loop bv = let create db = let canceler = Lwt_canceler.create () in - let pending = Tezos_crypto.Protocol_hash.Map.empty in + let pending = Protocol_hash.Map.empty in let request = Lwt_condition.create () in let bv = {canceler; pending; request; db; worker = Lwt.return_unit} in Lwt_canceler.on_cancel bv.canceler (fun () -> - Tezos_crypto.Protocol_hash.Map.iter - (fun _ (_, r, _) -> Lwt.cancel r) - bv.pending ; + Protocol_hash.Map.iter (fun _ (_, r, _) -> Lwt.cancel r) bv.pending ; Lwt.return_unit) ; bv.worker <- Lwt_utils.worker @@ -113,17 +111,12 @@ let validate state hash protocol = let* () = Protocol_validator_event.(emit pushing_protocol_validation) hash in - match Tezos_crypto.Protocol_hash.Map.find hash state.pending with + match Protocol_hash.Map.find hash state.pending with | None -> let res, wakener = Lwt.task () in - let broadcast = - Tezos_crypto.Protocol_hash.Map.cardinal state.pending = 0 - in + let broadcast = Protocol_hash.Map.cardinal state.pending = 0 in state.pending <- - Tezos_crypto.Protocol_hash.Map.add - hash - (protocol, res, wakener) - state.pending ; + Protocol_hash.Map.add hash (protocol, res, wakener) state.pending ; if broadcast then Lwt_condition.broadcast state.request () ; res | Some (_, res, _) -> res) diff --git a/src/lib_shell/protocol_validator.mli b/src/lib_shell/protocol_validator.mli index 33281e37d040..ca1e65baabc6 100644 --- a/src/lib_shell/protocol_validator.mli +++ b/src/lib_shell/protocol_validator.mli @@ -29,10 +29,7 @@ type t val create : Distributed_db.t -> t val validate : - t -> - Tezos_crypto.Protocol_hash.t -> - Protocol.t -> - Registered_protocol.t tzresult Lwt.t + t -> Protocol_hash.t -> Protocol.t -> Registered_protocol.t tzresult Lwt.t val shutdown : t -> unit Lwt.t @@ -40,7 +37,7 @@ val fetch_and_compile_protocol : t -> ?peer:P2p_peer.Id.t -> ?timeout:Ptime.Span.t -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Registered_protocol.t tzresult Lwt.t val fetch_and_compile_protocols : diff --git a/src/lib_shell/protocol_validator_event.ml b/src/lib_shell/protocol_validator_event.ml index e080d62858e8..5858320264a3 100644 --- a/src/lib_shell/protocol_validator_event.ml +++ b/src/lib_shell/protocol_validator_event.ml @@ -52,7 +52,7 @@ let previously_validated_protocol = ~name:"previously_validated_protocol" ~msg:"protocol {hash} already validated, ignoring" ~level:Debug - ("hash", Tezos_crypto.Protocol_hash.encoding) + ("hash", Protocol_hash.encoding) let pushing_protocol_validation = declare_1 @@ -60,7 +60,7 @@ let pushing_protocol_validation = ~name:"pushing_protocol_validation" ~msg:"pushing validation request for protocol {hash}" ~level:Debug - ("hash", Tezos_crypto.Protocol_hash.encoding) + ("hash", Protocol_hash.encoding) let fetching_protocol = declare_2 @@ -68,5 +68,5 @@ let fetching_protocol = ~name:"fetching_protocol" ~msg:"fetching protocol {hash}" ~level:Notice - ("hash", Tezos_crypto.Protocol_hash.encoding) + ("hash", Protocol_hash.encoding) ("source", Data_encoding.option P2p_peer.Id.encoding) diff --git a/src/lib_shell/shell_operation.ml b/src/lib_shell/shell_operation.ml index 39f03f970572..03bab55f3477 100644 --- a/src/lib_shell/shell_operation.ml +++ b/src/lib_shell/shell_operation.ml @@ -26,7 +26,7 @@ (*****************************************************************************) type 'protocol_operation operation = { - hash : Tezos_crypto.Operation_hash.t; + hash : Operation_hash.t; raw : Operation.t; protocol : 'protocol_operation; count_successful_prechecks : int; @@ -54,9 +54,7 @@ module type PARSER = sig type protocol_operation val parse : - Tezos_crypto.Operation_hash.t -> - Operation.t -> - protocol_operation operation tzresult + Operation_hash.t -> Operation.t -> protocol_operation operation tzresult end module MakeParser (Proto : Tezos_protocol_environment.PROTOCOL) : diff --git a/src/lib_shell/shell_operation.mli b/src/lib_shell/shell_operation.mli index d24888df6283..9fbea1aded36 100644 --- a/src/lib_shell/shell_operation.mli +++ b/src/lib_shell/shell_operation.mli @@ -31,7 +31,7 @@ (** Representation of a parsed operation, used only in the shell. *) type 'protocol_operation operation = private { - hash : Tezos_crypto.Operation_hash.t; (** Hash of an operation. *) + hash : Operation_hash.t; (** Hash of an operation. *) raw : Operation.t; (** Raw representation of an operation (from the point view of the shell). *) @@ -71,9 +71,7 @@ module type PARSER = sig data within [op] is too large (to protect against DoS attacks), and - {!Validation_errors.Parse_error} if serialized data cannot be parsed. *) val parse : - Tezos_crypto.Operation_hash.t -> - Operation.t -> - protocol_operation operation tzresult + Operation_hash.t -> Operation.t -> protocol_operation operation tzresult end (** Create a {!PARSER} tailored to a given protocol. *) @@ -87,12 +85,11 @@ module Internal_for_tests : sig val to_raw : _ operation -> Operation.t (** The hash of an {!operation} *) - val hash_of : _ operation -> Tezos_crypto.Operation_hash.t + val hash_of : _ operation -> Operation_hash.t (** A constructor for the [operation] datatype. It by-passes the checks done by the [parse] function. *) - val make_operation : - Operation.t -> Tezos_crypto.Operation_hash.t -> 'a -> 'a operation + val make_operation : Operation.t -> Operation_hash.t -> 'a -> 'a operation (** [safe_binary_of_bytes encoding bytes] parses [bytes] using [encoding]. Any error happening during parsing becomes {!Parse_error}. diff --git a/src/lib_shell/shell_plugin.ml b/src/lib_shell/shell_plugin.ml index a6ccbc7f0bb4..3d6cda2ec5bf 100644 --- a/src/lib_shell/shell_plugin.ml +++ b/src/lib_shell/shell_plugin.ml @@ -44,7 +44,7 @@ module type FILTER = sig val flush : state -> head:Tezos_base.Block_header.shell_header -> state tzresult Lwt.t - val remove : filter_state:state -> Tezos_crypto.Operation_hash.t -> state + val remove : filter_state:state -> Operation_hash.t -> state val pre_filter : config -> @@ -55,15 +55,15 @@ module type FILTER = sig Lwt.t val add_operation_and_enforce_mempool_bound : - ?replace:Tezos_crypto.Operation_hash.t -> + ?replace:Operation_hash.t -> config -> state -> - Tezos_crypto.Operation_hash.t * Proto.operation -> + Operation_hash.t * Proto.operation -> ( state * [ `No_replace | `Replace of - Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification ], + Operation_hash.t * Prevalidator_classification.error_classification + ], Prevalidator_classification.error_classification ) result Lwt.t @@ -112,7 +112,7 @@ module No_filter (Proto : Registered_protocol.T) : end module type METRICS = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t val update_metrics : protocol_metadata:bytes -> @@ -122,7 +122,7 @@ module type METRICS = sig end module Undefined_metrics_plugin (Proto : sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t end) = struct let hash = Proto.hash @@ -130,25 +130,22 @@ struct let update_metrics ~protocol_metadata:_ _ _ = Lwt.return_unit end -let rpc_table : (module RPC) Tezos_crypto.Protocol_hash.Table.t = - Tezos_crypto.Protocol_hash.Table.create 5 +let rpc_table : (module RPC) Protocol_hash.Table.t = + Protocol_hash.Table.create 5 -let metrics_table : (module METRICS) Tezos_crypto.Protocol_hash.Table.t = - Tezos_crypto.Protocol_hash.Table.create 5 +let metrics_table : (module METRICS) Protocol_hash.Table.t = + Protocol_hash.Table.create 5 let register_rpc (module Rpc : RPC) = - assert (not (Tezos_crypto.Protocol_hash.Table.mem rpc_table Rpc.Proto.hash)) ; - Tezos_crypto.Protocol_hash.Table.add rpc_table Rpc.Proto.hash (module Rpc) + assert (not (Protocol_hash.Table.mem rpc_table Rpc.Proto.hash)) ; + Protocol_hash.Table.add rpc_table Rpc.Proto.hash (module Rpc) let register_metrics (module Metrics : METRICS) = - Tezos_crypto.Protocol_hash.Table.replace - metrics_table - Metrics.hash - (module Metrics) + Protocol_hash.Table.replace metrics_table Metrics.hash (module Metrics) -let find_rpc = Tezos_crypto.Protocol_hash.Table.find rpc_table +let find_rpc = Protocol_hash.Table.find rpc_table -let find_metrics = Tezos_crypto.Protocol_hash.Table.find metrics_table +let find_metrics = Protocol_hash.Table.find metrics_table let safe_find_metrics hash = match find_metrics hash with @@ -170,12 +167,11 @@ let no_filter (module Proto : Registered_protocol.T) = if is_recent_proto (module Proto) then Recent (module No_filter (Proto)) else Legacy (module Legacy_mempool_plugin.No_filter (Proto)) -let filter_table : filter_t Tezos_crypto.Protocol_hash.Table.t = - Tezos_crypto.Protocol_hash.Table.create 5 +let filter_table : filter_t Protocol_hash.Table.t = Protocol_hash.Table.create 5 let add_to_filter_table proto_hash (filter : filter_t) = - assert (not (Tezos_crypto.Protocol_hash.Table.mem filter_table proto_hash)) ; - Tezos_crypto.Protocol_hash.Table.add filter_table proto_hash filter + assert (not (Protocol_hash.Table.mem filter_table proto_hash)) ; + Protocol_hash.Table.add filter_table proto_hash filter let register_filter (module Filter : FILTER) = add_to_filter_table Filter.Proto.hash (Recent (module Filter)) @@ -183,4 +179,4 @@ let register_filter (module Filter : FILTER) = let register_legacy_filter (module Filter : Legacy_mempool_plugin.FILTER) = add_to_filter_table Filter.Proto.hash (Legacy (module Filter)) -let find_filter = Tezos_crypto.Protocol_hash.Table.find filter_table +let find_filter = Protocol_hash.Table.find filter_table diff --git a/src/lib_shell/shell_plugin.mli b/src/lib_shell/shell_plugin.mli index d0b38cba6667..5543fd201de1 100644 --- a/src/lib_shell/shell_plugin.mli +++ b/src/lib_shell/shell_plugin.mli @@ -59,7 +59,7 @@ module type FILTER = sig (** [remove ~filter_state oph] removes the operation manager linked to [oph] from the state of the filter *) - val remove : filter_state:state -> Tezos_crypto.Operation_hash.t -> state + val remove : filter_state:state -> Operation_hash.t -> state (** [pre_filter config ~filter_state operation_data] is called on arrival of an operation and after a flush of @@ -100,15 +100,15 @@ module type FILTER = sig can no longer be full, so this function will succeed and return [`No_replace]). *) val add_operation_and_enforce_mempool_bound : - ?replace:Tezos_crypto.Operation_hash.t -> + ?replace:Operation_hash.t -> config -> state -> - Tezos_crypto.Operation_hash.t * Proto.operation -> + Operation_hash.t * Proto.operation -> ( state * [ `No_replace | `Replace of - Tezos_crypto.Operation_hash.t - * Prevalidator_classification.error_classification ], + Operation_hash.t * Prevalidator_classification.error_classification + ], Prevalidator_classification.error_classification ) result Lwt.t @@ -138,7 +138,7 @@ module No_filter (Proto : Registered_protocol.T) : * allows to decode protocol data payload and provide back basic * types that can be used as metrics. *) module type METRICS = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t val update_metrics : protocol_metadata:bytes -> @@ -149,7 +149,7 @@ end (** Emtpy metrics module. All metrics are -1. *) module Undefined_metrics_plugin (P : sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t end) : METRICS (** Juggling between recent filter version {!FILTER}, designed for @@ -179,13 +179,13 @@ val register_rpc : (module RPC) -> unit val register_metrics : (module METRICS) -> unit (** Looks for a mempool filter plug-in for a specific protocol. *) -val find_filter : Tezos_crypto.Protocol_hash.t -> filter_t option +val find_filter : Protocol_hash.t -> filter_t option (** Looks for an rpc plug-in for a specific protocol. *) -val find_rpc : Tezos_crypto.Protocol_hash.t -> (module RPC) option +val find_rpc : Protocol_hash.t -> (module RPC) option (** Looks for a metrics plugin module for a specific protocol *) -val find_metrics : Tezos_crypto.Protocol_hash.t -> (module METRICS) option +val find_metrics : Protocol_hash.t -> (module METRICS) option (** Same as [find_metrics] but returns [Undefined_metrics_plugin] if not found *) -val safe_find_metrics : Tezos_crypto.Protocol_hash.t -> (module METRICS) Lwt.t +val safe_find_metrics : Protocol_hash.t -> (module METRICS) Lwt.t diff --git a/src/lib_shell/test/generators.ml b/src/lib_shell/test/generators.ml index 5363f282bf13..4d8fe2f36c71 100644 --- a/src/lib_shell/test/generators.ml +++ b/src/lib_shell/test/generators.ml @@ -50,12 +50,12 @@ let operation_mock_proto_gen = let* len_gen = frequencya [|(9, return 0); (1, 0 -- 31)|] in string_size ?gen:None len_gen -let block_hash_gen : Tezos_crypto.Block_hash.t QCheck2.Gen.t = +let block_hash_gen : Block_hash.t QCheck2.Gen.t = let open QCheck2.Gen in let string_gen = QCheck2.Gen.small_string ?gen:None in let+ key = opt (string_size (0 -- 64)) and+ path = list_size (0 -- 10) string_gen in - Tezos_crypto.Block_hash.hash_string ?key path + Block_hash.hash_string ?key path (** A generator of operations. - [proto_gen] is the generator for protocol bytes. By default, it is @@ -78,7 +78,7 @@ let operation_gen ?(proto_gen = operation_proto_gen) ?block_hash_t () : (** Like {!operation_gen} with a hash. *) let raw_operation_with_hash_gen ?proto_gen ?block_hash_t () : - (Tezos_crypto.Operation_hash.t * Operation.t) QCheck2.Gen.t = + (Operation_hash.t * Operation.t) QCheck2.Gen.t = let open QCheck2.Gen in let+ op = operation_gen ?proto_gen ?block_hash_t () in let hash = Operation.hash op in @@ -132,12 +132,12 @@ let operation_with_hash_and_priority_gen ?proto_gen ?block_hash_t () : return (op, priority) let raw_op_map_gen ?proto_gen ?block_hash_t () : - Operation.t Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + Operation.t Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let+ ops = small_list (raw_operation_with_hash_gen ?proto_gen ?block_hash_t ()) in - List.to_seq ops |> Tezos_crypto.Operation_hash.Map.of_seq + List.to_seq ops |> Operation_hash.Map.of_seq (** A generator of maps of operations and their hashes. Parameters are: - [?proto_gen] is an optional generator for the protocol bytes. @@ -147,12 +147,12 @@ let raw_op_map_gen ?proto_gen ?block_hash_t () : this generator guarantees that all returned operations are distinct (because their hashes differ). *) let op_map_gen ?proto_gen ?block_hash_t () : - unit operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + unit operation Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let+ ops = small_list (operation_with_hash_gen ?proto_gen ?block_hash_t ()) in List.to_seq ops |> Seq.map (fun op -> (op.hash, op)) - |> Tezos_crypto.Operation_hash.Map.of_seq + |> Operation_hash.Map.of_seq (** A generator like {!raw_op_map_gen} but which guarantees the size of the returned maps: they are exactly of size [n]. We need @@ -160,23 +160,23 @@ let op_map_gen ?proto_gen ?block_hash_t () : of fixed lengths) because we *need* to return maps, because we need the properties that all operations hashes are different. *) let raw_op_map_gen_n ?proto_gen ?block_hash_t (n : int) : - Operation.t Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + Operation.t Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let map_take_n n m = - Tezos_crypto.Operation_hash.Map.bindings m - |> List.take_n n |> List.to_seq |> Tezos_crypto.Operation_hash.Map.of_seq + Operation_hash.Map.bindings m + |> List.take_n n |> List.to_seq |> Operation_hash.Map.of_seq in let merge _oph old _new = Some old in - let rec go (ops : Operation.t Tezos_crypto.Operation_hash.Map.t) = - if Tezos_crypto.Operation_hash.Map.cardinal ops >= n then + let rec go (ops : Operation.t Operation_hash.Map.t) = + if Operation_hash.Map.cardinal ops >= n then (* Done *) return (map_take_n n ops) else (* Not enough operations yet, generate more *) let* new_ops = raw_op_map_gen ?proto_gen ?block_hash_t () in - go (Tezos_crypto.Operation_hash.Map.union merge ops new_ops) + go (Operation_hash.Map.union merge ops new_ops) in - go Tezos_crypto.Operation_hash.Map.empty + go Operation_hash.Map.empty (** A generator like {!op_map_gen} but which guarantees the size of the returned maps: they are exactly of size [n]. We need @@ -184,23 +184,23 @@ let raw_op_map_gen_n ?proto_gen ?block_hash_t (n : int) : of fixed lengths) because we *need* to return maps, because we need the properties that all operations hashes are different. *) let op_map_gen_n ?proto_gen ?block_hash_t (n : int) : - unit operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + unit operation Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let map_take_n n m = - Tezos_crypto.Operation_hash.Map.bindings m - |> List.take_n n |> List.to_seq |> Tezos_crypto.Operation_hash.Map.of_seq + Operation_hash.Map.bindings m + |> List.take_n n |> List.to_seq |> Operation_hash.Map.of_seq in let merge _oph old _new = Some old in - let rec go (ops : unit operation Tezos_crypto.Operation_hash.Map.t) = - if Tezos_crypto.Operation_hash.Map.cardinal ops >= n then + let rec go (ops : unit operation Operation_hash.Map.t) = + if Operation_hash.Map.cardinal ops >= n then (* Done *) return (map_take_n n ops) else (* Not enough operations yet, generate more *) let* new_ops = op_map_gen ?proto_gen ?block_hash_t () in - go (Tezos_crypto.Operation_hash.Map.union merge ops new_ops) + go (Operation_hash.Map.union merge ops new_ops) in - go Tezos_crypto.Operation_hash.Map.empty + go Operation_hash.Map.empty (** Do we need richer errors? If so, how to generate those? *) let classification_gen : classification QCheck2.Gen.t = @@ -248,13 +248,10 @@ let with_t_operation_gen : unit t -> unit operation QCheck2.Gen.t = let open QCheck2 in fun t -> let to_ops map = - Tezos_crypto.Operation_hash.Map.bindings map - |> List.map (fun (_oph, (op, _)) -> op) + Operation_hash.Map.bindings map |> List.map (fun (_oph, (op, _)) -> op) in (* If map is empty, it cannot be used as a generator *) - let freq_of_map map = - if Tezos_crypto.Operation_hash.Map.is_empty map then 0 else 1 - in + let freq_of_map map = if Operation_hash.Map.is_empty map then 0 else 1 in (* If list is empty, it cannot be used as a generator *) let freq_of_list = function [] -> 0 | _ -> 1 in (* If map is not empty, take one of its elements *) diff --git a/src/lib_shell/test/generators_tree.ml b/src/lib_shell/test/generators_tree.ml index 2cb2f9e91e33..e5aa008f59f6 100644 --- a/src/lib_shell/test/generators_tree.ml +++ b/src/lib_shell/test/generators_tree.ml @@ -208,20 +208,15 @@ end module Block = struct (** The block-like interface that suffices to test [Prevalidator.Internal_for_tests.handle_live_operations] *) - type t = { - bhash : Tezos_crypto.Block_hash.t; - operations : unit operation list list; - } + type t = {bhash : Block_hash.t; operations : unit operation list list} (* Because we use hashes to implement equality, we must make sure that for any pair of generated blocks [(b1, b2)], [b1.hash <> b2.hash] implies [b1 <> b2] where [<>] is polymorphic inequality. Said differently, hashes should not be faked. *) - let equal : t -> t -> bool = - fun t1 t2 -> Tezos_crypto.Block_hash.equal t1.bhash t2.bhash + let equal : t -> t -> bool = fun t1 t2 -> Block_hash.equal t1.bhash t2.bhash - let compare (t1 : t) (t2 : t) = - Tezos_crypto.Block_hash.compare t1.bhash t2.bhash + let compare (t1 : t) (t2 : t) = Block_hash.compare t1.bhash t2.bhash (** [hash_of_blocks ops] is used to compute the hash of a block whose [operations] field contains [ops]. @@ -233,15 +228,15 @@ module Block = struct is why we hash the hashes of operations. *) let hash_of_block ops = let hash = - Tezos_crypto.Operation_list_hash.compute + Operation_list_hash.compute (List.map (fun op -> op.hash) @@ List.concat ops) in (* We forge a fake [block_header] hash by first hashing the operations and change the [b58] signature into a signature that looks like the one of a block header by prefixing it with the letter [B]. *) - let hash_string = Tezos_crypto.Operation_list_hash.to_b58check hash in + let hash_string = Operation_list_hash.to_b58check hash in let suffix = String.sub hash_string 2 31 in - match Tezos_crypto.Block_hash.of_string @@ "B" ^ suffix with + match Block_hash.of_string @@ "B" ^ suffix with | Error err -> Format.printf "Unexpected error: %a" Error_monad.pp_print_trace err ; assert false @@ -264,7 +259,7 @@ module Block = struct String.concat "|" (List.map - Tezos_crypto.Operation_hash.to_short_b58check + Operation_hash.to_short_b58check (List.map (fun op -> op.hash) ops)) in let ops_string = @@ -273,7 +268,7 @@ module Block = struct "" t.operations in - Format.asprintf "%a:[%s]" Tezos_crypto.Block_hash.pp t.bhash ops_string + Format.asprintf "%a:[%s]" Block_hash.pp t.bhash ops_string (* [pp_list] is unused but useful when debugging, renaming it to [_pp_list] to keep it around *) @@ -401,7 +396,7 @@ let tree_gen ?blocks () = (** A generator for passing the last argument of [Prevalidator.handle_live_operations] *) let old_mempool_gen (tree : Block.t Tree.tree) : - unit operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + unit operation Operation_hash.Map.t QCheck2.Gen.t = let blocks = Tree.values tree in let pairs = List.concat_map Block.tools.operations blocks |> List.concat in let elements = @@ -411,14 +406,14 @@ let old_mempool_gen (tree : Block.t Tree.tree) : Internal_for_tests.make_operation op hash ()) pairs in - if elements = [] then QCheck2.Gen.return Tezos_crypto.Operation_hash.Map.empty + if elements = [] then QCheck2.Gen.return Operation_hash.Map.empty else let list_gen = QCheck2.Gen.(oneofl elements |> list) in QCheck2.Gen.map (fun l -> List.to_seq l |> Seq.map (fun op -> (op.hash, op)) - |> Tezos_crypto.Operation_hash.Map.of_seq) + |> Operation_hash.Map.of_seq) list_gen (** Function to implement @@ -500,7 +495,7 @@ let classification_chain_tools (tree : Block.t Tree.tree) : let tree_gen ?blocks () : (Block.t Tree.tree * (Block.t * Block.t) option - * unit operation Tezos_crypto.Operation_hash.Map.t) + * unit operation Operation_hash.Map.t) QCheck2.Gen.t = let open QCheck2.Gen in let* tree = tree_gen ?blocks () in diff --git a/src/lib_shell/test/legacy_generators.ml b/src/lib_shell/test/legacy_generators.ml index 92c655daa2b7..2605aed41ff3 100644 --- a/src/lib_shell/test/legacy_generators.ml +++ b/src/lib_shell/test/legacy_generators.ml @@ -53,12 +53,12 @@ let operation_mock_proto_gen = let* len_gen = frequencya [|(9, return 0); (1, 0 -- 31)|] in string_size ?gen:None len_gen -let block_hash_gen : Tezos_crypto.Block_hash.t QCheck2.Gen.t = +let block_hash_gen : Block_hash.t QCheck2.Gen.t = let open QCheck2.Gen in let string_gen = QCheck2.Gen.small_string ?gen:None in let+ key = opt (string_size (0 -- 64)) and+ path = list_size (0 -- 10) string_gen in - Tezos_crypto.Block_hash.hash_string ?key path + Block_hash.hash_string ?key path (** A generator of operations. - [proto_gen] is the generator for protocol bytes. By default, it is @@ -82,7 +82,7 @@ let operation_gen ?(proto_gen = operation_proto_gen) ?block_hash_t () : (** Like {!operation_gen} with a hash. *) let raw_operation_with_hash_gen ?proto_gen ?block_hash_t () : - (Tezos_crypto.Operation_hash.t * Operation.t) QCheck2.Gen.t = + (Operation_hash.t * Operation.t) QCheck2.Gen.t = let open QCheck2.Gen in let+ op = operation_gen ?proto_gen ?block_hash_t () in let hash = Operation.hash op in @@ -136,12 +136,12 @@ let operation_with_hash_and_priority_gen ?proto_gen ?block_hash_t () : return (op, priority) let raw_op_map_gen ?proto_gen ?block_hash_t () : - Operation.t Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + Operation.t Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let+ ops = small_list (raw_operation_with_hash_gen ?proto_gen ?block_hash_t ()) in - List.to_seq ops |> Tezos_crypto.Operation_hash.Map.of_seq + List.to_seq ops |> Operation_hash.Map.of_seq (** A generator of maps of operations and their hashes. Parameters are: - [?proto_gen] is an optional generator for the protocol bytes. @@ -151,13 +151,12 @@ let raw_op_map_gen ?proto_gen ?block_hash_t () : this generator guarantees that all returned operations are distinct (because their hashes differ). *) let op_map_gen ?proto_gen ?block_hash_t () : - unit Prevalidation.operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t - = + unit Prevalidation.operation Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let+ ops = small_list (operation_with_hash_gen ?proto_gen ?block_hash_t ()) in List.to_seq ops |> Seq.map (fun op -> (op.Prevalidation.hash, op)) - |> Tezos_crypto.Operation_hash.Map.of_seq + |> Operation_hash.Map.of_seq (** A generator like {!raw_op_map_gen} but which guarantees the size of the returned maps: they are exactly of size [n]. We need @@ -165,23 +164,23 @@ let op_map_gen ?proto_gen ?block_hash_t () : of fixed lengths) because we *need* to return maps, because we need the properties that all operations hashes are different. *) let raw_op_map_gen_n ?proto_gen ?block_hash_t (n : int) : - Operation.t Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t = + Operation.t Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let map_take_n n m = - Tezos_crypto.Operation_hash.Map.bindings m - |> List.take_n n |> List.to_seq |> Tezos_crypto.Operation_hash.Map.of_seq + Operation_hash.Map.bindings m + |> List.take_n n |> List.to_seq |> Operation_hash.Map.of_seq in let merge _oph old _new = Some old in - let rec go (ops : Operation.t Tezos_crypto.Operation_hash.Map.t) = - if Tezos_crypto.Operation_hash.Map.cardinal ops >= n then + let rec go (ops : Operation.t Operation_hash.Map.t) = + if Operation_hash.Map.cardinal ops >= n then (* Done *) return (map_take_n n ops) else (* Not enough operations yet, generate more *) let* new_ops = raw_op_map_gen ?proto_gen ?block_hash_t () in - go (Tezos_crypto.Operation_hash.Map.union merge ops new_ops) + go (Operation_hash.Map.union merge ops new_ops) in - go Tezos_crypto.Operation_hash.Map.empty + go Operation_hash.Map.empty (** A generator like {!op_map_gen} but which guarantees the size of the returned maps: they are exactly of size [n]. We need @@ -189,25 +188,23 @@ let raw_op_map_gen_n ?proto_gen ?block_hash_t (n : int) : of fixed lengths) because we *need* to return maps, because we need the properties that all operations hashes are different. *) let op_map_gen_n ?proto_gen ?block_hash_t (n : int) : - unit Prevalidation.operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t - = + unit Prevalidation.operation Operation_hash.Map.t QCheck2.Gen.t = let open QCheck2.Gen in let map_take_n n m = - Tezos_crypto.Operation_hash.Map.bindings m - |> List.take_n n |> List.to_seq |> Tezos_crypto.Operation_hash.Map.of_seq + Operation_hash.Map.bindings m + |> List.take_n n |> List.to_seq |> Operation_hash.Map.of_seq in let merge _oph old _new = Some old in - let rec go - (ops : unit Prevalidation.operation Tezos_crypto.Operation_hash.Map.t) = - if Tezos_crypto.Operation_hash.Map.cardinal ops >= n then + let rec go (ops : unit Prevalidation.operation Operation_hash.Map.t) = + if Operation_hash.Map.cardinal ops >= n then (* Done *) return (map_take_n n ops) else (* Not enough operations yet, generate more *) let* new_ops = op_map_gen ?proto_gen ?block_hash_t () in - go (Tezos_crypto.Operation_hash.Map.union merge ops new_ops) + go (Operation_hash.Map.union merge ops new_ops) in - go Tezos_crypto.Operation_hash.Map.empty + go Operation_hash.Map.empty (** Do we need richer errors? If so, how to generate those? *) let classification_gen : classification QCheck2.Gen.t = @@ -255,13 +252,10 @@ let with_t_operation_gen : unit t -> unit Prevalidation.operation QCheck2.Gen.t let open QCheck2 in fun t -> let to_ops map = - Tezos_crypto.Operation_hash.Map.bindings map - |> List.map (fun (_oph, (op, _)) -> op) + Operation_hash.Map.bindings map |> List.map (fun (_oph, (op, _)) -> op) in (* If map is empty, it cannot be used as a generator *) - let freq_of_map map = - if Tezos_crypto.Operation_hash.Map.is_empty map then 0 else 1 - in + let freq_of_map map = if Operation_hash.Map.is_empty map then 0 else 1 in (* If list is empty, it cannot be used as a generator *) let freq_of_list = function [] -> 0 | _ -> 1 in (* If map is not empty, take one of its elements *) diff --git a/src/lib_shell/test/legacy_generators_tree.ml b/src/lib_shell/test/legacy_generators_tree.ml index 3073ad0abb67..b2e9993d21be 100644 --- a/src/lib_shell/test/legacy_generators_tree.ml +++ b/src/lib_shell/test/legacy_generators_tree.ml @@ -210,7 +210,7 @@ module Block = struct (** The block-like interface that suffices to test [Prevalidator.Internal_for_tests.handle_live_operations] *) type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; operations : unit Prevalidation.operation list list; } @@ -218,11 +218,9 @@ module Block = struct that for any pair of generated blocks [(b1, b2)], [b1.hash <> b2.hash] implies [b1 <> b2] where [<>] is polymorphic inequality. Said differently, hashes should not be faked. *) - let equal : t -> t -> bool = - fun t1 t2 -> Tezos_crypto.Block_hash.equal t1.hash t2.hash + let equal : t -> t -> bool = fun t1 t2 -> Block_hash.equal t1.hash t2.hash - let compare (t1 : t) (t2 : t) = - Tezos_crypto.Block_hash.compare t1.hash t2.hash + let compare (t1 : t) (t2 : t) = Block_hash.compare t1.hash t2.hash (** [hash_of_blocks ops] is used to compute the hash of a block whose [operations] field contains [ops]. @@ -234,15 +232,15 @@ module Block = struct is why we hash the hashes of operations. *) let hash_of_block ops = let hash = - Tezos_crypto.Operation_list_hash.compute + Operation_list_hash.compute (List.map (fun op -> op.Prevalidation.hash) @@ List.concat ops) in (* We forge a fake [block_header] hash by first hashing the operations and change the [b58] signature into a signature that looks like the one of a block header by prefixing it with the letter [B]. *) - let hash_string = Tezos_crypto.Operation_list_hash.to_b58check hash in + let hash_string = Operation_list_hash.to_b58check hash in let suffix = String.sub hash_string 2 31 in - match Tezos_crypto.Block_hash.of_string @@ "B" ^ suffix with + match Block_hash.of_string @@ "B" ^ suffix with | Error err -> Format.printf "Unexpected error: %a" Error_monad.pp_print_trace err ; assert false @@ -265,7 +263,7 @@ module Block = struct String.concat "|" (List.map - Tezos_crypto.Operation_hash.to_short_b58check + Operation_hash.to_short_b58check (List.map (fun op -> op.Prevalidation.hash) ops)) in let ops_string = @@ -274,7 +272,7 @@ module Block = struct "" t.operations in - Format.asprintf "%a:[%s]" Tezos_crypto.Block_hash.pp t.hash ops_string + Format.asprintf "%a:[%s]" Block_hash.pp t.hash ops_string (* [pp_list] is unused but useful when debugging, renaming it to [_pp_list] to keep it around *) @@ -402,8 +400,7 @@ let tree_gen ?blocks () = (** A generator for passing the last argument of [Prevalidator.handle_live_operations] *) let old_mempool_gen (tree : Block.t Tree.tree) : - unit Prevalidation.operation Tezos_crypto.Operation_hash.Map.t QCheck2.Gen.t - = + unit Prevalidation.operation Operation_hash.Map.t QCheck2.Gen.t = let blocks = Tree.values tree in let pairs = List.concat_map Block.tools.operations blocks |> List.concat in let elements = @@ -413,14 +410,14 @@ let old_mempool_gen (tree : Block.t Tree.tree) : Prevalidation.Internal_for_tests.make_operation op hash ()) pairs in - if elements = [] then QCheck2.Gen.return Tezos_crypto.Operation_hash.Map.empty + if elements = [] then QCheck2.Gen.return Operation_hash.Map.empty else let list_gen = QCheck2.Gen.(oneofl elements |> list) in QCheck2.Gen.map (fun l -> List.to_seq l |> Seq.map (fun op -> (op.Prevalidation.hash, op)) - |> Tezos_crypto.Operation_hash.Map.of_seq) + |> Operation_hash.Map.of_seq) list_gen (** Function to implement @@ -502,7 +499,7 @@ let classification_chain_tools (tree : Block.t Tree.tree) : let tree_gen ?blocks () : (Block.t Tree.tree * (Block.t * Block.t) option - * unit Prevalidation.operation Tezos_crypto.Operation_hash.Map.t) + * unit Prevalidation.operation Operation_hash.Map.t) QCheck2.Gen.t = let open QCheck2.Gen in let* tree = tree_gen ?blocks () in diff --git a/src/lib_shell/test/legacy_test_prevalidation.ml b/src/lib_shell/test/legacy_test_prevalidation.ml index 1b80851d16fc..e21e1315f80e 100644 --- a/src/lib_shell/test/legacy_test_prevalidation.ml +++ b/src/lib_shell/test/legacy_test_prevalidation.ml @@ -68,22 +68,21 @@ module Classification = Legacy_prevalidator_classification module Parameters : Requester_impl.PARAMETERS - with type key = Tezos_crypto.Operation_hash.t + with type key = Operation_hash.t and type value = int = struct - type key = Tezos_crypto.Operation_hash.t + type key = Operation_hash.t type value = int end -module Hash : Requester.HASH with type t = Tezos_crypto.Operation_hash.t = -struct +module Hash : Requester.HASH with type t = Operation_hash.t = struct type t = Parameters.key let name = "test_with_key_Operation_hash_dot_t" - let encoding = Tezos_crypto.Operation_hash.encoding + let encoding = Operation_hash.encoding - let pp = Tezos_crypto.Operation_hash.pp + let pp = Operation_hash.pp end module Test_request = Requester_impl.Simple_request (Parameters) @@ -109,7 +108,7 @@ let mk_operation n : Operation.t = let base_prefix = String.sub base 0 (base_len - n_string_len) in let hash_string = base_prefix ^ n_string in assert (String.length hash_string = base_len) ; - let branch = Tezos_crypto.Block_hash.of_string_exn hash_string in + let branch = Block_hash.of_string_exn hash_string in let proto = Bytes.of_string n_string in {shell = {branch}; proto} @@ -176,9 +175,7 @@ let test_in_mempool_leak f (nb_ops : int) (_ : unit) = f [] op classes in List.iter handle (1 -- nb_ops) ; - let actual_in_mempool_size = - Tezos_crypto.Operation_hash.Map.cardinal classes.in_mempool - in + let actual_in_mempool_size = Operation_hash.Map.cardinal classes.in_mempool in Alcotest.( check bool @@ -209,7 +206,7 @@ let test_db_do_not_clear_right_away f (nb_ops : int) (_ : unit) = let op = mk_operation i in let oph = Operation.hash op in let op = Prevalidation.Internal_for_tests.make_operation op oph () in - Format.printf "Injecting op: %a\n" Tezos_crypto.Operation_hash.pp oph ; + Format.printf "Injecting op: %a\n" Operation_hash.pp oph ; let injected = Lwt_main.run @@ Test_Requester.inject requester oph i in assert injected ; f [] op classes ; @@ -218,7 +215,7 @@ let test_db_do_not_clear_right_away f (nb_ops : int) (_ : unit) = bool (Format.asprintf "requester memory contains most recent classified operation (%a)" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) (Option.is_some @@ Lwt_main.run @@ Test_Requester.read_opt requester oph) true) diff --git a/src/lib_shell/test/legacy_test_prevalidation_t.ml b/src/lib_shell/test/legacy_test_prevalidation_t.ml index f0e6b16237c3..113143927aae 100644 --- a/src/lib_shell/test/legacy_test_prevalidation_t.ml +++ b/src/lib_shell/test/legacy_test_prevalidation_t.ml @@ -67,7 +67,7 @@ module Internal_for_tests = Prevalidation.Internal_for_tests module Init = struct let genesis_protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp" let chain_id = Tezos_crypto.Chain_id.zero @@ -97,11 +97,8 @@ module Init = struct let v = Tezos_shell_context.Shell_context.wrap_disk_context v in f v) - let genesis_block (context_hash : Tezos_crypto.Context_hash.t) : Store.Block.t - = - let block_hash : Tezos_crypto.Block_hash.t = - Tezos_crypto.Block_hash.hash_string ["genesis"] - in + let genesis_block (context_hash : Context_hash.t) : Store.Block.t = + let block_hash : Block_hash.t = Block_hash.hash_string ["genesis"] in let genesis : Genesis.t = {time = genesis_time; block = block_hash; protocol = genesis_protocol} in @@ -142,7 +139,7 @@ let chain_store = () (** Test that [create] returns [Ok] in a pristine context. *) let test_create ctxt = let open Lwt_result_syntax in - let live_operations = Tezos_crypto.Operation_hash.Set.empty in + let live_operations = Operation_hash.Set.empty in let timestamp : Time.Protocol.t = now () in let (module Prevalidation) = create_prevalidation (module Mock_protocol) ctxt @@ -174,10 +171,10 @@ let prevalidation_operations_gen (type a) empty string, otherwise the call to [P.parse] will fail with the bytes being too long (hereby looking like an attack). *) let proto_gen : string QCheck2.Gen.t = QCheck2.Gen.return "" in - let+ (ops : Operation.t Tezos_crypto.Operation_hash.Map.t) = + let+ (ops : Operation.t Operation_hash.Map.t) = Generators.raw_op_map_gen_n ~proto_gen ?block_hash_t:None n in - List.map mk_operation (Tezos_crypto.Operation_hash.Map.bindings ops) + List.map mk_operation (Operation_hash.Map.bindings ops) (** The number of operations used by tests that follow *) let nb_ops = 100 @@ -195,7 +192,7 @@ let mk_ops (type a) when the protocol's [apply_operation] crashes. *) let test_apply_operation_crash ctxt = let open Lwt_result_syntax in - let live_operations = Tezos_crypto.Operation_hash.Set.empty in + let live_operations = Operation_hash.Set.empty in let timestamp : Time.Protocol.t = now () in let (module P) = create_prevalidation (module Mock_protocol) ctxt in let ops : P.protocol_operation Prevalidation.operation list = @@ -236,11 +233,11 @@ let mk_live_operations (type a) rand (ops : a Prevalidation.operation list) = List.fold_left (fun acc (op : _ Prevalidation.operation) -> if Random.State.bool rand then - Tezos_crypto.Operation_hash.Set.add + Operation_hash.Set.add (Internal_for_tests.to_raw op |> Operation.hash) acc else acc) - Tezos_crypto.Operation_hash.Set.empty + Operation_hash.Set.empty ops (** Test that [Prevalidation.apply_operations] returns [Outdated] @@ -267,15 +264,13 @@ let test_apply_operation_live_operations ctxt = let ops : P.protocol_operation Prevalidation.operation list = mk_ops (module P) in - let live_operations : Tezos_crypto.Operation_hash.Set.t = - mk_live_operations rand ops - in + let live_operations : Operation_hash.Set.t = mk_live_operations rand ops in let predecessor : Store.Block.t = Init.genesis_block @@ Context_ops.hash ~time:timestamp ctxt in let* pv = P.create chain_store ~predecessor ~live_operations ~timestamp () in let op_in_live_operations op = - Tezos_crypto.Operation_hash.Set.mem + Operation_hash.Set.mem (Internal_for_tests.to_raw op |> Operation.hash) live_operations in @@ -318,9 +313,7 @@ let test_apply_operation_applied ctxt = let ops : P.protocol_operation Prevalidation.operation list = mk_ops (module P) in - let live_operations : Tezos_crypto.Operation_hash.Set.t = - mk_live_operations rand ops - in + let live_operations : Operation_hash.Set.t = mk_live_operations rand ops in let predecessor : Store.Block.t = Init.genesis_block @@ Context_ops.hash ~time:timestamp ctxt in diff --git a/src/lib_shell/test/legacy_test_prevalidator_classification.ml b/src/lib_shell/test/legacy_test_prevalidator_classification.ml index dfd4134ef4c9..52b54d170e0e 100644 --- a/src/lib_shell/test/legacy_test_prevalidator_classification.ml +++ b/src/lib_shell/test/legacy_test_prevalidator_classification.ml @@ -57,11 +57,11 @@ module Operation_map = struct Format.fprintf ppf "(%a: (%a, <tztrace>))" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Operation.pp op.Prevalidation.raw)) - (Tezos_crypto.Operation_hash.Map.bindings map) + (Operation_hash.Map.bindings map) let pp ppf map = Format.fprintf @@ -71,23 +71,22 @@ module Operation_map = struct Format.fprintf ppf "(%a: %a)" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Operation.pp op.Prevalidation.raw)) - (Tezos_crypto.Operation_hash.Map.bindings map) + (Operation_hash.Map.bindings map) (* Uses polymorphic equality on tztraces! *) let eq = - Tezos_crypto.Operation_hash.Map.equal (fun (o1, t1) (o2, t2) -> - Tezos_crypto.Operation_hash.equal o1.Prevalidation.hash o2.hash - && t1 = t2) + Operation_hash.Map.equal (fun (o1, t1) (o2, t2) -> + Operation_hash.equal o1.Prevalidation.hash o2.hash && t1 = t2) end type classification_event = | Add_if_not_present of Classification.classification * unit Prevalidation.operation - | Remove of Tezos_crypto.Operation_hash.t + | Remove of Operation_hash.t | Flush of bool let drop oph t = @@ -170,8 +169,7 @@ let qcheck_eq_false ~actual = let qcheck_bounded_map_is_empty bounded_map = let actual = - bounded_map |> Classification.map - |> Tezos_crypto.Operation_hash.Map.is_empty + bounded_map |> Classification.map |> Operation_hash.Map.is_empty in qcheck_eq_true ~actual @@ -180,21 +178,21 @@ let qcheck_bounded_map_is_empty bounded_map = that these fields are disjoint. *) let disjoint_union_classified_fields ?fail_msg (t : unit Classification.t) = let ( +> ) acc next_set = - if not (Tezos_crypto.Operation_hash.Set.disjoint acc next_set) then + if not (Operation_hash.Set.disjoint acc next_set) then QCheck2.Test.fail_reportf "Invariant 'The fields: [refused; outdated; branch_refused; \ branch_delayed; applied] are disjoint' broken by t =@.%a@.%s" Classification.Internal_for_tests.pp t (match fail_msg with None -> "" | Some msg -> "\n" ^ msg ^ "@.") ; - Tezos_crypto.Operation_hash.Set.union acc next_set + Operation_hash.Set.union acc next_set in let to_set = Classification.Internal_for_tests.set_of_bounded_map in to_set t.refused +> to_set t.outdated +> to_set t.branch_refused +> to_set t.branch_delayed +> (Classification.Sized_map.to_seq t.prechecked - |> Seq.map fst |> Tezos_crypto.Operation_hash.Set.of_seq) - +> (Tezos_crypto.Operation_hash.Set.of_list + |> Seq.map fst |> Operation_hash.Set.of_seq) + +> (Operation_hash.Set.of_list @@ List.rev_map (fun op -> op.Prevalidation.hash) t.applied_rev) (** Checks both invariants of type [Legacy_prevalidator_classification.t]: @@ -212,28 +210,17 @@ let disjoint_union_classified_fields ?fail_msg (t : unit Classification.t) = of breaking this using [Tezt]. *) let check_invariants ?fail_msg (t : unit Classification.t) = let to_set map = - Tezos_crypto.Operation_hash.Map.to_seq map - |> Seq.map fst |> Tezos_crypto.Operation_hash.Set.of_seq + Operation_hash.Map.to_seq map |> Seq.map fst |> Operation_hash.Set.of_seq in let expected_in_mempool = disjoint_union_classified_fields ?fail_msg t in let mempool_as_set = to_set t.in_mempool in - if - not - (Tezos_crypto.Operation_hash.Set.equal expected_in_mempool mempool_as_set) - then + if not (Operation_hash.Set.equal expected_in_mempool mempool_as_set) then let set_pp ppf set = - set |> Tezos_crypto.Operation_hash.Set.elements - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) - in - let set1 = - Tezos_crypto.Operation_hash.Set.diff expected_in_mempool mempool_as_set - in - let set2 = - Tezos_crypto.Operation_hash.Set.diff mempool_as_set expected_in_mempool + set |> Operation_hash.Set.elements + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in + let set1 = Operation_hash.Set.diff expected_in_mempool mempool_as_set in + let set2 = Operation_hash.Set.diff mempool_as_set expected_in_mempool in let sets_report = Format.asprintf "In individual fields but not in [in_mempool]:\n\ @@ -276,10 +263,9 @@ let event_pp pp = function "Add_if_not_present %a %a" classification_pp classification - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op.Prevalidation.hash - | Remove oph -> - Format.fprintf pp "Remove %a" Tezos_crypto.Operation_hash.pp oph + | Remove oph -> Format.fprintf pp "Remove %a" Operation_hash.pp oph | Flush handle_branch_refused -> Format.fprintf pp "Flush ~handle_branch_refused:%b" handle_branch_refused @@ -455,7 +441,7 @@ module Bounded = struct let binding_pp ppf bindings = bindings |> List.map (fun value -> value.Prevalidation.hash) - |> Format.pp_print_list Tezos_crypto.Operation_hash.pp ppf + |> Format.pp_print_list Operation_hash.pp ppf in Format.asprintf "Legacy_prevalidator_classification.t:@.%a@.Classification:@.%s@.First \ @@ -468,8 +454,7 @@ module Bounded = struct binding_pp other_bindings - let custom_gen - (discarded_operations_rev : Tezos_crypto.Operation_hash.t list ref) : + let custom_gen (discarded_operations_rev : Operation_hash.t list ref) : custom QCheck2.Gen.t = let open QCheck2.Gen in let* map_size_limit = 1 -- 20 in @@ -506,13 +491,10 @@ module Bounded = struct not (List.for_all (fun excess_hash -> - List.mem - ~equal:Tezos_crypto.Operation_hash.equal - excess_hash - discarded_hashes) + List.mem ~equal:Operation_hash.equal excess_hash discarded_hashes) excess_hashes) then - let hashes_pp = Format.pp_print_list Tezos_crypto.Operation_hash.pp in + let hashes_pp = Format.pp_print_list Operation_hash.pp in QCheck2.Test.fail_reportf "Expected all excess hashes to have been discarded but it was \ not.@.Excess hashes:@.%a@.Discarded hashes:@.%a" @@ -524,8 +506,7 @@ module Bounded = struct let check_map_is_full ~expected_size ~bounded_map = if Compare.List_length_with.( - Tezos_crypto.Operation_hash.Map.bindings - (Classification.map bounded_map) + Operation_hash.Map.bindings (Classification.map bounded_map) <> expected_size) then QCheck2.Test.fail_reportf @@ -533,8 +514,7 @@ module Bounded = struct %i.@.Bounded_map content:@.%a" expected_size (List.length - (Tezos_crypto.Operation_hash.Map.bindings - (Classification.map bounded_map))) + (Operation_hash.Map.bindings (Classification.map bounded_map))) Classification.Internal_for_tests.bounded_map_pp bounded_map @@ -552,10 +532,10 @@ module Bounded = struct let hashes = first_ops @ other_ops |> List.map (fun op -> op.Prevalidation.hash) in - let unique_hashes = Tezos_crypto.Operation_hash.Set.of_list hashes in + let unique_hashes = Operation_hash.Set.of_list hashes in QCheck2.assume Compare.List_length_with.( - hashes = Tezos_crypto.Operation_hash.Set.cardinal unique_hashes) ; + hashes = Operation_hash.Set.cardinal unique_hashes) ; (* Remove all operations for the tested classification *) let bounded_map = match error_classification with @@ -565,7 +545,7 @@ module Bounded = struct | `Outdated _ -> t.outdated in let () = - Tezos_crypto.Operation_hash.Map.iter + Operation_hash.Map.iter (fun oph _op -> drop oph t) (Classification.map bounded_map) in @@ -588,15 +568,13 @@ end module To_map = struct let map_pp fmt x = let map_to_list m = - Tezos_crypto.Operation_hash.Map.to_seq m - |> Seq.map (fun (_, op) -> op) - |> List.of_seq + Operation_hash.Map.to_seq m |> Seq.map (fun (_, op) -> op) |> List.of_seq in let pp_pair fmt op = Format.fprintf fmt "%a:%a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op.Prevalidation.hash Operation.pp op.raw @@ -604,7 +582,7 @@ module To_map = struct Format.fprintf fmt "%a" (Format.pp_print_list pp_pair) (map_to_list x) let map_eq = - Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> + Operation_hash.Map.equal (fun op1 op2 -> Operation.equal op1.Prevalidation.raw op2.raw) (** [remove_all m1 m2] returns the subset of [m1] thas is not within [m2]. @@ -612,11 +590,11 @@ module To_map = struct that are in [m2]. *) let remove_all m1 m2 = let keys2 = - Tezos_crypto.Operation_hash.Map.bindings m2 - |> List.map fst |> Tezos_crypto.Operation_hash.Set.of_list + Operation_hash.Map.bindings m2 + |> List.map fst |> Operation_hash.Set.of_list in - Tezos_crypto.Operation_hash.Map.filter - (fun key _val -> not (Tezos_crypto.Operation_hash.Set.mem key keys2)) + Operation_hash.Map.filter + (fun key _val -> not (Operation_hash.Set.mem key keys2)) m1 (** [eq_mod_binding m1 (k, v_opt) m2] holds iff: @@ -627,13 +605,13 @@ module To_map = struct for some unknown value [v]. *) let eq_mod_op m1 (k, v_opt) m2 = let diff = remove_all m2 m1 in - match (Tezos_crypto.Operation_hash.Map.bindings diff, v_opt) with + match (Operation_hash.Map.bindings diff, v_opt) with | [], _ -> true | [(kdiff, vdiff)], Some v - when Tezos_crypto.Operation_hash.equal kdiff k + when Operation_hash.equal kdiff k && Operation.equal v.Prevalidation.raw vdiff.Prevalidation.raw -> true - | [(kdiff, _)], None when Tezos_crypto.Operation_hash.equal kdiff k -> true + | [(kdiff, _)], None when Operation_hash.equal kdiff k -> true | _ -> false (** [to_map_all] calls [Classification.to_map] with all named @@ -659,7 +637,7 @@ module To_map = struct qcheck_eq' ~pp:map_pp ~eq:map_eq - ~expected:Tezos_crypto.Operation_hash.Map.empty + ~expected:Operation_hash.Map.empty ~actual:(to_map_all t) () @@ -705,7 +683,7 @@ module To_map = struct "Starting with:@. %a@.and operation hash %a@. " Operation_map.pp (to_map_all t) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op.Prevalidation.hash let test_map_remove_add = @@ -730,17 +708,15 @@ module To_map = struct let t' = Classification.Internal_for_tests.copy t in drop op.Prevalidation.hash t ; let initial = to_map_all t in - let left = - Tezos_crypto.Operation_hash.Map.add op.Prevalidation.hash op initial - in + let left = Operation_hash.Map.add op.Prevalidation.hash op initial in Classification.add classification op t' ; let right = to_map_all t' in qcheck_eq' ~expected:left ~actual:right ~eq: - (Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> - Tezos_crypto.Operation_hash.equal op1.Prevalidation.hash op2.hash)) + (Operation_hash.Map.equal (fun op1 op2 -> + Operation_hash.equal op1.Prevalidation.hash op2.hash)) ~pp:map_pp () @@ -766,17 +742,15 @@ module To_map = struct Classification.add classification op t ; let initial = to_map_all t in let oph = op.Prevalidation.hash in - let left = Tezos_crypto.Operation_hash.Map.remove oph initial in + let left = Operation_hash.Map.remove oph initial in drop oph t' ; let right = to_map_all t' in qcheck_eq' ~expected:left ~actual:right ~eq: - (Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> - Tezos_crypto.Operation_hash.equal - op1.Prevalidation.hash - op2.Prevalidation.hash)) + (Operation_hash.Map.equal (fun op1 op2 -> + Operation_hash.equal op1.Prevalidation.hash op2.Prevalidation.hash)) ~pp:map_pp () @@ -813,12 +787,11 @@ module To_map = struct let oph = op.Prevalidation.hash in let is_in_mempool = is_in_mempool oph t in let map = - to_map_all t - |> Tezos_crypto.Operation_hash.Map.filter (fun oph' _ -> oph' = oph) + to_map_all t |> Operation_hash.Map.filter (fun oph' _ -> oph' = oph) in qcheck_eq' ~expected:is_in_mempool - ~actual:(Tezos_crypto.Operation_hash.Map.cardinal map = 1) + ~actual:(Operation_hash.Map.cardinal map = 1) () (** Tests that [Classification.to_map] returns an empty map if all parameters @@ -832,7 +805,7 @@ module To_map = struct qcheck_eq' ~pp:map_pp ~eq:map_eq - ~expected:Tezos_crypto.Operation_hash.Map.empty + ~expected:Operation_hash.Map.empty ~actual: (Classification.Internal_for_tests.to_map ~applied:false diff --git a/src/lib_shell/test/legacy_test_prevalidator_classification_operations.ml b/src/lib_shell/test/legacy_test_prevalidator_classification_operations.ml index 4d6dda41ea73..b6ac4681a727 100644 --- a/src/lib_shell/test/legacy_test_prevalidator_classification_operations.ml +++ b/src/lib_shell/test/legacy_test_prevalidator_classification_operations.ml @@ -43,7 +43,7 @@ *) open Qcheck2_helpers -module Op_map = Tezos_crypto.Operation_hash.Map +module Op_map = Operation_hash.Map module Prevalidation = Legacy_prevalidation module Classification = Legacy_prevalidator_classification module Generators = Legacy_generators @@ -65,22 +65,22 @@ let values_from_to ~(equal : 'a -> 'a -> bool) (tree : 'a Tree.tree) |> force_opt ~loc:__LOC__ |> fun preds -> start :: preds -(** Pretty print values of type [Tezos_crypto.Operation_hash.Set.t] *) +(** Pretty print values of type [Operation_hash.Set.t] *) let op_set_pp fmt x = - let set_to_list m = Tezos_crypto.Operation_hash.Set.to_seq m |> List.of_seq in + let set_to_list m = Operation_hash.Set.to_seq m |> List.of_seq in Format.fprintf fmt "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) (set_to_list x) -(** Pretty print values of type [Operation.t Tezos_crypto.Operation_hash.Map] *) +(** Pretty print values of type [Operation.t Operation_hash.Map] *) let op_map_pp fmt x = let pp_pair fmt (hash, op) = Format.fprintf fmt "%a:%a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp hash Operation.pp op.Prevalidation.raw @@ -89,7 +89,7 @@ let op_map_pp fmt x = fmt "%a" (Format.pp_print_list pp_pair) - (Tezos_crypto.Operation_hash.Map.bindings x) + (Operation_hash.Map.bindings x) let qcheck_cond ?pp ~cond e1 e2 () = if cond e1 e2 then true @@ -111,24 +111,23 @@ let qcheck_cond ?pp ~cond e1 e2 () = pp e2 -let blocks_to_oph_set (blocks : Tezos_crypto.Operation_hash.t list list list) : - Tezos_crypto.Operation_hash.Set.t = - List.concat blocks |> List.concat |> Tezos_crypto.Operation_hash.Set.of_list +let blocks_to_oph_set (blocks : Operation_hash.t list list list) : + Operation_hash.Set.t = + List.concat blocks |> List.concat |> Operation_hash.Set.of_list (** [is_subset m1 m2] returns whether all bindings of [m1] are in [m2]. In other words, it returns whether [m2] is a superset of [m1]. *) let is_subset (m1 : unit Prevalidation.operation Op_map.t) (m2 : unit Prevalidation.operation Op_map.t) = - let rec go - (m1_seq : - (Tezos_crypto.Operation_hash.t * unit Prevalidation.operation) Seq.t) = + let rec go (m1_seq : (Operation_hash.t * unit Prevalidation.operation) Seq.t) + = match m1_seq () with | Seq.Nil -> true | Seq.Cons ((m1_key, m1_value), m1_rest) -> ( match Op_map.find m1_key m2 with | None -> (* A key in [m1] that is not in [m2] *) false | Some m2_value -> - Tezos_crypto.Operation_hash.equal + Operation_hash.equal m1_value.Prevalidation.hash m2_value.Prevalidation.hash && go m1_rest) @@ -161,10 +160,7 @@ module Handle_operations = struct List.map (fun (blk : Block.t) -> blk.hash) live_blocks in return - ( tree, - pair_blocks_opt, - old_mempool, - Tezos_crypto.Block_hash.Set.of_list live_blocks ) + (tree, pair_blocks_opt, old_mempool, Block_hash.Set.of_list live_blocks) in QCheck2.Test.make ~name:"[handle_live_operations] is a subset of alive blocks" @@ -179,7 +175,7 @@ module Handle_operations = struct (* Keep only the ones in live_blocks *) |> List.to_seq |> Seq.filter (fun (blk : Block.t) -> - Tezos_crypto.Block_hash.Set.mem blk.hash live_blocks) + Block_hash.Set.mem blk.hash live_blocks) (* Then extract (oph, op) pairs from them *) |> Seq.flat_map (fun (blk : Block.t) -> List.to_seq blk.operations) |> Seq.flat_map List.to_seq @@ -194,7 +190,7 @@ module Handle_operations = struct ~from_branch ~to_branch ~is_branch_alive:(fun blk_hash -> - Tezos_crypto.Block_hash.Set.mem blk_hash live_blocks) + Block_hash.Set.mem blk_hash live_blocks) ~parse old_mempool |> Lwt_main.run @@ -231,9 +227,7 @@ module Handle_operations = struct (* Expected operations are the ones from [ancestor] to [from_branch], minus the ones from ancestor to [to_branch]. *) let expected = - Tezos_crypto.Operation_hash.Set.diff - expected_superset - from_ancestor_to_to_branch + Operation_hash.Set.diff expected_superset from_ancestor_to_to_branch in let actual = Classification.Internal_for_tests.handle_live_operations @@ -244,16 +238,11 @@ module Handle_operations = struct ~to_branch ~is_branch_alive:(Fun.const true) ~parse - Tezos_crypto.Operation_hash.Map.empty + Operation_hash.Map.empty |> Lwt_main.run |> Op_map.bindings |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + |> Operation_hash.Set.of_list in - qcheck_eq' - ~pp:op_set_pp - ~eq:Tezos_crypto.Operation_hash.Set.equal - ~expected - ~actual - () + qcheck_eq' ~pp:op_set_pp ~eq:Operation_hash.Set.equal ~expected ~actual () (** Test that operations cleared by [handle_live_operations] are operations on the path from [ancestor] to [to_branch] (when all @@ -266,10 +255,8 @@ module Handle_operations = struct QCheck2.assume @@ Option.is_some pair_blocks_opt ; let from_branch, to_branch = force_opt ~loc:__LOC__ pair_blocks_opt in let chain = Generators_tree.classification_chain_tools tree in - let cleared = ref Tezos_crypto.Operation_hash.Set.empty in - let clearer oph = - cleared := Tezos_crypto.Operation_hash.Set.add oph !cleared - in + let cleared = ref Operation_hash.Set.empty in + let clearer oph = cleared := Operation_hash.Set.add oph !cleared in let chain = {chain with clear_or_cancel = clearer} in let equal = Block.equal in let ancestor : Block.t = @@ -294,7 +281,7 @@ module Handle_operations = struct |> Lwt_main.run |> ignore ; qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset !cleared expected_superset () @@ -309,9 +296,9 @@ module Handle_operations = struct QCheck2.assume @@ Option.is_some pair_blocks_opt ; let from_branch, to_branch = force_opt ~loc:__LOC__ pair_blocks_opt in let chain = Generators_tree.classification_chain_tools tree in - let injected = ref Tezos_crypto.Operation_hash.Set.empty in + let injected = ref Operation_hash.Set.empty in let inject_operation oph _op = - injected := Tezos_crypto.Operation_hash.Set.add oph !injected ; + injected := Operation_hash.Set.add oph !injected ; Lwt.return_unit in let chain = {chain with inject_operation} in @@ -338,7 +325,7 @@ module Handle_operations = struct |> Lwt_main.run |> ignore ; qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset !injected expected_superset () @@ -357,7 +344,7 @@ module Recyle_operations = struct let classification_of_ops_gen (ops : unit Prevalidation.operation Op_map.t) : unit Classification.t QCheck2.Gen.t = let open QCheck2.Gen in - let ops = Tezos_crypto.Operation_hash.Map.bindings ops |> List.map snd in + let ops = Operation_hash.Map.bindings ops |> List.map snd in let length = List.length ops in let* empty_space = 0 -- 100 in (* To avoid throwing part of [ops], we want the capacity of the classification @@ -459,7 +446,7 @@ module Recyle_operations = struct ~chain ~from_branch ~to_branch - ~live_blocks:Tezos_crypto.Block_hash.Set.empty + ~live_blocks:Block_hash.Set.empty ~classes ~pending ~handle_branch_refused @@ -486,21 +473,19 @@ module Recyle_operations = struct Tree.find_ancestor ~equal tree from_branch to_branch |> force_opt ~loc:__LOC__ in - let live_blocks : Tezos_crypto.Block_hash.Set.t = - Tree.values tree |> List.map Block.to_hash - |> Tezos_crypto.Block_hash.Set.of_list + let live_blocks : Block_hash.Set.t = + Tree.values tree |> List.map Block.to_hash |> Block_hash.Set.of_list in (* This is inherited from the behavior of [handle_live_operations] *) - let expected_from_tree : Tezos_crypto.Operation_hash.Set.t = + let expected_from_tree : Operation_hash.Set.t = List.map Block.tools.all_operation_hashes (values_from_to ~equal tree from_branch ancestor) |> blocks_to_oph_set in (* This is coming from [recycle_operations] itself *) - let op_map_to_hash_list (m : 'a Tezos_crypto.Operation_hash.Map.t) = - Op_map.bindings m |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + let op_map_to_hash_list (m : 'a Operation_hash.Map.t) = + Op_map.bindings m |> List.map fst |> Operation_hash.Set.of_list in let expected_from_classification = Classification.Internal_for_tests.to_map @@ -514,9 +499,9 @@ module Recyle_operations = struct |> op_map_to_hash_list in let expected_from_pending = op_map_to_hash_list pending in - let expected_superset : Tezos_crypto.Operation_hash.Set.t = - Tezos_crypto.Operation_hash.Set.union - (Tezos_crypto.Operation_hash.Set.union + let expected_superset : Operation_hash.Set.t = + Operation_hash.Set.union + (Operation_hash.Set.union expected_from_tree expected_from_classification) expected_from_pending @@ -524,7 +509,7 @@ module Recyle_operations = struct let parse raw hash = Some (Prevalidation.Internal_for_tests.make_operation hash raw ()) in - let actual : Tezos_crypto.Operation_hash.Set.t = + let actual : Operation_hash.Set.t = Classification.recycle_operations ~block_store:Block.tools ~chain @@ -536,11 +521,11 @@ module Recyle_operations = struct ~handle_branch_refused ~parse |> Lwt_main.run |> Op_map.bindings |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + |> Operation_hash.Set.of_list in qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset actual expected_superset () @@ -553,9 +538,8 @@ module Recyle_operations = struct QCheck2.Gen.(pair gen bool) @@ fun ((tree, pair_blocks_opt, classes, pending), handle_branch_refused) -> QCheck2.assume @@ Option.is_some pair_blocks_opt ; - let live_blocks : Tezos_crypto.Block_hash.Set.t = - Tree.values tree |> List.map Block.to_hash - |> Tezos_crypto.Block_hash.Set.of_list + let live_blocks : Block_hash.Set.t = + Tree.values tree |> List.map Block.to_hash |> Block_hash.Set.of_list in let expected : unit Prevalidation.operation Op_map.t = Classification.Internal_for_tests.to_map diff --git a/src/lib_shell/test/legacy_test_prevalidator_pending_operations.ml b/src/lib_shell/test/legacy_test_prevalidator_pending_operations.ml index 51bf868e6ea8..654ac4c0ec31 100644 --- a/src/lib_shell/test/legacy_test_prevalidator_pending_operations.ml +++ b/src/lib_shell/test/legacy_test_prevalidator_pending_operations.ml @@ -51,7 +51,7 @@ let pending_of_list = List.fold_left (fun pendings (op, priority) -> if - Tezos_crypto.Operation_hash.Set.mem + Operation_hash.Set.mem (Prevalidation.Internal_for_tests.hash_of op) (Pending_ops.hashes pendings) then (* no duplicate hashes *) diff --git a/src/lib_shell/test/shell_test_helpers.ml b/src/lib_shell/test/shell_test_helpers.ml index 4a397ac7e9dc..89756920ba02 100644 --- a/src/lib_shell/test/shell_test_helpers.ml +++ b/src/lib_shell/test/shell_test_helpers.ml @@ -35,11 +35,11 @@ open Filename.Infix (** Basic blocks *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisGeneskvg68z" let genesis_protocol_hash = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp" let genesis_time = Time.Protocol.of_seconds 0L diff --git a/src/lib_shell/test/test_consensus_heuristic.ml b/src/lib_shell/test/test_consensus_heuristic.ml index 5a042e6c3c44..f4d814ef7eed 100644 --- a/src/lib_shell/test/test_consensus_heuristic.ml +++ b/src/lib_shell/test/test_consensus_heuristic.ml @@ -35,8 +35,7 @@ module Assert = Assert open Consensus_heuristic let pp ppf = function - | Consensus hash -> - Format.fprintf ppf "Consensus with %a" Tezos_crypto.Block_hash.pp hash + | Consensus hash -> Format.fprintf ppf "Consensus with %a" Block_hash.pp hash | No_consensus _ -> Format.fprintf ppf "No consensus" | Need_more_candidates -> Format.fprintf ppf "Synchronised (not stuck)" @@ -45,8 +44,7 @@ let forge_peer_id () = identity.peer_id let forge_hash () = - Tezos_crypto.Block_hash.hash_bytes - [Bytes.init 32 (fun _ -> Char.chr (Random.int 256))] + Block_hash.hash_bytes [Bytes.init 32 (fun _ -> Char.chr (Random.int 256))] let create_state_init_1 () = let h = create ~expected:1 ~threshold:1 () in @@ -67,7 +65,7 @@ let create_state_bad_expected () = let create_consensus () = let h = create ~expected:1 ~threshold:1 () in let peer_id = forge_peer_id () in - let zero = Tezos_crypto.Block_hash.zero in + let zero = Block_hash.zero in update h (peer_id, zero) ; Assert.equal ~pp (get_state h) (Consensus zero) @@ -76,7 +74,7 @@ let create_no_consensus () = let peer_1 = forge_peer_id () in let peer_2 = forge_peer_id () in let peer_3 = forge_peer_id () in - let hash_1 = Tezos_crypto.Block_hash.zero in + let hash_1 = Block_hash.zero in let hash_2 = forge_hash () in update h (peer_1, hash_1) ; update h (peer_2, hash_2) ; @@ -122,13 +120,10 @@ let job_return_hash () = Worker.create ~expire_time:Ptime.Span.zero ~restart_delay:Ptime.Span.zero - ~job:(fun () -> Lwt.return (Consensus Tezos_crypto.Block_hash.zero)) + ~job:(fun () -> Lwt.return (Consensus Block_hash.zero)) in let p = Worker.wait worker in - Assert.equal - ~pp - (Lwt.state p) - (Lwt.state (Lwt.return Tezos_crypto.Block_hash.zero)) + Assert.equal ~pp (Lwt.state p) (Lwt.state (Lwt.return Block_hash.zero)) let job_sleep () = let worker = @@ -153,12 +148,9 @@ let job_protected () = let p = Worker.wait worker in Assert.equal ~pp (Lwt.state p) Lwt.Sleep ; Lwt.cancel p ; - Lwt.wakeup u (Consensus Tezos_crypto.Block_hash.zero) ; + Lwt.wakeup u (Consensus Block_hash.zero) ; let p' = Worker.wait worker in - Assert.equal - ~pp - (Lwt.state p') - (Lwt.state (Lwt.return Tezos_crypto.Block_hash.zero)) + Assert.equal ~pp (Lwt.state p') (Lwt.state (Lwt.return Block_hash.zero)) let worker_canceled () = let t, _ = Lwt.task () in @@ -186,7 +178,7 @@ let tests_worker_raw : (string * (unit -> unit)) list = let job_return_no_consensus () = let open Lwt_syntax in let counter = ref 0 in - let hash_1 = Tezos_crypto.Block_hash.zero in + let hash_1 = Block_hash.zero in let worker = Worker.create ~expire_time:Ptime.Span.zero @@ -206,7 +198,7 @@ let job_return_no_consensus () = let job_return_need_more_candidates () = let open Lwt_syntax in let counter = ref 0 in - let hash_1 = Tezos_crypto.Block_hash.zero in + let hash_1 = Block_hash.zero in let worker = Worker.create ~expire_time:Ptime.Span.zero diff --git a/src/lib_shell/test/test_peer_validator.ml b/src/lib_shell/test/test_peer_validator.ml index cf30321e9540..1f032341bc1c 100644 --- a/src/lib_shell/test/test_peer_validator.ml +++ b/src/lib_shell/test/test_peer_validator.ml @@ -137,7 +137,7 @@ let test_validate_new_head_on_lower_fitness () = Assert.assert_true (Format.asprintf "The ddb should contain two entries for %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash) (known_0 && known_1) ; @@ -160,7 +160,7 @@ let test_validate_new_head_on_lower_fitness () = Assert.assert_false (Format.asprintf "The ddb should not contain an entry for %a anymore" - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash) (known_0 || known_1) ; return_unit) diff --git a/src/lib_shell/test/test_prevalidation_t.ml b/src/lib_shell/test/test_prevalidation_t.ml index bc4dc67da114..7731c4a3022e 100644 --- a/src/lib_shell/test/test_prevalidation_t.ml +++ b/src/lib_shell/test/test_prevalidation_t.ml @@ -40,8 +40,6 @@ Subject: Unit tests for {!Prevalidation.T} *) -open Tezos_crypto - module Init = struct let chain_id = Shell_test_helpers.chain_id diff --git a/src/lib_shell/test/test_prevalidator_classification.ml b/src/lib_shell/test/test_prevalidator_classification.ml index 5cb75702e1cb..113d8f1ba8b8 100644 --- a/src/lib_shell/test/test_prevalidator_classification.ml +++ b/src/lib_shell/test/test_prevalidator_classification.ml @@ -55,11 +55,11 @@ module Operation_map = struct Format.fprintf ppf "(%a: (%a, <tztrace>))" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Operation.pp op.raw)) - (Tezos_crypto.Operation_hash.Map.bindings map) + (Operation_hash.Map.bindings map) let pp ppf map = Format.fprintf @@ -69,21 +69,21 @@ module Operation_map = struct Format.fprintf ppf "(%a: %a)" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Operation.pp op.raw)) - (Tezos_crypto.Operation_hash.Map.bindings map) + (Operation_hash.Map.bindings map) (* Uses polymorphic equality on tztraces! *) let eq = - Tezos_crypto.Operation_hash.Map.equal (fun (o1, t1) (o2, t2) -> - Tezos_crypto.Operation_hash.equal o1.hash o2.hash && t1 = t2) + Operation_hash.Map.equal (fun (o1, t1) (o2, t2) -> + Operation_hash.equal o1.hash o2.hash && t1 = t2) end type classification_event = | Add_if_not_present of Classification.classification * unit operation - | Remove of Tezos_crypto.Operation_hash.t + | Remove of Operation_hash.t | Flush of bool let drop oph t = @@ -164,8 +164,7 @@ let qcheck_eq_false ~actual = let qcheck_bounded_map_is_empty bounded_map = let actual = - bounded_map |> Classification.map - |> Tezos_crypto.Operation_hash.Map.is_empty + bounded_map |> Classification.map |> Operation_hash.Map.is_empty in qcheck_eq_true ~actual @@ -174,21 +173,21 @@ let qcheck_bounded_map_is_empty bounded_map = that these fields are disjoint. *) let disjoint_union_classified_fields ?fail_msg (t : unit Classification.t) = let ( +> ) acc next_set = - if not (Tezos_crypto.Operation_hash.Set.disjoint acc next_set) then + if not (Operation_hash.Set.disjoint acc next_set) then QCheck2.Test.fail_reportf "Invariant 'The fields: [refused; outdated; branch_refused; \ branch_delayed; applied] are disjoint' broken by t =@.%a@.%s" Classification.Internal_for_tests.pp t (match fail_msg with None -> "" | Some msg -> "\n" ^ msg ^ "@.") ; - Tezos_crypto.Operation_hash.Set.union acc next_set + Operation_hash.Set.union acc next_set in let to_set = Classification.Internal_for_tests.set_of_bounded_map in to_set t.refused +> to_set t.outdated +> to_set t.branch_refused +> to_set t.branch_delayed +> (Classification.Sized_map.to_seq t.prechecked - |> Seq.map fst |> Tezos_crypto.Operation_hash.Set.of_seq) - +> (Tezos_crypto.Operation_hash.Set.of_list + |> Seq.map fst |> Operation_hash.Set.of_seq) + +> (Operation_hash.Set.of_list @@ List.rev_map (fun op -> op.hash) t.applied_rev) (** Checks both invariants of type [Prevalidator_classification.t]: @@ -206,28 +205,17 @@ let disjoint_union_classified_fields ?fail_msg (t : unit Classification.t) = of breaking this using [Tezt]. *) let check_invariants ?fail_msg (t : unit Classification.t) = let to_set map = - Tezos_crypto.Operation_hash.Map.to_seq map - |> Seq.map fst |> Tezos_crypto.Operation_hash.Set.of_seq + Operation_hash.Map.to_seq map |> Seq.map fst |> Operation_hash.Set.of_seq in let expected_in_mempool = disjoint_union_classified_fields ?fail_msg t in let mempool_as_set = to_set t.in_mempool in - if - not - (Tezos_crypto.Operation_hash.Set.equal expected_in_mempool mempool_as_set) - then + if not (Operation_hash.Set.equal expected_in_mempool mempool_as_set) then let set_pp ppf set = - set |> Tezos_crypto.Operation_hash.Set.elements - |> Format.fprintf - ppf - "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) - in - let set1 = - Tezos_crypto.Operation_hash.Set.diff expected_in_mempool mempool_as_set - in - let set2 = - Tezos_crypto.Operation_hash.Set.diff mempool_as_set expected_in_mempool + set |> Operation_hash.Set.elements + |> Format.fprintf ppf "%a" (Format.pp_print_list Operation_hash.pp) in + let set1 = Operation_hash.Set.diff expected_in_mempool mempool_as_set in + let set2 = Operation_hash.Set.diff mempool_as_set expected_in_mempool in let sets_report = Format.asprintf "In individual fields but not in [in_mempool]:\n\ @@ -270,10 +258,9 @@ let event_pp pp = function "Add_if_not_present %a %a" classification_pp classification - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op.hash - | Remove oph -> - Format.fprintf pp "Remove %a" Tezos_crypto.Operation_hash.pp oph + | Remove oph -> Format.fprintf pp "Remove %a" Operation_hash.pp oph | Flush handle_branch_refused -> Format.fprintf pp "Flush ~handle_branch_refused:%b" handle_branch_refused @@ -449,7 +436,7 @@ module Bounded = struct let binding_pp ppf bindings = bindings |> List.map (fun value -> value.hash) - |> Format.pp_print_list Tezos_crypto.Operation_hash.pp ppf + |> Format.pp_print_list Operation_hash.pp ppf in Format.asprintf "Prevalidator_classification.t:@.%a@.Classification:@.%s@.First \ @@ -462,8 +449,7 @@ module Bounded = struct binding_pp other_bindings - let custom_gen - (discarded_operations_rev : Tezos_crypto.Operation_hash.t list ref) : + let custom_gen (discarded_operations_rev : Operation_hash.t list ref) : custom QCheck2.Gen.t = let open QCheck2.Gen in let* map_size_limit = 1 -- 20 in @@ -500,13 +486,10 @@ module Bounded = struct not (List.for_all (fun excess_hash -> - List.mem - ~equal:Tezos_crypto.Operation_hash.equal - excess_hash - discarded_hashes) + List.mem ~equal:Operation_hash.equal excess_hash discarded_hashes) excess_hashes) then - let hashes_pp = Format.pp_print_list Tezos_crypto.Operation_hash.pp in + let hashes_pp = Format.pp_print_list Operation_hash.pp in QCheck2.Test.fail_reportf "Expected all excess hashes to have been discarded but it was \ not.@.Excess hashes:@.%a@.Discarded hashes:@.%a" @@ -518,8 +501,7 @@ module Bounded = struct let check_map_is_full ~expected_size ~bounded_map = if Compare.List_length_with.( - Tezos_crypto.Operation_hash.Map.bindings - (Classification.map bounded_map) + Operation_hash.Map.bindings (Classification.map bounded_map) <> expected_size) then QCheck2.Test.fail_reportf @@ -527,8 +509,7 @@ module Bounded = struct %i.@.Bounded_map content:@.%a" expected_size (List.length - (Tezos_crypto.Operation_hash.Map.bindings - (Classification.map bounded_map))) + (Operation_hash.Map.bindings (Classification.map bounded_map))) Classification.Internal_for_tests.bounded_map_pp bounded_map @@ -544,10 +525,10 @@ module Bounded = struct @@ fun (t, error_classification, first_ops, other_ops) -> (* We must not have duplicate operation hashes otherwise we may not go over the bound *) let hashes = first_ops @ other_ops |> List.map (fun op -> op.hash) in - let unique_hashes = Tezos_crypto.Operation_hash.Set.of_list hashes in + let unique_hashes = Operation_hash.Set.of_list hashes in QCheck2.assume Compare.List_length_with.( - hashes = Tezos_crypto.Operation_hash.Set.cardinal unique_hashes) ; + hashes = Operation_hash.Set.cardinal unique_hashes) ; (* Remove all operations for the tested classification *) let bounded_map = match error_classification with @@ -557,7 +538,7 @@ module Bounded = struct | `Outdated _ -> t.outdated in let () = - Tezos_crypto.Operation_hash.Map.iter + Operation_hash.Map.iter (fun oph _op -> drop oph t) (Classification.map bounded_map) in @@ -580,35 +561,26 @@ end module To_map = struct let map_pp fmt x = let map_to_list m = - Tezos_crypto.Operation_hash.Map.to_seq m - |> Seq.map (fun (_, op) -> op) - |> List.of_seq + Operation_hash.Map.to_seq m |> Seq.map (fun (_, op) -> op) |> List.of_seq in let pp_pair fmt op = - Format.fprintf - fmt - "%a:%a" - Tezos_crypto.Operation_hash.pp - op.hash - Operation.pp - op.raw + Format.fprintf fmt "%a:%a" Operation_hash.pp op.hash Operation.pp op.raw in Format.fprintf fmt "%a" (Format.pp_print_list pp_pair) (map_to_list x) let map_eq = - Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> - Operation.equal op1.raw op2.raw) + Operation_hash.Map.equal (fun op1 op2 -> Operation.equal op1.raw op2.raw) (** [remove_all m1 m2] returns the subset of [m1] thas is not within [m2]. Said differently, [remove_all m1 m2] removes from [m1] all keys that are in [m2]. *) let remove_all m1 m2 = let keys2 = - Tezos_crypto.Operation_hash.Map.bindings m2 - |> List.map fst |> Tezos_crypto.Operation_hash.Set.of_list + Operation_hash.Map.bindings m2 + |> List.map fst |> Operation_hash.Set.of_list in - Tezos_crypto.Operation_hash.Map.filter - (fun key _val -> not (Tezos_crypto.Operation_hash.Set.mem key keys2)) + Operation_hash.Map.filter + (fun key _val -> not (Operation_hash.Set.mem key keys2)) m1 (** [eq_mod_binding m1 (k, v_opt) m2] holds iff: @@ -619,13 +591,12 @@ module To_map = struct for some unknown value [v]. *) let eq_mod_op m1 (k, v_opt) m2 = let diff = remove_all m2 m1 in - match (Tezos_crypto.Operation_hash.Map.bindings diff, v_opt) with + match (Operation_hash.Map.bindings diff, v_opt) with | [], _ -> true | [(kdiff, vdiff)], Some v - when Tezos_crypto.Operation_hash.equal kdiff k - && Operation.equal v.raw vdiff.raw -> + when Operation_hash.equal kdiff k && Operation.equal v.raw vdiff.raw -> true - | [(kdiff, _)], None when Tezos_crypto.Operation_hash.equal kdiff k -> true + | [(kdiff, _)], None when Operation_hash.equal kdiff k -> true | _ -> false (** [to_map_all] calls [Classification.to_map] with all named @@ -651,7 +622,7 @@ module To_map = struct qcheck_eq' ~pp:map_pp ~eq:map_eq - ~expected:Tezos_crypto.Operation_hash.Map.empty + ~expected:Operation_hash.Map.empty ~actual:(to_map_all t) () @@ -696,7 +667,7 @@ module To_map = struct "Starting with:@. %a@.and operation hash %a@. " Operation_map.pp (to_map_all t) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op.hash let test_map_remove_add = @@ -721,15 +692,15 @@ module To_map = struct let t' = Classification.Internal_for_tests.copy t in drop op.hash t ; let initial = to_map_all t in - let left = Tezos_crypto.Operation_hash.Map.add op.hash op initial in + let left = Operation_hash.Map.add op.hash op initial in Classification.add classification op t' ; let right = to_map_all t' in qcheck_eq' ~expected:left ~actual:right ~eq: - (Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> - Tezos_crypto.Operation_hash.equal op1.hash op2.hash)) + (Operation_hash.Map.equal (fun op1 op2 -> + Operation_hash.equal op1.hash op2.hash)) ~pp:map_pp () @@ -754,15 +725,15 @@ module To_map = struct let t' = Classification.Internal_for_tests.copy t in Classification.add classification op t ; let initial = to_map_all t in - let left = Tezos_crypto.Operation_hash.Map.remove op.hash initial in + let left = Operation_hash.Map.remove op.hash initial in drop op.hash t' ; let right = to_map_all t' in qcheck_eq' ~expected:left ~actual:right ~eq: - (Tezos_crypto.Operation_hash.Map.equal (fun op1 op2 -> - Tezos_crypto.Operation_hash.equal op1.hash op2.hash)) + (Operation_hash.Map.equal (fun op1 op2 -> + Operation_hash.equal op1.hash op2.hash)) ~pp:map_pp () @@ -799,12 +770,11 @@ module To_map = struct let oph = op.hash in let is_in_mempool = is_in_mempool oph t in let map = - to_map_all t - |> Tezos_crypto.Operation_hash.Map.filter (fun oph' _ -> oph' = oph) + to_map_all t |> Operation_hash.Map.filter (fun oph' _ -> oph' = oph) in qcheck_eq' ~expected:is_in_mempool - ~actual:(Tezos_crypto.Operation_hash.Map.cardinal map = 1) + ~actual:(Operation_hash.Map.cardinal map = 1) () (** Tests that [Classification.to_map] returns an empty map if all parameters @@ -818,7 +788,7 @@ module To_map = struct qcheck_eq' ~pp:map_pp ~eq:map_eq - ~expected:Tezos_crypto.Operation_hash.Map.empty + ~expected:Operation_hash.Map.empty ~actual: (Classification.Internal_for_tests.to_map ~applied:false diff --git a/src/lib_shell/test/test_prevalidator_classification_operations.ml b/src/lib_shell/test/test_prevalidator_classification_operations.ml index b4928d749b63..77fb127dc71e 100644 --- a/src/lib_shell/test/test_prevalidator_classification_operations.ml +++ b/src/lib_shell/test/test_prevalidator_classification_operations.ml @@ -43,7 +43,7 @@ open Qcheck2_helpers open Shell_operation -module Op_map = Tezos_crypto.Operation_hash.Map +module Op_map = Operation_hash.Map module Classification = Prevalidator_classification module Tree = Generators_tree.Tree module List_extra = Generators_tree.List_extra @@ -64,31 +64,25 @@ let values_from_to ~(equal : 'a -> 'a -> bool) (tree : 'a Tree.tree) |> force_opt ~loc:__LOC__ |> fun preds -> start :: preds -(** Pretty print values of type [Tezos_crypto.Operation_hash.Set.t] *) +(** Pretty print values of type [Operation_hash.Set.t] *) let op_set_pp fmt x = - let set_to_list m = Tezos_crypto.Operation_hash.Set.to_seq m |> List.of_seq in + let set_to_list m = Operation_hash.Set.to_seq m |> List.of_seq in Format.fprintf fmt "%a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) (set_to_list x) -(** Pretty print values of type [Operation.t Tezos_crypto.Operation_hash.Map] *) +(** Pretty print values of type [Operation.t Operation_hash.Map] *) let op_map_pp fmt x = let pp_pair fmt (hash, op) = - Format.fprintf - fmt - "%a:%a" - Tezos_crypto.Operation_hash.pp - hash - Operation.pp - op.raw + Format.fprintf fmt "%a:%a" Operation_hash.pp hash Operation.pp op.raw in Format.fprintf fmt "%a" (Format.pp_print_list pp_pair) - (Tezos_crypto.Operation_hash.Map.bindings x) + (Operation_hash.Map.bindings x) let qcheck_cond ?pp ~cond e1 e2 () = if cond e1 e2 then true @@ -110,22 +104,21 @@ let qcheck_cond ?pp ~cond e1 e2 () = pp e2 -let blocks_to_oph_set (blocks : Tezos_crypto.Operation_hash.t list list list) : - Tezos_crypto.Operation_hash.Set.t = - List.concat blocks |> List.concat |> Tezos_crypto.Operation_hash.Set.of_list +let blocks_to_oph_set (blocks : Operation_hash.t list list list) : + Operation_hash.Set.t = + List.concat blocks |> List.concat |> Operation_hash.Set.of_list (** [is_subset m1 m2] returns whether all bindings of [m1] are in [m2]. In other words, it returns whether [m2] is a superset of [m1]. *) let is_subset (m1 : unit operation Op_map.t) (m2 : unit operation Op_map.t) = - let rec go (m1_seq : (Tezos_crypto.Operation_hash.t * unit operation) Seq.t) = + let rec go (m1_seq : (Operation_hash.t * unit operation) Seq.t) = match m1_seq () with | Seq.Nil -> true | Seq.Cons ((m1_key, m1_value), m1_rest) -> ( match Op_map.find m1_key m2 with | None -> (* A key in [m1] that is not in [m2] *) false | Some m2_value -> - Tezos_crypto.Operation_hash.equal m1_value.hash m2_value.hash - && go m1_rest) + Operation_hash.equal m1_value.hash m2_value.hash && go m1_rest) in go (Op_map.to_seq m1) @@ -154,10 +147,7 @@ module Handle_operations = struct List.map (fun (blk : Block.t) -> blk.bhash) live_blocks in return - ( tree, - pair_blocks_opt, - old_mempool, - Tezos_crypto.Block_hash.Set.of_list live_blocks ) + (tree, pair_blocks_opt, old_mempool, Block_hash.Set.of_list live_blocks) in QCheck2.Test.make ~name:"[handle_live_operations] is a subset of alive blocks" @@ -172,7 +162,7 @@ module Handle_operations = struct (* Keep only the ones in live_blocks *) |> List.to_seq |> Seq.filter (fun (blk : Block.t) -> - Tezos_crypto.Block_hash.Set.mem blk.bhash live_blocks) + Block_hash.Set.mem blk.bhash live_blocks) (* Then extract (oph, op) pairs from them *) |> Seq.flat_map (fun (blk : Block.t) -> List.to_seq blk.operations) |> Seq.flat_map List.to_seq @@ -187,7 +177,7 @@ module Handle_operations = struct ~from_branch ~to_branch ~is_branch_alive:(fun blk_hash -> - Tezos_crypto.Block_hash.Set.mem blk_hash live_blocks) + Block_hash.Set.mem blk_hash live_blocks) ~parse old_mempool |> Lwt_main.run @@ -224,9 +214,7 @@ module Handle_operations = struct (* Expected operations are the ones from [ancestor] to [from_branch], minus the ones from ancestor to [to_branch]. *) let expected = - Tezos_crypto.Operation_hash.Set.diff - expected_superset - from_ancestor_to_to_branch + Operation_hash.Set.diff expected_superset from_ancestor_to_to_branch in let actual = Classification.Internal_for_tests.handle_live_operations @@ -237,16 +225,11 @@ module Handle_operations = struct ~to_branch ~is_branch_alive:(Fun.const true) ~parse - Tezos_crypto.Operation_hash.Map.empty + Operation_hash.Map.empty |> Lwt_main.run |> Op_map.bindings |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + |> Operation_hash.Set.of_list in - qcheck_eq' - ~pp:op_set_pp - ~eq:Tezos_crypto.Operation_hash.Set.equal - ~expected - ~actual - () + qcheck_eq' ~pp:op_set_pp ~eq:Operation_hash.Set.equal ~expected ~actual () (** Test that operations cleared by [handle_live_operations] are operations on the path from [ancestor] to [to_branch] (when all @@ -259,10 +242,8 @@ module Handle_operations = struct QCheck2.assume @@ Option.is_some pair_blocks_opt ; let from_branch, to_branch = force_opt ~loc:__LOC__ pair_blocks_opt in let chain = Generators_tree.classification_chain_tools tree in - let cleared = ref Tezos_crypto.Operation_hash.Set.empty in - let clearer oph = - cleared := Tezos_crypto.Operation_hash.Set.add oph !cleared - in + let cleared = ref Operation_hash.Set.empty in + let clearer oph = cleared := Operation_hash.Set.add oph !cleared in let chain = {chain with clear_or_cancel = clearer} in let equal = Block.equal in let ancestor : Block.t = @@ -287,7 +268,7 @@ module Handle_operations = struct |> Lwt_main.run |> ignore ; qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset !cleared expected_superset () @@ -302,9 +283,9 @@ module Handle_operations = struct QCheck2.assume @@ Option.is_some pair_blocks_opt ; let from_branch, to_branch = force_opt ~loc:__LOC__ pair_blocks_opt in let chain = Generators_tree.classification_chain_tools tree in - let injected = ref Tezos_crypto.Operation_hash.Set.empty in + let injected = ref Operation_hash.Set.empty in let inject_operation oph _op = - injected := Tezos_crypto.Operation_hash.Set.add oph !injected ; + injected := Operation_hash.Set.add oph !injected ; Lwt.return_unit in let chain = {chain with inject_operation} in @@ -331,7 +312,7 @@ module Handle_operations = struct |> Lwt_main.run |> ignore ; qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset !injected expected_superset () @@ -350,7 +331,7 @@ module Recyle_operations = struct let classification_of_ops_gen (ops : unit operation Op_map.t) : unit Classification.t QCheck2.Gen.t = let open QCheck2.Gen in - let ops = Tezos_crypto.Operation_hash.Map.bindings ops |> List.map snd in + let ops = Operation_hash.Map.bindings ops |> List.map snd in let length = List.length ops in let* empty_space = 0 -- 100 in (* To avoid throwing part of [ops], we want the capacity of the classification @@ -450,7 +431,7 @@ module Recyle_operations = struct ~chain ~from_branch ~to_branch - ~live_blocks:Tezos_crypto.Block_hash.Set.empty + ~live_blocks:Block_hash.Set.empty ~classes ~pending ~handle_branch_refused @@ -477,21 +458,19 @@ module Recyle_operations = struct Tree.find_ancestor ~equal tree from_branch to_branch |> force_opt ~loc:__LOC__ in - let live_blocks : Tezos_crypto.Block_hash.Set.t = - Tree.values tree |> List.map Block.to_hash - |> Tezos_crypto.Block_hash.Set.of_list + let live_blocks : Block_hash.Set.t = + Tree.values tree |> List.map Block.to_hash |> Block_hash.Set.of_list in (* This is inherited from the behavior of [handle_live_operations] *) - let expected_from_tree : Tezos_crypto.Operation_hash.Set.t = + let expected_from_tree : Operation_hash.Set.t = List.map Block.tools.all_operation_hashes (values_from_to ~equal tree from_branch ancestor) |> blocks_to_oph_set in (* This is coming from [recycle_operations] itself *) - let op_map_to_hash_list (m : 'a Tezos_crypto.Operation_hash.Map.t) = - Op_map.bindings m |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + let op_map_to_hash_list (m : 'a Operation_hash.Map.t) = + Op_map.bindings m |> List.map fst |> Operation_hash.Set.of_list in let expected_from_classification = Classification.Internal_for_tests.to_map @@ -505,15 +484,15 @@ module Recyle_operations = struct |> op_map_to_hash_list in let expected_from_pending = op_map_to_hash_list pending in - let expected_superset : Tezos_crypto.Operation_hash.Set.t = - Tezos_crypto.Operation_hash.Set.union - (Tezos_crypto.Operation_hash.Set.union + let expected_superset : Operation_hash.Set.t = + Operation_hash.Set.union + (Operation_hash.Set.union expected_from_tree expected_from_classification) expected_from_pending in let parse raw hash = Some (make_operation hash raw ()) in - let actual : Tezos_crypto.Operation_hash.Set.t = + let actual : Operation_hash.Set.t = Classification.recycle_operations ~block_store:Block.tools ~chain @@ -525,11 +504,11 @@ module Recyle_operations = struct ~handle_branch_refused ~parse |> Lwt_main.run |> Op_map.bindings |> List.map fst - |> Tezos_crypto.Operation_hash.Set.of_list + |> Operation_hash.Set.of_list in qcheck_cond ~pp:op_set_pp - ~cond:Tezos_crypto.Operation_hash.Set.subset + ~cond:Operation_hash.Set.subset actual expected_superset () @@ -542,9 +521,8 @@ module Recyle_operations = struct QCheck2.Gen.(pair gen bool) @@ fun ((tree, pair_blocks_opt, classes, pending), handle_branch_refused) -> QCheck2.assume @@ Option.is_some pair_blocks_opt ; - let live_blocks : Tezos_crypto.Block_hash.Set.t = - Tree.values tree |> List.map Block.to_hash - |> Tezos_crypto.Block_hash.Set.of_list + let live_blocks : Block_hash.Set.t = + Tree.values tree |> List.map Block.to_hash |> Block_hash.Set.of_list in let expected : unit operation Op_map.t = Classification.Internal_for_tests.to_map diff --git a/src/lib_shell/test/test_prevalidator_pending_operations.ml b/src/lib_shell/test/test_prevalidator_pending_operations.ml index b3f47b968cab..9a368eb8a5ed 100644 --- a/src/lib_shell/test/test_prevalidator_pending_operations.ml +++ b/src/lib_shell/test/test_prevalidator_pending_operations.ml @@ -48,7 +48,7 @@ let pending_of_list = List.fold_left (fun pendings (op, priority) -> if - Tezos_crypto.Operation_hash.Set.mem + Operation_hash.Set.mem (Shell_operation.Internal_for_tests.hash_of op) (Pending_ops.hashes pendings) then (* no duplicate hashes *) diff --git a/src/lib_shell/test/test_protocol_validator.ml b/src/lib_shell/test/test_protocol_validator.ml index 0f491e4cacdb..33dcfdc49c7d 100644 --- a/src/lib_shell/test/test_protocol_validator.ml +++ b/src/lib_shell/test/test_protocol_validator.ml @@ -53,11 +53,11 @@ module Alcotest_protocol_validator = struct let eq (p1 : t) (p2 : t) : bool = let (module P1) = p1 in let (module P2) = p2 in - Tezos_crypto.Protocol_hash.equal P1.hash P2.hash + Protocol_hash.equal P1.hash P2.hash in let pp fmt (p : t) = let (module P) = p in - Tezos_crypto.Protocol_hash.pp fmt P.hash + Protocol_hash.pp fmt P.hash in Alcotest.testable pp eq end @@ -97,9 +97,7 @@ let test_pushing_validator_protocol vl _switch () = (* Let's validate a phony protocol *) let open Lwt_syntax in let pt = Protocol.{expected_env = V0; components = []} in - let* res = - Protocol_validator.validate vl Tezos_crypto.Protocol_hash.zero pt - in + let* res = Protocol_validator.validate vl Protocol_hash.zero pt in Alcotest.( check (Tztestable.tzresults Alcotest_protocol_validator.registered_protocol)) "Compilation should fail." @@ -107,7 +105,7 @@ let test_pushing_validator_protocol vl _switch () = (Error [ Validation_errors.Invalid_protocol - {hash = Tezos_crypto.Protocol_hash.zero; error = Compilation_failed}; + {hash = Protocol_hash.zero; error = Compilation_failed}; ]) ; Mock_sink.( assert_has_event @@ -156,7 +154,7 @@ let test_fetching_protocol vl _switch () = ~peer:P2p_peer.Id.zero ~timeout:Ptime.Span.zero vl - Tezos_crypto.Protocol_hash.zero + Protocol_hash.zero in Mock_sink.( assert_has_event diff --git a/src/lib_shell/test/test_shell_operation.ml b/src/lib_shell/test/test_shell_operation.ml index 1dce02e0e9fb..dc1f4df19054 100644 --- a/src/lib_shell/test/test_shell_operation.ml +++ b/src/lib_shell/test/test_shell_operation.ml @@ -68,22 +68,21 @@ module Classification = Prevalidator_classification module Parameters : Requester_impl.PARAMETERS - with type key = Tezos_crypto.Operation_hash.t + with type key = Operation_hash.t and type value = int = struct - type key = Tezos_crypto.Operation_hash.t + type key = Operation_hash.t type value = int end -module Hash : Requester.HASH with type t = Tezos_crypto.Operation_hash.t = -struct +module Hash : Requester.HASH with type t = Operation_hash.t = struct type t = Parameters.key let name = "test_with_key_Operation_hash_dot_t" - let encoding = Tezos_crypto.Operation_hash.encoding + let encoding = Operation_hash.encoding - let pp = Tezos_crypto.Operation_hash.pp + let pp = Operation_hash.pp end module Test_request = Requester_impl.Simple_request (Parameters) @@ -109,7 +108,7 @@ let mk_operation n : Operation.t = let base_prefix = String.sub base 0 (base_len - n_string_len) in let hash_string = base_prefix ^ n_string in assert (String.length hash_string = base_len) ; - let branch = Tezos_crypto.Block_hash.of_string_exn hash_string in + let branch = Block_hash.of_string_exn hash_string in let proto = Bytes.of_string n_string in {shell = {branch}; proto} @@ -176,9 +175,7 @@ let test_in_mempool_leak f (nb_ops : int) (_ : unit) = f [] op classes in List.iter handle (1 -- nb_ops) ; - let actual_in_mempool_size = - Tezos_crypto.Operation_hash.Map.cardinal classes.in_mempool - in + let actual_in_mempool_size = Operation_hash.Map.cardinal classes.in_mempool in Alcotest.( check bool @@ -209,7 +206,7 @@ let test_db_do_not_clear_right_away f (nb_ops : int) (_ : unit) = let op = mk_operation i in let oph = Operation.hash op in let op = Shell_operation.Internal_for_tests.make_operation op oph () in - Format.printf "Injecting op: %a\n" Tezos_crypto.Operation_hash.pp oph ; + Format.printf "Injecting op: %a\n" Operation_hash.pp oph ; let injected = Lwt_main.run @@ Test_Requester.inject requester oph i in assert injected ; f [] op classes ; @@ -218,7 +215,7 @@ let test_db_do_not_clear_right_away f (nb_ops : int) (_ : unit) = bool (Format.asprintf "requester memory contains most recent classified operation (%a)" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) (Option.is_some @@ Lwt_main.run @@ Test_Requester.read_opt requester oph) true) diff --git a/src/lib_shell/validator.ml b/src/lib_shell/validator.ml index 2381a3865dc3..391a8088bd55 100644 --- a/src/lib_shell/validator.ml +++ b/src/lib_shell/validator.ml @@ -117,7 +117,7 @@ let read_block_header db h = let validate_block v ?(force = false) ?chain_id bytes operations = let open Lwt_result_syntax in - let hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let hash = Block_hash.hash_bytes [bytes] in match Block_header.of_bytes bytes with | None -> failwith "Cannot parse block header." | Some block -> @@ -132,7 +132,7 @@ let validate_block v ?(force = false) ?chain_id bytes operations = | None -> failwith "Unknown predecessor (%a), cannot inject the block." - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block.shell.predecessor | Some (chain_id, _bh) -> Lwt.return (get v chain_id)) | Some chain_id -> ( @@ -149,7 +149,7 @@ let validate_block v ?(force = false) ?chain_id bytes operations = | false -> failwith "Unknown predecessor (%a), cannot inject the block." - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block.shell.predecessor) in let validation = @@ -202,7 +202,7 @@ let inject_operation v ?chain_id ~force op = else failwith "Unknown branch (%a), cannot inject the operation." - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short op.shell.branch | Some (chain_id, _bh) -> let*? nv = get v chain_id in diff --git a/src/lib_shell/validator.mli b/src/lib_shell/validator.mli index cbcc8420e8c8..fd690fe4a310 100644 --- a/src/lib_shell/validator.mli +++ b/src/lib_shell/validator.mli @@ -60,7 +60,7 @@ val validate_block : ?chain_id:Tezos_crypto.Chain_id.t -> Bytes.t -> Operation.t list list -> - (Tezos_crypto.Block_hash.t * unit tzresult Lwt.t) tzresult Lwt.t + (Block_hash.t * unit tzresult Lwt.t) tzresult Lwt.t (** Monitor all the valid block (for all activate chains). *) val watcher : t -> Store.Block.t Lwt_stream.t * Lwt_watcher.stopper diff --git a/src/lib_shell_benchmarks/io_benchmarks.ml b/src/lib_shell_benchmarks/io_benchmarks.ml index fab45ee1e149..cb17ae2daa40 100644 --- a/src/lib_shell_benchmarks/io_benchmarks.ml +++ b/src/lib_shell_benchmarks/io_benchmarks.ml @@ -868,13 +868,13 @@ let () = Registration.register (module Irmin_pack_write_bench) module Read_random_key_bench : Benchmark.S = struct type config = { - existing_context : string * Tezos_crypto.Context_hash.t; + existing_context : string * Context_hash.t; subdirectory : string list; } let default_config = { - existing_context = ("/no/such/directory", Tezos_crypto.Context_hash.zero); + existing_context = ("/no/such/directory", Context_hash.zero); subdirectory = ["no"; "such"; "key"]; } @@ -884,9 +884,7 @@ module Read_random_key_bench : Benchmark.S = struct (fun {existing_context; subdirectory} -> (existing_context, subdirectory)) (fun (existing_context, subdirectory) -> {existing_context; subdirectory}) (obj2 - (req - "existing_context" - (tup2 string Tezos_crypto.Context_hash.encoding)) + (req "existing_context" (tup2 string Context_hash.encoding)) (req "subdirectory" (list string))) let name = ns "READ_RANDOM_KEY" @@ -978,7 +976,7 @@ module Write_random_keys_bench : Benchmark.S = struct open Base_samplers type config = { - existing_context : string * Tezos_crypto.Context_hash.t; + existing_context : string * Context_hash.t; storage_chunk_bytes : int; storage_chunks : range; max_written_keys : int; @@ -988,7 +986,7 @@ module Write_random_keys_bench : Benchmark.S = struct let default_config = { - existing_context = ("/no/such/directory", Tezos_crypto.Context_hash.zero); + existing_context = ("/no/such/directory", Context_hash.zero); storage_chunk_bytes = 1000; storage_chunks = {min = 1; max = 1000}; max_written_keys = 10_000; @@ -1029,9 +1027,7 @@ module Write_random_keys_bench : Benchmark.S = struct subdirectory; }) (obj6 - (req - "existing_context" - (tup2 string Tezos_crypto.Context_hash.encoding)) + (req "existing_context" (tup2 string Context_hash.encoding)) (req "storage_chunk_bytes" int) (req "storage_chunks" range_encoding) (req "max_written_keys" int) diff --git a/src/lib_shell_benchmarks/io_helpers.ml b/src/lib_shell_benchmarks/io_helpers.ml index ee13463f7673..6e3c8c7e30bb 100644 --- a/src/lib_shell_benchmarks/io_helpers.ml +++ b/src/lib_shell_benchmarks/io_helpers.ml @@ -37,7 +37,7 @@ let prepare_genesis base_dir = let open Lwt_result_syntax in let*! index = Tezos_context.Context.init ~readonly:false base_dir in let genesis_block = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisGeneskvg68z" in let* context_hash = @@ -45,7 +45,7 @@ let prepare_genesis base_dir = index ~chain_id:(Tezos_crypto.Chain_id.of_block_hash genesis_block) ~time:(Time.Protocol.of_seconds 0L) - ~protocol:Tezos_crypto.Protocol_hash.zero + ~protocol:Protocol_hash.zero in let*! o = Tezos_context.Context.checkout index context_hash in match o with diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 616a831aac87..3f1a66cb9b99 100644 --- a/src/lib_shell_services/block_services.ml +++ b/src/lib_shell_services/block_services.ml @@ -76,7 +76,7 @@ type block = [ `Genesis | `Head of int | `Alias of [`Caboose | `Checkpoint | `Savepoint] * int - | `Hash of Tezos_crypto.Block_hash.t * int + | `Hash of Block_hash.t * int | `Level of Int32.t ] let parse_block s = @@ -132,17 +132,17 @@ let parse_block s = Ok (`Alias (`Caboose, int_of_string n)) | ["caboose"; n], '+' -> Ok (`Alias (`Caboose, -int_of_string n)) | [hol], _ -> ( - match Tezos_crypto.Block_hash.of_b58check_opt hol with + match Block_hash.of_b58check_opt hol with | Some h -> Ok (`Hash (h, 0)) | None -> to_level (to_valid_level_id s)) | [hol; n], '~' | [hol; n], '-' -> ( - match Tezos_crypto.Block_hash.of_b58check_opt hol with + match Block_hash.of_b58check_opt hol with | Some h -> Ok (`Hash (h, int_of_string n)) | None -> let offset = to_valid_level_id n in to_level ~offset (to_valid_level_id hol)) | [hol; n], '+' -> ( - match Tezos_crypto.Block_hash.of_b58check_opt hol with + match Block_hash.of_b58check_opt hol with | Some h -> Ok (`Hash (h, -int_of_string n)) | None -> let offset = Int32.neg (to_valid_level_id n) in @@ -189,11 +189,10 @@ let to_string = function | `Head 0 -> "head" | `Head n when n < 0 -> Printf.sprintf "head+%d" (-n) | `Head n -> Printf.sprintf "head~%d" n - | `Hash (h, 0) -> Tezos_crypto.Block_hash.to_b58check h + | `Hash (h, 0) -> Block_hash.to_b58check h | `Hash (h, n) when n < 0 -> - Printf.sprintf "%s+%d" (Tezos_crypto.Block_hash.to_b58check h) (-n) - | `Hash (h, n) -> - Printf.sprintf "%s~%d" (Tezos_crypto.Block_hash.to_b58check h) n + Printf.sprintf "%s+%d" (Block_hash.to_b58check h) (-n) + | `Hash (h, n) -> Printf.sprintf "%s~%d" (Block_hash.to_b58check h) n | `Level i -> Printf.sprintf "%d" (Int32.to_int i) let blocks_arg = @@ -336,7 +335,7 @@ let merkle_tree_encoding : Proof.merkle_tree Data_encoding.t = ])) module type PROTO = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t type block_header_data @@ -364,8 +363,8 @@ module type PROTO = sig end type protocols = { - current_protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + current_protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; } let raw_protocol_encoding = @@ -373,14 +372,13 @@ let raw_protocol_encoding = (fun {current_protocol; next_protocol} -> (current_protocol, next_protocol)) (fun (current_protocol, next_protocol) -> {current_protocol; next_protocol}) (obj2 - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding)) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding)) module Make (Proto : PROTO) (Next_proto : PROTO) = struct - let protocol_hash = Tezos_crypto.Protocol_hash.to_b58check Proto.hash + let protocol_hash = Protocol_hash.to_b58check Proto.hash - let next_protocol_hash = - Tezos_crypto.Protocol_hash.to_b58check Next_proto.hash + let next_protocol_hash = Protocol_hash.to_b58check Next_proto.hash type raw_block_header = { shell : Block_header.shell_header; @@ -398,7 +396,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct type block_header = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; } @@ -414,7 +412,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (obj3 (req "protocol" (constant protocol_hash)) (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "hash" Tezos_crypto.Block_hash.encoding)) + (req "hash" Block_hash.encoding)) raw_block_header_encoding) type block_metadata = { @@ -494,7 +492,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct type operation = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Operation_hash.t; + hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; receipt : operation_receipt; @@ -544,14 +542,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (obj3 (req "protocol" (constant protocol_hash)) (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "hash" Tezos_crypto.Operation_hash.encoding)) + (req "hash" Operation_hash.encoding)) (merge_objs (dynamic_size Operation.shell_header_encoding) (dynamic_size operation_data_encoding))) type block_info = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : raw_block_header; metadata : block_metadata option; operations : operation list list; @@ -566,7 +564,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (obj6 (req "protocol" (constant protocol_hash)) (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "header" (dynamic_size raw_block_header_encoding)) (opt "metadata" (dynamic_size block_metadata_encoding)) (req "operations" (list (dynamic_size (list operation_encoding))))) @@ -578,7 +576,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct Tezos_rpc.Service.get_service ~description:"The block's hash, its unique identifier." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Block_hash.encoding + ~output:Block_hash.encoding Tezos_rpc.Path.(path / "hash") let header = @@ -608,7 +606,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "Hash of the metadata associated to the block. This is only set on \ blocks starting from environment V1." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Block_metadata_hash.encoding + ~output:Block_metadata_hash.encoding Tezos_rpc.Path.(path / "metadata_hash") let protocols = @@ -622,7 +620,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct Tezos_rpc.Service.get_service ~description:"Context hash resulting of the block application." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Context_hash.encoding + ~output:Context_hash.encoding Tezos_rpc.Path.(path / "resulting_context_hash") module Header = struct @@ -740,7 +738,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct Tezos_rpc.Service.get_service ~description:"The hashes of all the operations included in the block." ~query:Tezos_rpc.Query.empty - ~output:(list (list Tezos_crypto.Operation_hash.encoding)) + ~output:(list (list Operation_hash.encoding)) path let operation_hashes_in_pass = @@ -749,7 +747,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "All the operations included in `n-th` validation pass of the \ block." ~query:Tezos_rpc.Query.empty - ~output:(list Tezos_crypto.Operation_hash.encoding) + ~output:(list Operation_hash.encoding) Tezos_rpc.Path.(path /: Operations.list_arg) let operation_hash = @@ -758,7 +756,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "The hash of then `m-th` operation in the `n-th` validation pass \ of the block." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Operation_hash.encoding + ~output:Operation_hash.encoding Tezos_rpc.Path.(path /: Operations.list_arg /: Operations.offset_arg) end @@ -769,7 +767,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "The root hash of the operations metadata from the block. This is \ only set on blocks starting from environment V1." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Operation_metadata_list_list_hash.encoding + ~output:Operation_metadata_list_list_hash.encoding Tezos_rpc.Path.(path / "operations_metadata_hash") let path = Tezos_rpc.Path.(path / "operation_metadata_hashes") @@ -780,7 +778,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "The hashes of all the operation metadata included in the block. \ This is only set on blocks starting from environment V1." ~query:Tezos_rpc.Query.empty - ~output:(list (list Tezos_crypto.Operation_metadata_hash.encoding)) + ~output:(list (list Operation_metadata_hash.encoding)) path let operation_metadata_hashes_in_pass = @@ -790,7 +788,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct the block. This is only set on blocks starting from environment \ V1." ~query:Tezos_rpc.Query.empty - ~output:(list Tezos_crypto.Operation_metadata_hash.encoding) + ~output:(list Operation_metadata_hash.encoding) Tezos_rpc.Path.(path /: Operations.list_arg) let operation_metadata_hash = @@ -800,7 +798,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct validation pass of the block. This is only set on blocks starting \ from environment V1." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Operation_metadata_hash.encoding + ~output:Operation_metadata_hash.encoding Tezos_rpc.Path.(path /: Operations.list_arg /: Operations.offset_arg) end @@ -983,16 +981,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct module Mempool = struct type t = { - applied : (Tezos_crypto.Operation_hash.t * Next_proto.operation) list; - refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - outdated : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; + applied : (Operation_hash.t * Next_proto.operation) list; + refused : (Next_proto.operation * error list) Operation_hash.Map.t; + outdated : (Next_proto.operation * error list) Operation_hash.Map.t; branch_refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; + (Next_proto.operation * error list) Operation_hash.Map.t; branch_delayed : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - unprocessed : Next_proto.operation Tezos_crypto.Operation_hash.Map.t; + (Next_proto.operation * error list) Operation_hash.Map.t; + unprocessed : Next_proto.operation Operation_hash.Map.t; } let version_0_encoding = @@ -1036,37 +1032,36 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (hash, {shell; protocol_data})) (merge_objs (merge_objs - (obj1 - (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) (dynamic_size Operation.shell_header_encoding)) (dynamic_size Next_proto.operation_data_encoding))))) (req "refused" - (Tezos_crypto.Operation_hash.Map.encoding + (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "outdated" - (Tezos_crypto.Operation_hash.Map.encoding + (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "branch_refused" - (Tezos_crypto.Operation_hash.Map.encoding + (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "branch_delayed" - (Tezos_crypto.Operation_hash.Map.encoding + (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "unprocessed" - (Tezos_crypto.Operation_hash.Map.encoding + (Operation_hash.Map.encoding (dynamic_size next_operation_encoding)))) let version_1_encoding = @@ -1074,12 +1069,11 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct req kind (conv - (fun map -> Tezos_crypto.Operation_hash.Map.bindings map) - (fun list -> - list |> List.to_seq |> Tezos_crypto.Operation_hash.Map.of_seq) + (fun map -> Operation_hash.Map.bindings map) + (fun list -> list |> List.to_seq |> Operation_hash.Map.of_seq) (list (merge_objs - (obj1 (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) (merge_objs next_operation_encoding (obj1 (req "error" Tezos_rpc.Error.encoding)))))) @@ -1124,8 +1118,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (hash, {shell; protocol_data})) (merge_objs (merge_objs - (obj1 - (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) Operation.shell_header_encoding) (dynamic_size Next_proto.operation_data_encoding))))) (operations_with_error_encoding "refused") @@ -1135,14 +1128,12 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (req "unprocessed" (conv - (fun map -> Tezos_crypto.Operation_hash.Map.bindings map) + (fun map -> Operation_hash.Map.bindings map) (fun list -> - list |> List.to_seq - |> Tezos_crypto.Operation_hash.Map.of_seq) + list |> List.to_seq |> Operation_hash.Map.of_seq) (list (merge_objs - (obj1 - (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) next_operation_encoding))))) (* This encoding should be always the one by default. *) @@ -1275,7 +1266,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct future. Note: If the baker has already received the operation, \ then it's necessary to restart it to flush the operation from it." ~query:Tezos_rpc.Query.empty - ~input:Tezos_crypto.Operation_hash.encoding + ~input:Operation_hash.encoding ~output:unit Tezos_rpc.Path.(path / "ban_operation") @@ -1285,7 +1276,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct "Remove an operation from the set of banned operations (nothing \ happens if it was not banned)." ~query:Tezos_rpc.Query.empty - ~input:Tezos_crypto.Operation_hash.encoding + ~input:Operation_hash.encoding ~output:unit Tezos_rpc.Path.(path / "unban_operation") @@ -1364,7 +1355,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let processed_operation_encoding = merge_objs (merge_objs - (obj1 (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) next_operation_encoding) (obj1 (dft "error" Tezos_rpc.Error.opt_encoding None)) @@ -1433,7 +1424,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct branch in an operation header, are recent enough for that operation \ to be included in the current block." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Block_hash.Set.encoding + ~output:Block_hash.Set.encoding Tezos_rpc.Path.(live_blocks_path open_root) end @@ -1667,16 +1658,12 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct module Mempool = struct type t = S.Mempool.t = { - applied : (Tezos_crypto.Operation_hash.t * Next_proto.operation) list; - refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - outdated : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - branch_refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - branch_delayed : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - unprocessed : Next_proto.operation Tezos_crypto.Operation_hash.Map.t; + applied : (Operation_hash.t * Next_proto.operation) list; + refused : (Next_proto.operation * error list) Operation_hash.Map.t; + outdated : (Next_proto.operation * error list) Operation_hash.Map.t; + branch_refused : (Next_proto.operation * error list) Operation_hash.Map.t; + branch_delayed : (Next_proto.operation * error list) Operation_hash.Map.t; + unprocessed : Next_proto.operation Operation_hash.Map.t; } type t_with_version = S.Mempool.t_with_version = @@ -1770,7 +1757,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct end module Fake_protocol = struct - let hash = Tezos_crypto.Protocol_hash.zero + let hash = Protocol_hash.zero type block_header_data = unit diff --git a/src/lib_shell_services/block_services.mli b/src/lib_shell_services/block_services.mli index 64eedb5cdb17..84af7a80a6b8 100644 --- a/src/lib_shell_services/block_services.mli +++ b/src/lib_shell_services/block_services.mli @@ -51,7 +51,7 @@ type block = (** The [n]th predecessor of the [caboose], the [checkpoint] or the [savepoint] if [n > 0]. If [n = 0], represents the block itself. If [n < 0], represents the [n]th successor. *) - | `Hash of Tezos_crypto.Block_hash.t * int + | `Hash of Block_hash.t * int (** The [n]th predecessor of the block of given [hash] if [n > 0]. If [n = 0], represents the block itself. Otherwise, if [n < 0], represents the [n]th successor.*) @@ -91,7 +91,7 @@ val raw_context_insert : string list * Proof.raw_context -> Proof.raw_context -> Proof.raw_context module type PROTO = sig - val hash : Tezos_crypto.Protocol_hash.t + val hash : Protocol_hash.t type block_header_data @@ -119,8 +119,8 @@ module type PROTO = sig end type protocols = { - current_protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + current_protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; } val protocols : @@ -140,7 +140,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig type block_header = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; } @@ -161,7 +161,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig type operation = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Operation_hash.t; + hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; receipt : operation_receipt; @@ -169,7 +169,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig type block_info = { chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : raw_block_header; metadata : block_metadata option; operations : operation list list; @@ -193,7 +193,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t val raw_header : #simple -> ?chain:chain -> ?block:block -> unit -> Bytes.t tzresult Lwt.t @@ -217,14 +217,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Block_metadata_hash.t tzresult Lwt.t + Block_metadata_hash.t tzresult Lwt.t val resulting_context_hash : #simple -> ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Context_hash.t tzresult Lwt.t + Context_hash.t tzresult Lwt.t module Header : sig val shell_header : @@ -281,14 +281,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Operation_hash.t list list tzresult Lwt.t + Operation_hash.t list list tzresult Lwt.t val operation_hashes_in_pass : #simple -> ?chain:chain -> ?block:block -> int -> - Tezos_crypto.Operation_hash.t list tzresult Lwt.t + Operation_hash.t list tzresult Lwt.t val operation_hash : #simple -> @@ -296,7 +296,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?block:block -> int -> int -> - Tezos_crypto.Operation_hash.t tzresult Lwt.t + Operation_hash.t tzresult Lwt.t end module Operation_metadata_hashes : sig @@ -305,21 +305,21 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Operation_metadata_list_list_hash.t tzresult Lwt.t + Operation_metadata_list_list_hash.t tzresult Lwt.t val operation_metadata_hashes : #simple -> ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Operation_metadata_hash.t list list tzresult Lwt.t + Operation_metadata_hash.t list list tzresult Lwt.t val operation_metadata_hashes_in_pass : #simple -> ?chain:chain -> ?block:block -> int -> - Tezos_crypto.Operation_metadata_hash.t list tzresult Lwt.t + Operation_metadata_hash.t list tzresult Lwt.t val operation_metadata_hash : #simple -> @@ -327,7 +327,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?block:block -> int -> int -> - Tezos_crypto.Operation_metadata_hash.t tzresult Lwt.t + Operation_metadata_hash.t tzresult Lwt.t end module Context : sig @@ -389,16 +389,12 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig module Mempool : sig type t = { - applied : (Tezos_crypto.Operation_hash.t * Next_proto.operation) list; - refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - outdated : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - branch_refused : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - branch_delayed : - (Next_proto.operation * error list) Tezos_crypto.Operation_hash.Map.t; - unprocessed : Next_proto.operation Tezos_crypto.Operation_hash.Map.t; + applied : (Operation_hash.t * Next_proto.operation) list; + refused : (Next_proto.operation * error list) Operation_hash.Map.t; + outdated : (Next_proto.operation * error list) Operation_hash.Map.t; + branch_refused : (Next_proto.operation * error list) Operation_hash.Map.t; + branch_delayed : (Next_proto.operation * error list) Operation_hash.Map.t; + unprocessed : Next_proto.operation Operation_hash.Map.t; } type t_with_version @@ -432,14 +428,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig val ban_operation : #simple -> ?chain:chain -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> unit Tezos_error_monad.Error_monad.tzresult Lwt.t (** Call RPC POST /chains/[chain]/mempool/unban_operation *) val unban_operation : #simple -> ?chain:chain -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> unit Tezos_error_monad.Error_monad.tzresult Lwt.t (** Call RPC POST /chains/[chain]/mempool/unban_all_operations *) @@ -460,9 +456,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?outdated:bool -> ?validation_passes:int list -> unit -> - (((Tezos_crypto.Operation_hash.t * Next_proto.operation) - * error trace option) - list + (((Operation_hash.t * Next_proto.operation) * error trace option) list Lwt_stream.t * stopper) tzresult @@ -482,17 +476,11 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ?chain:chain -> ?block:block -> unit -> - Tezos_crypto.Block_hash.Set.t tzresult Lwt.t + Block_hash.Set.t tzresult Lwt.t module S : sig val hash : - ( [`GET], - prefix, - prefix, - unit, - unit, - Tezos_crypto.Block_hash.t ) - Tezos_rpc.Service.t + ([`GET], prefix, prefix, unit, unit, Block_hash.t) Tezos_rpc.Service.t val info : ( [`GET], @@ -518,20 +506,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix, unit, unit, - Tezos_crypto.Block_metadata_hash.t ) + Block_metadata_hash.t ) Tezos_rpc.Service.t val protocols : ([`GET], prefix, prefix, unit, unit, protocols) Tezos_rpc.Service.t val resulting_context_hash : - ( [`GET], - prefix, - prefix, - unit, - unit, - Tezos_crypto.Context_hash.t ) - Tezos_rpc.Service.t + ([`GET], prefix, prefix, unit, unit, Context_hash.t) Tezos_rpc.Service.t module Header : sig val shell_header : @@ -592,7 +574,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix, unit, unit, - Tezos_crypto.Operation_hash.t list list ) + Operation_hash.t list list ) Tezos_rpc.Service.t val operation_hashes_in_pass : @@ -601,7 +583,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix * int, unit, unit, - Tezos_crypto.Operation_hash.t list ) + Operation_hash.t list ) Tezos_rpc.Service.t val operation_hash : @@ -610,7 +592,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig (prefix * int) * int, unit, unit, - Tezos_crypto.Operation_hash.t ) + Operation_hash.t ) Tezos_rpc.Service.t end @@ -621,7 +603,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix, unit, unit, - Tezos_crypto.Operation_metadata_list_list_hash.t ) + Operation_metadata_list_list_hash.t ) Tezos_rpc.Service.t val operation_metadata_hashes : @@ -630,7 +612,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix, unit, unit, - Tezos_crypto.Operation_metadata_hash.t list list ) + Operation_metadata_hash.t list list ) Tezos_rpc.Service.t val operation_metadata_hashes_in_pass : @@ -639,7 +621,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig prefix * int, unit, unit, - Tezos_crypto.Operation_metadata_hash.t list ) + Operation_metadata_hash.t list ) Tezos_rpc.Service.t val operation_metadata_hash : @@ -648,7 +630,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig (prefix * int) * int, unit, unit, - Tezos_crypto.Operation_metadata_hash.t ) + Operation_metadata_hash.t ) Tezos_rpc.Service.t end @@ -751,24 +733,12 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig (** Define RPC POST /chains/[chain]/mempool/ban_operation *) val ban_operation : ('a, 'b) Tezos_rpc.Path.t -> - ( [`POST], - 'a, - 'b, - unit, - Tezos_crypto.Operation_hash.t, - unit ) - Tezos_rpc.Service.t + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/unban_operation *) val unban_operation : ('a, 'b) Tezos_rpc.Path.t -> - ( [`POST], - 'a, - 'b, - unit, - Tezos_crypto.Operation_hash.t, - unit ) - Tezos_rpc.Service.t + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/unban_all_operations *) val unban_all_operations : @@ -788,9 +758,8 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ; outdated : bool ; validation_passes : int list >, unit, - ((Tezos_crypto.Operation_hash.t * Next_proto.operation) - * error trace option) - list ) + ((Operation_hash.t * Next_proto.operation) * error trace option) list + ) Tezos_rpc.Service.t (** Define RPC GET /chains/[chain]/mempool/filter *) @@ -828,13 +797,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig end val live_blocks : - ( [`GET], - prefix, - prefix, - unit, - unit, - Tezos_crypto.Block_hash.Set.t ) - Tezos_rpc.Service.t + ([`GET], prefix, prefix, unit, unit, Block_hash.Set.t) Tezos_rpc.Service.t end end diff --git a/src/lib_shell_services/block_validator_errors.ml b/src/lib_shell_services/block_validator_errors.ml index 9431af68deb4..a789a926a9c3 100644 --- a/src/lib_shell_services/block_validator_errors.ml +++ b/src/lib_shell_services/block_validator_errors.ml @@ -25,16 +25,16 @@ (*****************************************************************************) type block_error = - | Cannot_parse_operation of Tezos_crypto.Operation_hash.t + | Cannot_parse_operation of Operation_hash.t | Invalid_fitness of {expected : Fitness.t; found : Fitness.t} | Non_increasing_timestamp | Non_increasing_fitness | Invalid_level of {expected : Int32.t; found : Int32.t} | Invalid_proto_level of {expected : int; found : int} - | Replayed_operation of Tezos_crypto.Operation_hash.t + | Replayed_operation of Operation_hash.t | Outdated_operation of { - operation : Tezos_crypto.Operation_hash.t; - originating_block : Tezos_crypto.Block_hash.t; + operation : Operation_hash.t; + originating_block : Block_hash.t; } | Expired_chain of { chain_id : Tezos_crypto.Chain_id.t; @@ -43,13 +43,9 @@ type block_error = } | Unexpected_number_of_validation_passes of int (* uint8 *) | Too_many_operations of {pass : int; found : int; max : int} - | Oversized_operation of { - operation : Tezos_crypto.Operation_hash.t; - size : int; - max : int; - } + | Oversized_operation of {operation : Operation_hash.t; size : int; max : int} | Unallowed_pass of { - operation : Tezos_crypto.Operation_hash.t; + operation : Operation_hash.t; pass : int; allowed_pass : int option; } @@ -67,7 +63,7 @@ let block_error_encoding = ~title:"Cannot_parse_operation" (obj2 (req "error" (constant "cannot_parse_operation")) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "operation" Operation_hash.encoding)) (function | Cannot_parse_operation operation -> Some ((), operation) | _ -> None) (fun ((), operation) -> Cannot_parse_operation operation); @@ -121,7 +117,7 @@ let block_error_encoding = ~title:"Replayed_operation" (obj2 (req "error" (constant "replayed_operation")) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "operation" Operation_hash.encoding)) (function | Replayed_operation operation -> Some ((), operation) | _ -> None) (fun ((), operation) -> Replayed_operation operation); @@ -130,8 +126,8 @@ let block_error_encoding = ~title:"Outdated_operation" (obj3 (req "error" (constant "outdated_operation")) - (req "operation" Tezos_crypto.Operation_hash.encoding) - (req "originating_block" Tezos_crypto.Block_hash.encoding)) + (req "operation" Operation_hash.encoding) + (req "originating_block" Block_hash.encoding)) (function | Outdated_operation {operation; originating_block} -> Some ((), operation, originating_block) @@ -178,7 +174,7 @@ let block_error_encoding = ~title:"Oversized_operation" (obj4 (req "error" (constant "oversized_operation")) - (req "operation" Tezos_crypto.Operation_hash.encoding) + (req "operation" Operation_hash.encoding) (req "found" int31) (req "max" int31)) (function @@ -192,7 +188,7 @@ let block_error_encoding = ~title:"Unallowed_pass" (obj4 (req "error" (constant "invalid_pass")) - (req "operation" Tezos_crypto.Operation_hash.encoding) + (req "operation" Operation_hash.encoding) (req "pass" uint8) (req "allowed_pass" (option uint8))) (function @@ -233,7 +229,7 @@ let pp_block_error ppf = function Format.fprintf ppf "Failed to parse the operation %a." - Tezos_crypto.Operation_hash.pp_short + Operation_hash.pp_short oph | Invalid_fitness {expected; found} -> Format.fprintf @@ -261,15 +257,15 @@ let pp_block_error ppf = function Format.fprintf ppf "The operation %a was previously included in the chain." - Tezos_crypto.Operation_hash.pp_short + Operation_hash.pp_short oph | Outdated_operation {operation; originating_block} -> Format.fprintf ppf "The operation %a is outdated (originated in block: %a)" - Tezos_crypto.Operation_hash.pp_short + Operation_hash.pp_short operation - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short originating_block | Expired_chain {chain_id; expiration; timestamp} -> Format.fprintf @@ -295,7 +291,7 @@ let pp_block_error ppf = function Format.fprintf ppf "Oversized operation %a (size: %d, max: %d)" - Tezos_crypto.Operation_hash.pp_short + Operation_hash.pp_short operation size max @@ -304,7 +300,7 @@ let pp_block_error ppf = function ppf "Operation %a included in validation pass %d, while only the \ following passes are allowed: @[<h>%a@]" - Tezos_crypto.Operation_hash.pp_short + Operation_hash.pp_short operation pass (fun fmt -> function @@ -402,20 +398,17 @@ let pp_validation_process_error ppf = function msg type error += - | Invalid_block of {block : Tezos_crypto.Block_hash.t; error : block_error} - | Unavailable_protocol of { - block : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; - } + | Invalid_block of {block : Block_hash.t; error : block_error} + | Unavailable_protocol of {block : Block_hash.t; protocol : Protocol_hash.t} | Inconsistent_operations_hash of { - block : Tezos_crypto.Block_hash.t; - expected : Tezos_crypto.Operation_list_list_hash.t; - found : Tezos_crypto.Operation_list_list_hash.t; + block : Block_hash.t; + expected : Operation_list_list_hash.t; + found : Operation_list_list_hash.t; } - | Applying_non_prechecked_block of Tezos_crypto.Block_hash.t - | Failed_to_checkout_context of Tezos_crypto.Context_hash.t + | Applying_non_prechecked_block of Block_hash.t + | Failed_to_checkout_context of Context_hash.t | System_error of {errno : string; fn : string; msg : string} - | Missing_test_protocol of Tezos_crypto.Protocol_hash.t + | Missing_test_protocol of Protocol_hash.t | Validation_process_failed of validation_process_error | Cannot_validate_while_shutting_down @@ -429,13 +422,13 @@ let () = Format.fprintf ppf "@[<v 2>Invalid block %a@ %a@]" - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block pp_block_error error) Data_encoding.( obj2 - (req "invalid_block" Tezos_crypto.Block_hash.encoding) + (req "invalid_block" Block_hash.encoding) (req "error" block_error_encoding)) (function Invalid_block {block; error} -> Some (block, error) | _ -> None) (fun (block, error) -> Invalid_block {block; error}) ; @@ -448,14 +441,14 @@ let () = Format.fprintf ppf "Missing protocol (%a) when validating the block %a." - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short protocol - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block) Data_encoding.( obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "missing_protocol" Tezos_crypto.Protocol_hash.encoding)) + (req "block" Block_hash.encoding) + (req "missing_protocol" Protocol_hash.encoding)) (function | Unavailable_protocol {block; protocol} -> Some (block, protocol) | _ -> None) @@ -471,17 +464,17 @@ let () = ppf "@[<v 2>The provided list of operations for block %a is inconsistent \ with the block header@ expected: %a@ found: %a@]" - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block - Tezos_crypto.Operation_list_list_hash.pp_short + Operation_list_list_hash.pp_short expected - Tezos_crypto.Operation_list_list_hash.pp_short + Operation_list_list_hash.pp_short found) Data_encoding.( obj3 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "expected" Tezos_crypto.Operation_list_list_hash.encoding) - (req "found" Tezos_crypto.Operation_list_list_hash.encoding)) + (req "block" Block_hash.encoding) + (req "expected" Operation_list_list_hash.encoding) + (req "found" Operation_list_list_hash.encoding)) (function | Inconsistent_operations_hash {block; expected; found} -> Some (block, expected, found) @@ -493,13 +486,13 @@ let () = ~id:"Block_validator_process.applying_non_prechecked_block" ~title:"Applying non prechecked block" ~description:"Applying non prechecked block" - ~pp:(fun ppf (hash : Tezos_crypto.Block_hash.t) -> + ~pp:(fun ppf (hash : Block_hash.t) -> Format.fprintf ppf "Applying non prechecked block %a" - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short hash) - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Applying_non_prechecked_block bh -> Some bh | _ -> None) (fun bh -> Applying_non_prechecked_block bh) ; Error_monad.register_error_kind @@ -507,13 +500,13 @@ let () = ~id:"Block_validator_process.failed_to_checkout_context" ~title:"Fail during checkout context" ~description:"The context checkout failed using a given hash" - ~pp:(fun ppf (hash : Tezos_crypto.Context_hash.t) -> + ~pp:(fun ppf (hash : Context_hash.t) -> Format.fprintf ppf "@[Failed to checkout the context with hash %a@]" - Tezos_crypto.Context_hash.pp_short + Context_hash.pp_short hash) - Data_encoding.(obj1 (req "hash" Tezos_crypto.Context_hash.encoding)) + Data_encoding.(obj1 (req "hash" Context_hash.encoding)) (function Failed_to_checkout_context h -> Some h | _ -> None) (fun h -> Failed_to_checkout_context h) ; Error_monad.register_error_kind @@ -542,10 +535,9 @@ let () = Format.fprintf ppf "Missing test protocol %a when forking the test chain." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol) - Data_encoding.( - obj1 (req "test_protocol" Tezos_crypto.Protocol_hash.encoding)) + Data_encoding.(obj1 (req "test_protocol" Protocol_hash.encoding)) (function Missing_test_protocol protocol -> Some protocol | _ -> None) (fun protocol -> Missing_test_protocol protocol) ; Error_monad.register_error_kind diff --git a/src/lib_shell_services/block_validator_errors.mli b/src/lib_shell_services/block_validator_errors.mli index c9d0a555012d..e7d32664737b 100644 --- a/src/lib_shell_services/block_validator_errors.mli +++ b/src/lib_shell_services/block_validator_errors.mli @@ -25,16 +25,16 @@ (*****************************************************************************) type block_error = - | Cannot_parse_operation of Tezos_crypto.Operation_hash.t + | Cannot_parse_operation of Operation_hash.t | Invalid_fitness of {expected : Fitness.t; found : Fitness.t} | Non_increasing_timestamp | Non_increasing_fitness | Invalid_level of {expected : Int32.t; found : Int32.t} | Invalid_proto_level of {expected : int; found : int} - | Replayed_operation of Tezos_crypto.Operation_hash.t + | Replayed_operation of Operation_hash.t | Outdated_operation of { - operation : Tezos_crypto.Operation_hash.t; - originating_block : Tezos_crypto.Block_hash.t; + operation : Operation_hash.t; + originating_block : Block_hash.t; } | Expired_chain of { chain_id : Tezos_crypto.Chain_id.t; @@ -43,13 +43,9 @@ type block_error = } | Unexpected_number_of_validation_passes of int (* uint8 *) | Too_many_operations of {pass : int; found : int; max : int} - | Oversized_operation of { - operation : Tezos_crypto.Operation_hash.t; - size : int; - max : int; - } + | Oversized_operation of {operation : Operation_hash.t; size : int; max : int} | Unallowed_pass of { - operation : Tezos_crypto.Operation_hash.t; + operation : Operation_hash.t; pass : int; allowed_pass : int option; } @@ -67,21 +63,18 @@ type validation_process_error = | Cannot_run_external_validator of string type error += - | Invalid_block of {block : Tezos_crypto.Block_hash.t; error : block_error} - | Unavailable_protocol of { - block : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; - } + | Invalid_block of {block : Block_hash.t; error : block_error} + | Unavailable_protocol of {block : Block_hash.t; protocol : Protocol_hash.t} | Inconsistent_operations_hash of { - block : Tezos_crypto.Block_hash.t; - expected : Tezos_crypto.Operation_list_list_hash.t; - found : Tezos_crypto.Operation_list_list_hash.t; + block : Block_hash.t; + expected : Operation_list_list_hash.t; + found : Operation_list_list_hash.t; } - | Applying_non_prechecked_block of Tezos_crypto.Block_hash.t - | Failed_to_checkout_context of Tezos_crypto.Context_hash.t + | Applying_non_prechecked_block of Block_hash.t + | Failed_to_checkout_context of Context_hash.t | System_error of {errno : string; fn : string; msg : string} - | Missing_test_protocol of Tezos_crypto.Protocol_hash.t + | Missing_test_protocol of Protocol_hash.t | Validation_process_failed of validation_process_error | Cannot_validate_while_shutting_down -val invalid_block : Tezos_crypto.Block_hash.t -> block_error -> error +val invalid_block : Block_hash.t -> block_error -> error diff --git a/src/lib_shell_services/block_validator_worker_state.ml b/src/lib_shell_services/block_validator_worker_state.ml index f1da6c91eb5f..71b9d518f7e2 100644 --- a/src/lib_shell_services/block_validator_worker_state.ml +++ b/src/lib_shell_services/block_validator_worker_state.ml @@ -26,7 +26,7 @@ module Request = struct type validation_view = { chain_id : Tezos_crypto.Chain_id.t; - block : Tezos_crypto.Block_hash.t; + block : Block_hash.t; peer : P2p_peer.Id.t option; } @@ -36,7 +36,7 @@ module Request = struct (fun {block; chain_id; peer} -> (block, chain_id, peer)) (fun (block, chain_id, peer) -> {block; chain_id; peer}) (obj3 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "chain_id" Tezos_crypto.Chain_id.encoding) (opt "peer" P2p_peer.Id.encoding)) @@ -80,7 +80,7 @@ module Request = struct Format.fprintf ppf "Validation of %a (chain: %a)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block Tezos_crypto.Chain_id.pp_short chain_id ; diff --git a/src/lib_shell_services/block_validator_worker_state.mli b/src/lib_shell_services/block_validator_worker_state.mli index 16b2e8ac749b..b71120813814 100644 --- a/src/lib_shell_services/block_validator_worker_state.mli +++ b/src/lib_shell_services/block_validator_worker_state.mli @@ -26,7 +26,7 @@ module Request : sig type validation_view = { chain_id : Tezos_crypto.Chain_id.t; - block : Tezos_crypto.Block_hash.t; + block : Block_hash.t; peer : P2p_peer.Id.t option; } diff --git a/src/lib_shell_services/chain_services.ml b/src/lib_shell_services/chain_services.ml index 72e205ee42e2..397c0c7343c1 100644 --- a/src/lib_shell_services/chain_services.ml +++ b/src/lib_shell_services/chain_services.ml @@ -34,11 +34,7 @@ let to_string = Block_services.chain_to_string let parse_chain = Block_services.parse_chain -type invalid_block = { - hash : Tezos_crypto.Block_hash.t; - level : Int32.t; - errors : error list; -} +type invalid_block = {hash : Block_hash.t; level : Int32.t; errors : error list} type prefix = Block_services.chain_prefix @@ -52,14 +48,14 @@ let checkpoint_encoding = (req "history_mode" History_mode.encoding) let block_descriptor_encoding = - obj2 (req "block_hash" Tezos_crypto.Block_hash.encoding) (req "level" int32) + obj2 (req "block_hash" Block_hash.encoding) (req "level" int32) let invalid_block_encoding = conv (fun {hash; level; errors} -> (hash, level, errors)) (fun (hash, level, errors) -> {hash; level; errors}) (obj3 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "level" int32) (req "errors" Tezos_rpc.Error.encoding)) @@ -157,7 +153,7 @@ module S = struct "An empty argument requests blocks starting with the current \ head. A non empty list allows to request one or more specific \ fragments of the chain." - Tezos_crypto.Block_hash.rpc_arg + Block_hash.rpc_arg (fun x -> x#heads) |+ opt_field "min_date" @@ -181,7 +177,7 @@ module S = struct head of the chain. Optional arguments allow to return the list of \ predecessors of a given block or of a set of blocks." ~query:list_query - ~output:(list (list Tezos_crypto.Block_hash.encoding)) + ~output:(list (list Block_hash.encoding)) path end @@ -202,14 +198,14 @@ module S = struct ~description:"The errors that appears during the block (in)validation." ~query:Tezos_rpc.Query.empty ~output:invalid_block_encoding - Tezos_rpc.Path.(path /: Tezos_crypto.Block_hash.rpc_arg) + Tezos_rpc.Path.(path /: Block_hash.rpc_arg) let delete = Tezos_rpc.Service.delete_service ~description:"Remove an invalid block for the tezos storage" ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty - Tezos_rpc.Path.(path /: Tezos_crypto.Block_hash.rpc_arg) + Tezos_rpc.Path.(path /: Block_hash.rpc_arg) end end @@ -258,8 +254,8 @@ module Blocks = struct include Block_services.Empty type protocols = Block_services.protocols = { - current_protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + current_protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; } let protocols = Block_services.protocols diff --git a/src/lib_shell_services/chain_services.mli b/src/lib_shell_services/chain_services.mli index c114b9c98d6b..bbd3ccee2c0a 100644 --- a/src/lib_shell_services/chain_services.mli +++ b/src/lib_shell_services/chain_services.mli @@ -32,11 +32,7 @@ val to_string : chain -> string val chain_arg : chain Tezos_rpc.Arg.t -type invalid_block = { - hash : Tezos_crypto.Block_hash.t; - level : Int32.t; - errors : error list; -} +type invalid_block = {hash : Block_hash.t; level : Int32.t; errors : error list} type prefix = unit * chain @@ -57,39 +53,30 @@ module Mempool = Block_services.Empty.Mempool module Levels : sig val checkpoint : - #simple -> - ?chain:chain -> - unit -> - (Tezos_crypto.Block_hash.t * int32) tzresult Lwt.t + #simple -> ?chain:chain -> unit -> (Block_hash.t * int32) tzresult Lwt.t val savepoint : - #simple -> - ?chain:chain -> - unit -> - (Tezos_crypto.Block_hash.t * int32) tzresult Lwt.t + #simple -> ?chain:chain -> unit -> (Block_hash.t * int32) tzresult Lwt.t val caboose : - #simple -> - ?chain:chain -> - unit -> - (Tezos_crypto.Block_hash.t * int32) tzresult Lwt.t + #simple -> ?chain:chain -> unit -> (Block_hash.t * int32) tzresult Lwt.t end module Blocks : sig val list : #simple -> ?chain:chain -> - ?heads:Tezos_crypto.Block_hash.t list -> + ?heads:Block_hash.t list -> ?length:int -> ?min_date:Time.Protocol.t -> unit -> - Tezos_crypto.Block_hash.t list list tzresult Lwt.t + Block_hash.t list list tzresult Lwt.t include module type of Block_services.Empty type protocols = { - current_protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + current_protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; } val protocols : @@ -105,13 +92,9 @@ module Invalid_blocks : sig #simple -> ?chain:chain -> unit -> invalid_block list tzresult Lwt.t val get : - #simple -> - ?chain:chain -> - Tezos_crypto.Block_hash.t -> - invalid_block tzresult Lwt.t + #simple -> ?chain:chain -> Block_hash.t -> invalid_block tzresult Lwt.t - val delete : - #simple -> ?chain:chain -> Tezos_crypto.Block_hash.t -> unit tzresult Lwt.t + val delete : #simple -> ?chain:chain -> Block_hash.t -> unit tzresult Lwt.t end module S : sig @@ -152,7 +135,7 @@ module S : sig prefix, unit, unit, - Tezos_crypto.Block_hash.t * int32 ) + Block_hash.t * int32 ) Tezos_rpc.Service.t val savepoint : @@ -161,7 +144,7 @@ module S : sig prefix, unit, unit, - Tezos_crypto.Block_hash.t * int32 ) + Block_hash.t * int32 ) Tezos_rpc.Service.t val caboose : @@ -170,7 +153,7 @@ module S : sig prefix, unit, unit, - Tezos_crypto.Block_hash.t * int32 ) + Block_hash.t * int32 ) Tezos_rpc.Service.t end @@ -181,11 +164,11 @@ module S : sig ( [`GET], prefix, prefix, - < heads : Tezos_crypto.Block_hash.t list + < heads : Block_hash.t list ; length : int option ; min_date : Time.Protocol.t option >, unit, - Tezos_crypto.Block_hash.t list list ) + Block_hash.t list list ) Tezos_rpc.Service.t end @@ -202,7 +185,7 @@ module S : sig val get : ( [`GET], prefix, - prefix * Tezos_crypto.Block_hash.t, + prefix * Block_hash.t, unit, unit, invalid_block ) @@ -211,7 +194,7 @@ module S : sig val delete : ( [`DELETE], prefix, - prefix * Tezos_crypto.Block_hash.t, + prefix * Block_hash.t, unit, unit, unit ) diff --git a/src/lib_shell_services/chain_validator_worker_state.ml b/src/lib_shell_services/chain_validator_worker_state.ml index 63edc1a4e5a7..c0b8c5a7a048 100644 --- a/src/lib_shell_services/chain_validator_worker_state.ml +++ b/src/lib_shell_services/chain_validator_worker_state.ml @@ -25,7 +25,7 @@ (*****************************************************************************) module Request = struct - type view = Hash of Tezos_crypto.Block_hash.t | PeerId of P2p_peer.Id.t + type view = Hash of Block_hash.t | PeerId of P2p_peer.Id.t let encoding = let open Data_encoding in @@ -34,7 +34,7 @@ module Request = struct case (Tag 0) ~title:"Hash" - (obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + (obj1 (req "hash" Block_hash.encoding)) (function Hash h -> Some h | _ -> None) (fun h -> Hash h); case @@ -46,7 +46,7 @@ module Request = struct ] let pp ppf = function - | Hash h -> Tezos_crypto.Block_hash.pp ppf h + | Hash h -> Block_hash.pp ppf h | PeerId pid -> P2p_peer.Id.pp ppf pid end diff --git a/src/lib_shell_services/chain_validator_worker_state.mli b/src/lib_shell_services/chain_validator_worker_state.mli index 98ef6d6a724f..77467fa78565 100644 --- a/src/lib_shell_services/chain_validator_worker_state.mli +++ b/src/lib_shell_services/chain_validator_worker_state.mli @@ -25,7 +25,7 @@ (*****************************************************************************) module Request : sig - type view = Hash of Tezos_crypto.Block_hash.t | PeerId of P2p_peer.Id.t + type view = Hash of Block_hash.t | PeerId of P2p_peer.Id.t val encoding : view Data_encoding.encoding diff --git a/src/lib_shell_services/injection_services.ml b/src/lib_shell_services/injection_services.ml index 95fbc16adab3..9b451c8a6945 100644 --- a/src/lib_shell_services/injection_services.ml +++ b/src/lib_shell_services/injection_services.ml @@ -25,11 +25,9 @@ type Error_monad.error += Injection_operations_error -type Error_monad.error += - | Injection_operation_succeed_case of Tezos_crypto.Operation_hash.t +type Error_monad.error += Injection_operation_succeed_case of Operation_hash.t -type Error_monad.error += - | Injection_operation_error_case of Tezos_crypto.Operation_hash.t +type Error_monad.error += Injection_operation_error_case of Operation_hash.t let () = let open Data_encoding in @@ -56,12 +54,8 @@ let () = "The injection of this operation succeed among a list of injections \ containing at least one error." ~pp:(fun ppf oph -> - Format.fprintf - ppf - "Injection of %a succeeded." - Tezos_crypto.Operation_hash.pp - oph) - (obj1 (req "oph" Tezos_crypto.Operation_hash.encoding)) + Format.fprintf ppf "Injection of %a succeeded." Operation_hash.pp oph) + (obj1 (req "oph" Operation_hash.encoding)) (function Injection_operation_succeed_case oph -> Some oph | _ -> None) (function oph -> Injection_operation_succeed_case oph) ; register_error_kind @@ -75,9 +69,9 @@ let () = Format.fprintf ppf "Injection of %a failed. Error is next." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) - (obj1 (req "oph" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "oph" Operation_hash.encoding)) (function Injection_operation_error_case oph -> Some oph | _ -> None) (function oph -> Injection_operation_error_case oph) @@ -123,7 +117,7 @@ module S = struct main chain." ~query:block_query ~input:block_param - ~output:Tezos_crypto.Block_hash.encoding + ~output:Block_hash.encoding Tezos_rpc.Path.(path / "block") let operation_query = @@ -173,7 +167,7 @@ module S = struct or the main chain." ~query:operation_query ~input:bytes - ~output:Tezos_crypto.Operation_hash.encoding + ~output:Operation_hash.encoding (if private_ then Tezos_rpc.Path.(root / "private" / "injection" / "operation") else Tezos_rpc.Path.(path / "operation")) @@ -198,7 +192,7 @@ module S = struct specific to this injection)." ~query:operations_query ~input:(list (dynamic_size bytes)) - ~output:(list Tezos_crypto.Operation_hash.encoding) + ~output:(list Operation_hash.encoding) Tezos_rpc.Path.(root / "private" / "injection" / "operations") let private_operation = operation ~private_:true @@ -222,7 +216,7 @@ module S = struct will be validated before the result is returned." ~query:protocol_query ~input:Protocol.encoding - ~output:Tezos_crypto.Protocol_hash.encoding + ~output:Protocol_hash.encoding Tezos_rpc.Path.(path / "protocol") end diff --git a/src/lib_shell_services/injection_services.mli b/src/lib_shell_services/injection_services.mli index de2eca18ec9c..532acb97fe6e 100644 --- a/src/lib_shell_services/injection_services.mli +++ b/src/lib_shell_services/injection_services.mli @@ -39,11 +39,9 @@ open Tezos_rpc.Context [Injection_operation_error_case oph] followed by [err]. *) type Error_monad.error += Injection_operations_error -type Error_monad.error += - | Injection_operation_succeed_case of Tezos_crypto.Operation_hash.t +type Error_monad.error += Injection_operation_succeed_case of Operation_hash.t -type Error_monad.error += - | Injection_operation_error_case of Tezos_crypto.Operation_hash.t +type Error_monad.error += Injection_operation_error_case of Operation_hash.t (** [block cctxt ?async ?force raw_block] tries to inject [raw_block] inside the node. If [?async] is [true], [raw_block] @@ -57,21 +55,21 @@ val block : ?chain:Chain_services.chain -> Bytes.t -> Operation.t list list -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t val operation : #simple -> ?async:bool -> ?chain:Chain_services.chain -> Bytes.t -> - Tezos_crypto.Operation_hash.t tzresult Lwt.t + Operation_hash.t tzresult Lwt.t val private_operation : #simple -> ?async:bool -> ?chain:Chain_services.chain -> Bytes.t -> - Tezos_crypto.Operation_hash.t tzresult Lwt.t + Operation_hash.t tzresult Lwt.t (** [private_operations] injects multiple operations. The [private_] prefix is because the service is bound to the /private/ path-prefix @@ -83,13 +81,10 @@ val private_operations : ?force:bool -> ?chain:Chain_services.chain -> Bytes.t list -> - Tezos_crypto.Operation_hash.t list tzresult Lwt.t + Operation_hash.t list tzresult Lwt.t val protocol : - #simple -> - ?async:bool -> - Protocol.t -> - Tezos_crypto.Protocol_hash.t tzresult Lwt.t + #simple -> ?async:bool -> Protocol.t -> Protocol_hash.t tzresult Lwt.t module S : sig val block : @@ -98,7 +93,7 @@ module S : sig unit, < async : bool ; force : bool ; chain : Chain_services.chain option >, Bytes.t * Operation.t list list, - Tezos_crypto.Block_hash.t ) + Block_hash.t ) Tezos_rpc.Service.t val operation : @@ -107,7 +102,7 @@ module S : sig unit, < async : bool ; chain : Chain_services.chain option >, Bytes.t, - Tezos_crypto.Operation_hash.t ) + Operation_hash.t ) Tezos_rpc.Service.t val private_operation : @@ -116,7 +111,7 @@ module S : sig unit, < async : bool ; chain : Chain_services.chain option >, Bytes.t, - Tezos_crypto.Operation_hash.t ) + Operation_hash.t ) Tezos_rpc.Service.t val private_operations : @@ -125,7 +120,7 @@ module S : sig unit, < async : bool ; force : bool ; chain : Chain_services.chain option >, Bytes.t list, - Tezos_crypto.Operation_hash.t list ) + Operation_hash.t list ) Tezos_rpc.Service.t val protocol : @@ -134,6 +129,6 @@ module S : sig unit, < async : bool >, Protocol.t, - Tezos_crypto.Protocol_hash.t ) + Protocol_hash.t ) Tezos_rpc.Service.t end diff --git a/src/lib_shell_services/monitor_services.ml b/src/lib_shell_services/monitor_services.ml index e6d5bbdc79d5..1d704bee50b8 100644 --- a/src/lib_shell_services/monitor_services.ml +++ b/src/lib_shell_services/monitor_services.ml @@ -27,7 +27,7 @@ type chain_status = | Active_main of Tezos_crypto.Chain_id.t | Active_test of { chain : Tezos_crypto.Chain_id.t; - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; expiration_date : Time.Protocol.t; } | Stopping of Tezos_crypto.Chain_id.t @@ -48,7 +48,7 @@ let chain_status_encoding = ~title:"Test" (obj3 (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "test_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "test_protocol" Protocol_hash.encoding) (req "expiration_date" Time.Protocol.encoding)) (function | Active_test {chain; protocol; expiration_date} -> @@ -80,7 +80,7 @@ module S = struct ~query:Tezos_rpc.Query.empty ~output: (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "timestamp" Time.Protocol.encoding)) Tezos_rpc.Path.(path / "bootstrapped") @@ -94,9 +94,8 @@ module S = struct method chains = chains end) - |+ multi_field "protocol" Tezos_crypto.Protocol_hash.rpc_arg (fun t -> - t#protocols) - |+ multi_field "next_protocol" Tezos_crypto.Protocol_hash.rpc_arg (fun t -> + |+ multi_field "protocol" Protocol_hash.rpc_arg (fun t -> t#protocols) + |+ multi_field "next_protocol" Protocol_hash.rpc_arg (fun t -> t#next_protocols) |+ multi_field "chain" Chain_services.chain_arg (fun t -> t#chains) |> seal @@ -111,7 +110,7 @@ module S = struct (merge_objs (obj2 (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "hash" Tezos_crypto.Block_hash.encoding)) + (req "hash" Block_hash.encoding)) Block_header.encoding) Tezos_rpc.Path.(path / "valid_blocks") @@ -121,7 +120,7 @@ module S = struct object method next_protocols = next_protocols end) - |+ multi_field "next_protocol" Tezos_crypto.Protocol_hash.rpc_arg (fun t -> + |+ multi_field "next_protocol" Protocol_hash.rpc_arg (fun t -> t#next_protocols) |> seal @@ -133,7 +132,7 @@ module S = struct ~query:heads_query ~output: (merge_objs - (obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + (obj1 (req "hash" Block_hash.encoding)) Block_header.encoding) Tezos_rpc.Path.(path / "heads" /: Chain_services.chain_arg) @@ -143,7 +142,7 @@ module S = struct "Monitor all economic protocols that are retrieved and successfully \ loaded and compiled by the node." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Protocol_hash.encoding + ~output:Protocol_hash.encoding Tezos_rpc.Path.(path / "protocols") (* DEPRECATED: use [version] from "version_services" instead. *) diff --git a/src/lib_shell_services/monitor_services.mli b/src/lib_shell_services/monitor_services.mli index b74609efb1ab..65eaa65013b5 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -29,39 +29,34 @@ type chain_status = | Active_main of Tezos_crypto.Chain_id.t | Active_test of { chain : Tezos_crypto.Chain_id.t; - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; expiration_date : Time.Protocol.t; } | Stopping of Tezos_crypto.Chain_id.t val bootstrapped : #streamed -> - ((Tezos_crypto.Block_hash.t * Time.Protocol.t) Lwt_stream.t * stopper) - tzresult - Lwt.t + ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * stopper) tzresult Lwt.t val valid_blocks : #streamed -> ?chains:Chain_services.chain list -> - ?protocols:Tezos_crypto.Protocol_hash.t list -> - ?next_protocols:Tezos_crypto.Protocol_hash.t list -> + ?protocols:Protocol_hash.t list -> + ?next_protocols:Protocol_hash.t list -> unit -> - (((Tezos_crypto.Chain_id.t * Tezos_crypto.Block_hash.t) * Block_header.t) - Lwt_stream.t + (((Tezos_crypto.Chain_id.t * Block_hash.t) * Block_header.t) Lwt_stream.t * stopper) tzresult Lwt.t val heads : #streamed -> - ?next_protocols:Tezos_crypto.Protocol_hash.t list -> + ?next_protocols:Protocol_hash.t list -> Chain_services.chain -> - ((Tezos_crypto.Block_hash.t * Block_header.t) Lwt_stream.t * stopper) tzresult - Lwt.t + ((Block_hash.t * Block_header.t) Lwt_stream.t * stopper) tzresult Lwt.t val protocols : - #streamed -> - (Tezos_crypto.Protocol_hash.t Lwt_stream.t * stopper) tzresult Lwt.t + #streamed -> (Protocol_hash.t Lwt_stream.t * stopper) tzresult Lwt.t val commit_hash : #simple -> string tzresult Lwt.t @@ -75,7 +70,7 @@ module S : sig unit, unit, unit, - Tezos_crypto.Block_hash.t * Time.Protocol.t ) + Block_hash.t * Time.Protocol.t ) Tezos_rpc.Service.t val valid_blocks : @@ -83,29 +78,23 @@ module S : sig unit, unit, < chains : Chain_services.chain list - ; next_protocols : Tezos_crypto.Protocol_hash.t list - ; protocols : Tezos_crypto.Protocol_hash.t list >, + ; next_protocols : Protocol_hash.t list + ; protocols : Protocol_hash.t list >, unit, - (Tezos_crypto.Chain_id.t * Tezos_crypto.Block_hash.t) * Block_header.t ) + (Tezos_crypto.Chain_id.t * Block_hash.t) * Block_header.t ) Tezos_rpc.Service.t val heads : ( [`GET], unit, unit * Chain_services.chain, - < next_protocols : Tezos_crypto.Protocol_hash.t list >, + < next_protocols : Protocol_hash.t list >, unit, - Tezos_crypto.Block_hash.t * Block_header.t ) + Block_hash.t * Block_header.t ) Tezos_rpc.Service.t val protocols : - ( [`GET], - unit, - unit, - unit, - unit, - Tezos_crypto.Protocol_hash.t ) - Tezos_rpc.Service.t + ([`GET], unit, unit, unit, unit, Protocol_hash.t) Tezos_rpc.Service.t val commit_hash : ([`GET], unit, unit, unit, unit, string) Tezos_rpc.Service.t diff --git a/src/lib_shell_services/peer_validator_worker_state.ml b/src/lib_shell_services/peer_validator_worker_state.ml index e7d112d50c66..099d11dc11ba 100644 --- a/src/lib_shell_services/peer_validator_worker_state.ml +++ b/src/lib_shell_services/peer_validator_worker_state.ml @@ -24,9 +24,7 @@ (*****************************************************************************) module Request = struct - type view = - | New_head of Tezos_crypto.Block_hash.t - | New_branch of Tezos_crypto.Block_hash.t * int + type view = New_head of Block_hash.t | New_branch of Block_hash.t * int let encoding = let open Data_encoding in @@ -37,7 +35,7 @@ module Request = struct ~title:"New_head" (obj2 (req "request" (constant "new_head")) - (req "block" Tezos_crypto.Block_hash.encoding)) + (req "block" Block_hash.encoding)) (function New_head h -> Some ((), h) | _ -> None) (fun ((), h) -> New_head h); case @@ -45,20 +43,19 @@ module Request = struct ~title:"New_branch" (obj3 (req "request" (constant "new_branch")) - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "locators" int31)) (function New_branch (h, l) -> Some ((), h, l) | _ -> None) (fun ((), h, l) -> New_branch (h, l)); ] let pp ppf = function - | New_head hash -> - Format.fprintf ppf "New head %a" Tezos_crypto.Block_hash.pp hash + | New_head hash -> Format.fprintf ppf "New head %a" Block_hash.pp hash | New_branch (hash, len) -> Format.fprintf ppf "New branch %a, locator length %d" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash len end diff --git a/src/lib_shell_services/peer_validator_worker_state.mli b/src/lib_shell_services/peer_validator_worker_state.mli index 36f870f80406..71b0593df9fc 100644 --- a/src/lib_shell_services/peer_validator_worker_state.mli +++ b/src/lib_shell_services/peer_validator_worker_state.mli @@ -24,9 +24,7 @@ (*****************************************************************************) module Request : sig - type view = - | New_head of Tezos_crypto.Block_hash.t - | New_branch of Tezos_crypto.Block_hash.t * int + type view = New_head of Block_hash.t | New_branch of Block_hash.t * int val encoding : view Data_encoding.encoding diff --git a/src/lib_shell_services/preapply_result.ml b/src/lib_shell_services/preapply_result.ml index df8f2e405e36..04d0f3501964 100644 --- a/src/lib_shell_services/preapply_result.ml +++ b/src/lib_shell_services/preapply_result.ml @@ -24,43 +24,42 @@ (*****************************************************************************) type 'error t = { - applied : (Tezos_crypto.Operation_hash.t * Operation.t) list; - refused : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; - outdated : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; - branch_refused : - (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; - branch_delayed : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; + applied : (Operation_hash.t * Operation.t) list; + refused : (Operation.t * 'error list) Operation_hash.Map.t; + outdated : (Operation.t * 'error list) Operation_hash.Map.t; + branch_refused : (Operation.t * 'error list) Operation_hash.Map.t; + branch_delayed : (Operation.t * 'error list) Operation_hash.Map.t; } let empty = { applied = []; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; } let encoding error_encoding = let open Data_encoding in let operation_encoding = merge_objs - (obj1 (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) (dynamic_size Operation.encoding) in let refused_encoding = merge_objs - (obj1 (req "hash" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "hash" Operation_hash.encoding)) (merge_objs (dynamic_size Operation.encoding) (obj1 (req "error" error_encoding))) in - let build_list map = Tezos_crypto.Operation_hash.Map.bindings map in + let build_list map = Operation_hash.Map.bindings map in let build_map list = List.fold_right - (fun (k, e) m -> Tezos_crypto.Operation_hash.Map.add k e m) + (fun (k, e) m -> Operation_hash.Map.add k e m) list - Tezos_crypto.Operation_hash.Map.empty + Operation_hash.Map.empty in conv (fun {applied; refused; outdated; branch_refused; branch_delayed} -> diff --git a/src/lib_shell_services/preapply_result.mli b/src/lib_shell_services/preapply_result.mli index ef2ae2f536f3..0ae05104776b 100644 --- a/src/lib_shell_services/preapply_result.mli +++ b/src/lib_shell_services/preapply_result.mli @@ -25,16 +25,14 @@ (** A container for classified operations *) type 'error t = { - applied : (Tezos_crypto.Operation_hash.t * Operation.t) list; - (** Applied operations *) - refused : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; + applied : (Operation_hash.t * Operation.t) list; (** Applied operations *) + refused : (Operation.t * 'error list) Operation_hash.Map.t; (** Refused operations, for example because of an invalid signature *) - outdated : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; + outdated : (Operation.t * 'error list) Operation_hash.Map.t; (** Outdated operations, for example a late endorsement *) - branch_refused : - (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; + branch_refused : (Operation.t * 'error list) Operation_hash.Map.t; (** Branch refused operations, for example because of insufficient balance *) - branch_delayed : (Operation.t * 'error list) Tezos_crypto.Operation_hash.Map.t; + branch_delayed : (Operation.t * 'error list) Operation_hash.Map.t; (** Branch delayed operations, for example because of a timestamp in the future *) } diff --git a/src/lib_shell_services/prevalidator_worker_state.ml b/src/lib_shell_services/prevalidator_worker_state.ml index 9d3ab0a5a172..05ed0d89168f 100644 --- a/src/lib_shell_services/prevalidator_worker_state.ml +++ b/src/lib_shell_services/prevalidator_worker_state.ml @@ -27,17 +27,17 @@ module Request = struct type ('a, 'b) t = | Flush : - Tezos_crypto.Block_hash.t + Block_hash.t * Chain_validator_worker_state.update - * Tezos_crypto.Block_hash.Set.t - * Tezos_crypto.Operation_hash.Set.t + * Block_hash.Set.t + * Operation_hash.Set.t -> (unit, error trace) t | Notify : P2p_peer.Id.t * Mempool.t -> (unit, Empty.t) t | Leftover : (unit, Empty.t) t | Inject : {op : Operation.t; force : bool} -> (unit, error trace) t - | Arrived : Tezos_crypto.Operation_hash.t * Operation.t -> (unit, Empty.t) t + | Arrived : Operation_hash.t * Operation.t -> (unit, Empty.t) t | Advertise : (unit, Empty.t) t - | Ban : Tezos_crypto.Operation_hash.t -> (unit, error trace) t + | Ban : Operation_hash.t -> (unit, error trace) t type view = View : _ t -> view @@ -52,7 +52,7 @@ module Request = struct ~title:"Flush" (obj3 (req "request" (constant "flush")) - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "event" Chain_validator_worker_state.update_encoding)) (function | View (Flush (hash, event, _, _)) -> Some ((), hash, event) @@ -60,10 +60,7 @@ module Request = struct (fun ((), hash, event) -> View (Flush - ( hash, - event, - Tezos_crypto.Block_hash.Set.empty, - Tezos_crypto.Operation_hash.Set.empty ))); + (hash, event, Block_hash.Set.empty, Operation_hash.Set.empty))); case (Tag 1) ~title:"Notify" @@ -90,7 +87,7 @@ module Request = struct ~title:"Arrived" (obj3 (req "request" (constant "arrived")) - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation" Operation.encoding)) (function | View (Arrived (oph, op)) -> Some ((), oph, op) | _ -> None) @@ -112,7 +109,7 @@ module Request = struct ~title:"Ban" (obj2 (req "request" (constant "ban")) - (req "operation_hash" Tezos_crypto.Operation_hash.encoding)) + (req "operation_hash" Operation_hash.encoding)) (function View (Ban oph) -> Some ((), oph) | _ -> None) (fun ((), oph) -> View (Ban oph)); ] @@ -120,11 +117,7 @@ module Request = struct let pp ppf (View r) = match r with | Flush (hash, _, _, _) -> - Format.fprintf - ppf - "switching to new head %a" - Tezos_crypto.Block_hash.pp - hash + Format.fprintf ppf "switching to new head %a" Block_hash.pp hash | Notify (id, {Mempool.known_valid; pending}) -> Format.fprintf ppf @@ -132,43 +125,24 @@ module Request = struct P2p_peer.Id.pp id ; List.iter - (fun oph -> - Format.fprintf - ppf - "@,%a (applied)" - Tezos_crypto.Operation_hash.pp - oph) + (fun oph -> Format.fprintf ppf "@,%a (applied)" Operation_hash.pp oph) known_valid ; List.iter - (fun oph -> - Format.fprintf - ppf - "@,%a (pending)" - Tezos_crypto.Operation_hash.pp - oph) - (Tezos_crypto.Operation_hash.Set.elements pending) ; + (fun oph -> Format.fprintf ppf "@,%a (pending)" Operation_hash.pp oph) + (Operation_hash.Set.elements pending) ; Format.fprintf ppf "@]" | Leftover -> Format.fprintf ppf "process next batch of operation" | Inject {op; force} -> Format.fprintf ppf "injecting operation %a (force:%b)" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op) force | Arrived (oph, _) -> - Format.fprintf - ppf - "operation %a arrived" - Tezos_crypto.Operation_hash.pp - oph + Format.fprintf ppf "operation %a arrived" Operation_hash.pp oph | Advertise -> Format.fprintf ppf "advertising pending operations" - | Ban oph -> - Format.fprintf - ppf - "banning operation %a" - Tezos_crypto.Operation_hash.pp - oph + | Ban oph -> Format.fprintf ppf "banning operation %a" Operation_hash.pp oph end module Operation_encountered = struct @@ -178,7 +152,7 @@ module Operation_encountered = struct | Notified of P2p_peer_id.t option | Other - type t = situation * Tezos_crypto.Operation_hash.t + type t = situation * Operation_hash.t let encoding = let open Data_encoding in @@ -190,7 +164,7 @@ module Operation_encountered = struct ~title:"injected" (obj2 (req "situation" (constant "injected")) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "operation" Operation_hash.encoding)) (function Injected, oph -> Some ((), oph) | _ -> None) (fun ((), oph) -> (Injected, oph)); case @@ -198,7 +172,7 @@ module Operation_encountered = struct ~title:"arrived" (obj2 (req "situation" (constant "arrived")) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "operation" Operation_hash.encoding)) (function Arrived, oph -> Some ((), oph) | _ -> None) (fun ((), oph) -> (Arrived, oph)); case @@ -206,7 +180,7 @@ module Operation_encountered = struct ~title:"notified" (obj3 (req "situation" (constant "notified")) - (req "operation" Tezos_crypto.Operation_hash.encoding) + (req "operation" Operation_hash.encoding) (req "peer" (option P2p_peer_id.encoding))) (function Notified peer, oph -> Some ((), oph, peer) | _ -> None) (fun ((), oph, peer) -> (Notified peer, oph)); @@ -215,7 +189,7 @@ module Operation_encountered = struct ~title:"other" (obj2 (req "situation" (constant "other")) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "operation" Operation_hash.encoding)) (function Other, hash -> Some ((), hash) | _ -> None) (fun ((), oph) -> (Other, oph)); ] @@ -234,6 +208,6 @@ module Operation_encountered = struct "operation %a: %a" situation_pp situation - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph end diff --git a/src/lib_shell_services/prevalidator_worker_state.mli b/src/lib_shell_services/prevalidator_worker_state.mli index 45a1dbd10304..b29de7ccd9ca 100644 --- a/src/lib_shell_services/prevalidator_worker_state.mli +++ b/src/lib_shell_services/prevalidator_worker_state.mli @@ -27,10 +27,10 @@ module Request : sig type ('a, 'b) t = | Flush : - Tezos_crypto.Block_hash.t + Block_hash.t * Chain_validator_worker_state.update - * Tezos_crypto.Block_hash.Set.t - * Tezos_crypto.Operation_hash.Set.t + * Block_hash.Set.t + * Operation_hash.Set.t -> (unit, error trace) t (** The chain changed, the mempool is being notified of the new state. *) | Notify : P2p_peer.Id.t * Mempool.t -> (unit, Empty.t) t @@ -39,11 +39,11 @@ module Request : sig (** Operations not yet processed should be processed. *) | Inject : {op : Operation.t; force : bool} -> (unit, error trace) t (** Operation has been locally injected (sent) to the node. *) - | Arrived : Tezos_crypto.Operation_hash.t * Operation.t -> (unit, Empty.t) t + | Arrived : Operation_hash.t * Operation.t -> (unit, Empty.t) t (** Operation was fetched by the node. *) | Advertise : (unit, Empty.t) t (** Current mempool should be advertised to all known peers. *) - | Ban : Tezos_crypto.Operation_hash.t -> (unit, error trace) t + | Ban : Operation_hash.t -> (unit, error trace) t (** User requested the node to ban operation with this hash. *) type view = View : _ t -> view @@ -74,7 +74,7 @@ module Operation_encountered : sig | Notified of P2p_peer_id.t option | Other - type t = situation * Tezos_crypto.Operation_hash.t + type t = situation * Operation_hash.t val encoding : t Data_encoding.t diff --git a/src/lib_shell_services/protocol_services.ml b/src/lib_shell_services/protocol_services.ml index 92e7e2ad8ed2..3420784d0c67 100644 --- a/src/lib_shell_services/protocol_services.ml +++ b/src/lib_shell_services/protocol_services.ml @@ -26,7 +26,7 @@ open Data_encoding module S = struct - let protocols_arg = Tezos_crypto.Protocol_hash.rpc_arg + let protocols_arg = Protocol_hash.rpc_arg let contents = Tezos_rpc.Service.get_service @@ -43,7 +43,7 @@ module S = struct let list = Tezos_rpc.Service.get_service ~query:Tezos_rpc.Query.empty - ~output:(list Tezos_crypto.Protocol_hash.encoding) + ~output:(list Protocol_hash.encoding) Tezos_rpc.Path.(root / "protocols") let fetch = diff --git a/src/lib_shell_services/protocol_services.mli b/src/lib_shell_services/protocol_services.mli index 40e6e010b4c9..eaaed856b5af 100644 --- a/src/lib_shell_services/protocol_services.mli +++ b/src/lib_shell_services/protocol_services.mli @@ -25,21 +25,20 @@ open Tezos_rpc.Context -val contents : - #simple -> Tezos_crypto.Protocol_hash.t -> Protocol.t tzresult Lwt.t +val contents : #simple -> Protocol_hash.t -> Protocol.t tzresult Lwt.t val environment : - #simple -> Tezos_crypto.Protocol_hash.t -> Protocol.env_version tzresult Lwt.t + #simple -> Protocol_hash.t -> Protocol.env_version tzresult Lwt.t -val list : #simple -> Tezos_crypto.Protocol_hash.t list tzresult Lwt.t +val list : #simple -> Protocol_hash.t list tzresult Lwt.t -val fetch : #simple -> Tezos_crypto.Protocol_hash.t -> unit tzresult Lwt.t +val fetch : #simple -> Protocol_hash.t -> unit tzresult Lwt.t module S : sig val contents : ( [`GET], unit, - unit * Tezos_crypto.Protocol_hash.t, + unit * Protocol_hash.t, unit, unit, Protocol.t ) @@ -48,27 +47,15 @@ module S : sig val environment : ( [`GET], unit, - unit * Tezos_crypto.Protocol_hash.t, + unit * Protocol_hash.t, unit, unit, Protocol.env_version ) Tezos_rpc.Service.t val list : - ( [`GET], - unit, - unit, - unit, - unit, - Tezos_crypto.Protocol_hash.t list ) - Tezos_rpc.Service.t + ([`GET], unit, unit, unit, unit, Protocol_hash.t list) Tezos_rpc.Service.t val fetch : - ( [`GET], - unit, - unit * Tezos_crypto.Protocol_hash.t, - unit, - unit, - unit ) - Tezos_rpc.Service.t + ([`GET], unit, unit * Protocol_hash.t, unit, unit, unit) Tezos_rpc.Service.t end diff --git a/src/lib_shell_services/state_events.ml b/src/lib_shell_services/state_events.ml index c0e6d9db9531..b0249a8becf7 100644 --- a/src/lib_shell_services/state_events.ml +++ b/src/lib_shell_services/state_events.ml @@ -33,7 +33,7 @@ let missing_pruned_contents = ~name:"missing_pruned_contents" ~msg:"cannot find pruned contents of block {block_hash}" ~level:Error - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) let pop_block = declare_1 @@ -41,7 +41,7 @@ let pop_block = ~name:"pop_block" ~msg:"pop_block {block_hash}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) let push_block = declare_1 @@ -49,7 +49,7 @@ let push_block = ~name:"push_block" ~msg:"push_block {block_hash}" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) let destroy_state = declare_1 diff --git a/src/lib_shell_services/store_errors.ml b/src/lib_shell_services/store_errors.ml index 4f78fd9458cb..f3e23d0e843b 100644 --- a/src/lib_shell_services/store_errors.ml +++ b/src/lib_shell_services/store_errors.ml @@ -24,13 +24,10 @@ (*****************************************************************************) type error += - | Block_not_found of {hash : Tezos_crypto.Block_hash.t; distance : int} - | Resulting_context_hash_not_found of { - hash : Tezos_crypto.Block_hash.t; - level : int32; - } + | Block_not_found of {hash : Block_hash.t; distance : int} + | Resulting_context_hash_not_found of {hash : Block_hash.t; level : int32} | Bad_level of {head_level : Int32.t; given_level : Int32.t} - | Block_metadata_not_found of Tezos_crypto.Block_hash.t + | Block_metadata_not_found of Block_hash.t | Protocol_not_found of {protocol_level : int} | Cannot_switch_history_mode of { previous_mode : History_mode.t; @@ -38,12 +35,12 @@ type error += } | Invalid_head_switch of { checkpoint_level : int32; - given_head : Tezos_crypto.Block_hash.t * int32; + given_head : Block_hash.t * int32; } | Inconsistent_store_state of string | Inconsistent_operations_hash of { - expected : Tezos_crypto.Operation_list_list_hash.t; - got : Tezos_crypto.Operation_list_list_hash.t; + expected : Operation_list_list_hash.t; + got : Operation_list_list_hash.t; } let () = @@ -57,10 +54,10 @@ let () = ppf "Cannot find block at distance %d from block %a." distance - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash) Data_encoding.( - obj1 (req "block_not_found" @@ tup2 Tezos_crypto.Block_hash.encoding int31)) + obj1 (req "block_not_found" @@ tup2 Block_hash.encoding int31)) (function | Block_not_found {hash; distance} -> Some (hash, distance) | _ -> None) (fun (hash, distance) -> Block_not_found {hash; distance}) ; @@ -73,11 +70,11 @@ let () = Format.fprintf ppf "Cannot find the resulting context hash for the block %a (level: %ld)." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash level) Data_encoding.( - obj1 (req "block_not_found" @@ tup2 Tezos_crypto.Block_hash.encoding int32)) + obj1 (req "block_not_found" @@ tup2 Block_hash.encoding int32)) (function | Resulting_context_hash_not_found {hash; level} -> Some (hash, level) | _ -> None) @@ -107,10 +104,9 @@ let () = Format.fprintf ppf "Unable to find block %a's metadata." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash) - Data_encoding.( - obj1 (req "block_metadata_not_found" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "block_metadata_not_found" Block_hash.encoding)) (function | Block_metadata_not_found block_hash -> Some block_hash | _ -> None) (fun block_hash -> Block_metadata_not_found block_hash) ; @@ -159,14 +155,14 @@ let () = Format.fprintf ppf "The given head %a (%ld) is below the minimum allowed level %ld." - Tezos_crypto.Block_hash.pp + Block_hash.pp head_hash head_level minimum_allowed_level) Data_encoding.( obj2 (req "minimum_allowed_level" int32) - (req "given_head" @@ tup2 Tezos_crypto.Block_hash.encoding int32)) + (req "given_head" @@ tup2 Block_hash.encoding int32)) (function | Invalid_head_switch {checkpoint_level; given_head} -> Some (checkpoint_level, given_head) @@ -182,18 +178,14 @@ let () = Format.fprintf ppf "Inconsistent operation hashes. Expected: %a, got %a." - Tezos_crypto.Operation_list_list_hash.pp + Operation_list_list_hash.pp oph - Tezos_crypto.Operation_list_list_hash.pp + Operation_list_list_hash.pp oph') Data_encoding.( obj2 - (req - "expected_operation_hashes" - Tezos_crypto.Operation_list_list_hash.encoding) - (req - "received_operation_hashes" - Tezos_crypto.Operation_list_list_hash.encoding)) + (req "expected_operation_hashes" Operation_list_list_hash.encoding) + (req "received_operation_hashes" Operation_list_list_hash.encoding)) (function | Inconsistent_operations_hash {expected; got} -> Some (expected, got) | _ -> None) @@ -207,11 +199,11 @@ type cemented_store_inconsistency = } | Bad_offset of {level : int; cycle : string} | Unexpected_level of { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; expected : Int32.t; got : Int32.t; } - | Corrupted_index of Tezos_crypto.Block_hash.t + | Corrupted_index of Block_hash.t | Inconsistent_highest_cemented_level of { highest_cemented_level : Int32.t; cementing_highwatermark : Int32.t; @@ -250,7 +242,7 @@ let cemented_store_inconsistency_encoding = (Tag 3) ~title:"Unexpected level" (obj3 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "expected" int32) (req "got" int32)) (function @@ -262,7 +254,7 @@ let cemented_store_inconsistency_encoding = case (Tag 4) ~title:"Corrupted index" - (obj1 (req "block_hash" Tezos_crypto.Block_hash.encoding)) + (obj1 (req "block_hash" Block_hash.encoding)) (function Corrupted_index h -> Some h | _ -> None) (fun h -> Corrupted_index h); case @@ -340,7 +332,7 @@ let store_block_error_encoding = type error += | Cannot_write_in_readonly - | Wrong_predecessor of Tezos_crypto.Block_hash.t * int + | Wrong_predecessor of Block_hash.t * int | Invalid_blocks_to_cement | Wrong_floating_kind_swap | Cannot_update_floating_store @@ -358,33 +350,30 @@ type error += | Missing_last_allowed_fork_level_block | Inconsistent_block_hash of { level : Int32.t; - expected_hash : Tezos_crypto.Block_hash.t; - computed_hash : Tezos_crypto.Block_hash.t; + expected_hash : Block_hash.t; + computed_hash : Block_hash.t; } | Inconsistent_block_predecessor of { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; level : Int32.t; - expected_hash : Tezos_crypto.Block_hash.t; - computed_hash : Tezos_crypto.Block_hash.t; + expected_hash : Block_hash.t; + computed_hash : Block_hash.t; } - | Cannot_encode_block of Tezos_crypto.Block_hash.t - | Cannot_store_block of Tezos_crypto.Block_hash.t * store_block_error - | Cannot_checkout_context of - Tezos_crypto.Block_hash.t * Tezos_crypto.Context_hash.t + | Cannot_encode_block of Block_hash.t + | Cannot_store_block of Block_hash.t * store_block_error + | Cannot_checkout_context of Block_hash.t * Context_hash.t | Cannot_find_protocol of int | Invalid_genesis_marking | Cannot_retrieve_savepoint of Int32.t - | Cannot_set_target of (Tezos_crypto.Block_hash.t * Int32.t) + | Cannot_set_target of (Block_hash.t * Int32.t) | Missing_commit_info of string | Inconsistent_chain_store | Fork_testchain_not_allowed | Cannot_fork_testchain of Tezos_crypto.Chain_id.t | Cannot_load_testchain of string - | Missing_activation_block of - Tezos_crypto.Block_hash.t * Tezos_crypto.Protocol_hash.t * History_mode.t - | Inconsistent_protocol_commit_info of - Tezos_crypto.Block_hash.t * Tezos_crypto.Protocol_hash.t - | Failed_to_get_live_blocks of Tezos_crypto.Block_hash.t + | Missing_activation_block of Block_hash.t * Protocol_hash.t * History_mode.t + | Inconsistent_protocol_commit_info of Block_hash.t * Protocol_hash.t + | Failed_to_get_live_blocks of Block_hash.t | Target_mismatch | Bad_head_invariant @@ -408,11 +397,10 @@ let () = Format.fprintf ppf "Failed to get the nth predecessor of %a. The offset is invalid: %d." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash offset) - Data_encoding.( - obj2 (req "hash" Tezos_crypto.Block_hash.encoding) (req "offset" int31)) + Data_encoding.(obj2 (req "hash" Block_hash.encoding) (req "offset" int31)) (function | Wrong_predecessor (hash, offset) -> Some (hash, offset) | _ -> None) (fun (hash, offset) -> Wrong_predecessor (hash, offset)) ; @@ -621,14 +609,14 @@ let () = | Unexpected_level {block_hash; expected; got} -> Format.asprintf "bad level found for block %a - expected %ld got %ld" - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash expected got | Corrupted_index h -> Format.asprintf "%a was not found in the imported store" - Tezos_crypto.Block_hash.pp + Block_hash.pp h | Inconsistent_highest_cemented_level {highest_cemented_level; cementing_highwatermark} -> @@ -668,15 +656,15 @@ let () = "Inconsistent block: inconsistent hash found for block %ld. Expected \ %a, got %a." level - Tezos_crypto.Block_hash.pp + Block_hash.pp expected_hash - Tezos_crypto.Block_hash.pp + Block_hash.pp computed_hash) Data_encoding.( obj3 (req "level" int32) - (req "expected_hash" Tezos_crypto.Block_hash.encoding) - (req "computed_hash" Tezos_crypto.Block_hash.encoding)) + (req "expected_hash" Block_hash.encoding) + (req "computed_hash" Block_hash.encoding)) (function | Inconsistent_block_hash {level; expected_hash; computed_hash} -> Some (level, expected_hash, computed_hash) @@ -693,19 +681,19 @@ let () = ppf "Inconsistent block: inconsistent predecessor found for block %a (%ld) \ - expected: %a vs got: %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash level - Tezos_crypto.Block_hash.pp + Block_hash.pp expected_hash - Tezos_crypto.Block_hash.pp + Block_hash.pp computed_hash) Data_encoding.( obj4 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "level" int32) - (req "expected_hash" Tezos_crypto.Block_hash.encoding) - (req "computed_hash" Tezos_crypto.Block_hash.encoding)) + (req "expected_hash" Block_hash.encoding) + (req "computed_hash" Block_hash.encoding)) (function | Inconsistent_block_predecessor {block_hash; level; expected_hash; computed_hash} -> @@ -723,9 +711,9 @@ let () = Format.fprintf ppf "Failed to write block in floating store: cannot encode block %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_encode_block hash -> Some hash | _ -> None) (fun hash -> Cannot_encode_block hash) ; Error_monad.register_error_kind @@ -737,7 +725,7 @@ let () = Format.fprintf ppf "Failed to store block %a: %s." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash (match err with | Invalid_block -> "the block is marked as invalid" @@ -766,7 +754,7 @@ let () = genesis_level)) Data_encoding.( obj2 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "err" store_block_error_encoding)) (function Cannot_store_block (hash, err) -> Some (hash, err) | _ -> None) (fun (hash, err) -> Cannot_store_block (hash, err)) ; @@ -779,14 +767,14 @@ let () = Format.fprintf ppf "Failed to checkout the context (%a) for block %a." - Tezos_crypto.Context_hash.pp + Context_hash.pp ch - Tezos_crypto.Block_hash.pp + Block_hash.pp bh) Data_encoding.( obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) - (req "context_hash" Tezos_crypto.Context_hash.encoding)) + (req "block_hash" Block_hash.encoding) + (req "context_hash" Context_hash.encoding)) (function Cannot_checkout_context (bh, ch) -> Some (bh, ch) | _ -> None) (fun (bh, ch) -> Cannot_checkout_context (bh, ch)) ; Error_monad.register_error_kind @@ -833,11 +821,10 @@ let () = ppf "Failed to set the given target %a (%ld): it is either invalid, or not \ a predecessor of the checkpoint." - Tezos_crypto.Block_hash.pp + Block_hash.pp given_target_hash given_target_level) - Data_encoding.( - obj1 (req "given_target" (tup2 Tezos_crypto.Block_hash.encoding int32))) + Data_encoding.(obj1 (req "given_target" (tup2 Block_hash.encoding int32))) (function Cannot_set_target given_target -> Some given_target | _ -> None) (fun given_target -> Cannot_set_target given_target) ; Error_monad.register_error_kind @@ -915,16 +902,16 @@ let () = ppf "Failed to restore snapshot: the expected activation block %a \ originating the protocol %a was not found for %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp bh - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp ph History_mode.pp hm) Data_encoding.( obj3 - (req "block_hash" Tezos_crypto.Block_hash.encoding) - (req "protocol_hash" Tezos_crypto.Protocol_hash.encoding) + (req "block_hash" Block_hash.encoding) + (req "protocol_hash" Protocol_hash.encoding) (req "history_mode" History_mode.encoding)) (function | Missing_activation_block (bh, ph, hm) -> Some (bh, ph, hm) | _ -> None) @@ -939,14 +926,14 @@ let () = ppf "Failed to restore snapshot: inconsistent commit info found for \ transition block %a activating protocol %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp bh - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp ph) Data_encoding.( obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) - (req "protocol_hash" Tezos_crypto.Protocol_hash.encoding)) + (req "block_hash" Block_hash.encoding) + (req "protocol_hash" Protocol_hash.encoding)) (function | Inconsistent_protocol_commit_info (bh, ph) -> Some (bh, ph) | _ -> None) (fun (bh, ph) -> Inconsistent_protocol_commit_info (bh, ph)) ; @@ -955,13 +942,13 @@ let () = ~id:"store.failed_to_get_live_blocks" ~title:"Fail to get live blocks" ~description:"Unable to compute live blocks from a given block." - ~pp:(fun ppf (hash : Tezos_crypto.Block_hash.t) -> + ~pp:(fun ppf (hash : Block_hash.t) -> Format.fprintf ppf "Failed to get live blocks from block %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Failed_to_get_live_blocks h -> Some h | _ -> None) (fun h -> Failed_to_get_live_blocks h) ; Error_monad.register_error_kind @@ -989,14 +976,11 @@ type error += | Unexpected_missing_block of {block_name : string} | Unexpected_missing_block_metadata of {block_name : string} | Unexpected_missing_activation_block of { - block : Tezos_crypto.Block_hash.t; - protocol : Tezos_crypto.Protocol_hash.t; + block : Block_hash.t; + protocol : Protocol_hash.t; } | Unexpected_missing_protocol of {protocol_level : int} - | Inconsistent_genesis of { - expected : Tezos_crypto.Block_hash.t; - got : Tezos_crypto.Block_hash.t; - } + | Inconsistent_genesis of {expected : Block_hash.t; got : Block_hash.t} | Inconsistent_cementing_highwatermark of { highest_cemented_level : Int32.t; cementing_highwatermark : Int32.t; @@ -1051,14 +1035,14 @@ let () = ppf "The block %a activating protocol %a is unexpectedly missing from the \ store." - Tezos_crypto.Block_hash.pp + Block_hash.pp block - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proto) Data_encoding.( obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding)) + (req "block" Block_hash.encoding) + (req "protocol" Protocol_hash.encoding)) (function | Unexpected_missing_activation_block {block; protocol} -> Some (block, protocol) @@ -1089,14 +1073,12 @@ let () = Format.fprintf ppf "The genesis (%a) found in the store is not the one expected (%a)." - Tezos_crypto.Block_hash.pp + Block_hash.pp got - Tezos_crypto.Block_hash.pp + Block_hash.pp expected) Data_encoding.( - obj2 - (req "expected" Tezos_crypto.Block_hash.encoding) - (req "got" Tezos_crypto.Block_hash.encoding)) + obj2 (req "expected" Block_hash.encoding) (req "got" Block_hash.encoding)) (function | Inconsistent_genesis {expected; got} -> Some (expected, got) | _ -> None) (fun (expected, got) -> Inconsistent_genesis {expected; got}) ; @@ -1199,7 +1181,7 @@ let () = {genesis; caboose; savepoint; cementing_highwatermark; checkpoint; head}) type corruption_kind = - | Inferred_head of Tezos_crypto.Block_hash.t * Int32.t + | Inferred_head of Block_hash.t * Int32.t | Cannot_find_floating_savepoint | Cannot_find_savepoint_candidate | Cannot_find_floating_caboose @@ -1215,7 +1197,7 @@ let corruption_kind_encoding = case (Tag 0) ~title:"Inferred_head" - (obj2 (req "hash" Tezos_crypto.Block_hash.encoding) (req "level" int32)) + (obj2 (req "hash" Block_hash.encoding) (req "level" int32)) (function | Inferred_head (hash, level) -> Some (hash, level) | _ -> None) (fun (hash, level) -> Inferred_head (hash, level)); @@ -1270,7 +1252,7 @@ let pp_corruption_kind ppf = function Format.fprintf ppf "inferred head (%a, %ld) must have metadata" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash level | Cannot_find_floating_savepoint -> diff --git a/src/lib_shell_services/validation_errors.ml b/src/lib_shell_services/validation_errors.ml index c4b605a405ca..decb202c402e 100644 --- a/src/lib_shell_services/validation_errors.ml +++ b/src/lib_shell_services/validation_errors.ml @@ -34,7 +34,7 @@ type error += Oversized_operation of {size : int; max : int} type error += | Future_block_header of { - block : Tezos_crypto.Block_hash.t; + block : Block_hash.t; block_time : Time.Protocol.t; time : Time.System.t; } @@ -87,7 +87,7 @@ let () = Format.fprintf ppf "Future block header (block: %a, block_time: %a, time: %a)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block Time.System.pp_hum (Time.System.of_protocol_exn block_time) @@ -95,7 +95,7 @@ let () = time) Data_encoding.( obj3 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (req "block_time" Time.Protocol.encoding) (req "time" Time.System.encoding)) (function @@ -121,7 +121,7 @@ type error += Unknown_chain of Tezos_crypto.Chain_id.t type error += Bad_data_dir -type error += Block_not_invalid of Tezos_crypto.Block_hash.t +type error += Block_not_invalid of Block_hash.t let () = (* Unknown network *) @@ -158,21 +158,19 @@ let () = Format.fprintf ppf "Block %a was expected to be invalid, but was not actually invalid." - Tezos_crypto.Block_hash.pp + Block_hash.pp block) - Data_encoding.(obj1 (req "block" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "block" Block_hash.encoding)) (function Block_not_invalid block -> Some block | _ -> None) (fun block -> Block_not_invalid block) (* Block database error *) -type error += - | Inconsistent_hash of - Tezos_crypto.Context_hash.t * Tezos_crypto.Context_hash.t +type error += Inconsistent_hash of Context_hash.t * Context_hash.t -type error += Missing_block_metadata_hash of Tezos_crypto.Block_hash.t +type error += Missing_block_metadata_hash of Block_hash.t -type error += Missing_operation_metadata_hashes of Tezos_crypto.Block_hash.t +type error += Missing_operation_metadata_hashes of Block_hash.t let () = (* Inconsistent hash *) @@ -187,14 +185,14 @@ let () = Format.fprintf ppf "@[<v 2>Inconsistent hash:@ got: %a@ expected: %a" - Tezos_crypto.Context_hash.pp + Context_hash.pp got - Tezos_crypto.Context_hash.pp + Context_hash.pp exp) Data_encoding.( obj2 - (req "wrong_context_hash" Tezos_crypto.Context_hash.encoding) - (req "expected_context_hash" Tezos_crypto.Context_hash.encoding)) + (req "wrong_context_hash" Context_hash.encoding) + (req "expected_context_hash" Context_hash.encoding)) (function Inconsistent_hash (got, exp) -> Some (got, exp) | _ -> None) (fun (got, exp) -> Inconsistent_hash (got, exp)) ; register_error_kind @@ -208,9 +206,9 @@ let () = Format.fprintf ppf "@[<v 2>Missing block metadata hash at block: %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp block) - Data_encoding.(obj1 (req "block" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "block" Block_hash.encoding)) (function Missing_block_metadata_hash block -> Some block | _ -> None) (fun block -> Missing_block_metadata_hash block) ; register_error_kind @@ -224,9 +222,9 @@ let () = Format.fprintf ppf "@[<v 2>Missing operation metadata hashes at block: %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp block) - Data_encoding.(obj1 (req "block" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "block" Block_hash.encoding)) (function | Missing_operation_metadata_hashes block -> Some block | _ -> None) (fun block -> Missing_operation_metadata_hashes block) @@ -284,10 +282,7 @@ let () = type protocol_error = Compilation_failed | Dynlinking_failed type error += - | Invalid_protocol of { - hash : Tezos_crypto.Protocol_hash.t; - error : protocol_error; - } + | Invalid_protocol of {hash : Protocol_hash.t; error : protocol_error} let protocol_error_encoding = let open Data_encoding in @@ -322,19 +317,19 @@ let () = Format.fprintf ppf "@[<v 2>Invalid protocol %a@ %a@]" - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short protocol pp_protocol_error error) Data_encoding.( merge_objs - (obj1 (req "invalid_protocol" Tezos_crypto.Protocol_hash.encoding)) + (obj1 (req "invalid_protocol" Protocol_hash.encoding)) protocol_error_encoding) (function | Invalid_protocol {hash; error} -> Some (hash, error) | _ -> None) (fun (hash, error) -> Invalid_protocol {hash; error}) -type error += Cannot_load_protocol of Tezos_crypto.Protocol_hash.t +type error += Cannot_load_protocol of Protocol_hash.t let () = register_error_kind @@ -347,9 +342,9 @@ let () = ppf "Failed to load the protocol %a from disk: the corresponding files \ might be missing or corrupted." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocol) - Data_encoding.(obj1 (req "protocol" Tezos_crypto.Protocol_hash.encoding)) + Data_encoding.(obj1 (req "protocol" Protocol_hash.encoding)) (function Cannot_load_protocol protocol -> Some protocol | _ -> None) (fun protocol -> Cannot_load_protocol protocol) @@ -383,8 +378,7 @@ let () = type error += Inactive_chain of Tezos_crypto.Chain_id.t -type error += - | Checkpoint_error of Tezos_crypto.Block_hash.t * P2p_peer.Id.t option +type error += Checkpoint_error of Block_hash.t * P2p_peer.Id.t option let () = (* Inactive network *) @@ -416,7 +410,7 @@ let () = Format.fprintf ppf "The block %a is incompatible with the current checkpoint." - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block | Some peer -> Format.fprintf @@ -425,12 +419,10 @@ let () = checkpoint (%a)." P2p_peer.Id.pp peer - Tezos_crypto.Block_hash.pp_short + Block_hash.pp_short block) Data_encoding.( - obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (opt "peer" P2p_peer.Id.encoding)) + obj2 (req "block" Block_hash.encoding) (opt "peer" P2p_peer.Id.encoding)) (function | Checkpoint_error (block, peer) -> Some (block, peer) | _ -> None) (fun (block, peer) -> Checkpoint_error (block, peer)) diff --git a/src/lib_shell_services/validation_errors.mli b/src/lib_shell_services/validation_errors.mli index df095c309ee2..d01e8477794b 100644 --- a/src/lib_shell_services/validation_errors.mli +++ b/src/lib_shell_services/validation_errors.mli @@ -34,7 +34,7 @@ type error += Oversized_operation of {size : int; max : int} type error += | Future_block_header of { - block : Tezos_crypto.Block_hash.t; + block : Block_hash.t; block_time : Time.Protocol.t; time : Time.System.t; } @@ -47,17 +47,15 @@ type error += Unknown_chain of Tezos_crypto.Chain_id.t type error += Bad_data_dir -type error += Block_not_invalid of Tezos_crypto.Block_hash.t +type error += Block_not_invalid of Block_hash.t (* Block database error *) -type error += - | Inconsistent_hash of - Tezos_crypto.Context_hash.t * Tezos_crypto.Context_hash.t +type error += Inconsistent_hash of Context_hash.t * Context_hash.t -type error += Missing_block_metadata_hash of Tezos_crypto.Block_hash.t +type error += Missing_block_metadata_hash of Block_hash.t -type error += Missing_operation_metadata_hashes of Tezos_crypto.Block_hash.t +type error += Missing_operation_metadata_hashes of Block_hash.t (******************* Bootstrap pipeline errors ****************************) @@ -70,12 +68,9 @@ type error += Too_short_locator of P2p_peer.Id.t * Block_locator.t type protocol_error = Compilation_failed | Dynlinking_failed type error += - | Invalid_protocol of { - hash : Tezos_crypto.Protocol_hash.t; - error : protocol_error; - } + | Invalid_protocol of {hash : Protocol_hash.t; error : protocol_error} -type error += Cannot_load_protocol of Tezos_crypto.Protocol_hash.t +type error += Cannot_load_protocol of Protocol_hash.t (********************* Peer validator errors ******************************) @@ -85,5 +80,4 @@ type error += Unknown_ancestor | Known_invalid type error += Inactive_chain of Tezos_crypto.Chain_id.t -type error += - | Checkpoint_error of Tezos_crypto.Block_hash.t * P2p_peer.Id.t option +type error += Checkpoint_error of Block_hash.t * P2p_peer.Id.t option diff --git a/src/lib_shell_services/validation_events.ml b/src/lib_shell_services/validation_events.ml index fb9e03d5ecfb..338aa7533694 100644 --- a/src/lib_shell_services/validation_events.ml +++ b/src/lib_shell_services/validation_events.ml @@ -33,8 +33,8 @@ let new_protocol_initialisation = ~name:"new_protocol_initialisation" ~msg:"initializing protocol {proto_hash}..." ~level:Notice - ~pp1:Tezos_crypto.Protocol_hash.pp_short - ("proto_hash", Tezos_crypto.Protocol_hash.encoding) + ~pp1:Protocol_hash.pp_short + ("proto_hash", Protocol_hash.encoding) let using_preapply_result = declare_1 @@ -42,5 +42,5 @@ let using_preapply_result = ~name:"using_preapply_result" ~msg:"using pre-application result for block {block_hash} application" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) diff --git a/src/lib_signer_backends/unencrypted.ml b/src/lib_signer_backends/unencrypted.ml index b91d3656545a..93f6a324d862 100644 --- a/src/lib_signer_backends/unencrypted.ml +++ b/src/lib_signer_backends/unencrypted.ml @@ -45,7 +45,7 @@ let make_sapling_key sk = Client_keys.make_sapling_uri (Uri.make ~scheme ~path ()) module Make_common (S : sig - include Tezos_crypto.S.COMMON_SIGNATURE + include Tezos_crypto.Intfs.COMMON_SIGNATURE type public_key_hash = Public_key_hash.t diff --git a/src/lib_store/unix/snapshots.ml b/src/lib_store/unix/snapshots.ml index 73123a2157ac..a597a9f2797c 100644 --- a/src/lib_store/unix/snapshots.ml +++ b/src/lib_store/unix/snapshots.ml @@ -1515,7 +1515,7 @@ module type EXPORTER = sig unit Lwt.t val export_context : - t -> Context.index -> Tezos_crypto.Context_hash.t -> unit tzresult Lwt.t + t -> Context.index -> Context_hash.t -> unit tzresult Lwt.t val copy_cemented_block : t -> file:string -> start_level:int32 -> end_level:int32 -> unit Lwt.t diff --git a/src/lib_test/assert_lib.ml b/src/lib_test/assert_lib.ml index 5da6fff72a1d..e6fefc7a00ff 100644 --- a/src/lib_test/assert_lib.ml +++ b/src/lib_test/assert_lib.ml @@ -34,7 +34,7 @@ module Crypto = struct | None -> Format.pp_print_string ppf "none" | Some op -> Format.pp_print_string ppf - @@ Tezos_crypto.Operation_hash.to_b58check + @@ Tezos_crypto.Hashed.Operation_hash.to_b58check (Tezos_base.Operation.hash op) in Assert.equal ?loc ?msg ~pp ~eq op1 op2 @@ -45,7 +45,7 @@ module Crypto = struct Format.fprintf ppf "@[<v 2>%a@ %a@]" - Tezos_crypto.Block_hash.pp + Tezos_crypto.Hashed.Block_hash.pp (Tezos_base.Block_header.hash st) Data_encoding.Json.pp (Data_encoding.Json.construct Tezos_base.Block_header.encoding st) @@ -53,38 +53,44 @@ module Crypto = struct Assert.equal ?loc ?msg ~pp ~eq st1 st2 let equal_block_set ?loc ?msg set1 set2 = - let b1 = Tezos_crypto.Block_hash.Set.elements set1 - and b2 = Tezos_crypto.Block_hash.Set.elements set2 in + let b1 = Tezos_crypto.Hashed.Block_hash.Set.elements set1 + and b2 = Tezos_crypto.Hashed.Block_hash.Set.elements set2 in Assert.equal_list ?loc ?msg - ~eq:Tezos_crypto.Block_hash.equal - ~pp:Tezos_crypto.Block_hash.pp + ~eq:Tezos_crypto.Hashed.Block_hash.equal + ~pp:Tezos_crypto.Hashed.Block_hash.pp b1 b2 let equal_block_map ~eq ?loc ?msg map1 map2 = - let b1 = Tezos_crypto.Block_hash.Map.bindings map1 - and b2 = Tezos_crypto.Block_hash.Map.bindings map2 in + let b1 = Tezos_crypto.Hashed.Block_hash.Map.bindings map1 + and b2 = Tezos_crypto.Hashed.Block_hash.Map.bindings map2 in Assert.equal_list ?loc ?msg ~eq:(fun (h1, b1) (h2, b2) -> - Tezos_crypto.Block_hash.equal h1 h2 && eq b1 b2) - ~pp:(fun ppf (h, _) -> Tezos_crypto.Block_hash.pp ppf h) + Tezos_crypto.Hashed.Block_hash.equal h1 h2 && eq b1 b2) + ~pp:(fun ppf (h, _) -> Tezos_crypto.Hashed.Block_hash.pp ppf h) b1 b2 let equal_block_hash_list ?loc ?msg l1 l2 = - let pp = Tezos_crypto.Block_hash.pp_short in - Assert.equal_list ?loc ?msg ~eq:Tezos_crypto.Block_hash.equal ~pp l1 l2 + let pp = Tezos_crypto.Hashed.Block_hash.pp_short in + Assert.equal_list + ?loc + ?msg + ~eq:Tezos_crypto.Hashed.Block_hash.equal + ~pp + l1 + l2 let equal_block_descriptor ?loc ?msg bd1 bd2 = let eq (l1, h1) (l2, h2) = - Int32.equal l1 l2 && Tezos_crypto.Block_hash.equal h1 h2 + Int32.equal l1 l2 && Tezos_crypto.Hashed.Block_hash.equal h1 h2 in let pp ppf (l, h) = - Format.fprintf ppf "(%ld, %a)" l Tezos_crypto.Block_hash.pp h + Format.fprintf ppf "(%ld, %a)" l Tezos_crypto.Hashed.Block_hash.pp h in Assert.equal ?loc ?msg ~pp ~eq bd1 bd2 end diff --git a/src/lib_test/assert_lib.mli b/src/lib_test/assert_lib.mli index c5f451c58e3f..703486ac1770 100644 --- a/src/lib_test/assert_lib.mli +++ b/src/lib_test/assert_lib.mli @@ -38,23 +38,23 @@ module Crypto : sig (** [equal_block_set msg bs0 bs1] checks that the block sets [bs0] and [bs1] are equal. Will fail with the message [msg] otherwise *) val equal_block_set : - Tezos_crypto.Block_hash.Set.t Tezos_test_helpers.Assert.check2 + Tezos_crypto.Hashed.Block_hash.Set.t Tezos_test_helpers.Assert.check2 (** [equal_block_map msg bm0 bm1] checks that the block maps [bm0] and [bm1] are equal. Will fail with the message [msg] otherwise *) val equal_block_map : eq:('a -> 'a -> bool) -> - 'a Tezos_crypto.Block_hash.Map.t Tezos_test_helpers.Assert.check2 + 'a Tezos_crypto.Hashed.Block_hash.Map.t Tezos_test_helpers.Assert.check2 (** [equal_block_hash_list msg bhl0 bhl1] checks that the block hashes list [bhl0] and [bhl1] are equal. Will fail with the message [msg] otherwise *) val equal_block_hash_list : - Tezos_crypto.Block_hash.t list Tezos_test_helpers.Assert.check2 + Tezos_crypto.Hashed.Block_hash.t list Tezos_test_helpers.Assert.check2 (** [equal_block_descriptor msg bd0 bd1] checks that the block descriptors [bd0] and [bd1] are equal. Will fail with the message [msg] otherwise *) val equal_block_descriptor : - (int32 * Tezos_crypto.Block_hash.t) Tezos_test_helpers.Assert.check2 + (int32 * Tezos_crypto.Hashed.Block_hash.t) Tezos_test_helpers.Assert.check2 end (** Module concerning assertions about raw trees i.e. values of type diff --git a/src/lib_tree_encoding/tezos_tree_encoding.mli b/src/lib_tree_encoding/tezos_tree_encoding.mli index f579ead34594..6a08fd53bc5d 100644 --- a/src/lib_tree_encoding/tezos_tree_encoding.mli +++ b/src/lib_tree_encoding/tezos_tree_encoding.mli @@ -285,7 +285,7 @@ module type TREE = sig val find_tree : tree -> key -> tree option Lwt.t - val hash : tree -> Tezos_crypto.Context_hash.t + val hash : tree -> Context_hash.t val length : tree -> key -> int Lwt.t diff --git a/src/lib_tree_encoding/tree.ml b/src/lib_tree_encoding/tree.ml index 94a9d8539694..297c7c02b8d9 100644 --- a/src/lib_tree_encoding/tree.ml +++ b/src/lib_tree_encoding/tree.ml @@ -47,7 +47,7 @@ module type S = sig val find_tree : tree -> key -> tree option Lwt.t - val hash : tree -> Tezos_crypto.Context_hash.t + val hash : tree -> Context_hash.t val length : tree -> key -> int Lwt.t @@ -80,7 +80,7 @@ let find : type tree. tree backend -> tree -> key -> value option Lwt.t = let find_tree : type tree. tree backend -> tree -> key -> tree option Lwt.t = fun (module T) tree key -> T.find_tree tree key -let hash : type tree. tree backend -> tree -> Tezos_crypto.Context_hash.t = +let hash : type tree. tree backend -> tree -> Context_hash.t = fun (module T) tree -> T.hash tree let length : type tree. tree backend -> tree -> key -> int Lwt.t = diff --git a/src/lib_tree_encoding/tree.mli b/src/lib_tree_encoding/tree.mli index 8dc408a5dffd..48873f112af4 100644 --- a/src/lib_tree_encoding/tree.mli +++ b/src/lib_tree_encoding/tree.mli @@ -51,7 +51,7 @@ module type S = sig val find_tree : tree -> key -> tree option Lwt.t - val hash : tree -> Tezos_crypto.Context_hash.t + val hash : tree -> Context_hash.t val length : tree -> key -> int Lwt.t diff --git a/src/lib_validation/block_validation.mli b/src/lib_validation/block_validation.mli index d65c64bf9f13..eb2b3dc003aa 100644 --- a/src/lib_validation/block_validation.mli +++ b/src/lib_validation/block_validation.mli @@ -73,7 +73,7 @@ type ops_metadata = | No_metadata_hash of operation_metadata list list | Metadata_hash of (operation_metadata * Operation_metadata_hash.t) list list -module Shell_header_hash : S.HASH +module Shell_header_hash : Tezos_crypto.Intfs.HASH type result = { shell_header_hash : Shell_header_hash.t; diff --git a/src/lib_validation/external_validation.ml b/src/lib_validation/external_validation.ml index 1b70305c8faa..9e8d3ba7cfcf 100644 --- a/src/lib_validation/external_validation.ml +++ b/src/lib_validation/external_validation.ml @@ -388,7 +388,7 @@ let case_context_gc tag = tag ~title:"context_gc" (obj2 - (req "context_hash" Tezos_crypto.Context_hash.encoding) + (req "context_hash" Context_hash.encoding) (req "gc_lockfile_path" string)) (function | Context_garbage_collection {context_hash; gc_lockfile_path} -> 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 f919ddc635ae..75bf9108a831 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml +++ b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.ml @@ -27,7 +27,7 @@ open Protocol open Protocol_client_context let protocol = - Tezos_crypto.Protocol_hash.of_b58check_exn + Protocol_hash.of_b58check_exn "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P" let bake cctxt ?timestamp block command sk = @@ -96,7 +96,7 @@ let proto_param ~name ~desc t = ~name ~desc (Tezos_clic.parameter (fun _ str -> - Lwt.return (Tezos_crypto.Protocol_hash.of_b58check str))) + Lwt.return (Protocol_hash.of_b58check str))) t let commands () = @@ -142,8 +142,8 @@ let commands () = (Activate {protocol = hash; fitness; protocol_parameters}) sk >>=? fun hash -> - cctxt#answer "Injected %a" Tezos_crypto.Block_hash.pp_short hash - >>= fun () -> return_unit); + cctxt#answer "Injected %a" Block_hash.pp_short hash >>= fun () -> + return_unit); command ~desc:"Fork a test protocol" (args2 timestamp_arg test_delay_arg) @@ -162,8 +162,8 @@ let commands () = (Activate_testchain {protocol = hash; delay}) sk >>=? fun hash -> - cctxt#answer "Injected %a" Tezos_crypto.Block_hash.pp_short hash - >>= fun () -> return_unit); + cctxt#answer "Injected %a" Block_hash.pp_short hash >>= fun () -> + return_unit); ] let () = Client_commands.register protocol @@ fun _network -> commands () 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 d2a08cabec07..21b0b3ce6a67 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli +++ b/src/proto_000_Ps9mPmXa/lib_client/client_proto_main.mli @@ -31,4 +31,4 @@ val bake : Shell_services.block -> Data.Command.t -> Client_keys_v0.sk_uri -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t diff --git a/src/proto_000_Ps9mPmXa/lib_protocol/dune b/src/proto_000_Ps9mPmXa/lib_protocol/dune index 2b1de34c283a..f20ae1bb7b04 100644 --- a/src/proto_000_Ps9mPmXa/lib_protocol/dune +++ b/src/proto_000_Ps9mPmXa/lib_protocol/dune @@ -58,7 +58,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P\"\nlet name = Tezos_protocol_environment_000_Ps9mPmXa.Name.name\ninclude Tezos_raw_protocol_000_Ps9mPmXa\ninclude Tezos_raw_protocol_000_Ps9mPmXa.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P\"\nlet name = Tezos_protocol_environment_000_Ps9mPmXa.Name.name\ninclude Tezos_raw_protocol_000_Ps9mPmXa\ninclude Tezos_raw_protocol_000_Ps9mPmXa.Main\n"))) (rule (targets tezos_protocol_000_Ps9mPmXa.ml) diff --git a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml index afe05faed866..66e535e6d8b2 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml @@ -387,9 +387,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -403,9 +403,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -447,7 +447,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -458,7 +458,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal (match ballot with Yay -> "YAY" | Pass -> "PASS" | Nay -> "NAY") | Single_and_result diff --git a/src/proto_001_PtCJ7pwo/lib_protocol/dune b/src/proto_001_PtCJ7pwo/lib_protocol/dune index 4e260b6ac2b6..0ccc7d54b04f 100644 --- a/src/proto_001_PtCJ7pwo/lib_protocol/dune +++ b/src/proto_001_PtCJ7pwo/lib_protocol/dune @@ -125,7 +125,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY\"\nlet name = Tezos_protocol_environment_001_PtCJ7pwo.Name.name\ninclude Tezos_raw_protocol_001_PtCJ7pwo\ninclude Tezos_raw_protocol_001_PtCJ7pwo.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY\"\nlet name = Tezos_protocol_environment_001_PtCJ7pwo.Name.name\ninclude Tezos_raw_protocol_001_PtCJ7pwo\ninclude Tezos_raw_protocol_001_PtCJ7pwo.Main\n"))) (rule (targets tezos_protocol_001_PtCJ7pwo.ml) 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 41581ac0d854..3f3da27cd5b5 100644 --- a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml +++ b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.ml @@ -103,7 +103,7 @@ let get_operation_from_block (cctxt : #Client_context.full) ~chain predecessors | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 e751b37023ae..b9f204f06001 100644 --- a/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli +++ b/src/proto_002_PsYLVpVv/lib_client/client_proto_context.mli @@ -74,5 +74,5 @@ val display_receipt_for_operation : #Alpha_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml index 237e6b7892ea..1e7b81791c1a 100644 --- a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml +++ b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml @@ -391,9 +391,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -407,9 +407,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -451,7 +451,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -462,7 +462,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal (match ballot with Yay -> "YAY" | Pass -> "PASS" | Nay -> "NAY") | Single_and_result 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 3d30e237fb6e..ae7a815ae8b7 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 @@ -224,7 +224,7 @@ let commands () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) diff --git a/src/proto_002_PsYLVpVv/lib_protocol/dune b/src/proto_002_PsYLVpVv/lib_protocol/dune index f5c75cb5c99a..3f652ff48fe3 100644 --- a/src/proto_002_PsYLVpVv/lib_protocol/dune +++ b/src/proto_002_PsYLVpVv/lib_protocol/dune @@ -125,7 +125,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt\"\nlet name = Tezos_protocol_environment_002_PsYLVpVv.Name.name\ninclude Tezos_raw_protocol_002_PsYLVpVv\ninclude Tezos_raw_protocol_002_PsYLVpVv.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt\"\nlet name = Tezos_protocol_environment_002_PsYLVpVv.Name.name\ninclude Tezos_raw_protocol_002_PsYLVpVv\ninclude Tezos_raw_protocol_002_PsYLVpVv.Main\n"))) (rule (targets tezos_protocol_002_PsYLVpVv.ml) 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 6d62e5b5dafc..a7a63b7b8358 100644 --- a/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml +++ b/src/proto_003_PsddFKi3/lib_client/client_proto_context.ml @@ -79,7 +79,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -149,7 +149,7 @@ let get_operation_from_block (cctxt : #Client_context.full) ~chain predecessors | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 604e83f44383..fb21d6c53a6e 100644 --- a/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli +++ b/src/proto_003_PsddFKi3/lib_client/client_proto_context.mli @@ -72,7 +72,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -104,5 +104,5 @@ val display_receipt_for_operation : #Alpha_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_003_PsddFKi3/lib_client/operation_result.ml b/src/proto_003_PsddFKi3/lib_client/operation_result.ml index 1bcf19505aa2..e5f61fa29063 100644 --- a/src/proto_003_PsddFKi3/lib_client/operation_result.ml +++ b/src/proto_003_PsddFKi3/lib_client/operation_result.ml @@ -402,9 +402,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -418,9 +418,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -462,7 +462,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -473,7 +473,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 81393dd717c2..23bb9a2dbb2a 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 @@ -230,7 +230,7 @@ let commands () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -291,10 +291,7 @@ let commands () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -309,14 +306,10 @@ let commands () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_003_PsddFKi3/lib_protocol/dune b/src/proto_003_PsddFKi3/lib_protocol/dune index 15b996954665..2ea0586e1164 100644 --- a/src/proto_003_PsddFKi3/lib_protocol/dune +++ b/src/proto_003_PsddFKi3/lib_protocol/dune @@ -126,7 +126,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP\"\nlet name = Tezos_protocol_environment_003_PsddFKi3.Name.name\ninclude Tezos_raw_protocol_003_PsddFKi3\ninclude Tezos_raw_protocol_003_PsddFKi3.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP\"\nlet name = Tezos_protocol_environment_003_PsddFKi3.Name.name\ninclude Tezos_raw_protocol_003_PsddFKi3\ninclude Tezos_raw_protocol_003_PsddFKi3.Main\n"))) (rule (targets tezos_protocol_003_PsddFKi3.ml) 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 dbacb43060eb..6c80ff7576b7 100644 --- a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml +++ b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.ml @@ -80,7 +80,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -150,7 +150,7 @@ let get_operation_from_block (cctxt : #Client_context.full) ~chain predecessors | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 73fd63e7fb3b..db294df5861a 100644 --- a/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli +++ b/src/proto_004_Pt24m4xi/lib_client/client_proto_context.mli @@ -72,7 +72,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -106,5 +106,5 @@ val display_receipt_for_operation : #Alpha_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml index 1bcf19505aa2..e5f61fa29063 100644 --- a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml +++ b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml @@ -402,9 +402,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -418,9 +418,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -462,7 +462,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -473,7 +473,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 81393dd717c2..23bb9a2dbb2a 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 @@ -230,7 +230,7 @@ let commands () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -291,10 +291,7 @@ let commands () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -309,14 +306,10 @@ let commands () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_004_Pt24m4xi/lib_protocol/dune b/src/proto_004_Pt24m4xi/lib_protocol/dune index 4755d6e0a582..d94e5f48906a 100644 --- a/src/proto_004_Pt24m4xi/lib_protocol/dune +++ b/src/proto_004_Pt24m4xi/lib_protocol/dune @@ -126,7 +126,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd\"\nlet name = Tezos_protocol_environment_004_Pt24m4xi.Name.name\ninclude Tezos_raw_protocol_004_Pt24m4xi\ninclude Tezos_raw_protocol_004_Pt24m4xi.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd\"\nlet name = Tezos_protocol_environment_004_Pt24m4xi.Name.name\ninclude Tezos_raw_protocol_004_Pt24m4xi\ninclude Tezos_raw_protocol_004_Pt24m4xi.Main\n"))) (rule (targets tezos_protocol_004_Pt24m4xi.ml) diff --git a/src/proto_005_PsBABY5H/lib_protocol/dune b/src/proto_005_PsBABY5H/lib_protocol/dune index f72ebca96287..a4133965562a 100644 --- a/src/proto_005_PsBABY5H/lib_protocol/dune +++ b/src/proto_005_PsBABY5H/lib_protocol/dune @@ -127,7 +127,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU\"\nlet name = Tezos_protocol_environment_005_PsBABY5H.Name.name\ninclude Tezos_raw_protocol_005_PsBABY5H\ninclude Tezos_raw_protocol_005_PsBABY5H.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU\"\nlet name = Tezos_protocol_environment_005_PsBABY5H.Name.name\ninclude Tezos_raw_protocol_005_PsBABY5H\ninclude Tezos_raw_protocol_005_PsBABY5H.Main\n"))) (rule (targets tezos_protocol_005_PsBABY5H.ml) 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 70a862de2a5c..4b01089a4cd5 100644 --- a/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml +++ b/src/proto_005_PsBabyM1/lib_client/client_proto_context.ml @@ -77,7 +77,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -147,7 +147,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j diff --git a/src/proto_005_PsBabyM1/lib_client/client_proto_context.mli b/src/proto_005_PsBabyM1/lib_client/client_proto_context.mli index 17878cb4e928..0fa6d4b862bb 100644 --- a/src/proto_005_PsBabyM1/lib_client/client_proto_context.mli +++ b/src/proto_005_PsBabyM1/lib_client/client_proto_context.mli @@ -73,7 +73,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -107,5 +107,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_005_PsBabyM1/lib_client/injection.ml b/src/proto_005_PsBabyM1/lib_client/injection.ml index 9a773c603ca2..ac43d32265ce 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.ml +++ b/src/proto_005_PsBabyM1/lib_client/injection.ml @@ -45,15 +45,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -183,7 +180,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -657,12 +654,12 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -673,8 +670,7 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -684,9 +680,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -743,9 +739,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -753,7 +749,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ~source ~src_pk ~src_sk ?fee ?(gas_limit = Z.minus_one) ?(storage_limit = Z.of_int (-1)) ?counter ~fee_parameter (type kind) (operation : kind manager_operation) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents * kind Kind.manager contents_result) tzresult diff --git a/src/proto_005_PsBabyM1/lib_client/injection.mli b/src/proto_005_PsBabyM1/lib_client/injection.mli index 73cb9d7b4e72..3ae8af786db4 100644 --- a/src/proto_005_PsBabyM1/lib_client/injection.mli +++ b/src/proto_005_PsBabyM1/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list val inject_operation : #Protocol_client_context.full -> @@ -71,8 +69,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val inject_manager_operation : #Protocol_client_context.full -> diff --git a/src/proto_005_PsBabyM1/lib_client/operation_result.ml b/src/proto_005_PsBabyM1/lib_client/operation_result.ml index cdedc77f8c1f..72e04fdc0022 100644 --- a/src/proto_005_PsBabyM1/lib_client/operation_result.ml +++ b/src/proto_005_PsBabyM1/lib_client/operation_result.ml @@ -407,9 +407,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -423,9 +423,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -467,7 +467,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -478,7 +478,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 443f6f27b3fa..6548da803750 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 @@ -294,7 +294,7 @@ let commands () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -355,10 +355,7 @@ let commands () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -373,14 +370,10 @@ let commands () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_005_PsBabyM1/lib_protocol/dune b/src/proto_005_PsBabyM1/lib_protocol/dune index b2c47a58ee82..e36889788ac2 100644 --- a/src/proto_005_PsBabyM1/lib_protocol/dune +++ b/src/proto_005_PsBabyM1/lib_protocol/dune @@ -127,7 +127,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS\"\nlet name = Tezos_protocol_environment_005_PsBabyM1.Name.name\ninclude Tezos_raw_protocol_005_PsBabyM1\ninclude Tezos_raw_protocol_005_PsBabyM1.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS\"\nlet name = Tezos_protocol_environment_005_PsBabyM1.Name.name\ninclude Tezos_raw_protocol_005_PsBabyM1\ninclude Tezos_raw_protocol_005_PsBabyM1.Main\n"))) (rule (targets tezos_protocol_005_PsBabyM1.ml) 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 2f45b33b519c..295fa69b8bd5 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml @@ -419,7 +419,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -526,7 +526,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 1b18732eac64..f40826febc60 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli @@ -203,7 +203,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -240,7 +240,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -252,7 +252,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -262,5 +262,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_006_PsCARTHA/lib_client/injection.ml b/src/proto_006_PsCARTHA/lib_client/injection.ml index 9a773c603ca2..ac43d32265ce 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.ml +++ b/src/proto_006_PsCARTHA/lib_client/injection.ml @@ -45,15 +45,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -183,7 +180,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -657,12 +654,12 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -673,8 +670,7 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -684,9 +680,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -743,9 +739,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -753,7 +749,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ~source ~src_pk ~src_sk ?fee ?(gas_limit = Z.minus_one) ?(storage_limit = Z.of_int (-1)) ?counter ~fee_parameter (type kind) (operation : kind manager_operation) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents * kind Kind.manager contents_result) tzresult diff --git a/src/proto_006_PsCARTHA/lib_client/injection.mli b/src/proto_006_PsCARTHA/lib_client/injection.mli index 73cb9d7b4e72..3ae8af786db4 100644 --- a/src/proto_006_PsCARTHA/lib_client/injection.mli +++ b/src/proto_006_PsCARTHA/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list val inject_operation : #Protocol_client_context.full -> @@ -71,8 +69,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val inject_manager_operation : #Protocol_client_context.full -> diff --git a/src/proto_006_PsCARTHA/lib_client/operation_result.ml b/src/proto_006_PsCARTHA/lib_client/operation_result.ml index 6edf2fc4ab3e..137e03133a5a 100644 --- a/src/proto_006_PsCARTHA/lib_client/operation_result.ml +++ b/src/proto_006_PsCARTHA/lib_client/operation_result.ml @@ -403,9 +403,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -419,9 +419,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -463,7 +463,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -474,7 +474,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 1bee6defcd5e..a115b2734a16 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 @@ -89,7 +89,7 @@ let non_negative_param = let block_hash_param = Tezos_clic.parameter (fun _ s -> - try return (Tezos_crypto.Block_hash.of_b58check_exn s) + try return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -1020,7 +1020,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1051,7 +1051,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1108,7 +1108,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)))) @@ -1150,7 +1150,7 @@ let commands network () = Constants.fixed.max_proposals_per_delegate ; (match Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare + ~compare:Protocol_hash.compare proposals with | [] -> () @@ -1163,21 +1163,18 @@ let commands network () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else error "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p) proposals ; if @@ -1264,7 +1261,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)) @@ param @@ -1334,10 +1331,7 @@ let commands network () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -1352,14 +1346,10 @@ let commands network () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_006_PsCARTHA/lib_protocol/dune b/src/proto_006_PsCARTHA/lib_protocol/dune index f2b988f94741..b7f0befc854f 100644 --- a/src/proto_006_PsCARTHA/lib_protocol/dune +++ b/src/proto_006_PsCARTHA/lib_protocol/dune @@ -127,7 +127,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb\"\nlet name = Tezos_protocol_environment_006_PsCARTHA.Name.name\ninclude Tezos_raw_protocol_006_PsCARTHA\ninclude Tezos_raw_protocol_006_PsCARTHA.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb\"\nlet name = Tezos_protocol_environment_006_PsCARTHA.Name.name\ninclude Tezos_raw_protocol_006_PsCARTHA\ninclude Tezos_raw_protocol_006_PsCARTHA.Main\n"))) (rule (targets tezos_protocol_006_PsCARTHA.ml) 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 fe730a5950f3..1f9125eb2c81 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_context.ml @@ -92,7 +92,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -162,7 +162,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j diff --git a/src/proto_007_PsDELPH1/lib_client/client_proto_context.mli b/src/proto_007_PsDELPH1/lib_client/client_proto_context.mli index b4fb066bb904..ade19b02248a 100644 --- a/src/proto_007_PsDELPH1/lib_client/client_proto_context.mli +++ b/src/proto_007_PsDELPH1/lib_client/client_proto_context.mli @@ -75,7 +75,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -109,5 +109,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_007_PsDELPH1/lib_client/operation_result.ml b/src/proto_007_PsDELPH1/lib_client/operation_result.ml index e55afc20088a..a488a1a4b53b 100644 --- a/src/proto_007_PsDELPH1/lib_client/operation_result.ml +++ b/src/proto_007_PsDELPH1/lib_client/operation_result.ml @@ -399,9 +399,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -415,9 +415,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -459,7 +459,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -470,7 +470,7 @@ let rec pp_contents_and_result_list : source Voting_period.pp period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 beb4c7a2461b..bad6e90f5d05 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 @@ -278,7 +278,7 @@ let commands () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -339,10 +339,7 @@ let commands () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -357,14 +354,10 @@ let commands () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_007_PsDELPH1/lib_protocol/dune b/src/proto_007_PsDELPH1/lib_protocol/dune index 9a3db57e93a4..2b72065887b5 100644 --- a/src/proto_007_PsDELPH1/lib_protocol/dune +++ b/src/proto_007_PsDELPH1/lib_protocol/dune @@ -129,7 +129,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo\"\nlet name = Tezos_protocol_environment_007_PsDELPH1.Name.name\ninclude Tezos_raw_protocol_007_PsDELPH1\ninclude Tezos_raw_protocol_007_PsDELPH1.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo\"\nlet name = Tezos_protocol_environment_007_PsDELPH1.Name.name\ninclude Tezos_raw_protocol_007_PsDELPH1\ninclude Tezos_raw_protocol_007_PsDELPH1.Main\n"))) (rule (targets tezos_protocol_007_PsDELPH1.ml) 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 37b6d9c4913a..ea96ff391ad8 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml @@ -494,7 +494,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -600,7 +600,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 9563d5498817..81d210140a76 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli @@ -244,7 +244,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -282,7 +282,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -294,7 +294,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -304,5 +304,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.ml b/src/proto_008_PtEdo2Zk/lib_client/injection.ml index 15bd3a52a821..c7ecbb59e25d 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.ml @@ -45,15 +45,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result type _ annotated_manager_operation = | Manager_info : { @@ -225,7 +222,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -718,12 +715,12 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -734,8 +731,7 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -745,9 +741,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -804,9 +800,9 @@ let inject_operation (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -818,7 +814,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?(gas_limit = Gas.Arith.integral Z.minus_one) ?(storage_limit = Z.of_int (-1)) ?counter ~fee_parameter (type kind) (operations : kind annotated_manager_operation_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents_list * kind Kind.manager contents_result_list) tzresult diff --git a/src/proto_008_PtEdo2Zk/lib_client/injection.mli b/src/proto_008_PtEdo2Zk/lib_client/injection.mli index 70f5dc785fbc..6f3cae1e82e1 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/injection.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/injection.mli @@ -68,7 +68,7 @@ val manager_to_list : packed_annotated_manager_operation list type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -93,9 +93,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list val inject_operation : #Protocol_client_context.full -> @@ -112,8 +110,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : ?fee:Tez.t -> diff --git a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml index aa3387c18cbc..2033d79822a5 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml @@ -406,9 +406,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -422,9 +422,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -465,7 +465,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -475,7 +475,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 81f3851ec0f2..ae70157175c1 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 @@ -96,7 +96,7 @@ let non_negative_param = let block_hash_param = Tezos_clic.parameter (fun _ s -> - try return (Tezos_crypto.Block_hash.of_b58check_exn s) + try return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -1275,7 +1275,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1306,7 +1306,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1363,7 +1363,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)))) @@ -1411,7 +1411,7 @@ let commands network () = Constants.fixed.max_proposals_per_delegate ; (match Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare + ~compare:Protocol_hash.compare proposals with | [] -> () @@ -1424,21 +1424,18 @@ let commands network () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else error "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p) proposals ; if @@ -1525,7 +1522,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)) @@ param @@ -1601,10 +1598,7 @@ let commands network () = let print_proposal = function | None -> assert false (* not called during proposal phase *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -1619,14 +1613,10 @@ let commands network () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml b/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml index 0336400af17d..8a76ae65af68 100644 --- a/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml +++ b/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml @@ -611,9 +611,7 @@ module RPC = struct f ctxt a1 >|=? function None -> raise Not_found | Some v -> v) in let originate_dummy_contract ctxt script balance = - let ctxt = - Contract.init_origination_nonce ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.originate diff --git a/src/proto_008_PtEdo2Zk/lib_protocol/dune b/src/proto_008_PtEdo2Zk/lib_protocol/dune index 65e91e0d2b8c..b5be2a22e48c 100644 --- a/src/proto_008_PtEdo2Zk/lib_protocol/dune +++ b/src/proto_008_PtEdo2Zk/lib_protocol/dune @@ -134,7 +134,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA\"\nlet name = Tezos_protocol_environment_008_PtEdo2Zk.Name.name\ninclude Tezos_raw_protocol_008_PtEdo2Zk\ninclude Tezos_raw_protocol_008_PtEdo2Zk.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA\"\nlet name = Tezos_protocol_environment_008_PtEdo2Zk.Name.name\ninclude Tezos_raw_protocol_008_PtEdo2Zk\ninclude Tezos_raw_protocol_008_PtEdo2Zk.Main\n"))) (rule (targets tezos_protocol_008_PtEdo2Zk.ml) diff --git a/src/proto_008_PtEdoTez/lib_protocol/dune b/src/proto_008_PtEdoTez/lib_protocol/dune index ec934aa60b14..95304a6d3864 100644 --- a/src/proto_008_PtEdoTez/lib_protocol/dune +++ b/src/proto_008_PtEdoTez/lib_protocol/dune @@ -134,7 +134,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq\"\nlet name = Tezos_protocol_environment_008_PtEdoTez.Name.name\ninclude Tezos_raw_protocol_008_PtEdoTez\ninclude Tezos_raw_protocol_008_PtEdoTez.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq\"\nlet name = Tezos_protocol_environment_008_PtEdoTez.Name.name\ninclude Tezos_raw_protocol_008_PtEdoTez\ninclude Tezos_raw_protocol_008_PtEdoTez.Main\n"))) (rule (targets tezos_protocol_008_PtEdoTez.ml) 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 5b3e70e8593c..5975fb3b757e 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml @@ -504,7 +504,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -610,7 +610,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 c0119412a5e9..cf64cb78e949 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli @@ -244,7 +244,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -282,7 +282,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -294,7 +294,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -304,5 +304,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_009_PsFLoren/lib_client/injection.ml b/src/proto_009_PsFLoren/lib_client/injection.ml index 71e263a0c28b..8280da1a2bb4 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.ml +++ b/src/proto_009_PsFLoren/lib_client/injection.ml @@ -45,15 +45,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -186,7 +183,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -720,12 +717,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -736,8 +733,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -747,9 +743,9 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -806,9 +802,9 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -853,7 +849,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ?simulation ~source ~src_pk ~src_sk ~fee ~gas_limit ~storage_limit ?counter ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents_list * kind Kind.manager contents_result_list) tzresult diff --git a/src/proto_009_PsFLoren/lib_client/injection.mli b/src/proto_009_PsFLoren/lib_client/injection.mli index 721a0cec81bb..61d6b9eec6ca 100644 --- a/src/proto_009_PsFLoren/lib_client/injection.mli +++ b/src/proto_009_PsFLoren/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -74,8 +72,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> diff --git a/src/proto_009_PsFLoren/lib_client/operation_result.ml b/src/proto_009_PsFLoren/lib_client/operation_result.ml index 53793a462690..943c221c0e2d 100644 --- a/src/proto_009_PsFLoren/lib_client/operation_result.ml +++ b/src/proto_009_PsFLoren/lib_client/operation_result.ml @@ -411,9 +411,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -427,9 +427,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -479,7 +479,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -489,7 +489,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 99d65369a1f3..7836774dd2ca 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 @@ -96,7 +96,7 @@ let non_negative_param = let block_hash_param = Tezos_clic.parameter (fun _ s -> - try return (Tezos_crypto.Block_hash.of_b58check_exn s) + try return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -1268,7 +1268,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1299,7 +1299,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1356,7 +1356,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)))) @@ -1404,7 +1404,7 @@ let commands network () = Constants.fixed.max_proposals_per_delegate ; (match Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare + ~compare:Protocol_hash.compare proposals with | [] -> () @@ -1417,21 +1417,18 @@ let commands network () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else error "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p) proposals ; if @@ -1518,7 +1515,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)) @@ param @@ -1597,10 +1594,7 @@ let commands network () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -1618,14 +1612,11 @@ let commands network () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_009_PsFLoren/lib_plugin/plugin.ml b/src/proto_009_PsFLoren/lib_plugin/plugin.ml index dcccb7d3022b..e2339ad863de 100644 --- a/src/proto_009_PsFLoren/lib_plugin/plugin.ml +++ b/src/proto_009_PsFLoren/lib_plugin/plugin.ml @@ -618,9 +618,7 @@ module RPC = struct f ctxt a1 >|=? function None -> raise Not_found | Some v -> v) in let originate_dummy_contract ctxt script balance = - let ctxt = - Contract.init_origination_nonce ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.originate diff --git a/src/proto_009_PsFLoren/lib_protocol/dune b/src/proto_009_PsFLoren/lib_protocol/dune index 16b4036fd009..815936a4808c 100644 --- a/src/proto_009_PsFLoren/lib_protocol/dune +++ b/src/proto_009_PsFLoren/lib_protocol/dune @@ -137,7 +137,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i\"\nlet name = Tezos_protocol_environment_009_PsFLoren.Name.name\ninclude Tezos_raw_protocol_009_PsFLoren\ninclude Tezos_raw_protocol_009_PsFLoren.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i\"\nlet name = Tezos_protocol_environment_009_PsFLoren.Name.name\ninclude Tezos_raw_protocol_009_PsFLoren\ninclude Tezos_raw_protocol_009_PsFLoren.Main\n"))) (rule (targets tezos_protocol_009_PsFLoren.ml) 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 d0c9373f6491..b5457b4d7996 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml @@ -531,7 +531,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -637,7 +637,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 eb5f6b84f688..12f545798111 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli @@ -253,7 +253,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -291,7 +291,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -303,7 +303,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -313,5 +313,5 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_010_PtGRANAD/lib_client/injection.ml b/src/proto_010_PtGRANAD/lib_client/injection.ml index 1acf3ac2cee5..f64047a1a11a 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.ml +++ b/src/proto_010_PtGRANAD/lib_client/injection.ml @@ -51,15 +51,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -192,7 +189,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -809,12 +806,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -825,8 +822,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -836,10 +832,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph num_confirmation_blocks - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -896,10 +892,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph num_confirmation_blocks - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -944,7 +940,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ?simulation ~source ~src_pk ~src_sk ~fee ~gas_limit ~storage_limit ?counter ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents_list * kind Kind.manager contents_result_list) tzresult diff --git a/src/proto_010_PtGRANAD/lib_client/injection.mli b/src/proto_010_PtGRANAD/lib_client/injection.mli index 721a0cec81bb..61d6b9eec6ca 100644 --- a/src/proto_010_PtGRANAD/lib_client/injection.mli +++ b/src/proto_010_PtGRANAD/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -74,8 +72,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> diff --git a/src/proto_010_PtGRANAD/lib_client/operation_result.ml b/src/proto_010_PtGRANAD/lib_client/operation_result.ml index d523d820b06d..03edb82199ba 100644 --- a/src/proto_010_PtGRANAD/lib_client/operation_result.ml +++ b/src/proto_010_PtGRANAD/lib_client/operation_result.ml @@ -412,9 +412,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -428,9 +428,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -480,7 +480,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -490,7 +490,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) 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 73e71ce22ba8..e1879de4a41b 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 @@ -96,7 +96,7 @@ let non_negative_param = let block_hash_param = Tezos_clic.parameter (fun _ s -> - try return (Tezos_crypto.Block_hash.of_b58check_exn s) + try return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -1262,7 +1262,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1293,7 +1293,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1350,7 +1350,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)))) @@ -1398,7 +1398,7 @@ let commands network () = Constants.fixed.max_proposals_per_delegate ; (match Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare + ~compare:Protocol_hash.compare proposals with | [] -> () @@ -1411,21 +1411,18 @@ let commands network () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else error "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p) proposals ; if @@ -1512,7 +1509,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)) @@ param @@ -1591,10 +1588,7 @@ let commands network () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -1612,14 +1606,11 @@ let commands network () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; diff --git a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml index 8156bd8acae5..5478fce475f5 100644 --- a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml +++ b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml @@ -791,9 +791,7 @@ module RPC = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = - Contract.init_origination_nonce ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.originate diff --git a/src/proto_010_PtGRANAD/lib_protocol/dune b/src/proto_010_PtGRANAD/lib_protocol/dune index 3f1fa76ad299..ca2bf2bc0c2f 100644 --- a/src/proto_010_PtGRANAD/lib_protocol/dune +++ b/src/proto_010_PtGRANAD/lib_protocol/dune @@ -142,7 +142,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV\"\nlet name = Tezos_protocol_environment_010_PtGRANAD.Name.name\ninclude Tezos_raw_protocol_010_PtGRANAD\ninclude Tezos_raw_protocol_010_PtGRANAD.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV\"\nlet name = Tezos_protocol_environment_010_PtGRANAD.Name.name\ninclude Tezos_raw_protocol_010_PtGRANAD\ninclude Tezos_raw_protocol_010_PtGRANAD.Main\n"))) (rule (targets tezos_protocol_010_PtGRANAD.ml) 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 27b93db0aaa6..71ea5125cf43 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml @@ -575,7 +575,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -681,7 +681,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 d69f8508bae7..2fd43b1073bf 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli @@ -275,7 +275,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -313,7 +313,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -325,7 +325,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -335,7 +335,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t val cached_contracts : 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_011_PtHangz2/lib_client/injection.ml b/src/proto_011_PtHangz2/lib_client/injection.ml index a908d99be6b7..eb67f8adc79a 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.ml +++ b/src/proto_011_PtHangz2/lib_client/injection.ml @@ -51,15 +51,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -192,7 +189,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -821,12 +818,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -837,8 +834,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (match confirmations with | None -> cctxt#message @@ -848,10 +844,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph num_confirmation_blocks - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -909,10 +905,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph num_confirmation_blocks - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -957,7 +953,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ?simulation ?force ~source ~src_pk ~src_sk ~fee ~gas_limit ~storage_limit ?counter ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents_list * kind Kind.manager contents_result_list) tzresult diff --git a/src/proto_011_PtHangz2/lib_client/injection.mli b/src/proto_011_PtHangz2/lib_client/injection.mli index c2d4543ad3f1..5f751ea5f3c9 100644 --- a/src/proto_011_PtHangz2/lib_client/injection.mli +++ b/src/proto_011_PtHangz2/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -74,8 +72,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> diff --git a/src/proto_011_PtHangz2/lib_client/mockup.ml b/src/proto_011_PtHangz2/lib_client/mockup.ml index 4f50d6bf9295..1a9efc551fc5 100644 --- a/src/proto_011_PtHangz2/lib_client/mockup.ml +++ b/src/proto_011_PtHangz2/lib_client/mockup.ml @@ -772,7 +772,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -792,7 +792,7 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end @@ -871,7 +871,7 @@ let mem_init : Tezos_mockup_registration.Registration.mockup_context tzresult Lwt.t = fun ~cctxt ~parameters ~constants_overrides_json ~bootstrap_accounts_json -> let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in (* Need to read this Json file before since timestamp modification may be in @@ -899,7 +899,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness:(Fitness.from_int64 0L) - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in Protocol_constants_overrides.apply_overrides cctxt diff --git a/src/proto_011_PtHangz2/lib_client/operation_result.ml b/src/proto_011_PtHangz2/lib_client/operation_result.ml index a12e60c070fb..edacbd8b765e 100644 --- a/src/proto_011_PtHangz2/lib_client/operation_result.ml +++ b/src/proto_011_PtHangz2/lib_client/operation_result.ml @@ -454,9 +454,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -470,9 +470,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -522,7 +522,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -532,7 +532,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_011_PtHangz2/lib_client/proxy.ml b/src/proto_011_PtHangz2/lib_client/proxy.ml index abd459fa2f3b..3e1068d9ae59 100644 --- a/src/proto_011_PtHangz2/lib_client/proxy.ml +++ b/src/proto_011_PtHangz2/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = 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 1d391b6ea0e0..d3b1dab83e8d 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 @@ -98,7 +98,7 @@ let non_negative_param = let block_hash_param = Tezos_clic.parameter (fun _ s -> - try return (Tezos_crypto.Block_hash.of_b58check_exn s) + try return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -1419,7 +1419,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1450,7 +1450,7 @@ let commands network () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ -1507,7 +1507,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)))) @@ -1555,7 +1555,7 @@ let commands network () = Constants.max_proposals_per_delegate ; (match Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare + ~compare:Protocol_hash.compare proposals with | [] -> () @@ -1568,21 +1568,18 @@ let commands network () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else error "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p) proposals ; if @@ -1669,7 +1666,7 @@ let commands network () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> return hash)) @@ param @@ -1748,10 +1745,7 @@ let commands network () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -1769,14 +1763,11 @@ let commands network () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; 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 f3f792dcd88d..652a15fa2519 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 @@ -83,20 +83,18 @@ type transfer = { } type state = { - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; counters : - (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.V0.Public_key_hash.Table.t; + (Block_hash.t * Z.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.V0.Public_key_hash.Set.t; - mutable last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } let verbose = ref false @@ -159,8 +157,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let parse_strategy s = match String.split ~limit:1 ':' s with @@ -291,13 +289,13 @@ let rec sample_source_from_pool state rng (cctxt : Protocol_client_context.full) cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) >>= fun () -> Lwt.return source | Some [] -> cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block >>= fun () -> Lwt_condition.wait state.new_block_condition >>= fun () -> @@ -317,7 +315,7 @@ let generate_fresh_source pool rng = (* [heads_iter cctxt f] calls [f head] each time there is a new head received by the streamed RPC /monitor/heads/main *) let heads_iter (cctxt : Protocol_client_context.full) - (f : Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t) : unit tzresult Lwt.t = let open Lwt_result_syntax in Error_monad.protect @@ -334,7 +332,7 @@ let heads_iter (cctxt : Protocol_client_context.full) debug_msg (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -343,9 +341,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let*! () = f block_hash_and_header in loop () @@ -355,7 +351,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -370,14 +366,14 @@ let heads_iter (cctxt : Protocol_client_context.full) debug_msg (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return_unit) ~on_error:(fun trace -> cctxt#error "An error while monitoring the new heads for proto %a occured: %a@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash Error_monad.pp_print_trace trace) @@ -479,7 +475,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng >>=? fun pcounter -> Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun branch -> (* If there is a new block refresh the fresh_pool *) - if not (Tezos_crypto.Block_hash.equal branch state.last_block) then ( + if not (Block_hash.equal branch state.last_block) then ( state.last_block <- branch ; if Option.is_some state.shuffled_pool then state.shuffled_pool <- @@ -498,7 +494,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng by the RPC _must_ be the freshest one. *) pcounter | Some (previous_branch, previous_counter) -> - if Tezos_crypto.Block_hash.equal branch previous_branch then + if Block_hash.equal branch previous_branch then (* We already injected an operation on top of this block: the one stored locally is the freshest one. *) previous_counter @@ -602,18 +598,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng debug_msg (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) >>= fun () -> let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> debug_msg (fun () -> @@ -627,7 +620,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -648,10 +641,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = Shell_services.Blocks.hash cctxt () >>=? fun current_head_on_exit -> let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -679,7 +672,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -692,9 +685,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = debug_msg (fun () -> cctxt#message "injected : %a\nincluded: %a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) injected_ops - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) included_ops) >>= fun () -> let injected_ops_count = List.length injected_ops in @@ -779,14 +772,12 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) else Lwt_unix.sleep remaining) >>= loop in - let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t = + let on_new_head : Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t = match state.shuffled_pool with (* Some _ if and only if [single_op_per_pkh_per_block] is true. *) | Some _ -> fun (new_block_hash, new_block_header) -> - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1115,7 +1106,7 @@ let generate_random_transactions = last_block = current_head_on_start; last_level = Int32.to_int header_on_start.shell.level; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_011_PtHangz2/lib_plugin/plugin.ml b/src/proto_011_PtHangz2/lib_plugin/plugin.ml index 2aff412d886f..620333a40dd7 100644 --- a/src/proto_011_PtHangz2/lib_plugin/plugin.ml +++ b/src/proto_011_PtHangz2/lib_plugin/plugin.ml @@ -950,9 +950,7 @@ module RPC = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = - Contract.init_origination_nonce ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.originate diff --git a/src/proto_011_PtHangz2/lib_protocol/dune b/src/proto_011_PtHangz2/lib_protocol/dune index 5546ab737eaf..1bf60b667fca 100644 --- a/src/proto_011_PtHangz2/lib_protocol/dune +++ b/src/proto_011_PtHangz2/lib_protocol/dune @@ -155,7 +155,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx\"\nlet name = Tezos_protocol_environment_011_PtHangz2.Name.name\ninclude Tezos_raw_protocol_011_PtHangz2\ninclude Tezos_raw_protocol_011_PtHangz2.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx\"\nlet name = Tezos_protocol_environment_011_PtHangz2.Name.name\ninclude Tezos_raw_protocol_011_PtHangz2\ninclude Tezos_raw_protocol_011_PtHangz2.Main\n"))) (rule (targets tezos_protocol_011_PtHangz2.ml) 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 3521d905700b..95a86015f5b7 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.ml @@ -611,7 +611,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -717,7 +717,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 9a7f82db020c..92f08c5e2db5 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.mli @@ -298,7 +298,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -336,7 +336,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -348,7 +348,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -358,7 +358,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t val cached_contracts : 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_utils.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_012_Psithaca/lib_client/injection.ml b/src/proto_012_Psithaca/lib_client/injection.ml index bb6ecffd90e8..b0735485a7d2 100644 --- a/src/proto_012_Psithaca/lib_client/injection.ml +++ b/src/proto_012_Psithaca/lib_client/injection.ml @@ -55,15 +55,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee contents = let open Operation in @@ -196,7 +193,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -858,12 +855,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -874,8 +871,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -887,10 +883,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -948,10 +944,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op.protocol_data.contents, result.contents) @@ -996,7 +992,7 @@ let inject_manager_operation cctxt ~chain ~block ?branch ?confirmations ?dry_run ?verbose_signing ?simulation ?force ~source ~src_pk ~src_sk ~fee ~gas_limit ~storage_limit ?counter ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * kind Kind.manager contents_list * kind Kind.manager contents_result_list) tzresult diff --git a/src/proto_012_Psithaca/lib_client/injection.mli b/src/proto_012_Psithaca/lib_client/injection.mli index c2d4543ad3f1..5f751ea5f3c9 100644 --- a/src/proto_012_Psithaca/lib_client/injection.mli +++ b/src/proto_012_Psithaca/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -53,9 +53,7 @@ val preapply : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -74,8 +72,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> diff --git a/src/proto_012_Psithaca/lib_client/mockup.ml b/src/proto_012_Psithaca/lib_client/mockup.ml index aa36f7fcf0e8..668d3569b84d 100644 --- a/src/proto_012_Psithaca/lib_client/mockup.ml +++ b/src/proto_012_Psithaca/lib_client/mockup.ml @@ -862,7 +862,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -882,14 +882,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -898,7 +898,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -1007,7 +1007,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in Protocol_constants_overrides.apply_overrides (cctxt :> Tezos_client_base.Client_context.printer) @@ -1064,10 +1064,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in diff --git a/src/proto_012_Psithaca/lib_client/operation_result.ml b/src/proto_012_Psithaca/lib_client/operation_result.ml index 287e33a26296..76fd9e110fdb 100644 --- a/src/proto_012_Psithaca/lib_client/operation_result.ml +++ b/src/proto_012_Psithaca/lib_client/operation_result.ml @@ -529,9 +529,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -580,9 +580,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -596,9 +596,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -621,7 +621,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -631,7 +631,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_012_Psithaca/lib_client/proxy.ml b/src/proto_012_Psithaca/lib_client/proxy.ml index 18efe19fa6bf..db20cd916ebf 100644 --- a/src/proto_012_Psithaca/lib_client/proxy.ml +++ b/src/proto_012_Psithaca/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = 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 455b51c5a548..61116e10efbc 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 @@ -403,7 +403,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -444,10 +444,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -465,14 +462,10 @@ let commands_ro () = fprintf ppf "* %a %ld (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p w - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; 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 5ac220ef5728..91437eaa2c95 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 @@ -83,20 +83,18 @@ type transfer = { } type state = { - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; counters : - (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.V0.Public_key_hash.Table.t; + (Block_hash.t * Z.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.V0.Public_key_hash.Set.t; - mutable last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } let verbose = ref false @@ -159,8 +157,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let parse_strategy s = match String.split ~limit:1 ':' s with @@ -291,13 +289,13 @@ let rec sample_source_from_pool state rng (cctxt : Protocol_client_context.full) cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) >>= fun () -> Lwt.return source | Some [] -> cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block >>= fun () -> Lwt_condition.wait state.new_block_condition >>= fun () -> @@ -317,7 +315,7 @@ let generate_fresh_source pool rng = (* [heads_iter cctxt f] calls [f head] each time there is a new head received by the streamed RPC /monitor/heads/main *) let heads_iter (cctxt : Protocol_client_context.full) - (f : Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t) : unit tzresult Lwt.t = let open Lwt_result_syntax in Error_monad.protect @@ -334,7 +332,7 @@ let heads_iter (cctxt : Protocol_client_context.full) debug_msg (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -343,9 +341,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let*! () = f block_hash_and_header in loop () @@ -355,7 +351,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -370,14 +366,14 @@ let heads_iter (cctxt : Protocol_client_context.full) debug_msg (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return_unit) ~on_error:(fun trace -> cctxt#error "An error while monitoring the new heads for proto %a occured: %a@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash Error_monad.pp_print_trace trace) @@ -479,7 +475,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng >>=? fun pcounter -> Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun branch -> (* If there is a new block refresh the fresh_pool *) - if not (Tezos_crypto.Block_hash.equal branch state.last_block) then ( + if not (Block_hash.equal branch state.last_block) then ( state.last_block <- branch ; if Option.is_some state.shuffled_pool then state.shuffled_pool <- @@ -498,7 +494,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng by the RPC _must_ be the freshest one. *) pcounter | Some (previous_branch, previous_counter) -> - if Tezos_crypto.Block_hash.equal branch previous_branch then + if Block_hash.equal branch previous_branch then (* We already injected an operation on top of this block: the one stored locally is the freshest one. *) previous_counter @@ -602,18 +598,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng debug_msg (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) >>= fun () -> let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> debug_msg (fun () -> @@ -627,7 +620,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -648,10 +641,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = Shell_services.Blocks.hash cctxt () >>=? fun current_head_on_exit -> let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -679,7 +672,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -692,9 +685,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = debug_msg (fun () -> cctxt#message "injected : %a\nincluded: %a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) injected_ops - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) included_ops) >>= fun () -> let injected_ops_count = List.length injected_ops in @@ -779,14 +772,12 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) else Lwt_unix.sleep remaining) >>= loop in - let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t = + let on_new_head : Block_hash.t * Tezos_base.Block_header.t -> unit Lwt.t = match state.shuffled_pool with (* Some _ if and only if [single_op_per_pkh_per_block] is true. *) | Some _ -> fun (new_block_hash, new_block_header) -> - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1109,7 +1100,7 @@ let generate_random_transactions = last_block = current_head_on_start; last_level = Int32.to_int header_on_start.shell.level; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_012_Psithaca/lib_delegate/baking_events.ml b/src/proto_012_Psithaca/lib_delegate/baking_events.ml index bba61a50f803..8ed73cd0eb3b 100644 --- a/src/proto_012_Psithaca/lib_delegate/baking_events.ml +++ b/src/proto_012_Psithaca/lib_delegate/baking_events.ml @@ -43,8 +43,8 @@ module State_transitions = struct ~name:"new_head" ~level:Notice ~msg:"received new head {block} at level {level}, round {round}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) ~pp3:Round.pp @@ -119,12 +119,12 @@ module State_transitions = struct ~msg: "proposal {new_proposal} for current round ({current_round}) has \ already been seen {previous_proposal}" - ~pp1:Tezos_crypto.Block_hash.pp - ("new_proposal", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("new_proposal", Block_hash.encoding) ~pp2:Round.pp ("current_round", Round.encoding) - ~pp3:Tezos_crypto.Block_hash.pp - ("previous_proposal", Tezos_crypto.Block_hash.encoding) + ~pp3:Block_hash.pp + ("previous_proposal", Block_hash.encoding) let updating_latest_proposal = declare_1 @@ -132,8 +132,8 @@ module State_transitions = struct ~name:"updating_latest_proposal" ~msg:"updating latest proposal to {block_hash}" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let baker_is_ahead_of_node = declare_2 @@ -156,10 +156,10 @@ module State_transitions = struct ~msg: "received a proposal on another branch - current: current \ pred{current_branch}, new pred {new_branch}" - ~pp1:Tezos_crypto.Block_hash.pp - ("current_branch", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("new_branch", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("current_branch", Block_hash.encoding) + ~pp2:Block_hash.pp + ("new_branch", Block_hash.encoding) let switching_branch = declare_0 @@ -215,8 +215,8 @@ module State_transitions = struct ~name:"preendorsing_proposal" ~level:Info ~msg:"preendorsing proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let skipping_invalid_proposal = declare_0 @@ -232,8 +232,8 @@ module State_transitions = struct ~name:"outdated_proposal" ~level:Debug ~msg:"outdated proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let proposing_fresh_block = declare_2 @@ -271,10 +271,10 @@ module State_transitions = struct ~msg: "unexpected prequorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let unexpected_quorum_received = declare_2 @@ -284,10 +284,10 @@ module State_transitions = struct ~msg: "unexpected quorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let step_current_phase = declare_2 @@ -321,8 +321,8 @@ module Node_rpc = struct ~name:"raw_info" ~level:Debug ~msg:"raw info for {block_hash} at level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) end @@ -451,8 +451,8 @@ module Scheduling = struct ~name:"proposal_in_the_future" ~level:Debug ~msg:"received proposal in the future {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let process_proposal_in_the_future = declare_1 @@ -460,8 +460,8 @@ module Scheduling = struct ~name:"process_proposal_in_the_future" ~level:Debug ~msg:"process proposal received in the future with hash {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) end module Lib = struct @@ -543,8 +543,8 @@ module Actions = struct ~name:"preendorsement_injected" ~level:Notice ~msg:"injected preendorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_delegate ("delegate", Baking_state.delegate_encoding) @@ -554,8 +554,8 @@ module Actions = struct ~name:"endorsement_injected" ~level:Notice ~msg:"injected endorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_delegate ("delegate", Baking_state.delegate_encoding) @@ -565,8 +565,8 @@ module Actions = struct ~name:"synchronizing_round" ~level:Info ~msg:"synchronizing round after block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let forging_block = declare_3 @@ -605,11 +605,11 @@ module Actions = struct ~msg: "block {block} at level {level}, round {round} injected for delegate \ {delegate}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:pp_int32 ~pp3:Round.pp ~pp4:Baking_state.pp_delegate - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("round", Round.encoding) ("delegate", Baking_state.delegate_encoding) @@ -668,8 +668,8 @@ module Nonces = struct ~name:"found_nonce_to_reveal" ~level:Notice ~msg:"found nonce to reveal for block {block}, level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) @@ -685,8 +685,8 @@ module Nonces = struct ("level", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let cannot_fetch_chain_head_level = declare_0 @@ -761,8 +761,8 @@ module Nonces = struct ~name:"registering_nonce" ~level:Info ~msg:"registering nonce for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let nothing_to_reveal = declare_1 @@ -770,8 +770,8 @@ module Nonces = struct ~name:"nothing_to_reveal" ~level:Info ~msg:"nothing to reveal for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let revelation_worker_started = declare_0 @@ -852,8 +852,8 @@ module Selection = struct ~name:"invalid_operation_filtered" ~level:Warning ~msg:"filtered invalid operation {op}: {errors}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.(TzTrace.encoding error_encoding)) @@ -863,6 +863,6 @@ module Selection = struct ~name:"cannot_serialize_operation_metadata" ~level:Warning ~msg:"cannot serialize operation {op} metadata" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) end diff --git a/src/proto_012_Psithaca/lib_delegate/delegate_events.ml b/src/proto_012_Psithaca/lib_delegate/delegate_events.ml index 011f0e04eee1..c53a64c39733 100644 --- a/src/proto_012_Psithaca/lib_delegate/delegate_events.ml +++ b/src/proto_012_Psithaca/lib_delegate/delegate_events.ml @@ -41,7 +41,7 @@ module Revelation = struct ~level ~name:"no_nonce_reveal" ~msg:"nothing to reveal for block {block}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let reveal_nonce = declare_5 @@ -55,7 +55,7 @@ module Revelation = struct ("level", Alpha_context.Raw_level.encoding) ("chain", Data_encoding.string) ("block", Data_encoding.string) - ("operation", Tezos_crypto.Operation_hash.encoding) + ("operation", Operation_hash.encoding) end module Nonces = struct @@ -99,7 +99,7 @@ module Nonces = struct ~level ~name:"found_nonce" ~msg:"found nonce to reveal for {hash} (level: {level})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) let bad_nonce = @@ -131,8 +131,8 @@ module Denunciator = struct ~level ~name:"double_endorsement_detected" ~msg:"double endorsement detected" - ("existing_endorsement", Tezos_crypto.Operation_hash.encoding) - ("new_endorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_endorsement", Operation_hash.encoding) + ("new_endorsement", Operation_hash.encoding) let double_endorsement_denounced = declare_2 @@ -140,7 +140,7 @@ module Denunciator = struct ~level ~name:"double_endorsement_denounced" ~msg:"double endorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -150,8 +150,8 @@ module Denunciator = struct ~level ~name:"double_preendorsement_detected" ~msg:"double preendorsement detected" - ("existing_preendorsement", Tezos_crypto.Operation_hash.encoding) - ("new_preendorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_preendorsement", Operation_hash.encoding) + ("new_preendorsement", Operation_hash.encoding) let double_preendorsement_denounced = declare_2 @@ -159,7 +159,7 @@ module Denunciator = struct ~level ~name:"double_preendorsement_denounced" ~msg:"double preendorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -169,7 +169,7 @@ module Denunciator = struct ~level:Error ~name:"inconsistent_endorsement" ~msg:"inconsistent endorsement found {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) let unexpected_pruned_block = declare_1 @@ -177,7 +177,7 @@ module Denunciator = struct ~level:Error ~name:"unexpected_pruned_block" ~msg:"unexpected pruned block: {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let double_baking_but_not = declare_0 @@ -201,7 +201,7 @@ module Denunciator = struct ~level ~name:"double_baking_denounced" ~msg:"double baking evidence injected {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -220,7 +220,7 @@ module Denunciator = struct ~name:"accuser_saw_block" ~msg:"block level: {level}" ("level", Alpha_context.Raw_level.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetch_operations_error = declare_1 @@ -228,8 +228,8 @@ module Denunciator = struct ~level:Error ~name:"fetch_operations_error" ~msg:"error while fetching operations of block {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) - ~pp1:Tezos_crypto.Block_hash.pp + ("hash", Block_hash.encoding) + ~pp1:Block_hash.pp let accuser_processed_block = declare_1 @@ -237,7 +237,7 @@ module Denunciator = struct ~level ~name:"accuser_processed_block" ~msg:"block {hash} registered" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let accuser_block_error = declare_2 @@ -246,7 +246,7 @@ module Denunciator = struct ~name:"accuser_block_error" ~msg:"error while processing block {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end @@ -325,7 +325,7 @@ module Baking_forge = struct ~level:Info ~name:"inject_baked_block" ~msg:"Client_baking_forge.inject_block: inject {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ~pp2:pp_ignore ("header", Data_encoding.bytes) ~pp3:Format.(pp_print_list @@ pp_print_list @@ Operation.pp) @@ -338,7 +338,7 @@ module Baking_forge = struct ~level:Debug ~name:"baking_local_validation_start" ~msg:"starting client-side validation after {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let context_fetch_error = declare_1 @@ -364,7 +364,7 @@ module Baking_forge = struct ~name:"baking_rejected_invalid_operation" ~msg:"client-side validation: filtered invalid operation {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) let shell_prevalidation_notice = @@ -436,7 +436,7 @@ module Baking_forge = struct ~name:"try_baking" ~msg: "try baking after {hash} (slot {priority}) for {client} ({timestamp})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("priority", Data_encoding.int31) ("client", Data_encoding.string) ("timestamp", Time.System.encoding) @@ -480,7 +480,7 @@ module Baking_forge = struct ~msg: "try forging locally the block header for {hash} (slot {priority}) for \ {client} ({timestamp})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("priority", Data_encoding.int31) ("client", Data_encoding.string) ("timestamp", Time.System.encoding) @@ -497,7 +497,7 @@ module Baking_forge = struct ("priority", Data_encoding.int31) ("fitness", Fitness.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let injected_block = @@ -511,9 +511,9 @@ module Baking_forge = struct {operations})" ~pp6:Fitness.pp ~pp7:Format.(pp_print_list Operation.pp) - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) ("priority", Data_encoding.int31) ("fitness", Fitness.encoding) @@ -549,7 +549,7 @@ module Baking_forge = struct ("priority", Data_encoding.int31) ("timestamp", Time.System.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let read_nonce_fail = @@ -689,10 +689,10 @@ module Endorsement = struct ~msg: "injected endorsement for block '{block_hash}' (level {level}, \ contract {client}) '{op_hash}'" - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) ("client", Data_encoding.string) - ("op_hash", Tezos_crypto.Operation_hash.encoding) + ("op_hash", Operation_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let endorsing = @@ -701,7 +701,7 @@ module Endorsement = struct ~level:Debug ~name:"endorsing" ~msg:"endorsing {block} for {client} (level {level})!" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) ("level", Alpha_context.Raw_level.encoding) @@ -711,7 +711,7 @@ module Endorsement = struct ~level:Debug ~name:"check_endorsement_ok" ~msg:"checking if allowed to endorse block {block} for {client}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) let endorsement_no_slots_found = @@ -720,7 +720,7 @@ module Endorsement = struct ~level:Debug ~name:"endorsement_no_slots_found" ~msg:"no slot found for {block}/{client}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) let endorsement_slots_found = @@ -738,7 +738,7 @@ module Endorsement = struct (pp_print_list ~pp_sep:(fun f () -> pp_print_string f "; ") Format.pp_print_int)) - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) ("slots", Data_encoding.list Data_encoding.int31) @@ -756,7 +756,7 @@ module Endorsement = struct ~level:Info ~name:"endorsement_stale_block" ~msg:"ignore block {block}: forged too far the past" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let endorsement_got_block = declare_1 @@ -764,7 +764,7 @@ module Endorsement = struct ~level:Info ~name:"endorsement_got_block" ~msg:"received new block {block}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let wait_before_injecting = declare_2 diff --git a/src/proto_012_Psithaca/lib_plugin/plugin.ml b/src/proto_012_Psithaca/lib_plugin/plugin.ml index 486e104b4fe3..40ad48d0d44c 100644 --- a/src/proto_012_Psithaca/lib_plugin/plugin.ml +++ b/src/proto_012_Psithaca/lib_plugin/plugin.ml @@ -236,16 +236,13 @@ module Mempool = struct (modulo replace_by_fee_factor) *) type manager_op_info = { - operation_hash : Tezos_crypto.Operation_hash.t; + operation_hash : Operation_hash.t; gas_limit : manager_gas_witness Gas.Arith.t; fee : Tez.t; weight : Q.t; } - type manager_op_weight = { - operation_hash : Tezos_crypto.Operation_hash.t; - weight : Q.t; - } + type manager_op_weight = {operation_hash : Operation_hash.t; weight : Q.t} let op_weight_of_info (info : manager_op_info) : manager_op_weight = {operation_hash = info.operation_hash; weight = info.weight} @@ -257,10 +254,7 @@ module Mempool = struct let compare op1 op2 = let c = Q.compare op1.weight op2.weight in if c <> 0 then c - else - Tezos_crypto.Operation_hash.compare - op1.operation_hash - op2.operation_hash + else Operation_hash.compare op1.operation_hash op2.operation_hash end) type state = { @@ -274,15 +268,14 @@ module Mempool = struct Each manager in the map should be accessible with an operation hash in [operation_hash_to_manager]. *) operation_hash_to_manager : - Tezos_crypto.Signature.V0.Public_key_hash.t - Tezos_crypto.Operation_hash.Map.t; + Tezos_crypto.Signature.V0.Public_key_hash.t 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]. *) prechecked_operations_count : int; (** Number of prechecked manager operations. Invariants: - - [Tezos_crypto.Operation_hash.Map.cardinal operation_hash_to_manager = + - [Operation_hash.Map.cardinal operation_hash_to_manager = prechecked_operations_count] - [prechecked_operations_count <= max_prechecked_manager_operations] *) ops_prechecked : ManagerOpWeightSet.t; @@ -299,7 +292,7 @@ module Mempool = struct round_zero_duration = None; op_prechecked_managers = Tezos_crypto.Signature.V0.Public_key_hash.Map.empty; - operation_hash_to_manager = Tezos_crypto.Operation_hash.Map.empty; + operation_hash_to_manager = Operation_hash.Map.empty; prechecked_operations_count = 0; ops_prechecked = ManagerOpWeightSet.empty; min_prechecked_op_weight = None; @@ -358,7 +351,7 @@ module Mempool = struct let remove ~(filter_state : state) oph = let removed_oph_source = ref None in let operation_hash_to_manager = - Tezos_crypto.Operation_hash.Map.update + Operation_hash.Map.update oph (function | None -> None @@ -399,7 +392,7 @@ module Mempool = struct match filter_state.min_prechecked_op_weight with | None -> None | Some op -> - if Tezos_crypto.Operation_hash.equal op.operation_hash oph then + if Operation_hash.equal op.operation_hash oph then ManagerOpWeightSet.min_elt ops_prechecked else Some op in @@ -443,7 +436,7 @@ module Mempool = struct (fun () -> Fees_too_low) type Environment.Error_monad.error += - | Manager_restriction of {oph : Tezos_crypto.Operation_hash.t; fee : Tez.t} + | Manager_restriction of {oph : Operation_hash.t; fee : Tez.t} let () = Environment.Error_monad.register_error_kind @@ -457,21 +450,21 @@ module Mempool = struct "Only one manager operation per manager per block allowed (found %a \ with %atez fee. You may want to use --replace to provide adequate \ fee and replace it)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Tez.pp fee) Data_encoding.( obj2 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation_fee" Tez.encoding)) (function Manager_restriction {oph; fee} -> Some (oph, fee) | _ -> None) (fun (oph, fee) -> Manager_restriction {oph; fee}) type Environment.Error_monad.error += | Manager_operation_replaced of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } let () = @@ -484,13 +477,13 @@ module Mempool = struct Format.fprintf ppf "The manager operation %a has been replaced with %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Manager_operation_replaced {old_hash; new_hash} -> Some (old_hash, new_hash) @@ -1042,7 +1035,7 @@ module Mempool = struct config -> state -> validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Tezos_base.Operation.shell_header -> t Kind.manager protocol_data -> nb_successful_prechecks:int -> @@ -1050,8 +1043,7 @@ module Mempool = struct gas_limit:manager_gas_witness Gas.Arith.t -> public_key_hash -> [> `Prechecked_manager of - [ `No_replace - | `Replace of Tezos_crypto.Operation_hash.t * error_classification ] + [`No_replace | `Replace of Operation_hash.t * error_classification] | error_classification ] Lwt.t = fun config @@ -1148,11 +1140,8 @@ module Mempool = struct | `Replace (oph, _class) -> remove ~filter_state oph in let prechecked_operations_count = - if - Tezos_crypto.Operation_hash.Map.mem - oph - filter_state.operation_hash_to_manager - then filter_state.prechecked_operations_count + if Operation_hash.Map.mem oph filter_state.operation_hash_to_manager then + filter_state.prechecked_operations_count else filter_state.prechecked_operations_count + 1 in let op_weight = op_weight_of_info info in @@ -1170,10 +1159,7 @@ module Mempool = struct info filter_state.op_prechecked_managers; operation_hash_to_manager = - Tezos_crypto.Operation_hash.Map.add - oph - source - filter_state.operation_hash_to_manager + Operation_hash.Map.add oph source filter_state.operation_hash_to_manager (* Record which manager is used for the operation hash. *); ops_prechecked = ManagerOpWeightSet.add op_weight filter_state.ops_prechecked; @@ -1185,14 +1171,13 @@ module Mempool = struct config -> filter_state:state -> validation_state:validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Main.operation -> nb_successful_prechecks:int -> [ `Passed_precheck of state * validation_state - * [ `No_replace - | `Replace of Tezos_crypto.Operation_hash.t * error_classification ] + * [`No_replace | `Replace of Operation_hash.t * error_classification] | error_classification | `Undecided ] Lwt.t = @@ -2264,9 +2249,7 @@ module RPC = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = - Contract.init_origination_nonce ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.raw_originate diff --git a/src/proto_012_Psithaca/lib_protocol/dune b/src/proto_012_Psithaca/lib_protocol/dune index 558578b8fa23..8286540fe1a7 100644 --- a/src/proto_012_Psithaca/lib_protocol/dune +++ b/src/proto_012_Psithaca/lib_protocol/dune @@ -172,7 +172,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A\"\nlet name = Tezos_protocol_environment_012_Psithaca.Name.name\ninclude Tezos_raw_protocol_012_Psithaca\ninclude Tezos_raw_protocol_012_Psithaca.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A\"\nlet name = Tezos_protocol_environment_012_Psithaca.Name.name\ninclude Tezos_raw_protocol_012_Psithaca\ninclude Tezos_raw_protocol_012_Psithaca.Main\n"))) (rule (targets tezos_protocol_012_Psithaca.ml) 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 cde3d18f0432..c7f8abc95326 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_args.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_args.ml @@ -673,7 +673,7 @@ module Tx_rollup = struct let context_hash_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Context_hash.of_b58check_opt s with + match Context_hash.of_b58check_opt s with | Some hash -> return hash | None -> failwith 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 8834918aa8ec..79f518382267 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_args.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_args.mli @@ -175,7 +175,7 @@ module Tx_rollup : sig ?name:string -> usage:string -> ('a, full) Tezos_clic.params -> - (Tezos_crypto.Context_hash.t -> 'a, full) Tezos_clic.params + (Context_hash.t -> 'a, full) Tezos_clic.params val message_result_path_param : ?name:string -> 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 3f8c2eb0741d..dc16867fdbfe 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.ml @@ -658,7 +658,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -768,7 +768,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 5f86e0f29fd0..6e72ec2dca00 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.mli @@ -332,7 +332,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -370,7 +370,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -382,7 +382,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -392,7 +392,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t val cached_contracts : @@ -437,7 +437,7 @@ val originate_tx_rollup : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_origination Kind.manager contents * Kind.tx_rollup_origination Kind.manager Apply_results.contents_result) tzresult @@ -463,7 +463,7 @@ val submit_tx_rollup_batch : content:string -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_submit_batch Kind.manager contents * Kind.tx_rollup_submit_batch Kind.manager Apply_results.contents_result) tzresult @@ -491,7 +491,7 @@ val submit_tx_rollup_commitment : predecessor:Tx_rollup_commitment_hash.t option -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_commit Kind.manager contents * Kind.tx_rollup_commit Kind.manager Apply_results.contents_result) tzresult @@ -515,7 +515,7 @@ val submit_tx_rollup_finalize_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_finalize_commitment Kind.manager contents * Kind.tx_rollup_finalize_commitment Kind.manager Apply_results.contents_result) @@ -540,7 +540,7 @@ val submit_tx_rollup_remove_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_remove_commitment Kind.manager contents * Kind.tx_rollup_remove_commitment Kind.manager Apply_results.contents_result) tzresult @@ -569,12 +569,12 @@ val submit_tx_rollup_rejection : message_path:Tx_rollup_inbox.Merkle.path -> message_result_hash:Tx_rollup_message_result_hash.t -> message_result_path:Tx_rollup_commitment.Merkle.path -> - previous_context_hash:Tezos_crypto.Context_hash.t -> + previous_context_hash:Context_hash.t -> previous_withdraw_list_hash:Tx_rollup_withdraw_list_hash.t -> previous_message_result_path:Tx_rollup_commitment.Merkle.path -> proof:Tx_rollup_l2_proof.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_rejection Kind.manager contents * Kind.tx_rollup_rejection Kind.manager Apply_results.contents_result) tzresult @@ -598,7 +598,7 @@ val submit_tx_rollup_return_bond : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_return_bond Kind.manager contents * Kind.tx_rollup_return_bond Kind.manager Apply_results.contents_result) tzresult @@ -621,13 +621,13 @@ val tx_rollup_dispatch_tickets : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> - context_hash:Tezos_crypto.Context_hash.t -> + context_hash:Context_hash.t -> message_position:int -> message_result_path:Tx_rollup_commitment.Merkle.path -> tickets_info:Tx_rollup_reveal.t list -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_dispatch_tickets Kind.manager contents * Kind.tx_rollup_dispatch_tickets Kind.manager Apply_results.contents_result) tzresult @@ -656,7 +656,7 @@ val transfer_ticket : destination:Contract.t -> entrypoint:Entrypoint.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.transfer_ticket Kind.manager contents * Kind.transfer_ticket Kind.manager Apply_results.contents_result) tzresult @@ -681,7 +681,7 @@ val sc_rollup_originate : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_originate Kind.manager contents * Kind.sc_rollup_originate Kind.manager Apply_results.contents_result, tztrace ) @@ -707,7 +707,7 @@ val sc_rollup_add_messages : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_add_messages Kind.manager contents * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult @@ -732,7 +732,7 @@ val sc_rollup_cement : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_cement Kind.manager contents * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) tzresult @@ -757,7 +757,7 @@ val sc_rollup_publish : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_publish Kind.manager contents * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_utils.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_013_PtJakart/lib_client/injection.ml b/src/proto_013_PtJakart/lib_client/injection.ml index ae3b812b3e49..6589bd23a66a 100644 --- a/src/proto_013_PtJakart/lib_client/injection.ml +++ b/src/proto_013_PtJakart/lib_client/injection.ml @@ -55,15 +55,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee (contents : packed_contents_list) = let l = Operation.to_list contents in @@ -195,7 +192,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -970,12 +967,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -986,8 +983,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -999,10 +995,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -1063,10 +1059,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op, result.contents) @@ -1289,7 +1285,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch ~src_sk ~fee ~gas_limit ~storage_limit ?counter ?(replace_by_fees = false) ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * kind Kind.manager contents_list * kind Kind.manager contents_result_list) diff --git a/src/proto_013_PtJakart/lib_client/injection.mli b/src/proto_013_PtJakart/lib_client/injection.mli index 0aee0eef507f..251f2f2ecb67 100644 --- a/src/proto_013_PtJakart/lib_client/injection.mli +++ b/src/proto_013_PtJakart/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -65,9 +65,7 @@ val simulate : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -87,8 +85,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> @@ -118,7 +115,7 @@ val inject_manager_operation : ?replace_by_fees:bool -> fee_parameter:fee_parameter -> 'kind Annotated_manager_operation.annotated_list -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * 'kind Kind.manager contents_list * 'kind Kind.manager contents_result_list) diff --git a/src/proto_013_PtJakart/lib_client/mockup.ml b/src/proto_013_PtJakart/lib_client/mockup.ml index fc7086309623..043a7d01cf29 100644 --- a/src/proto_013_PtJakart/lib_client/mockup.ml +++ b/src/proto_013_PtJakart/lib_client/mockup.ml @@ -1187,7 +1187,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -1207,14 +1207,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -1223,7 +1223,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -1332,7 +1332,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in Protocol_constants_overrides.apply_overrides (cctxt :> Tezos_client_base.Client_context.printer) @@ -1389,10 +1389,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in diff --git a/src/proto_013_PtJakart/lib_client/operation_result.ml b/src/proto_013_PtJakart/lib_client/operation_result.ml index 1f9e41f10903..eae377304340 100644 --- a/src/proto_013_PtJakart/lib_client/operation_result.ml +++ b/src/proto_013_PtJakart/lib_client/operation_result.ml @@ -955,9 +955,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -1006,9 +1006,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1022,9 +1022,9 @@ let rec pp_contents_and_result_list : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1047,7 +1047,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_result) -> @@ -1057,7 +1057,7 @@ let rec pp_contents_and_result_list : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_013_PtJakart/lib_client/proxy.ml b/src/proto_013_PtJakart/lib_client/proxy.ml index 4fcf55f89628..1bc8a5bb8f40 100644 --- a/src/proto_013_PtJakart/lib_client/proxy.ml +++ b/src/proto_013_PtJakart/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = 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 2e2d806d72ff..69b88110dbcd 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 @@ -439,7 +439,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -480,10 +480,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -501,16 +498,12 @@ let commands_ro () = fprintf ppf "* %a %a %s (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p Tez.pp (Tez.of_mutez_exn w) Client_proto_args.tez_sym - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; 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 ddbb4a024c97..113942e68041 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 @@ -95,22 +95,20 @@ type transfer = { } type state = { - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; counters : - (Tezos_crypto.Block_hash.t * Z.t) - Tezos_crypto.Signature.V0.Public_key_hash.Table.t; + (Block_hash.t * Z.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.V0.Public_key_hash.Set.t; - mutable last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; - mutable target_block : Tezos_crypto.Block_hash.t; + mutable target_block : Block_hash.t; (** The block on top of which we are injecting transactions (HEAD~2). *) new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } (** Cost estimations for every kind of transaction used in the stress test. @@ -182,8 +180,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let transaction_costs_encoding = let open Data_encoding in @@ -328,13 +326,13 @@ let rec sample_source_from_pool state rng (cctxt : Protocol_client_context.full) cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) >>= fun () -> Lwt.return source | Some [] -> cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block >>= fun () -> Lwt_condition.wait state.new_block_condition >>= fun () -> @@ -477,7 +475,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng >>=? fun pcounter -> Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun branch -> (* If there is a new block refresh the fresh_pool *) - if not (Tezos_crypto.Block_hash.equal branch state.last_block) then ( + if not (Block_hash.equal branch state.last_block) then ( state.last_block <- branch ; (* Because of how Tenderbake works the target block should stay 2 blocks in the past because this guarantees that we are targeting a @@ -505,7 +503,7 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng by the RPC _must_ be the freshest one. *) pcounter | Some (previous_branch, previous_counter) -> - if Tezos_crypto.Block_hash.equal branch previous_branch then + if Block_hash.equal branch previous_branch then (* We already injected an operation on top of this block: the one stored locally is the freshest one. *) previous_counter @@ -609,17 +607,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state rng debug_msg (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) >>= fun () -> let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find - state.injected_operations - branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; @@ -636,7 +632,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -657,10 +653,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = Shell_services.Blocks.hash cctxt () >>=? fun current_head_on_exit -> let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -688,7 +684,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -701,9 +697,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = debug_msg (fun () -> cctxt#message "injected : %a\nincluded: %a" - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) injected_ops - (Format.pp_print_list Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list Operation_hash.pp) included_ops) >>= fun () -> let injected_ops_count = List.length injected_ops in @@ -793,7 +789,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) dont_wait (fun () -> on_new_head cctxt (fun (block, new_block_header) -> - if not (Tezos_crypto.Block_hash.equal block state.last_block) then ( + if not (Block_hash.equal block state.last_block) then ( state.last_block <- block ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1158,7 +1154,7 @@ let generate_random_transactions = last_level = Int32.to_int header_on_start.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = @@ -1229,7 +1225,7 @@ let estimate_transaction_cost parameters (cctxt : Protocol_client_context.full) last_level = Int32.to_int header_on_start.shell.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let rng = Random.State.make [|parameters.seed|] in diff --git a/src/proto_013_PtJakart/lib_delegate/baking_events.ml b/src/proto_013_PtJakart/lib_delegate/baking_events.ml index ee28698ff809..8a148aefb8e7 100644 --- a/src/proto_013_PtJakart/lib_delegate/baking_events.ml +++ b/src/proto_013_PtJakart/lib_delegate/baking_events.ml @@ -43,8 +43,8 @@ module State_transitions = struct ~name:"new_head" ~level:Notice ~msg:"received new head {block} at level {level}, round {round}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) ~pp3:Round.pp @@ -119,12 +119,12 @@ module State_transitions = struct ~msg: "proposal {new_proposal} for current round ({current_round}) has \ already been seen {previous_proposal}" - ~pp1:Tezos_crypto.Block_hash.pp - ("new_proposal", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("new_proposal", Block_hash.encoding) ~pp2:Round.pp ("current_round", Round.encoding) - ~pp3:Tezos_crypto.Block_hash.pp - ("previous_proposal", Tezos_crypto.Block_hash.encoding) + ~pp3:Block_hash.pp + ("previous_proposal", Block_hash.encoding) let updating_latest_proposal = declare_1 @@ -132,8 +132,8 @@ module State_transitions = struct ~name:"updating_latest_proposal" ~msg:"updating latest proposal to {block_hash}" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let baker_is_ahead_of_node = declare_2 @@ -156,10 +156,10 @@ module State_transitions = struct ~msg: "received a proposal on another branch - current: current \ pred{current_branch}, new pred {new_branch}" - ~pp1:Tezos_crypto.Block_hash.pp - ("current_branch", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("new_branch", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("current_branch", Block_hash.encoding) + ~pp2:Block_hash.pp + ("new_branch", Block_hash.encoding) let switching_branch = declare_0 @@ -215,8 +215,8 @@ module State_transitions = struct ~name:"preendorsing_proposal" ~level:Info ~msg:"preendorsing proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let skipping_invalid_proposal = declare_0 @@ -232,8 +232,8 @@ module State_transitions = struct ~name:"outdated_proposal" ~level:Debug ~msg:"outdated proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let proposing_fresh_block = declare_2 @@ -271,10 +271,10 @@ module State_transitions = struct ~msg: "unexpected prequorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let unexpected_quorum_received = declare_2 @@ -284,10 +284,10 @@ module State_transitions = struct ~msg: "unexpected quorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let step_current_phase = declare_2 @@ -321,8 +321,8 @@ module Node_rpc = struct ~name:"raw_info" ~level:Debug ~msg:"raw info for {block_hash} at level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) end @@ -451,8 +451,8 @@ module Scheduling = struct ~name:"proposal_in_the_future" ~level:Debug ~msg:"received proposal in the future {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let process_proposal_in_the_future = declare_1 @@ -460,8 +460,8 @@ module Scheduling = struct ~name:"process_proposal_in_the_future" ~level:Debug ~msg:"process proposal received in the future with hash {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) end module Lib = struct @@ -543,8 +543,8 @@ module Actions = struct ~name:"preendorsement_injected" ~level:Notice ~msg:"injected preendorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_delegate ("delegate", Baking_state.delegate_encoding) @@ -554,8 +554,8 @@ module Actions = struct ~name:"endorsement_injected" ~level:Notice ~msg:"injected endorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_delegate ("delegate", Baking_state.delegate_encoding) @@ -565,8 +565,8 @@ module Actions = struct ~name:"synchronizing_round" ~level:Info ~msg:"synchronizing round after block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let forging_block = declare_3 @@ -605,11 +605,11 @@ module Actions = struct ~msg: "block {block} at level {level}, round {round} injected for delegate \ {delegate}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:pp_int32 ~pp3:Round.pp ~pp4:Baking_state.pp_delegate - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("round", Round.encoding) ("delegate", Baking_state.delegate_encoding) @@ -678,8 +678,8 @@ module Nonces = struct ~name:"found_nonce_to_reveal" ~level:Notice ~msg:"found nonce to reveal for block {block}, level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) @@ -695,8 +695,8 @@ module Nonces = struct ("level", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let cannot_fetch_chain_head_level = declare_0 @@ -771,8 +771,8 @@ module Nonces = struct ~name:"registering_nonce" ~level:Info ~msg:"registering nonce for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let nothing_to_reveal = declare_1 @@ -780,8 +780,8 @@ module Nonces = struct ~name:"nothing_to_reveal" ~level:Info ~msg:"nothing to reveal for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let revelation_worker_started = declare_0 @@ -864,8 +864,8 @@ module Selection = struct ~name:"invalid_operation_filtered" ~level:Warning ~msg:"filtered invalid operation {op}: {errors}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.(TzTrace.encoding error_encoding)) @@ -875,6 +875,6 @@ module Selection = struct ~name:"cannot_serialize_operation_metadata" ~level:Warning ~msg:"cannot serialize operation {op} metadata" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) end diff --git a/src/proto_013_PtJakart/lib_delegate/delegate_events.ml b/src/proto_013_PtJakart/lib_delegate/delegate_events.ml index 274e77d9c8f6..5774869900d5 100644 --- a/src/proto_013_PtJakart/lib_delegate/delegate_events.ml +++ b/src/proto_013_PtJakart/lib_delegate/delegate_events.ml @@ -41,7 +41,7 @@ module Revelation = struct ~level ~name:"no_nonce_reveal" ~msg:"nothing to reveal for block {block}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let reveal_nonce = declare_5 @@ -55,7 +55,7 @@ module Revelation = struct ("level", Alpha_context.Raw_level.encoding) ("chain", Data_encoding.string) ("block", Data_encoding.string) - ("operation", Tezos_crypto.Operation_hash.encoding) + ("operation", Operation_hash.encoding) end module Nonces = struct @@ -99,7 +99,7 @@ module Nonces = struct ~level ~name:"found_nonce" ~msg:"found nonce to reveal for {hash} (level: {level})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) let bad_nonce = @@ -131,8 +131,8 @@ module Denunciator = struct ~level ~name:"double_endorsement_detected" ~msg:"double endorsement detected" - ("existing_endorsement", Tezos_crypto.Operation_hash.encoding) - ("new_endorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_endorsement", Operation_hash.encoding) + ("new_endorsement", Operation_hash.encoding) let double_endorsement_denounced = declare_2 @@ -140,7 +140,7 @@ module Denunciator = struct ~level ~name:"double_endorsement_denounced" ~msg:"double endorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -150,8 +150,8 @@ module Denunciator = struct ~level ~name:"double_preendorsement_detected" ~msg:"double preendorsement detected" - ("existing_preendorsement", Tezos_crypto.Operation_hash.encoding) - ("new_preendorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_preendorsement", Operation_hash.encoding) + ("new_preendorsement", Operation_hash.encoding) let double_preendorsement_denounced = declare_2 @@ -159,7 +159,7 @@ module Denunciator = struct ~level ~name:"double_preendorsement_denounced" ~msg:"double preendorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -169,7 +169,7 @@ module Denunciator = struct ~level:Error ~name:"inconsistent_endorsement" ~msg:"inconsistent endorsement found {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) let unexpected_pruned_block = declare_1 @@ -177,7 +177,7 @@ module Denunciator = struct ~level:Error ~name:"unexpected_pruned_block" ~msg:"unexpected pruned block: {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let double_baking_but_not = declare_0 @@ -201,7 +201,7 @@ module Denunciator = struct ~level ~name:"double_baking_denounced" ~msg:"double baking evidence injected {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -220,7 +220,7 @@ module Denunciator = struct ~name:"accuser_saw_block" ~msg:"block level: {level}" ("level", Alpha_context.Raw_level.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetch_operations_error = declare_1 @@ -228,8 +228,8 @@ module Denunciator = struct ~level:Error ~name:"fetch_operations_error" ~msg:"error while fetching operations of block {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) - ~pp1:Tezos_crypto.Block_hash.pp + ("hash", Block_hash.encoding) + ~pp1:Block_hash.pp let accuser_processed_block = declare_1 @@ -237,7 +237,7 @@ module Denunciator = struct ~level ~name:"accuser_processed_block" ~msg:"block {hash} registered" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let accuser_block_error = declare_2 @@ -246,7 +246,7 @@ module Denunciator = struct ~name:"accuser_block_error" ~msg:"error while processing block {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end @@ -325,7 +325,7 @@ module Baking_forge = struct ~level:Info ~name:"inject_baked_block" ~msg:"Client_baking_forge.inject_block: inject {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ~pp2:pp_ignore ("header", Data_encoding.bytes) ~pp3:Format.(pp_print_list @@ pp_print_list @@ Operation.pp) @@ -338,7 +338,7 @@ module Baking_forge = struct ~level:Debug ~name:"baking_local_validation_start" ~msg:"starting client-side validation after {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let context_fetch_error = declare_1 @@ -364,7 +364,7 @@ module Baking_forge = struct ~name:"baking_rejected_invalid_operation" ~msg:"client-side validation: filtered invalid operation {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) let shell_prevalidation_notice = @@ -436,7 +436,7 @@ module Baking_forge = struct ~name:"try_baking" ~msg: "try baking after {hash} (slot {priority}) for {client} ({timestamp})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("priority", Data_encoding.int31) ("client", Data_encoding.string) ("timestamp", Time.System.encoding) @@ -480,7 +480,7 @@ module Baking_forge = struct ~msg: "try forging locally the block header for {hash} (slot {priority}) for \ {client} ({timestamp})" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("priority", Data_encoding.int31) ("client", Data_encoding.string) ("timestamp", Time.System.encoding) @@ -497,7 +497,7 @@ module Baking_forge = struct ("priority", Data_encoding.int31) ("fitness", Fitness.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let injected_block = @@ -511,9 +511,9 @@ module Baking_forge = struct {operations})" ~pp6:Fitness.pp ~pp7:Format.(pp_print_list Operation.pp) - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) ("priority", Data_encoding.int31) ("fitness", Fitness.encoding) @@ -549,7 +549,7 @@ module Baking_forge = struct ("priority", Data_encoding.int31) ("timestamp", Time.System.encoding) ("client", Data_encoding.string) - ("predecessor", Tezos_crypto.Block_hash.encoding) + ("predecessor", Block_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let read_nonce_fail = @@ -689,10 +689,10 @@ module Endorsement = struct ~msg: "injected endorsement for block '{block_hash}' (level {level}, \ contract {client}) '{op_hash}'" - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("level", Alpha_context.Raw_level.encoding) ("client", Data_encoding.string) - ("op_hash", Tezos_crypto.Operation_hash.encoding) + ("op_hash", Operation_hash.encoding) ("baker", Client_keys_v0.Public_key_hash.encoding) let endorsing = @@ -701,7 +701,7 @@ module Endorsement = struct ~level:Debug ~name:"endorsing" ~msg:"endorsing {block} for {client} (level {level})!" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) ("level", Alpha_context.Raw_level.encoding) @@ -711,7 +711,7 @@ module Endorsement = struct ~level:Debug ~name:"check_endorsement_ok" ~msg:"checking if allowed to endorse block {block} for {client}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) let endorsement_no_slots_found = @@ -720,7 +720,7 @@ module Endorsement = struct ~level:Debug ~name:"endorsement_no_slots_found" ~msg:"no slot found for {block}/{client}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) let endorsement_slots_found = @@ -738,7 +738,7 @@ module Endorsement = struct (pp_print_list ~pp_sep:(fun f () -> pp_print_string f "; ") Format.pp_print_int)) - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("client", Data_encoding.string) ("slots", Data_encoding.list Data_encoding.int31) @@ -756,7 +756,7 @@ module Endorsement = struct ~level:Info ~name:"endorsement_stale_block" ~msg:"ignore block {block}: forged too far the past" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let endorsement_got_block = declare_1 @@ -764,7 +764,7 @@ module Endorsement = struct ~level:Info ~name:"endorsement_got_block" ~msg:"received new block {block}" - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let wait_before_injecting = declare_2 diff --git a/src/proto_013_PtJakart/lib_injector/common.ml b/src/proto_013_PtJakart/lib_injector/common.ml index 69c4376cd88d..162a9278ed11 100644 --- a/src/proto_013_PtJakart/lib_injector/common.ml +++ b/src/proto_013_PtJakart/lib_injector/common.ml @@ -68,7 +68,7 @@ let tezos_reorg fetch_tezos_block ~old_head_hash ~new_head_hash = let open Alpha_block_services in let open Lwt_result_syntax in let rec loop old_chain new_chain old_head_hash new_head_hash = - if Tezos_crypto.Block_hash.(old_head_hash = new_head_hash) then + if Block_hash.(old_head_hash = new_head_hash) then return {old_chain = List.rev old_chain; new_chain = List.rev new_chain} else let* new_head = fetch_tezos_block new_head_hash in diff --git a/src/proto_013_PtJakart/lib_injector/common.mli b/src/proto_013_PtJakart/lib_injector/common.mli index 6e9cbff0c20d..081dc1e98615 100644 --- a/src/proto_013_PtJakart/lib_injector/common.mli +++ b/src/proto_013_PtJakart/lib_injector/common.mli @@ -59,18 +59,18 @@ type block_info := Alpha_block_services.block_info it from the L1 node otherwise. *) val fetch_tezos_block : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> block_info tzresult Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info tzresult Lwt.t (** [tezos_reorg fetch ~old_head_hash ~new_head_hash] computes the reorganization of L1 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) val tezos_reorg : - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> - old_head_hash:Tezos_crypto.Block_hash.t -> - new_head_hash:Tezos_crypto.Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> + old_head_hash:Block_hash.t -> + new_head_hash:Block_hash.t -> block_info reorg tzresult Lwt.t diff --git a/src/proto_013_PtJakart/lib_injector/disk_persistence.ml b/src/proto_013_PtJakart/lib_injector/disk_persistence.ml index 120fde84cff8..9941a6928cdd 100644 --- a/src/proto_013_PtJakart/lib_injector/disk_persistence.ml +++ b/src/proto_013_PtJakart/lib_injector/disk_persistence.ml @@ -276,7 +276,7 @@ end module Make_queue (N : sig val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_013_PtJakart/lib_injector/disk_persistence.mli b/src/proto_013_PtJakart/lib_injector/disk_persistence.mli index 6e37f06fe507..d55c04db2f11 100644 --- a/src/proto_013_PtJakart/lib_injector/disk_persistence.mli +++ b/src/proto_013_PtJakart/lib_injector/disk_persistence.mli @@ -106,7 +106,7 @@ module Make_queue (N : sig to store the persistent information for this queue. *) val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_013_PtJakart/lib_injector/injector_events.ml b/src/proto_013_PtJakart/lib_injector/injector_events.ml index 7789fe3352a6..b22dbdd7d6a5 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_events.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_events.ml @@ -113,7 +113,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"new_tezos_head" ~msg:"processing new Tezos head {head}" ~level:Debug - ("head", Tezos_crypto.Block_hash.encoding) + ("head", Block_hash.encoding) let injecting_pending = declare_1 @@ -168,7 +168,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"injected" ~msg:"Injected in {oph}" ~level:Notice - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let add_pending = declare_1 @@ -183,7 +183,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"included" ~msg:"Included operations of {block} at level {level}: {operations}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("operations", Data_encoding.list L1_operation.Hash.encoding) ~pp3:pp_operations_hash_list diff --git a/src/proto_013_PtJakart/lib_injector/injector_functor.ml b/src/proto_013_PtJakart/lib_injector/injector_functor.ml index dbb2eb77887a..c3200598c92c 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_functor.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_functor.ml @@ -73,7 +73,7 @@ module Make (Rollup : PARAMETERS) = struct node. *) type injected_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) } @@ -93,20 +93,20 @@ module Make (Rollup : PARAMETERS) = struct let open Data_encoding in conv (fun {op; oph} -> (oph, op)) (fun (oph, op) -> {op; oph}) @@ merge_objs - (obj1 (req "oph" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "oph" Operation_hash.encoding)) L1_operation.encoding end) module Injected_ophs = Disk_persistence.Make_table (struct - include Tezos_crypto.Operation_hash.Table + include Operation_hash.Table type value = L1_operation.Hash.t list let name = "injected_ophs" - let string_of_key = Tezos_crypto.Operation_hash.to_b58check + let string_of_key = Operation_hash.to_b58check - let key_of_string = Tezos_crypto.Operation_hash.of_b58check_opt + let key_of_string = Operation_hash.of_b58check_opt let value_encoding = Data_encoding.list L1_operation.Hash.encoding end) @@ -126,10 +126,10 @@ module Make (Rollup : PARAMETERS) = struct block. *) type included_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) - l1_block : Tezos_crypto.Block_hash.t; + l1_block : Block_hash.t; (** The hash of the L1 block in which the operation was included. *) l1_level : int32; (** The level of [l1_block]. *) } @@ -153,21 +153,21 @@ module Make (Rollup : PARAMETERS) = struct @@ merge_objs L1_operation.encoding (obj3 - (req "oph" Tezos_crypto.Operation_hash.encoding) - (req "l1_block" Tezos_crypto.Block_hash.encoding) + (req "oph" Operation_hash.encoding) + (req "l1_block" Block_hash.encoding) (req "l1_level" int32)) end) module Included_in_blocks = Disk_persistence.Make_table (struct - include Tezos_crypto.Block_hash.Table + include Block_hash.Table type value = int32 * L1_operation.Hash.t list let name = "included_in_blocks" - let string_of_key = Tezos_crypto.Block_hash.to_b58check + let string_of_key = Block_hash.to_b58check - let key_of_string = Tezos_crypto.Block_hash.of_b58check_opt + let key_of_string = Block_hash.of_b58check_opt let value_encoding = let open Data_encoding in @@ -620,7 +620,7 @@ module Make (Rollup : PARAMETERS) = struct | Ok packed_contents_list -> packed_contents_list in let signature = Tezos_crypto.Signature.V0.zero in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; 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 3633c6397c61..f64be4e54cf5 100644 --- a/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml +++ b/src/proto_013_PtJakart/lib_injector/injector_worker_types.ml @@ -84,7 +84,7 @@ module Request = struct Format.fprintf ppf "switching to new Tezos head %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.Alpha_block_services.hash ; if r.old_chain <> [] || r.new_chain <> [] then Format.fprintf diff --git a/src/proto_013_PtJakart/lib_injector/l1_operation.mli b/src/proto_013_PtJakart/lib_injector/l1_operation.mli index 21b13fbf32ff..6dc5bdeb9cd8 100644 --- a/src/proto_013_PtJakart/lib_injector/l1_operation.mli +++ b/src/proto_013_PtJakart/lib_injector/l1_operation.mli @@ -26,7 +26,7 @@ open Protocol.Alpha_context (** Hash with b58check encoding mop(53), for hashes of L1 manager operations *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for L1 operations hashes *) type hash = Hash.t diff --git a/src/proto_013_PtJakart/lib_plugin/plugin.ml b/src/proto_013_PtJakart/lib_plugin/plugin.ml index 886bea1d5f55..f0c8f84aace6 100644 --- a/src/proto_013_PtJakart/lib_plugin/plugin.ml +++ b/src/proto_013_PtJakart/lib_plugin/plugin.ml @@ -219,16 +219,13 @@ module Mempool = struct (modulo replace_by_fee_factor) *) type manager_op_info = { - operation_hash : Tezos_crypto.Operation_hash.t; + operation_hash : Operation_hash.t; gas_limit : Gas.Arith.fp; fee : Tez.t; weight : Q.t; } - type manager_op_weight = { - operation_hash : Tezos_crypto.Operation_hash.t; - weight : Q.t; - } + type manager_op_weight = {operation_hash : Operation_hash.t; weight : Q.t} let op_weight_of_info (info : manager_op_info) : manager_op_weight = {operation_hash = info.operation_hash; weight = info.weight} @@ -240,10 +237,7 @@ module Mempool = struct let compare op1 op2 = let c = Q.compare op1.weight op2.weight in if c <> 0 then c - else - Tezos_crypto.Operation_hash.compare - op1.operation_hash - op2.operation_hash + else Operation_hash.compare op1.operation_hash op2.operation_hash end) type state = { @@ -257,15 +251,14 @@ module Mempool = struct Each manager in the map should be accessible with an operation hash in [operation_hash_to_manager]. *) operation_hash_to_manager : - Tezos_crypto.Signature.V0.Public_key_hash.t - Tezos_crypto.Operation_hash.Map.t; + Tezos_crypto.Signature.V0.Public_key_hash.t 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]. *) prechecked_operations_count : int; (** Number of prechecked manager operations. Invariants: - - [Tezos_crypto.Operation_hash.Map.cardinal operation_hash_to_manager = + - [Operation_hash.Map.cardinal operation_hash_to_manager = prechecked_operations_count] - [prechecked_operations_count <= max_prechecked_manager_operations] *) ops_prechecked : ManagerOpWeightSet.t; @@ -282,7 +275,7 @@ module Mempool = struct round_zero_duration = None; op_prechecked_managers = Tezos_crypto.Signature.V0.Public_key_hash.Map.empty; - operation_hash_to_manager = Tezos_crypto.Operation_hash.Map.empty; + operation_hash_to_manager = Operation_hash.Map.empty; prechecked_operations_count = 0; ops_prechecked = ManagerOpWeightSet.empty; min_prechecked_op_weight = None; @@ -341,7 +334,7 @@ module Mempool = struct let remove ~(filter_state : state) oph = let removed_oph_source = ref None in let operation_hash_to_manager = - Tezos_crypto.Operation_hash.Map.update + Operation_hash.Map.update oph (function | None -> None @@ -382,7 +375,7 @@ module Mempool = struct match filter_state.min_prechecked_op_weight with | None -> None | Some op -> - if Tezos_crypto.Operation_hash.equal op.operation_hash oph then + if Operation_hash.equal op.operation_hash oph then ManagerOpWeightSet.min_elt ops_prechecked else Some op in @@ -426,7 +419,7 @@ module Mempool = struct (fun () -> Fees_too_low) type Environment.Error_monad.error += - | Manager_restriction of {oph : Tezos_crypto.Operation_hash.t; fee : Tez.t} + | Manager_restriction of {oph : Operation_hash.t; fee : Tez.t} let () = Environment.Error_monad.register_error_kind @@ -440,21 +433,21 @@ module Mempool = struct "Only one manager operation per manager per block allowed (found %a \ with %atez fee. You may want to use --replace to provide adequate \ fee and replace it)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Tez.pp fee) Data_encoding.( obj2 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation_fee" Tez.encoding)) (function Manager_restriction {oph; fee} -> Some (oph, fee) | _ -> None) (fun (oph, fee) -> Manager_restriction {oph; fee}) type Environment.Error_monad.error += | Manager_operation_replaced of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } let () = @@ -467,13 +460,13 @@ module Mempool = struct Format.fprintf ppf "The manager operation %a has been replaced with %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Manager_operation_replaced {old_hash; new_hash} -> Some (old_hash, new_hash) @@ -1031,7 +1024,7 @@ module Mempool = struct config -> state -> validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Tezos_base.Operation.shell_header -> t Kind.manager protocol_data -> nb_successful_prechecks:int -> @@ -1039,8 +1032,7 @@ module Mempool = struct gas_limit:Gas.Arith.fp -> public_key_hash -> [> `Prechecked_manager of - [ `No_replace - | `Replace of Tezos_crypto.Operation_hash.t * error_classification ] + [`No_replace | `Replace of Operation_hash.t * error_classification] | error_classification ] Lwt.t = fun config @@ -1127,11 +1119,8 @@ module Mempool = struct | `Replace (oph, _class) -> remove ~filter_state oph in let prechecked_operations_count = - if - Tezos_crypto.Operation_hash.Map.mem - oph - filter_state.operation_hash_to_manager - then filter_state.prechecked_operations_count + if Operation_hash.Map.mem oph filter_state.operation_hash_to_manager then + filter_state.prechecked_operations_count else filter_state.prechecked_operations_count + 1 in let op_weight = op_weight_of_info info in @@ -1149,10 +1138,7 @@ module Mempool = struct info filter_state.op_prechecked_managers; operation_hash_to_manager = - Tezos_crypto.Operation_hash.Map.add - oph - source - filter_state.operation_hash_to_manager + Operation_hash.Map.add oph source filter_state.operation_hash_to_manager (* Record which manager is used for the operation hash. *); ops_prechecked = ManagerOpWeightSet.add op_weight filter_state.ops_prechecked; @@ -1164,14 +1150,13 @@ module Mempool = struct config -> filter_state:state -> validation_state:validation_state -> - Tezos_crypto.Operation_hash.t -> + Operation_hash.t -> Main.operation -> nb_successful_prechecks:int -> [ `Passed_precheck of state * validation_state - * [ `No_replace - | `Replace of Tezos_crypto.Operation_hash.t * error_classification ] + * [`No_replace | `Replace of Operation_hash.t * error_classification] | error_classification | `Undecided ] Lwt.t = @@ -2327,9 +2312,7 @@ module RPC = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = - Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Origination_nonce.init ctxt Operation_hash.zero in Lwt.return (Contract.fresh_contract_from_current_nonce ctxt) >>=? fun (ctxt, dummy_contract) -> Contract.raw_originate diff --git a/src/proto_013_PtJakart/lib_protocol/dune b/src/proto_013_PtJakart/lib_protocol/dune index d8954ce3578b..760873a95274 100644 --- a/src/proto_013_PtJakart/lib_protocol/dune +++ b/src/proto_013_PtJakart/lib_protocol/dune @@ -237,7 +237,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY\"\nlet name = Tezos_protocol_environment_013_PtJakart.Name.name\ninclude Tezos_raw_protocol_013_PtJakart\ninclude Tezos_raw_protocol_013_PtJakart.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY\"\nlet name = Tezos_protocol_environment_013_PtJakart.Name.name\ninclude Tezos_raw_protocol_013_PtJakart\ninclude Tezos_raw_protocol_013_PtJakart.Main\n"))) (rule (targets tezos_protocol_013_PtJakart.ml) 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 e4d4fbf4183e..bc871b0523d4 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_args.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_args.ml @@ -668,7 +668,7 @@ module Tx_rollup = struct let context_hash_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Context_hash.of_b58check_opt s with + match Context_hash.of_b58check_opt s with | Some hash -> return hash | None -> failwith 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 a8140d2b736f..0e63ef373052 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_args.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_args.mli @@ -184,7 +184,7 @@ module Tx_rollup : sig ?name:string -> usage:string -> ('a, full) Tezos_clic.params -> - (Tezos_crypto.Context_hash.t -> 'a, full) Tezos_clic.params + (Context_hash.t -> 'a, full) Tezos_clic.params val message_result_path_param : ?name:string -> 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 2435305cc820..05415aac8bf1 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.ml @@ -691,7 +691,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -799,7 +799,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 ce1afbf2f687..6ef593bd6d04 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.mli @@ -356,7 +356,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -394,7 +394,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t val submit_ballot : @@ -406,7 +406,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -416,7 +416,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t val cached_contracts : @@ -461,7 +461,7 @@ val originate_tx_rollup : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_origination Kind.manager contents * Kind.tx_rollup_origination Kind.manager Apply_results.contents_result) tzresult @@ -487,7 +487,7 @@ val submit_tx_rollup_batch : content:string -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_submit_batch Kind.manager contents * Kind.tx_rollup_submit_batch Kind.manager Apply_results.contents_result) tzresult @@ -515,7 +515,7 @@ val submit_tx_rollup_commitment : predecessor:Tx_rollup_commitment_hash.t option -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_commit Kind.manager contents * Kind.tx_rollup_commit Kind.manager Apply_results.contents_result) tzresult @@ -539,7 +539,7 @@ val submit_tx_rollup_finalize_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_finalize_commitment Kind.manager contents * Kind.tx_rollup_finalize_commitment Kind.manager Apply_results.contents_result) @@ -564,7 +564,7 @@ val submit_tx_rollup_remove_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_remove_commitment Kind.manager contents * Kind.tx_rollup_remove_commitment Kind.manager Apply_results.contents_result) tzresult @@ -593,12 +593,12 @@ val submit_tx_rollup_rejection : message_path:Tx_rollup_inbox.Merkle.path -> message_result_hash:Tx_rollup_message_result_hash.t -> message_result_path:Tx_rollup_commitment.Merkle.path -> - previous_context_hash:Tezos_crypto.Context_hash.t -> + previous_context_hash:Context_hash.t -> previous_withdraw_list_hash:Tx_rollup_withdraw_list_hash.t -> previous_message_result_path:Tx_rollup_commitment.Merkle.path -> proof:Tx_rollup_l2_proof.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_rejection Kind.manager contents * Kind.tx_rollup_rejection Kind.manager Apply_results.contents_result) tzresult @@ -622,7 +622,7 @@ val submit_tx_rollup_return_bond : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_return_bond Kind.manager contents * Kind.tx_rollup_return_bond Kind.manager Apply_results.contents_result) tzresult @@ -645,13 +645,13 @@ val tx_rollup_dispatch_tickets : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> - context_hash:Tezos_crypto.Context_hash.t -> + context_hash:Context_hash.t -> message_position:int -> message_result_path:Tx_rollup_commitment.Merkle.path -> tickets_info:Tx_rollup_reveal.t list -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_dispatch_tickets Kind.manager contents * Kind.tx_rollup_dispatch_tickets Kind.manager Apply_results.contents_result) tzresult @@ -680,7 +680,7 @@ val transfer_ticket : destination:Contract.t -> entrypoint:Entrypoint.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.transfer_ticket Kind.manager contents * Kind.transfer_ticket Kind.manager Apply_results.contents_result) tzresult @@ -706,7 +706,7 @@ val sc_rollup_originate : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_originate Kind.manager contents * Kind.sc_rollup_originate Kind.manager Apply_results.contents_result, tztrace ) @@ -732,7 +732,7 @@ val sc_rollup_add_messages : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_add_messages Kind.manager contents * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult @@ -757,7 +757,7 @@ val sc_rollup_cement : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_cement Kind.manager contents * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) tzresult @@ -782,7 +782,7 @@ val sc_rollup_publish : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_publish Kind.manager contents * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult @@ -811,7 +811,7 @@ val sc_rollup_execute_outbox_message : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_execute_outbox_message Kind.manager contents * Kind.sc_rollup_execute_outbox_message Kind.manager Apply_results.contents_result, @@ -837,7 +837,7 @@ val sc_rollup_recover_bond : fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_recover_bond Kind.manager contents * Kind.sc_rollup_recover_bond Kind.manager Apply_results.contents_result) tzresult @@ -862,7 +862,7 @@ val sc_rollup_dal_slot_subscribe : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_dal_slot_subscribe Kind.manager contents * Kind.sc_rollup_dal_slot_subscribe Kind.manager Apply_results.contents_result) tzresult 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_utils.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_014_PtKathma/lib_client/injection.ml b/src/proto_014_PtKathma/lib_client/injection.ml index 575fa92eed8c..8311605b0a12 100644 --- a/src/proto_014_PtKathma/lib_client/injection.ml +++ b/src/proto_014_PtKathma/lib_client/injection.ml @@ -57,15 +57,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee (contents : packed_contents_list) = let l = Operation.to_list contents in @@ -187,7 +184,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -1042,12 +1039,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -1058,8 +1055,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -1071,10 +1067,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -1135,10 +1131,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op, result.contents) @@ -1361,7 +1357,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch ~src_sk ~fee ~gas_limit ~storage_limit ?counter ?(replace_by_fees = false) ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * kind Kind.manager contents_list * kind Kind.manager contents_result_list) diff --git a/src/proto_014_PtKathma/lib_client/injection.mli b/src/proto_014_PtKathma/lib_client/injection.mli index 1ab767fb6bf2..8b07fba5f375 100644 --- a/src/proto_014_PtKathma/lib_client/injection.mli +++ b/src/proto_014_PtKathma/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -63,9 +63,7 @@ val simulate : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -85,8 +83,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> @@ -116,7 +113,7 @@ val inject_manager_operation : ?replace_by_fees:bool -> fee_parameter:fee_parameter -> 'kind Annotated_manager_operation.annotated_list -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * 'kind Kind.manager contents_list * 'kind Kind.manager contents_result_list) diff --git a/src/proto_014_PtKathma/lib_client/mockup.ml b/src/proto_014_PtKathma/lib_client/mockup.ml index 82ee7b04c5fe..0176bc90d5f5 100644 --- a/src/proto_014_PtKathma/lib_client/mockup.ml +++ b/src/proto_014_PtKathma/lib_client/mockup.ml @@ -1372,7 +1372,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -1392,14 +1392,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -1408,7 +1408,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -1517,7 +1517,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in Protocol_constants_overrides.apply_overrides (cctxt :> Tezos_client_base.Client_context.printer) @@ -1574,10 +1574,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in diff --git a/src/proto_014_PtKathma/lib_client/operation_result.ml b/src/proto_014_PtKathma/lib_client/operation_result.ml index 394f9e9a3411..748133f34e07 100644 --- a/src/proto_014_PtKathma/lib_client/operation_result.ml +++ b/src/proto_014_PtKathma/lib_client/operation_result.ml @@ -926,9 +926,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -980,9 +980,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -995,9 +995,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1019,7 +1019,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_result -> Format.fprintf @@ -1028,7 +1028,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_014_PtKathma/lib_client/proxy.ml b/src/proto_014_PtKathma/lib_client/proxy.ml index 4df92d400a6d..0954933c0a34 100644 --- a/src/proto_014_PtKathma/lib_client/proxy.ml +++ b/src/proto_014_PtKathma/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = 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 1e230706ce4e..2c9f83d1c52e 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 @@ -422,7 +422,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> return hash)) @@ stop) @@ -463,10 +463,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -484,16 +481,12 @@ let commands_ro () = fprintf ppf "* %a %a %s (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p Tez.pp (Tez.of_mutez_exn w) Operation_result.tez_sym - (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + (if List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; 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 4b2bce49ed42..bf3a395b2752 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 @@ -100,18 +100,17 @@ type transfer = { type state = { rng_state : Random.State.t; - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; mutable pool : source_origin list; mutable pool_size : int; mutable shuffled_pool : source list; mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; - mutable last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; - mutable target_block : Tezos_crypto.Block_hash.t; + mutable target_block : Block_hash.t; (** The block on top of which we are injecting transactions (HEAD~2). *) new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } (** Cost estimations for every kind of transaction used in the stress test. @@ -187,8 +186,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let transaction_costs_encoding = let open Data_encoding in @@ -330,13 +329,13 @@ let rec get_source_from_shuffled_pool state cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) >>= fun () -> Lwt.return source | [] -> cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block >>= fun () -> Lwt_condition.wait state.new_block_condition >>= fun () -> @@ -358,9 +357,7 @@ let generate_fresh_source state = [promise] resolved when the stream is closed. [stopper ()] closes the stream. *) let heads_iter (cctxt : Protocol_client_context.full) - (f : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in @@ -375,7 +372,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -384,10 +381,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) - then + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let* () = f block_hash_and_header in loop () else @@ -396,7 +390,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -410,7 +404,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return (promise, stopper) @@ -616,18 +610,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Debug (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) >>= fun () -> let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> log Debug (fun () -> @@ -641,7 +632,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -662,10 +653,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = Shell_services.Blocks.hash cctxt () >>=? fun current_head_on_exit -> let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -693,7 +684,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -706,9 +697,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = log Debug (fun () -> cctxt#message "injected : [%a]@.included: [%a]" - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) injected_ops - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) included_ops) >>= fun () -> let injected_ops_count = List.length injected_ops in @@ -786,8 +777,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) >>= loop in let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t = + Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t = (* Because of how Tenderbake works the target block should stay 2 blocks in the past because this guarantees that we are targeting a block that is decided. *) @@ -799,8 +789,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) in fun (new_block_hash, new_block_header) -> update_target_block () >>=? fun () -> - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1138,7 +1127,7 @@ let generate_random_transactions = cctxt#error "The level of the head (%a) needs to be greater than 2 and is \ actually %ld." - Tezos_crypto.Block_hash.pp + Block_hash.pp current_head_on_start header_on_start.level else return_unit) @@ -1160,7 +1149,7 @@ let generate_random_transactions = last_level = Int32.to_int header_on_start.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_014_PtKathma/lib_injector/common.ml b/src/proto_014_PtKathma/lib_injector/common.ml index 69c4376cd88d..162a9278ed11 100644 --- a/src/proto_014_PtKathma/lib_injector/common.ml +++ b/src/proto_014_PtKathma/lib_injector/common.ml @@ -68,7 +68,7 @@ let tezos_reorg fetch_tezos_block ~old_head_hash ~new_head_hash = let open Alpha_block_services in let open Lwt_result_syntax in let rec loop old_chain new_chain old_head_hash new_head_hash = - if Tezos_crypto.Block_hash.(old_head_hash = new_head_hash) then + if Block_hash.(old_head_hash = new_head_hash) then return {old_chain = List.rev old_chain; new_chain = List.rev new_chain} else let* new_head = fetch_tezos_block new_head_hash in diff --git a/src/proto_014_PtKathma/lib_injector/common.mli b/src/proto_014_PtKathma/lib_injector/common.mli index 6e9cbff0c20d..081dc1e98615 100644 --- a/src/proto_014_PtKathma/lib_injector/common.mli +++ b/src/proto_014_PtKathma/lib_injector/common.mli @@ -59,18 +59,18 @@ type block_info := Alpha_block_services.block_info it from the L1 node otherwise. *) val fetch_tezos_block : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> block_info tzresult Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info tzresult Lwt.t (** [tezos_reorg fetch ~old_head_hash ~new_head_hash] computes the reorganization of L1 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) val tezos_reorg : - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> - old_head_hash:Tezos_crypto.Block_hash.t -> - new_head_hash:Tezos_crypto.Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> + old_head_hash:Block_hash.t -> + new_head_hash:Block_hash.t -> block_info reorg tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_injector/disk_persistence.ml b/src/proto_014_PtKathma/lib_injector/disk_persistence.ml index 120fde84cff8..9941a6928cdd 100644 --- a/src/proto_014_PtKathma/lib_injector/disk_persistence.ml +++ b/src/proto_014_PtKathma/lib_injector/disk_persistence.ml @@ -276,7 +276,7 @@ end module Make_queue (N : sig val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_014_PtKathma/lib_injector/disk_persistence.mli b/src/proto_014_PtKathma/lib_injector/disk_persistence.mli index 6e37f06fe507..d55c04db2f11 100644 --- a/src/proto_014_PtKathma/lib_injector/disk_persistence.mli +++ b/src/proto_014_PtKathma/lib_injector/disk_persistence.mli @@ -106,7 +106,7 @@ module Make_queue (N : sig to store the persistent information for this queue. *) val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_014_PtKathma/lib_injector/injector_events.ml b/src/proto_014_PtKathma/lib_injector/injector_events.ml index 7789fe3352a6..b22dbdd7d6a5 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_events.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_events.ml @@ -113,7 +113,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"new_tezos_head" ~msg:"processing new Tezos head {head}" ~level:Debug - ("head", Tezos_crypto.Block_hash.encoding) + ("head", Block_hash.encoding) let injecting_pending = declare_1 @@ -168,7 +168,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"injected" ~msg:"Injected in {oph}" ~level:Notice - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let add_pending = declare_1 @@ -183,7 +183,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"included" ~msg:"Included operations of {block} at level {level}: {operations}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("operations", Data_encoding.list L1_operation.Hash.encoding) ~pp3:pp_operations_hash_list diff --git a/src/proto_014_PtKathma/lib_injector/injector_functor.ml b/src/proto_014_PtKathma/lib_injector/injector_functor.ml index dbb2eb77887a..c3200598c92c 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_functor.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_functor.ml @@ -73,7 +73,7 @@ module Make (Rollup : PARAMETERS) = struct node. *) type injected_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) } @@ -93,20 +93,20 @@ module Make (Rollup : PARAMETERS) = struct let open Data_encoding in conv (fun {op; oph} -> (oph, op)) (fun (oph, op) -> {op; oph}) @@ merge_objs - (obj1 (req "oph" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "oph" Operation_hash.encoding)) L1_operation.encoding end) module Injected_ophs = Disk_persistence.Make_table (struct - include Tezos_crypto.Operation_hash.Table + include Operation_hash.Table type value = L1_operation.Hash.t list let name = "injected_ophs" - let string_of_key = Tezos_crypto.Operation_hash.to_b58check + let string_of_key = Operation_hash.to_b58check - let key_of_string = Tezos_crypto.Operation_hash.of_b58check_opt + let key_of_string = Operation_hash.of_b58check_opt let value_encoding = Data_encoding.list L1_operation.Hash.encoding end) @@ -126,10 +126,10 @@ module Make (Rollup : PARAMETERS) = struct block. *) type included_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) - l1_block : Tezos_crypto.Block_hash.t; + l1_block : Block_hash.t; (** The hash of the L1 block in which the operation was included. *) l1_level : int32; (** The level of [l1_block]. *) } @@ -153,21 +153,21 @@ module Make (Rollup : PARAMETERS) = struct @@ merge_objs L1_operation.encoding (obj3 - (req "oph" Tezos_crypto.Operation_hash.encoding) - (req "l1_block" Tezos_crypto.Block_hash.encoding) + (req "oph" Operation_hash.encoding) + (req "l1_block" Block_hash.encoding) (req "l1_level" int32)) end) module Included_in_blocks = Disk_persistence.Make_table (struct - include Tezos_crypto.Block_hash.Table + include Block_hash.Table type value = int32 * L1_operation.Hash.t list let name = "included_in_blocks" - let string_of_key = Tezos_crypto.Block_hash.to_b58check + let string_of_key = Block_hash.to_b58check - let key_of_string = Tezos_crypto.Block_hash.of_b58check_opt + let key_of_string = Block_hash.of_b58check_opt let value_encoding = let open Data_encoding in @@ -620,7 +620,7 @@ module Make (Rollup : PARAMETERS) = struct | Ok packed_contents_list -> packed_contents_list in let signature = Tezos_crypto.Signature.V0.zero in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; 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 3633c6397c61..f64be4e54cf5 100644 --- a/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml +++ b/src/proto_014_PtKathma/lib_injector/injector_worker_types.ml @@ -84,7 +84,7 @@ module Request = struct Format.fprintf ppf "switching to new Tezos head %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.Alpha_block_services.hash ; if r.old_chain <> [] || r.new_chain <> [] then Format.fprintf diff --git a/src/proto_014_PtKathma/lib_injector/l1_operation.mli b/src/proto_014_PtKathma/lib_injector/l1_operation.mli index 21b13fbf32ff..6dc5bdeb9cd8 100644 --- a/src/proto_014_PtKathma/lib_injector/l1_operation.mli +++ b/src/proto_014_PtKathma/lib_injector/l1_operation.mli @@ -26,7 +26,7 @@ open Protocol.Alpha_context (** Hash with b58check encoding mop(53), for hashes of L1 manager operations *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for L1 operations hashes *) type hash = Hash.t diff --git a/src/proto_014_PtKathma/lib_plugin/RPC.ml b/src/proto_014_PtKathma/lib_plugin/RPC.ml index 408b715712e4..35ec7ce3cbd9 100644 --- a/src/proto_014_PtKathma/lib_plugin/RPC.ml +++ b/src/proto_014_PtKathma/lib_plugin/RPC.ml @@ -914,7 +914,7 @@ module Scripts = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero in + let ctxt = Origination_nonce.init ctxt Operation_hash.zero in Contract.fresh_contract_from_current_nonce ctxt >>?= fun (ctxt, dummy_contract_hash) -> let dummy_contract = Contract.Originated dummy_contract_hash in diff --git a/src/proto_014_PtKathma/lib_protocol/dune b/src/proto_014_PtKathma/lib_protocol/dune index 307e259b2803..b2289ead86d8 100644 --- a/src/proto_014_PtKathma/lib_protocol/dune +++ b/src/proto_014_PtKathma/lib_protocol/dune @@ -259,7 +259,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg\"\nlet name = Tezos_protocol_environment_014_PtKathma.Name.name\ninclude Tezos_raw_protocol_014_PtKathma\ninclude Tezos_raw_protocol_014_PtKathma.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg\"\nlet name = Tezos_protocol_environment_014_PtKathma.Name.name\ninclude Tezos_raw_protocol_014_PtKathma\ninclude Tezos_raw_protocol_014_PtKathma.Main\n"))) (rule (targets tezos_protocol_014_PtKathma.ml) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml b/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml index 4770923fbc71..5671ed744b4b 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml @@ -90,6 +90,6 @@ let make ~rng_state = (* Required for eg Create_contract *) Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in return (ctxt, step_constants) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/test/test_helpers.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_helpers.ml index dfb174654cb1..7c818134d2ac 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/test/test_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/test/test_helpers.ml @@ -71,7 +71,7 @@ let typecheck_by_tezos = return @@ Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in fun bef node -> Stdlib.Result.get_ok diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml index d843da786e4a..d635611cad20 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml @@ -211,9 +211,7 @@ module Sc_rollup_add_external_messages_benchmark = struct let ctxt = Incremental.alpha_ctxt b in (* Necessary to originate rollups. *) let ctxt = - Alpha_context.Origination_nonce.init - ctxt - Tezos_crypto.Operation_hash.zero + Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in Alpha_context.Internal_for_tests.to_raw ctxt in 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 57f93ff31797..41ec36327341 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml @@ -152,7 +152,7 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let benchmark rng_state _conf () = let bytes = Base_samplers.bytes rng_state ~size:{min = 32; max = 64} in - let branch = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let branch = Block_hash.hash_bytes [bytes] in let op_hash = Operation.hash_raw {shell = {branch}; proto = bytes} in let nonce = Origination_nonce.Internal_for_tests.initial op_hash in let contract = Contract.Internal_for_tests.originated_contract nonce 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 2d13cc8e3ca5..f8ae1a374598 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml @@ -670,7 +670,7 @@ module Tx_rollup = struct let context_hash_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Context_hash.of_b58check_opt s with + match Context_hash.of_b58check_opt s with | Some hash -> return hash | None -> failwith 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 39946abf4a06..7b6e3abf965e 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_args.mli @@ -184,7 +184,7 @@ module Tx_rollup : sig ?name:string -> usage:string -> ('a, full) Tezos_clic.params -> - (Tezos_crypto.Context_hash.t -> 'a, full) Tezos_clic.params + (Context_hash.t -> 'a, full) Tezos_clic.params val message_result_path_param : ?name:string -> 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 5f3ddb053db5..0f982e7b7376 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml @@ -798,7 +798,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -906,7 +906,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j 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 37b0b362034f..3e8868c59be4 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli @@ -450,7 +450,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -503,7 +503,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t (** Calls {!Injection.inject_operation} @@ -518,7 +518,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys_v0.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -528,7 +528,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t (** Calls {!Tezos_protocol_alpha.Protocol.Alpha_services.Cache.cached_contracts} *) @@ -577,7 +577,7 @@ val originate_tx_rollup : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_origination Kind.manager contents * Kind.tx_rollup_origination Kind.manager Apply_results.contents_result) tzresult @@ -603,7 +603,7 @@ val submit_tx_rollup_batch : content:string -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_submit_batch Kind.manager contents * Kind.tx_rollup_submit_batch Kind.manager Apply_results.contents_result) tzresult @@ -631,7 +631,7 @@ val submit_tx_rollup_commitment : predecessor:Tx_rollup_commitment_hash.t option -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_commit Kind.manager contents * Kind.tx_rollup_commit Kind.manager Apply_results.contents_result) tzresult @@ -655,7 +655,7 @@ val submit_tx_rollup_finalize_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_finalize_commitment Kind.manager contents * Kind.tx_rollup_finalize_commitment Kind.manager Apply_results.contents_result) @@ -680,7 +680,7 @@ val submit_tx_rollup_remove_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_remove_commitment Kind.manager contents * Kind.tx_rollup_remove_commitment Kind.manager Apply_results.contents_result) tzresult @@ -709,12 +709,12 @@ val submit_tx_rollup_rejection : message_path:Tx_rollup_inbox.Merkle.path -> message_result_hash:Tx_rollup_message_result_hash.t -> message_result_path:Tx_rollup_commitment.Merkle.path -> - previous_context_hash:Tezos_crypto.Context_hash.t -> + previous_context_hash:Context_hash.t -> previous_withdraw_list_hash:Tx_rollup_withdraw_list_hash.t -> previous_message_result_path:Tx_rollup_commitment.Merkle.path -> proof:Tx_rollup_l2_proof.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_rejection Kind.manager contents * Kind.tx_rollup_rejection Kind.manager Apply_results.contents_result) tzresult @@ -738,7 +738,7 @@ val submit_tx_rollup_return_bond : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_return_bond Kind.manager contents * Kind.tx_rollup_return_bond Kind.manager Apply_results.contents_result) tzresult @@ -761,13 +761,13 @@ val tx_rollup_dispatch_tickets : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> - context_hash:Tezos_crypto.Context_hash.t -> + context_hash:Context_hash.t -> message_position:int -> message_result_path:Tx_rollup_commitment.Merkle.path -> tickets_info:Tx_rollup_reveal.t list -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_dispatch_tickets Kind.manager contents * Kind.tx_rollup_dispatch_tickets Kind.manager Apply_results.contents_result) tzresult @@ -796,7 +796,7 @@ val transfer_ticket : destination:Contract.t -> entrypoint:Entrypoint.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.transfer_ticket Kind.manager contents * Kind.transfer_ticket Kind.manager Apply_results.contents_result) tzresult @@ -822,7 +822,7 @@ val sc_rollup_originate : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_originate Kind.manager contents * Kind.sc_rollup_originate Kind.manager Apply_results.contents_result, tztrace ) @@ -848,7 +848,7 @@ val sc_rollup_add_messages : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_add_messages Kind.manager contents * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult @@ -873,7 +873,7 @@ val sc_rollup_cement : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_cement Kind.manager contents * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) tzresult @@ -898,7 +898,7 @@ val sc_rollup_publish : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_publish Kind.manager contents * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult @@ -924,7 +924,7 @@ val sc_rollup_execute_outbox_message : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_execute_outbox_message Kind.manager contents * Kind.sc_rollup_execute_outbox_message Kind.manager Apply_results.contents_result, @@ -950,7 +950,7 @@ val sc_rollup_recover_bond : fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_recover_bond Kind.manager contents * Kind.sc_rollup_recover_bond Kind.manager Apply_results.contents_result) tzresult @@ -976,7 +976,7 @@ val sc_rollup_refute : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_refute Kind.manager contents * Kind.sc_rollup_refute Kind.manager Apply_results.contents_result) tzresult @@ -1002,7 +1002,7 @@ val sc_rollup_timeout : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_timeout Kind.manager contents * Kind.sc_rollup_timeout Kind.manager Apply_results.contents_result) tzresult @@ -1027,7 +1027,7 @@ val sc_rollup_dal_slot_subscribe : src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_dal_slot_subscribe Kind.manager contents * Kind.sc_rollup_dal_slot_subscribe Kind.manager Apply_results.contents_result) tzresult 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 7393491c2dac..a229531b1cc3 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys_v0.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.V0.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys_v0.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_015_PtLimaPt/lib_client/injection.ml b/src/proto_015_PtLimaPt/lib_client/injection.ml index 6d6f8e519526..0839fc53fc78 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.ml +++ b/src/proto_015_PtLimaPt/lib_client/injection.ml @@ -57,15 +57,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee (contents : packed_contents_list) = let l = Operation.to_list contents in @@ -187,7 +184,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -1057,12 +1054,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -1073,8 +1070,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -1086,10 +1082,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -1150,10 +1146,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op, result.contents) @@ -1376,7 +1372,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch ~src_sk ~fee ~gas_limit ~storage_limit ?counter ?(replace_by_fees = false) ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * kind Kind.manager contents_list * kind Kind.manager contents_result_list) diff --git a/src/proto_015_PtLimaPt/lib_client/injection.mli b/src/proto_015_PtLimaPt/lib_client/injection.mli index 1ab767fb6bf2..8b07fba5f375 100644 --- a/src/proto_015_PtLimaPt/lib_client/injection.mli +++ b/src/proto_015_PtLimaPt/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -63,9 +63,7 @@ val simulate : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -85,8 +83,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> @@ -116,7 +113,7 @@ val inject_manager_operation : ?replace_by_fees:bool -> fee_parameter:fee_parameter -> 'kind Annotated_manager_operation.annotated_list -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * 'kind Kind.manager contents_list * 'kind Kind.manager contents_result_list) diff --git a/src/proto_015_PtLimaPt/lib_client/mockup.ml b/src/proto_015_PtLimaPt/lib_client/mockup.ml index c1a05a03d092..17a3f352c1e0 100644 --- a/src/proto_015_PtLimaPt/lib_client/mockup.ml +++ b/src/proto_015_PtLimaPt/lib_client/mockup.ml @@ -243,7 +243,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -263,14 +263,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -279,7 +279,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -455,7 +455,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in (match bootstrap_accounts_json with | None -> return None @@ -499,10 +499,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.V0.generate_key () in diff --git a/src/proto_015_PtLimaPt/lib_client/operation_result.ml b/src/proto_015_PtLimaPt/lib_client/operation_result.ml index aa12c1b8024f..dd163ff417a4 100644 --- a/src/proto_015_PtLimaPt/lib_client/operation_result.ml +++ b/src/proto_015_PtLimaPt/lib_client/operation_result.ml @@ -1057,9 +1057,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -1112,9 +1112,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1127,9 +1127,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1151,7 +1151,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_result -> Format.fprintf @@ -1160,7 +1160,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.V0.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_015_PtLimaPt/lib_client/proxy.ml b/src/proto_015_PtLimaPt/lib_client/proxy.ml index 7fc6fc607b08..d1ee80868ae5 100644 --- a/src/proto_015_PtLimaPt/lib_client/proxy.ml +++ b/src/proto_015_PtLimaPt/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = 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 208eba2140d4..39c075d4fb77 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 @@ -81,7 +81,7 @@ let report_michelson_errors ?(no_print_source = false) ~msg let block_hash_param = Tezos_clic.parameter (fun _ s -> - try Lwt_result_syntax.return (Tezos_crypto.Block_hash.of_b58check_exn s) + try Lwt_result_syntax.return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -529,7 +529,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ stop) @@ -573,10 +573,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -595,16 +592,13 @@ let commands_ro () = fprintf ppf "* %a %a %s (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p Tez.pp (Tez.of_mutez_exn w) Operation_result.tez_sym (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; @@ -1050,7 +1044,7 @@ let commands_rw () = (Some delegate) in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * _ contents * _ Apply_results.contents_result) option) = @@ -1345,7 +1339,7 @@ let commands_rw () = contents in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * _ contents_list * _ Apply_results.contents_result_list) @@ -1810,7 +1804,7 @@ let commands_rw () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ prefixes ["to"; "be"; "included"] @@ -1819,7 +1813,7 @@ let commands_rw () = operation_hash (ctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* (_ : Tezos_crypto.Block_hash.t * int * int) = + let* (_ : Block_hash.t * int * int) = Client_confirmations.wait_for_operation_inclusion ctxt ~chain:ctxt#chain @@ -1850,7 +1844,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)))) @@ -1914,9 +1908,7 @@ let commands_rw () = (List.length proposals) Constants.max_proposals_per_delegate ; (match - Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare - proposals + Base.List.find_all_dups ~compare:Protocol_hash.compare proposals with | [] -> () | dups -> @@ -1928,19 +1920,16 @@ let commands_rw () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem ~equal:Tezos_crypto.Protocol_hash.equal p known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else - error - "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp - p) + error "Protocol %a is not a known proposal." Protocol_hash.pp p) proposals ; if not has_voting_power then error @@ -2030,7 +2019,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ param @@ -2070,13 +2059,12 @@ let commands_rw () = let* () = match (info.current_period_kind, current_proposal) with | (Exploration | Promotion), Some current_proposal -> - if Tezos_crypto.Protocol_hash.equal proposal current_proposal then - return_unit + if Protocol_hash.equal proposal current_proposal then return_unit else let*! () = (if force then cctxt#warning else cctxt#error) "Unexpected proposal, expected: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp current_proposal in return_unit 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 30b70b3765bd..2c1f6e4b871b 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 @@ -100,18 +100,17 @@ type transfer = { type state = { rng_state : Random.State.t; - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; mutable pool : source_origin list; mutable pool_size : int; mutable shuffled_pool : source list; mutable revealed : Tezos_crypto.Signature.V0.Public_key_hash.Set.t; - mutable last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; - mutable target_block : Tezos_crypto.Block_hash.t; + mutable target_block : Block_hash.t; (** The block on top of which we are injecting transactions (HEAD~2). *) new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } (** Cost estimations for every kind of transaction used in the stress test. @@ -187,8 +186,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let transaction_costs_encoding = let open Data_encoding in @@ -347,7 +346,7 @@ let rec get_source_from_shuffled_pool state cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) in Lwt.return source @@ -355,7 +354,7 @@ let rec get_source_from_shuffled_pool state let* () = cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block in let* () = Lwt_condition.wait state.new_block_condition in @@ -377,9 +376,7 @@ let generate_fresh_source state = [promise] resolved when the stream is closed. [stopper ()] closes the stream. *) let heads_iter (cctxt : Protocol_client_context.full) - (f : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in @@ -394,7 +391,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -403,10 +400,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) - then + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let* () = f block_hash_and_header in loop () else @@ -415,7 +409,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -429,7 +423,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return (promise, stopper) @@ -653,18 +647,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Debug (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) in let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> let*! () = @@ -681,7 +672,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -704,10 +695,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = let* current_head_on_exit = Shell_services.Blocks.hash cctxt () in let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -739,7 +730,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -753,9 +744,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = log Debug (fun () -> cctxt#message "injected : [%a]@.included: [%a]" - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) injected_ops - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) included_ops) in let injected_ops_count = List.length injected_ops in @@ -849,8 +840,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) loop () in let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t = + Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t = (* Because of how Tenderbake works the target block should stay 2 blocks in the past because this guarantees that we are targeting a block that is decided. *) @@ -864,8 +854,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) in fun (new_block_hash, new_block_header) -> let* () = update_target_block () in - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1216,7 +1205,7 @@ let generate_random_transactions = cctxt#error "The level of the head (%a) needs to be greater than 2 and is \ actually %ld." - Tezos_crypto.Block_hash.pp + Block_hash.pp current_head_on_start header_on_start.level else return_unit @@ -1239,7 +1228,7 @@ let generate_random_transactions = last_level = Int32.to_int header_on_start.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.ml b/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.ml index 54b73da7c42f..2e54f32fdc13 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.ml @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.mli b/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.mli index 9a825a143620..5a280d04ac57 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.mli @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_cache.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_cache.ml index 1d5ffa81cdd2..2af2842c7777 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_cache.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_cache.ml @@ -30,8 +30,7 @@ open Protocol.Alpha_context type round = Round.t module Block_cache = - Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) (Block_hash) (** The [Timestamp_of_round_tbl] module allows to create memoization tables to store function calls of [Round.timestamp_of_round]. *) diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.ml index db13c684bf3c..2b8dca57b0f6 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.ml @@ -81,7 +81,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -221,7 +221,7 @@ let retries_on_failure_config_encoding = Data_encoding.int31 let user_activate_upgrades_config_encoding = let open Data_encoding in - list (tup2 int32 Tezos_crypto.Protocol_hash.encoding) + list (tup2 int32 Protocol_hash.encoding) let liquidity_baking_toggle_vote_config_encoding = Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote_encoding diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.mli index cd5b5a445f41..a1908d29dd22 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_configuration.mli @@ -56,7 +56,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -73,8 +73,7 @@ val default_nonce_config : nonce_config val default_retries_on_failure_config : int -val default_user_activated_upgrades : - (int32 * Tezos_crypto.Protocol_hash.t) list +val default_user_activated_upgrades : (int32 * Protocol_hash.t) list val default_liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote @@ -96,7 +95,7 @@ val make : ?nonce:nonce_config -> ?context_path:string -> ?retries_on_failure:int -> - ?user_activated_upgrades:(int32 * Tezos_crypto.Protocol_hash.t) list -> + ?user_activated_upgrades:(int32 * Protocol_hash.t) list -> ?liquidity_baking_toggle_vote: Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> ?per_block_vote_file:string -> @@ -115,7 +114,7 @@ val nonce_config_encoding : nonce_config Data_encoding.t val retries_on_failure_config_encoding : int Data_encoding.t val user_activate_upgrades_config_encoding : - (int32 * Tezos_crypto.Protocol_hash.t) list Data_encoding.t + (int32 * Protocol_hash.t) list Data_encoding.t val liquidity_baking_toggle_vote_config_encoding : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_events.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_events.ml index 30ff8ba7911d..110ce3854366 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_events.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_events.ml @@ -43,8 +43,8 @@ module State_transitions = struct ~name:"new_head" ~level:Notice ~msg:"received new head {block} at level {level}, round {round}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) ~pp3:Round.pp @@ -119,12 +119,12 @@ module State_transitions = struct ~msg: "proposal {new_proposal} for current round ({current_round}) has \ already been seen {previous_proposal}" - ~pp1:Tezos_crypto.Block_hash.pp - ("new_proposal", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("new_proposal", Block_hash.encoding) ~pp2:Round.pp ("current_round", Round.encoding) - ~pp3:Tezos_crypto.Block_hash.pp - ("previous_proposal", Tezos_crypto.Block_hash.encoding) + ~pp3:Block_hash.pp + ("previous_proposal", Block_hash.encoding) let updating_latest_proposal = declare_1 @@ -132,8 +132,8 @@ module State_transitions = struct ~name:"updating_latest_proposal" ~msg:"updating latest proposal to {block_hash}" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let baker_is_ahead_of_node = declare_2 @@ -156,10 +156,10 @@ module State_transitions = struct ~msg: "received a proposal on another branch - current: current \ pred{current_branch}, new pred {new_branch}" - ~pp1:Tezos_crypto.Block_hash.pp - ("current_branch", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("new_branch", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("current_branch", Block_hash.encoding) + ~pp2:Block_hash.pp + ("new_branch", Block_hash.encoding) let switching_branch = declare_0 @@ -215,8 +215,8 @@ module State_transitions = struct ~name:"attempting_preendorsing_proposal" ~level:Info ~msg:"attempting to preendorse proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let skipping_invalid_proposal = declare_0 @@ -232,8 +232,8 @@ module State_transitions = struct ~name:"outdated_proposal" ~level:Debug ~msg:"outdated proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let proposing_fresh_block = declare_2 @@ -271,10 +271,10 @@ module State_transitions = struct ~msg: "unexpected prequorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let unexpected_quorum_received = declare_2 @@ -284,10 +284,10 @@ module State_transitions = struct ~msg: "unexpected quorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let step_current_phase = declare_2 @@ -321,8 +321,8 @@ module Node_rpc = struct ~name:"raw_info" ~level:Debug ~msg:"raw info for {block_hash} at level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) end @@ -451,8 +451,8 @@ module Scheduling = struct ~name:"proposal_in_the_future" ~level:Debug ~msg:"received proposal in the future {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let process_proposal_in_the_future = declare_1 @@ -460,8 +460,8 @@ module Scheduling = struct ~name:"process_proposal_in_the_future" ~level:Debug ~msg:"process proposal received in the future with hash {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) end module Lib = struct @@ -543,8 +543,8 @@ module Actions = struct ~name:"preendorsement_injected" ~level:Notice ~msg:"injected preendorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -554,8 +554,8 @@ module Actions = struct ~name:"endorsement_injected" ~level:Notice ~msg:"injected endorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -565,8 +565,8 @@ module Actions = struct ~name:"synchronizing_round" ~level:Info ~msg:"synchronizing round after block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let prepare_forging_block = declare_3 @@ -615,11 +615,11 @@ module Actions = struct ~level:Notice ~msg: "block {block} at level {level}, round {round} injected for {delegate}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:pp_int32 ~pp3:Round.pp ~pp4:Baking_state.pp_consensus_key_and_delegate - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("round", Round.encoding) ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -694,8 +694,8 @@ module VDF = struct ("cycle", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let vdf_daemon_start = declare_1 @@ -743,8 +743,8 @@ module Nonces = struct ~name:"found_nonce_to_reveal" ~level:Notice ~msg:"found nonce to reveal for block {block}, level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) @@ -760,8 +760,8 @@ module Nonces = struct ("level", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let cannot_fetch_chain_head_level = declare_0 @@ -835,8 +835,8 @@ module Nonces = struct ~name:"registering_nonce" ~level:Info ~msg:"registering nonce for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let nothing_to_reveal = declare_1 @@ -844,8 +844,8 @@ module Nonces = struct ~name:"nothing_to_reveal" ~level:Info ~msg:"nothing to reveal for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let revelation_worker_started = declare_0 @@ -930,8 +930,8 @@ module Selection = struct ~name:"invalid_operation_filtered" ~level:Warning ~msg:"filtered invalid operation {op}: {errors}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.(TzTrace.encoding error_encoding)) @@ -941,6 +941,6 @@ module Selection = struct ~name:"cannot_serialize_operation_metadata" ~level:Warning ~msg:"cannot serialize operation {op} metadata" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) end diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_lib.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_lib.ml index f1b23c4582c1..7ec3ae000cd5 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_lib.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_lib.ml @@ -268,7 +268,7 @@ let propose_at_next_level ~minimal_timestamp state = "Proposed block at round %a on top of %a " Round.pp block_to_bake.round - Tezos_crypto.Block_hash.pp + Block_hash.pp block_to_bake.predecessor.hash in return state @@ -411,7 +411,7 @@ let bake_using_automaton config state block_stream = let*! () = cctxt#message "Block %a (%ld) injected" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash proposal.block.shell.level in diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml index 6ec9597c9ff9..c9e0f6bc17c7 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml @@ -33,34 +33,27 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -let empty = Tezos_crypto.Block_hash.Map.empty +let empty = Block_hash.Map.empty let encoding = let open Data_encoding in def "seed_nonce" @@ conv (fun m -> - Tezos_crypto.Block_hash.Map.fold - (fun hash nonce acc -> (hash, nonce) :: acc) - m - []) + Block_hash.Map.fold (fun hash nonce acc -> (hash, nonce) :: acc) m []) (fun l -> List.fold_left - (fun map (hash, nonce) -> - Tezos_crypto.Block_hash.Map.add hash nonce map) - Tezos_crypto.Block_hash.Map.empty + (fun map (hash, nonce) -> Block_hash.Map.add hash nonce map) + Block_hash.Map.empty l) - @@ list - (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "nonce" Nonce.encoding)) + @@ list (obj2 (req "block" Block_hash.encoding) (req "nonce" Nonce.encoding)) let may_migrate (wallet : Protocol_client_context.full) location = let base_dir = wallet#get_base_dir in @@ -85,16 +78,16 @@ let load (wallet : #Client_context.wallet) location = let save (wallet : #Client_context.wallet) location nonces = wallet#write (Baking_files.filename location) nonces encoding -let mem nonces hash = Tezos_crypto.Block_hash.Map.mem hash nonces +let mem nonces hash = Block_hash.Map.mem hash nonces -let find_opt nonces hash = Tezos_crypto.Block_hash.Map.find hash nonces +let find_opt nonces hash = Block_hash.Map.find hash nonces -let add nonces hash nonce = Tezos_crypto.Block_hash.Map.add hash nonce nonces +let add nonces hash nonce = Block_hash.Map.add hash nonce nonces -let remove nonces hash = Tezos_crypto.Block_hash.Map.remove hash nonces +let remove nonces hash = Block_hash.Map.remove hash nonces let remove_all nonces nonces_to_remove = - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash _ acc -> remove acc hash) nonces_to_remove nonces @@ -123,7 +116,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let block_cycle = Int32.(div block_level blocks_per_cycle) in Int32.sub current_cycle block_cycle > Int32.of_int preserved_cycles in - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash nonce acc -> acc >>=? fun (orphans, outdated) -> get_block_level_opt cctxt ~chain ~block:(`Hash (hash, 0)) >>= function @@ -138,7 +131,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let filter_outdated_nonces state nonces = get_outdated_nonces state nonces >>=? fun (orphans, outdated_nonces) -> when_ - (Tezos_crypto.Block_hash.Map.cardinal orphans >= 50) + (Block_hash.Map.cardinal orphans >= 50) (fun () -> Events.( emit too_many_nonces (Baking_files.filename state.nonces_location ^ "s")) @@ -265,9 +258,8 @@ let reveal_potential_nonces state new_proposal = let {cctxt; chain; nonces_location; last_predecessor; _} = state in let new_predecessor_hash = new_proposal.Baking_state.predecessor.hash in if - Tezos_crypto.Block_hash.(last_predecessor <> new_predecessor_hash) - && Tezos_crypto.Protocol_hash.( - new_proposal.predecessor.protocol = Protocol.hash) + Block_hash.(last_predecessor <> new_predecessor_hash) + && Protocol_hash.(new_proposal.predecessor.protocol = Protocol.hash) then ( (* only try revealing nonces when the proposal's predecessor is a new one *) state.last_predecessor <- new_predecessor_hash ; @@ -318,7 +310,7 @@ let start_revelation_worker cctxt config chain_id constants block_stream = constants; config; nonces_location; - last_predecessor = Tezos_crypto.Block_hash.zero; + last_predecessor = Block_hash.zero; } in let rec worker_loop () = diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli index df34657eb901..8809adad843e 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli @@ -32,35 +32,31 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -val empty : Nonce.t Tezos_crypto.Block_hash.Map.t +val empty : Nonce.t Block_hash.Map.t -val encoding : Nonce.t Tezos_crypto.Block_hash.Map.t Data_encoding.t +val encoding : Nonce.t Block_hash.Map.t Data_encoding.t val load : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + Nonce.t Block_hash.Map.t tzresult Lwt.t val save : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> + Nonce.t Block_hash.Map.t -> unit tzresult Lwt.t -val mem : - Nonce.t Tezos_crypto.Block_hash.Map.t -> Tezos_crypto.Block_hash.t -> bool +val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool -val find_opt : - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Tezos_crypto.Block_hash.t -> - Nonce.t option +val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : #Tezos_rpc.Context.simple -> @@ -70,28 +66,21 @@ val get_block_level_opt : val get_outdated_nonces : t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Nonce.t Tezos_crypto.Block_hash.Map.t - * Nonce.t Tezos_crypto.Block_hash.Map.t) - tzresult - Lwt.t + Nonce.t Block_hash.Map.t -> + (Nonce.t Block_hash.Map.t * Nonce.t Block_hash.Map.t) tzresult Lwt.t val filter_outdated_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> Nonce.t Block_hash.Map.t tzresult Lwt.t val blocks_from_current_cycle : t -> Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t val get_unrevealed_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Raw_level.t * Nonce.t) list tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> (Raw_level.t * Nonce.t) list tzresult Lwt.t val generate_seed_nonce : Baking_configuration.nonce_config -> @@ -102,7 +91,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -110,7 +99,7 @@ val inject_seed_nonce_revelation : #Protocol_client_context.full -> chain:Chain_services.chain -> block:Block_services.block -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> (Raw_level.t * Nonce.t) list -> unit tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_scheduling.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_scheduling.ml index bca851f697d8..38d42a06cc3d 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_scheduling.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_scheduling.ml @@ -211,10 +211,8 @@ let compute_next_round_time state = | None -> state.level_state.latest_proposal | Some {proposal; _} -> proposal in - if - Tezos_crypto.Protocol_hash.( - proposal.predecessor.next_protocol <> Protocol.hash) - then None + if Protocol_hash.(proposal.predecessor.next_protocol <> Protocol.hash) then + None else match state.level_state.next_level_proposed_round with | Some _proposed_round -> @@ -632,7 +630,7 @@ let create_initial_state cctxt ?(synchronize = true) ~chain config >>=? fun next_level_delegate_slots -> let elected_block = if - Tezos_crypto.Protocol_hash.( + Protocol_hash.( current_proposal.block.protocol <> Protocol.hash && current_proposal.block.next_protocol = Protocol.hash) then diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.ml index 39b641175d45..957768d1b412 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.ml @@ -94,9 +94,9 @@ let begin_construction ~timestamp ~protocol_data fitness = pred_shell.fitness; timestamp; level = pred_shell.level; - context = Tezos_crypto.Context_hash.zero (* fake context hash *); + context = Context_hash.zero (* fake context hash *); operations_hash = - Tezos_crypto.Operation_list_list_hash.zero (* fake op hash *); + Operation_list_list_hash.zero (* fake op hash *); } in let mode = diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli index d6d45255028e..1643296eb489 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli @@ -39,7 +39,7 @@ val load_context : (** Make sure that the given context is consistent by trying to read in it *) val check_context_consistency : - Abstract_context_index.t -> Tezos_crypto.Context_hash.t -> unit tzresult Lwt.t + Abstract_context_index.t -> Context_hash.t -> unit tzresult Lwt.t val begin_construction : timestamp:Time.Protocol.t -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml index 387055676d98..42a54e26cd49 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml @@ -112,17 +112,17 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; } type cache = { @@ -224,17 +224,17 @@ let block_info_encoding = }) (merge_objs (obj10 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "shell" Block_header.shell_header_encoding) (req "payload_hash" Block_payload_hash.encoding) (req "payload_round" Round.encoding) (req "round" Round.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding) (req "prequorum" (option prequorum_encoding)) (req "quorum" (list (dynamic_size Operation.encoding))) (req "payload" Operation_pool.payload_encoding)) - (obj1 (req "live_blocks" Tezos_crypto.Block_hash.Set.encoding))) + (obj1 (req "live_blocks" Block_hash.Set.encoding))) let round_of_shell_header shell_header = Environment.wrap_tzresult @@ -723,16 +723,16 @@ let pp_block_info fmt "@[<v 2>Block:@ hash: %a@ payload_hash: %a@ level: %ld@ round: %a@ \ protocol: %a@ next protocol: %a@ prequorum: %a@ quorum: %d endorsements@ \ payload: %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash Block_payload_hash.pp_short payload_hash shell.level Round.pp round - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short protocol - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short next_protocol (pp_option pp_prequorum) prequorum @@ -755,7 +755,7 @@ let pp_endorsable_payload fmt {proposal; prequorum} = Format.fprintf fmt "proposal: %a, prequorum: %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash pp_prequorum prequorum @@ -872,7 +872,7 @@ let pp_event fmt = function round %a" (List.length preendos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched @@ -882,7 +882,7 @@ let pp_event fmt = function "quorum reached with %d endorsements (power: %d) for %a at round %a" (List.length endos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli index 19437bc5b7b7..c46132e260e7 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli @@ -56,17 +56,17 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; (** Set of live blocks for this block that is used to filter old or too recent operations. *) } diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml index 23f95c9075e6..621daa8e4022 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml @@ -184,7 +184,7 @@ let process_new_block (cctxt : #Protocol_client_context.full) state let* level_info = get_level_info cctxt level in let level_str = Int32.to_string (Raw_level.to_int32 level) in let* () = check_new_cycle state level_info in - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then let*! () = D_Events.(emit protocol_change_detected) () in return_unit else diff --git a/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml b/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml index 3301fe0c8743..ffb4fb142e8a 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/block_forge.ml @@ -112,7 +112,7 @@ let finalize_block_header shell_header timestamp validation_result let retain_live_operations_only ~live_blocks operation_pool = Operation_pool.Prioritized.filter (fun ({shell; _} : packed_operation) -> - Tezos_crypto.Block_hash.Set.mem shell.branch live_blocks) + Block_hash.Set.mem shell.branch live_blocks) operation_pool let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info @@ -136,7 +136,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info | None -> next_protocol | Some hash -> hash in - return Tezos_crypto.Protocol_hash.(Protocol.hash <> next_protocol) + return Protocol_hash.(Protocol.hash <> next_protocol) in let filter_via_node ~operation_pool = let filtered_operations = @@ -168,7 +168,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info let operation_list_hash = Stdlib.List.tl operations |> List.flatten |> List.map Tezos_base.Operation.hash - |> Tezos_crypto.Operation_list_hash.compute + |> Operation_list_hash.compute in Block_payload.hash ~predecessor:shell_header.predecessor @@ -242,7 +242,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info let operation_list_hash = Stdlib.List.tl operations |> List.flatten |> List.map Tezos_base.Operation.hash - |> Tezos_crypto.Operation_list_hash.compute + |> Operation_list_hash.compute in Block_payload.hash ~predecessor:shell_header.predecessor @@ -297,11 +297,10 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info >>=? fun (incremental, ordered_pool) -> let operations = Operation_pool.ordered_to_list_list ordered_pool in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in (* We need to compute the final [operations_hash] before diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml index e192aa649a72..9be4d3735d52 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml @@ -28,16 +28,16 @@ open Alpha_context open Protocol_client_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } let raw_info cctxt ?(chain = `Main) hash shell_header = @@ -80,7 +80,7 @@ let info cctxt ?(chain = `Main) block = module Block_seen_event = struct type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Tezos_base.Block_header.t; occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; } @@ -101,7 +101,7 @@ module Block_seen_event = struct (function {hash; header; occurrence} -> (hash, occurrence, header)) (fun (hash, occurrence, header) -> make hash header occurrence) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (* Occurrence has to come before header, because: (Invalid_argument "Cannot merge two objects when the left element is of @@ -133,7 +133,7 @@ module Block_seen_event = struct With_version.(encoding ~name (first_version v0_encoding)) let pp ~short:_ ppf {hash; _} = - Format.fprintf ppf "Saw block %a" Tezos_crypto.Block_hash.pp_short hash + Format.fprintf ppf "Saw block %a" Block_hash.pp_short hash let doc = "Block observed while monitoring a blockchain." @@ -173,7 +173,7 @@ let monitor_heads cctxt ~next_protocols chain = type error += | Unexpected_empty_block_list of { chain : string; - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; length : int; } @@ -190,13 +190,13 @@ let () = "Unexpected empty block list retrieved from chain %s at block %a, \ length %d" chain - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash length) Data_encoding.( obj3 (req "chain" string) - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "length" int31)) (function | Unexpected_empty_block_list {chain; block_hash; length} -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli index 07d582b6ed9b..e3b8a7621d56 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli @@ -27,16 +27,16 @@ open Protocol open Alpha_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } val info : @@ -48,14 +48,14 @@ val info : val monitor_valid_blocks : #Protocol_client_context.rpc_context -> ?chains:Chain_services.chain list -> - ?protocols:Tezos_crypto.Protocol_hash.t list -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + ?protocols:Protocol_hash.t list -> + next_protocols:Protocol_hash.t list option -> unit -> (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + next_protocols:Protocol_hash.t list option -> Chain_services.chain -> block_info tzresult Lwt_stream.t tzresult Lwt.t @@ -65,4 +65,4 @@ val blocks_from_current_cycle : Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t 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 45a81bf1421b..b815392b9c65 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml @@ -49,8 +49,7 @@ module Slot_Map = Slot.Map (* type of operations stream, as returned by monitor_operations RPC *) type ops_stream = - ((Tezos_crypto.Operation_hash.t * packed_operation) * error trace option) list - Lwt_stream.t + ((Operation_hash.t * packed_operation) * error trace option) list Lwt_stream.t type 'a state = { (* Endorsements seen so far *) @@ -58,7 +57,7 @@ type 'a state = { (* Preendorsements seen so far *) preendorsements_table : Kind.preendorsement operation Slot_Map.t HLevel.t; (* Blocks received so far *) - blocks_table : Tezos_crypto.Block_hash.t Delegate_Map.t HLevel.t; + blocks_table : Block_hash.t Delegate_Map.t HLevel.t; (* Maximum delta of level to register *) preserved_levels : int; (* Highest level seen in a block *) @@ -127,7 +126,7 @@ let double_consensus_op_evidence (type kind) : kind consensus_operation_type -> #Protocol_client_context.full -> 'a -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> op1:kind Alpha_context.operation -> op2:kind Alpha_context.operation -> unit -> @@ -160,7 +159,7 @@ let process_consensus_op (type kind) cctxt (Operation.hash new_op, Operation.hash existing_op) in let op1, op2 = - if Tezos_crypto.Operation_hash.(new_op_hash < existing_op_hash) then + if Operation_hash.(new_op_hash < existing_op_hash) then (new_op, existing_op) else (existing_op, new_op) in @@ -274,8 +273,7 @@ let process_block (cctxt : #Protocol_client_context.full) state state.blocks_table (chain_id, level, round) (Delegate_Map.add baker.delegate new_hash map) - | Some existing_hash - when Tezos_crypto.Block_hash.(existing_hash = new_hash) -> + | Some existing_hash when Block_hash.(existing_hash = new_hash) -> (* This case should never happen *) Events.(emit double_baking_but_not) () >>= fun () -> return @@ -291,8 +289,7 @@ let process_block (cctxt : #Protocol_client_context.full) state let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in let bh1, bh2 = - if Tezos_crypto.Block_hash.(hash1 < hash2) then (bh1, bh2) - else (bh2, bh1) + if Block_hash.(hash1 < hash2) then (bh1, bh2) else (bh2, bh1) in (* If the blocks are on different chains then skip it *) get_block_offset level >>= fun block -> @@ -355,7 +352,7 @@ let cleanup_old_operations state = *) let process_new_block (cctxt : #Protocol_client_context.full) state {hash; chain_id; level; protocol; next_protocol; _} = - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then Events.(emit protocol_change_detected) () >>= fun () -> return_unit else Events.(emit accuser_saw_block) (level, hash) >>= fun () -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_daemon.ml b/src/proto_015_PtLimaPt/lib_delegate/client_daemon.ml index 836c95f1ad9a..ba2cfdac03b3 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_daemon.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_daemon.ml @@ -91,7 +91,7 @@ module Baker = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> let canceler = Lwt_canceler.create () in @@ -121,7 +121,7 @@ module Accuser = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> Client_baking_blocks.monitor_valid_blocks @@ -159,7 +159,7 @@ module VDF = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash in let* chain_id = Shell_services.Chain.chain_id cctxt ~chain () in diff --git a/src/proto_015_PtLimaPt/lib_delegate/delegate_events.ml b/src/proto_015_PtLimaPt/lib_delegate/delegate_events.ml index ca4361b2dc96..20f5d091dd9c 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/delegate_events.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/delegate_events.ml @@ -50,8 +50,8 @@ module Denunciator = struct ~level ~name:"double_endorsement_detected" ~msg:"double endorsement detected" - ("existing_endorsement", Tezos_crypto.Operation_hash.encoding) - ("new_endorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_endorsement", Operation_hash.encoding) + ("new_endorsement", Operation_hash.encoding) let double_endorsement_denounced = declare_2 @@ -59,7 +59,7 @@ module Denunciator = struct ~level ~name:"double_endorsement_denounced" ~msg:"double endorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -69,8 +69,8 @@ module Denunciator = struct ~level ~name:"double_preendorsement_detected" ~msg:"double preendorsement detected" - ("existing_preendorsement", Tezos_crypto.Operation_hash.encoding) - ("new_preendorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_preendorsement", Operation_hash.encoding) + ("new_preendorsement", Operation_hash.encoding) let double_preendorsement_denounced = declare_2 @@ -78,7 +78,7 @@ module Denunciator = struct ~level ~name:"double_preendorsement_denounced" ~msg:"double preendorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -88,7 +88,7 @@ module Denunciator = struct ~level:Error ~name:"inconsistent_endorsement" ~msg:"inconsistent endorsement found {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) let unexpected_pruned_block = declare_1 @@ -96,7 +96,7 @@ module Denunciator = struct ~level:Error ~name:"unexpected_pruned_block" ~msg:"unexpected pruned block: {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let double_baking_but_not = declare_0 @@ -120,7 +120,7 @@ module Denunciator = struct ~level ~name:"double_baking_denounced" ~msg:"double baking evidence injected {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -139,7 +139,7 @@ module Denunciator = struct ~name:"accuser_saw_block" ~msg:"block level: {level}" ("level", Alpha_context.Raw_level.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetch_operations_error = declare_1 @@ -147,8 +147,8 @@ module Denunciator = struct ~level:Error ~name:"fetch_operations_error" ~msg:"error while fetching operations of block {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) - ~pp1:Tezos_crypto.Block_hash.pp + ("hash", Block_hash.encoding) + ~pp1:Block_hash.pp let accuser_processed_block = declare_1 @@ -156,7 +156,7 @@ module Denunciator = struct ~level ~name:"accuser_processed_block" ~msg:"block {hash} registered" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let accuser_block_error = declare_2 @@ -165,7 +165,7 @@ module Denunciator = struct ~name:"accuser_block_error" ~msg:"error while processing block {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end diff --git a/src/proto_015_PtLimaPt/lib_delegate/logging.ml b/src/proto_015_PtLimaPt/lib_delegate/logging.ml index 6756e73e07e6..ed9cb18c9db3 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/logging.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/logging.ml @@ -147,9 +147,9 @@ let conflicting_endorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) let conflicting_preendorsements_tag = @@ -161,7 +161,7 @@ let conflicting_preendorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) diff --git a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml index 96749ae7c4de..badb4fc204d4 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.ml @@ -70,9 +70,7 @@ let raw_info cctxt ~chain ~block_hash shell payload_hash payload_round >>= fun () -> let open Protocol_client_context in let block = `Hash (block_hash, 0) in - let is_in_protocol = - Tezos_crypto.Protocol_hash.(current_protocol = Protocol.hash) - in + let is_in_protocol = Protocol_hash.(current_protocol = Protocol.hash) in (if is_in_protocol then Alpha_block_services.Operations.operations cctxt ~chain ~block () >>=? fun operations -> @@ -123,7 +121,7 @@ let info cctxt ~chain ~block () = (* Fails if the block's protocol is not the current one *) Shell_services.Blocks.protocols cctxt ~chain ~block () >>=? fun {current_protocol; next_protocol} -> - (if Tezos_crypto.Protocol_hash.(current_protocol <> Protocol.hash) then + (if Protocol_hash.(current_protocol <> Protocol.hash) then Block_services.Header.shell_header cctxt ~chain ~block () >>=? fun shell -> Chain_services.Blocks.Header.raw_protocol_data cctxt ~chain ~block () >>=? fun protocol_data -> @@ -157,7 +155,7 @@ let info cctxt ~chain ~block () = (Chain_services.Blocks.live_blocks cctxt ~chain ~block () >>= function | Error _ -> (* The RPC might fail when a block's metadata is not available *) - Lwt.return Tezos_crypto.Block_hash.Set.empty + Lwt.return Block_hash.Set.empty | Ok live_blocks -> Lwt.return live_blocks) >>= fun live_blocks -> raw_info diff --git a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli index 55694e129b55..2dd0468ef6f1 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli @@ -37,13 +37,13 @@ val inject_block : chain:Shell_services.chain -> Block_header.t -> Tezos_base.Operation.t list list -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t (** Preapply a block using the node validation mechanism.*) val preapply_block : #Protocol_client_context.full -> chain:Shell_services.chain -> - head:Tezos_crypto.Block_hash.t -> + head:Block_hash.t -> timestamp:Time.Protocol.t -> protocol_data:Protocol.block_header_data -> packed_operation list list -> @@ -58,7 +58,7 @@ val proposal : #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Baking_state.proposal tzresult Lwt.t (** Monitor proposals from the node.*) diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_pool.ml b/src/proto_015_PtLimaPt/lib_delegate/operation_pool.ml index 16ec9eda7cdb..7e0a7612054e 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_pool.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_pool.ml @@ -41,7 +41,7 @@ let compare_op op1 op2 = (* FIXME some operations (e.g. tx_rollup_rejection) pack functional values which could raise an exception. In this specific case, we default to comparing their hashes. *) - Tezos_crypto.Operation_hash.compare + Operation_hash.compare (Alpha_context.Operation.hash_packed op1) (Alpha_context.Operation.hash_packed op2) diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml index 4ce38666a3a0..9ffe7c25d8b7 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.ml @@ -165,7 +165,7 @@ type simulation_result = { validation_result : Tezos_protocol_environment.validation_result; block_header_metadata : block_header_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } let validate_operation inc op = @@ -250,11 +250,10 @@ let filter_operations_with_simulation initial_inc fees_config >>= fun (inc, managers) -> let operations = [consensus; votes; anonymous; managers] in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in let inc = {inc with header = {inc.header with operations_hash}} in diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.mli b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.mli index 3ab72a91347c..78caab5c158c 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_selection.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_selection.mli @@ -31,7 +31,7 @@ type simulation_result = { validation_result : validation_result; block_header_metadata : Apply_results.block_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } val filter_operations_with_simulation : diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_worker.ml b/src/proto_015_PtLimaPt/lib_delegate/operation_worker.ml index 5589f585649f..66cec5723476 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_worker.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_worker.ml @@ -145,7 +145,7 @@ module Events = struct end type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } @@ -158,7 +158,7 @@ let candidate_encoding = (fun (hash, round_watched, payload_hash_watched) -> {hash; round_watched; payload_hash_watched}) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "round_watched" Round.encoding) (req "payload_hash_watched" Block_payload_hash.encoding)) @@ -539,8 +539,7 @@ let retrieve_pending_operations cctxt state = state.operation_pool (List.rev_map (fun (_, (op, _)) -> op) - (Tezos_crypto.Operation_hash.Map.bindings - pending_mempool.branch_delayed)) ; + (Operation_hash.Map.bindings pending_mempool.branch_delayed)) ; return_unit let get_current_operations state = state.operation_pool diff --git a/src/proto_015_PtLimaPt/lib_delegate/operation_worker.mli b/src/proto_015_PtLimaPt/lib_delegate/operation_worker.mli index ab66270bfd91..eecbc990f2d1 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/operation_worker.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/operation_worker.mli @@ -34,7 +34,7 @@ open Alpha_context type t type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } diff --git a/src/proto_015_PtLimaPt/lib_delegate/state_transitions.ml b/src/proto_015_PtLimaPt/lib_delegate/state_transitions.ml index 71c79251fe67..6e8dd27e6284 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/state_transitions.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/state_transitions.ml @@ -47,9 +47,8 @@ let is_acceptable_proposal_for_current_level state let previous_proposal = state.level_state.latest_proposal in if Round.(proposal.block.round = previous_proposal.block.round) - && Tezos_crypto.Block_hash.( - proposal.block.hash <> previous_proposal.block.hash) - && Tezos_crypto.Block_hash.( + && Block_hash.(proposal.block.hash <> previous_proposal.block.hash) + && Block_hash.( proposal.predecessor.hash = previous_proposal.predecessor.hash) then (* An existing proposal was found at the same round: the @@ -118,9 +117,7 @@ let may_update_proposal state (proposal : proposal) = else Lwt.return state let preendorse state proposal = - if - Tezos_crypto.Protocol_hash.( - proposal.block.protocol <> proposal.block.next_protocol) + if Protocol_hash.(proposal.block.protocol <> proposal.block.next_protocol) then (* We do not preendorse the first transition block *) let new_round_state = {state.round_state with current_phase = Idle} in @@ -203,7 +200,7 @@ let rec handle_new_proposal state (new_proposal : proposal) = let's check if it's a valid one for us. *) let current_proposal = state.level_state.latest_proposal in if - Tezos_crypto.Block_hash.( + Block_hash.( current_proposal.predecessor.hash <> new_proposal.predecessor.hash) then Events.( @@ -537,8 +534,7 @@ let end_of_round state current_round = do_nothing new_state | Some (delegate, _) -> let last_proposal = state.level_state.latest_proposal.block in - if Tezos_crypto.Protocol_hash.(last_proposal.protocol <> Protocol.hash) - then + if Protocol_hash.(last_proposal.protocol <> Protocol.hash) then (* Do not inject a block for the previous protocol! (Let the baker of the previous protocol do it.) *) do_nothing new_state @@ -610,9 +606,7 @@ let make_endorse_action state proposal = let prequorum_reached_when_awaiting_preendorsements state candidate preendorsements = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit @@ -652,9 +646,7 @@ let prequorum_reached_when_awaiting_preendorsements state candidate let quorum_reached_when_waiting_endorsements state candidate endorsement_qc = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml index ee21b96b07c2..907d280256fc 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml @@ -10,7 +10,7 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) val monitor_heads : - unit -> (Tezos_crypto.Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -30,15 +30,14 @@ module type Mocked_services_hooks = sig [Tezos_shell_services.Injection_services.S.block], after checking that the block header can be deserialized. *) val inject_block : - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t (** [inject_operation] is used by the endorser (or the client) to inject operations, including endorsements. *) - val inject_operation : - Operation.t -> Tezos_crypto.Operation_hash.t tzresult Lwt.t + val inject_operation : Operation.t -> Operation_hash.t tzresult Lwt.t (** [pending_operations] returns the current contents of the mempool. It is used by the baker to fetch operations to potentially include in the @@ -55,9 +54,7 @@ module type Mocked_services_hooks = sig branch_delayed:bool -> branch_refused:bool -> refused:bool -> - ((Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) - * error trace option) - list + ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted @@ -65,16 +62,15 @@ module type Mocked_services_hooks = sig chain. Optional arguments allow to return the list of predecessors of a given block or of a set of blocks. *) val list_blocks : - heads:Tezos_crypto.Block_hash.t list -> + heads:Block_hash.t list -> length:int option -> min_date:Time.Protocol.t option -> - Tezos_crypto.Block_hash.t list list tzresult Lwt.t + Block_hash.t list list tzresult Lwt.t (** List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. *) - val live_blocks : - Block_services.block -> Tezos_crypto.Block_hash.Set.t tzresult Lwt.t + val live_blocks : Block_services.block -> Block_hash.Set.t tzresult Lwt.t (** [rpc_context_callback] is used in the implementations of several RPCs (see local_services.ml). It should correspond to the @@ -91,7 +87,7 @@ module type Mocked_services_hooks = sig to all nodes. *) val broadcast_block : ?dests:int list -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t @@ -106,8 +102,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> - (Tezos_crypto.Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -188,7 +183,7 @@ module Make (Hooks : Mocked_services_hooks) = struct match Block_header.of_bytes bytes with | None -> failwith "faked_services.inject_block: can't deserialize" | Some block_header -> - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in Hooks.inject_block block_hash block_header operations >>=? fun () -> return block_hash) @@ -207,7 +202,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Broadcast_services.S.block (fun () dests (block_header, operations) -> let bytes = Block_header.to_bytes block_header in - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in let dests = match dests#dests with [] -> None | dests -> Some dests in Hooks.broadcast_block ?dests block_hash block_header operations) 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 f8bfae831a30..d068cc59d35c 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 @@ -35,10 +35,8 @@ type chain = block list (** As new blocks and operations are received they are pushed to an Lwt_pipe wrapped into this type. *) type broadcast = - | Broadcast_block of - Tezos_crypto.Block_hash.t * Block_header.t * Operation.t list list - | Broadcast_op of - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation + | Broadcast_block of Block_hash.t * Block_header.t * Operation.t list list + | Broadcast_op of Operation_hash.t * Alpha_context.packed_operation (** The state of a mockup node. *) type state = { @@ -48,33 +46,29 @@ type state = { live_depth : int; (** How many blocks (counting from the head into the past) are considered live? *) mutable chain : chain; (** The chain as seen by this fake "node". *) - mutable mempool : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list; + mutable mempool : (Operation_hash.t * Mockup.M.Protocol.operation) list; (** Mempool of this fake "node". *) - chain_table : chain Tezos_crypto.Block_hash.Table.t; + chain_table : chain Block_hash.Table.t; (** The chain table of this fake "node". It maps from block hashes to blocks. *) - global_chain_table : block Tezos_crypto.Block_hash.Table.t; + global_chain_table : block Block_hash.Table.t; (** The global chain table that allows us to look up blocks that may be missing in [chain_table], i.e. not known to this particular node. This is used to find unknown predecessors. The real node can ask about an unknown block and receive it on request, this is supposed to emulate that functionality. *) - ctxt_table : - Tezos_protocol_environment.rpc_context Tezos_crypto.Context_hash.Table.t; + ctxt_table : Tezos_protocol_environment.rpc_context Context_hash.Table.t; (** The context table allows us to look up rpc_context by its hash. *) - heads_pipe : - (Tezos_crypto.Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; + heads_pipe : (Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; (** [heads_pipe] is used to implement the [monitor_heads] RPC. *) operations_pipe : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) option - Lwt_pipe.Unbounded.t; + (Operation_hash.t * Mockup.M.Protocol.operation) option Lwt_pipe.Unbounded.t; (** [operations_pipe] is used to implement the [operations_pipe] RPC. *) mutable streaming_operations : bool; (** A helper flag used to implement the monitor operations RPC. *) broadcast_pipes : broadcast Lwt_pipe.Unbounded.t list; (** Broadcast pipes per node. *) - genesis_block_true_hash : Tezos_crypto.Block_hash.t; + genesis_block_true_hash : Block_hash.t; (** True hash of the genesis block as calculated by the [Block_header.hash] function. *) @@ -85,10 +79,10 @@ let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" -let genesis_predecessor_block_hash = Tezos_crypto.Block_hash.zero +let genesis_predecessor_block_hash = Block_hash.zero type propagation = Block | Pass | Delay of float @@ -98,40 +92,34 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -140,7 +128,7 @@ module type Hooks = sig level:int32 -> round:int32 -> chain:chain -> unit tzresult Lwt.t val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t val stop_on_event : Baking_state.event -> bool @@ -161,12 +149,9 @@ let locate_blocks (state : state) block list tzresult Lwt.t = match block with | `Hash (hash, rel) -> ( - match Tezos_crypto.Block_hash.Table.find state.chain_table hash with + match Block_hash.Table.find state.chain_table hash with | None -> - failwith - "locate_blocks: can't find the block %a" - Tezos_crypto.Block_hash.pp - hash + failwith "locate_blocks: can't find the block %a" Block_hash.pp hash | Some chain0 -> let _, chain = List.split_n rel chain0 in return chain) @@ -192,8 +177,8 @@ let live_blocks (state : state) block = (List.fold_left (fun set ({rpc_context; _} : block) -> let hash = rpc_context.Tezos_protocol_environment.block_hash in - Tezos_crypto.Block_hash.Set.add hash set) - (Tezos_crypto.Block_hash.Set.singleton state.genesis_block_true_hash) + Block_hash.Set.add hash set) + (Block_hash.Set.singleton state.genesis_block_true_hash) segment) (** Extract the round number from raw fitness. *) @@ -287,27 +272,25 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : match block with | `Hash (requested_hash, rel) -> Int.equal rel 0 - && Tezos_crypto.Block_hash.equal - requested_hash - genesis_predecessor_block_hash + && Block_hash.equal requested_hash genesis_predecessor_block_hash | _ -> false in (* It is important to tell the baker that the genesis block is not in - the alpha protocol (we use Tezos_crypto.Protocol_hash.zero). This will make the + the alpha protocol (we use Protocol_hash.zero). This will make the baker not try to propose alternatives to that block and just accept - it as final in that Tezos_crypto.Protocol_hash.zero protocol. The same for - predecessor of genesis, it should be in Tezos_crypto.Protocol_hash.zero. *) + it as final in that Protocol_hash.zero protocol. The same for + predecessor of genesis, it should be in Protocol_hash.zero. *) return Tezos_shell_services.Block_services. { current_protocol = (if - Tezos_crypto.Block_hash.equal hash genesis_block_hash + Block_hash.equal hash genesis_block_hash || is_predecessor_of_genesis - then Tezos_crypto.Protocol_hash.zero + then Protocol_hash.zero else Protocol.hash); next_protocol = - (if is_predecessor_of_genesis then Tezos_crypto.Protocol_hash.zero + (if is_predecessor_of_genesis then Protocol_hash.zero else Protocol.hash); } @@ -404,11 +387,11 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : Mockup.M.Block_services.Mempool. { applied = ops; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; - unprocessed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; + unprocessed = Operation_hash.Map.empty; } let monitor_operations ~applied ~branch_delayed ~branch_refused ~refused = @@ -488,12 +471,11 @@ let clear_mempool state = (fun (_oph, (op : Mockup.M.Protocol.operation)) -> let included_in_head = List.mem - ~equal:Tezos_crypto.Operation_hash.equal + ~equal:Operation_hash.equal (Alpha_context.Operation.hash_packed op) included_ops_hashes in - Tezos_crypto.Block_hash.Set.mem op.shell.branch live_set - && not included_in_head) + Block_hash.Set.mem op.shell.branch live_set && not included_in_head) state.mempool in state.mempool <- mempool ; @@ -567,17 +549,13 @@ let rec process_block state block_hash (block_header : Block_header.t) let get_predecessor () = let predecessor_hash = block_header.Block_header.shell.predecessor in head state >>=? fun head -> - match - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash - with + match Block_hash.Table.find state.chain_table predecessor_hash with | None | Some [] -> ( (* Even if the predecessor is not known locally, it might be known by some node in the network. The code below "requests" information about the block by its hash. *) match - Tezos_crypto.Block_hash.Table.find - state.global_chain_table - predecessor_hash + Block_hash.Table.find state.global_chain_table predecessor_hash with | None -> failwith "get_predecessor: unknown predecessor block" | Some predecessor -> @@ -620,7 +598,7 @@ let rec process_block state block_hash (block_header : Block_header.t) then return predecessor else failwith "get_predecessor: the predecessor block is too old" in - match Tezos_crypto.Block_hash.Table.find state.chain_table block_hash with + match Block_hash.Table.find state.chain_table block_hash with | Some _ -> (* The block is already known. *) return_unit @@ -638,7 +616,7 @@ let rec process_block state block_hash (block_header : Block_header.t) (fun pass -> List.map (fun (Operation.{shell; proto} as op) -> - let hash : Tezos_crypto.Operation_hash.t = Operation.hash op in + let hash : Operation_hash.t = Operation.hash op in let protocol_data : Alpha_context.packed_protocol_data = Data_encoding.Binary.of_bytes_exn Protocol.operation_data_encoding @@ -665,19 +643,13 @@ let rec process_block state block_hash (block_header : Block_header.t) in let predecessor_hash = block_header.Block_header.shell.predecessor in let tail = - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash + Block_hash.Table.find state.chain_table predecessor_hash |> WithExceptions.Option.get ~loc:__LOC__ in let new_chain = new_block :: tail in - Tezos_crypto.Block_hash.Table.replace - state.chain_table - block_hash - new_chain ; - Tezos_crypto.Block_hash.Table.replace - state.global_chain_table - block_hash - new_block ; - Tezos_crypto.Context_hash.Table.replace + Block_hash.Table.replace state.chain_table block_hash new_chain ; + Block_hash.Table.replace state.global_chain_table block_hash new_block ; + Context_hash.Table.replace state.ctxt_table rpc_context.Tezos_protocol_environment.block_header.context rpc_context ; @@ -766,7 +738,7 @@ let create_fake_node_state ~i ~live_depth mempool = []; chain = chain0; chain_table = - Tezos_crypto.Block_hash.Table.of_seq + Block_hash.Table.of_seq (List.to_seq [ (rpc_context0.block_hash, chain0); @@ -775,7 +747,7 @@ let create_fake_node_state ~i ~live_depth ]); global_chain_table; ctxt_table = - Tezos_crypto.Context_hash.Table.of_seq + Context_hash.Table.of_seq (List.to_seq [ ( rpc_context0.Tezos_protocol_environment.block_header @@ -836,7 +808,7 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir sync_fun = Lwt.return; checkout_fun = (fun hash -> - Tezos_crypto.Context_hash.Table.find state.ctxt_table hash + Context_hash.Table.find state.ctxt_table hash |> Option.map (fun Tezos_protocol_environment.{context; _} -> context) |> Lwt.return); finalize_fun = Lwt.return; @@ -857,12 +829,12 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir User_hooks.check_chain_on_success ~chain:state.chain let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.V0.secret_key) - (predecessor_block_hash : Tezos_crypto.Block_hash.t) + (predecessor_block_hash : Block_hash.t) (block_header : Block_header.shell_header) : Bytes.t = let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in - let operation_list_hash = Tezos_crypto.Operation_list_hash.compute [] in + let operation_list_hash = Operation_list_hash.compute [] in let payload_hash = Protocol.Alpha_context.Block_payload.hash ~predecessor:predecessor_block_hash @@ -1155,7 +1127,7 @@ let run ?(config = default_config) bakers_spec = | Error () -> failwith "impossible: negative length of the baker spec" | Ok xs -> return xs) >>=? fun broadcast_pipes -> - let global_chain_table = Tezos_crypto.Block_hash.Table.create 10 in + let global_chain_table = Block_hash.Table.create 10 in Tezos_mockup_commands.Mockup_wallet.default_bootstrap_accounts >>=? fun bootstrap_secrets -> let accounts_with_secrets = @@ -1240,15 +1212,13 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) else failwith "unexpected signature for %a; tried with %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Tezos_crypto.Signature.V0.Public_key.pp public_key type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t let mempool_count_ops ~mempool ~predicate = List.map_es (fun (op_hash, op) -> predicate op_hash op) mempool @@ -1267,7 +1237,7 @@ let mempool_has_op_ref ~mempool ~predicate ~var = if result then var := true ; return_unit -let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_signed_by ~public_key (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1280,17 +1250,13 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) | _ -> Tezos_crypto.Signature.V0.Generic_operation) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) >>=? fun watermark -> match d.signature with | None -> failwith "did not find a signature for op %a@." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash | Some signature -> let unsigned_operation_bytes = @@ -1305,7 +1271,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) signature unsigned_operation_bytes)) -let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_preendorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1331,13 +1297,9 @@ let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) -let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_endorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1363,11 +1325,7 @@ let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) let op_is_both f g op_hash op = f op_hash op >>=? fun f_result -> 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 2c6652a1ec2e..93ad9eb1c1bd 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 @@ -56,25 +56,20 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t (** This function is called on injection of an operation. It is similar to [on_inject_block], which see. *) val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t @@ -82,23 +77,22 @@ module type Hooks = sig a "monitor heads" RPC call. Returning [None] here terminates the process for the baker. *) val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t (** This is called when a new operation is going to be sent as the response to a "monitor operations" RPC call. Returning [None] here indicates that the node has advanced to the next level. *) val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t (** Check a block before processing it in the mockup. *) val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -109,7 +103,7 @@ module type Hooks = sig (** Check operations in the mempool after injecting an operation. *) val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t (** This hook is used to decide when the baker is supposed to shut down. @@ -189,35 +183,33 @@ 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_hash:Block_hash.t -> block_header:Block_header.t -> public_key:Tezos_crypto.Signature.V0.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t (** Count the number of operations in the mempool that satisfy the given predicate. *) val mempool_count_ops : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> int tzresult Lwt.t (** Check if the mempool has at least one operation that satisfies the given predicate. *) val mempool_has_op : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> bool tzresult Lwt.t (** Similar to [mempool_has_op] but instead of returning a [bool] it sets the given [bool ref]. *) val mempool_has_op_ref : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> var:bool ref -> unit tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_injector/disk_persistence.ml b/src/proto_015_PtLimaPt/lib_injector/disk_persistence.ml index 120fde84cff8..9941a6928cdd 100644 --- a/src/proto_015_PtLimaPt/lib_injector/disk_persistence.ml +++ b/src/proto_015_PtLimaPt/lib_injector/disk_persistence.ml @@ -276,7 +276,7 @@ end module Make_queue (N : sig val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_015_PtLimaPt/lib_injector/disk_persistence.mli b/src/proto_015_PtLimaPt/lib_injector/disk_persistence.mli index 6e37f06fe507..d55c04db2f11 100644 --- a/src/proto_015_PtLimaPt/lib_injector/disk_persistence.mli +++ b/src/proto_015_PtLimaPt/lib_injector/disk_persistence.mli @@ -106,7 +106,7 @@ module Make_queue (N : sig to store the persistent information for this queue. *) val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml index d742edb00e33..21624cbabb24 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.ml @@ -76,7 +76,7 @@ let fetch_tezos_block ~find_in_cache (cctxt : #full) hash : i.e. calls {!fetch} for cache misses. *) error_with "Fetching Tezos block %a failed unexpectedly" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash | None, Some errs -> Error errs | Some block, _ -> Ok block @@ -87,7 +87,7 @@ let tezos_reorg fetch_tezos_block ~old_head_hash ~new_head_hash = let open Alpha_block_services in let open Lwt_result_syntax in let rec loop old_chain new_chain old_head_hash new_head_hash = - if Tezos_crypto.Block_hash.(old_head_hash = new_head_hash) then + if Block_hash.(old_head_hash = new_head_hash) then return {old_chain = List.rev old_chain; new_chain = List.rev new_chain} else let* new_head = fetch_tezos_block new_head_hash in diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli index 83dd948534f9..92bfa39debeb 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_common.mli +++ b/src/proto_015_PtLimaPt/lib_injector/injector_common.mli @@ -61,18 +61,18 @@ type block_info := Alpha_block_services.block_info {!Ringo_lwt.Sigs.CACHE_MAP_RESULT}. *) val fetch_tezos_block : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> block_info option Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> block_info option Lwt.t) -> block_info option Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info tzresult Lwt.t (** [tezos_reorg fetch ~old_head_hash ~new_head_hash] computes the reorganization of L1 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) val tezos_reorg : - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> - old_head_hash:Tezos_crypto.Block_hash.t -> - new_head_hash:Tezos_crypto.Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> + old_head_hash:Block_hash.t -> + new_head_hash:Block_hash.t -> block_info reorg tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_events.ml b/src/proto_015_PtLimaPt/lib_injector/injector_events.ml index 4f897439cce8..a43177e316f3 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_events.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_events.ml @@ -113,7 +113,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"new_tezos_head" ~msg:"processing new Tezos head {head}" ~level:Debug - ("head", Tezos_crypto.Block_hash.encoding) + ("head", Block_hash.encoding) let injecting_pending = declare_1 @@ -169,7 +169,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~msg:"Injected {nb} operations in {oph}" ~level:Notice ("nb", Data_encoding.int31) - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let add_pending = declare_1 @@ -184,7 +184,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"included" ~msg:"Included operations of {block} at level {level}: {operations}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("operations", Data_encoding.list L1_operation.Hash.encoding) ~pp3:pp_operations_hash_list diff --git a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml index e7d81d0a1171..3c9fbfd829f9 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_functor.ml @@ -73,7 +73,7 @@ module Make (Rollup : PARAMETERS) = struct node. *) type injected_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) } @@ -93,20 +93,20 @@ module Make (Rollup : PARAMETERS) = struct let open Data_encoding in conv (fun {op; oph} -> (oph, op)) (fun (oph, op) -> {op; oph}) @@ merge_objs - (obj1 (req "oph" Tezos_crypto.Operation_hash.encoding)) + (obj1 (req "oph" Operation_hash.encoding)) L1_operation.encoding end) module Injected_ophs = Disk_persistence.Make_table (struct - include Tezos_crypto.Operation_hash.Table + include Operation_hash.Table type value = L1_operation.Hash.t list let name = "injected_ophs" - let string_of_key = Tezos_crypto.Operation_hash.to_b58check + let string_of_key = Operation_hash.to_b58check - let key_of_string = Tezos_crypto.Operation_hash.of_b58check_opt + let key_of_string = Operation_hash.of_b58check_opt let value_encoding = Data_encoding.list L1_operation.Hash.encoding end) @@ -126,10 +126,10 @@ module Make (Rollup : PARAMETERS) = struct block. *) type included_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) - l1_block : Tezos_crypto.Block_hash.t; + l1_block : Block_hash.t; (** The hash of the L1 block in which the operation was included. *) l1_level : int32; (** The level of [l1_block]. *) } @@ -153,21 +153,21 @@ module Make (Rollup : PARAMETERS) = struct @@ merge_objs L1_operation.encoding (obj3 - (req "oph" Tezos_crypto.Operation_hash.encoding) - (req "l1_block" Tezos_crypto.Block_hash.encoding) + (req "oph" Operation_hash.encoding) + (req "l1_block" Block_hash.encoding) (req "l1_level" int32)) end) module Included_in_blocks = Disk_persistence.Make_table (struct - include Tezos_crypto.Block_hash.Table + include Block_hash.Table type value = int32 * L1_operation.Hash.t list let name = "included_in_blocks" - let string_of_key = Tezos_crypto.Block_hash.to_b58check + let string_of_key = Block_hash.to_b58check - let key_of_string = Tezos_crypto.Block_hash.of_b58check_opt + let key_of_string = Block_hash.of_b58check_opt let value_encoding = let open Data_encoding in @@ -658,7 +658,7 @@ module Make (Rollup : PARAMETERS) = struct | Ok packed_contents_list -> packed_contents_list in let signature = Tezos_crypto.Signature.V0.zero in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; 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 102fe5188ce7..dbcd78388ab5 100644 --- a/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml +++ b/src/proto_015_PtLimaPt/lib_injector/injector_worker_types.ml @@ -84,7 +84,7 @@ module Request = struct Format.fprintf ppf "switching to new Tezos head %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.Alpha_block_services.hash ; if r.old_chain <> [] || r.new_chain <> [] then Format.fprintf diff --git a/src/proto_015_PtLimaPt/lib_injector/l1_operation.mli b/src/proto_015_PtLimaPt/lib_injector/l1_operation.mli index 21b13fbf32ff..6dc5bdeb9cd8 100644 --- a/src/proto_015_PtLimaPt/lib_injector/l1_operation.mli +++ b/src/proto_015_PtLimaPt/lib_injector/l1_operation.mli @@ -26,7 +26,7 @@ open Protocol.Alpha_context (** Hash with b58check encoding mop(53), for hashes of L1 manager operations *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for L1 operations hashes *) type hash = Hash.t diff --git a/src/proto_015_PtLimaPt/lib_plugin/mempool.ml b/src/proto_015_PtLimaPt/lib_plugin/mempool.ml index 71b53d5f8dd9..81d0532d27df 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/mempool.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/mempool.ml @@ -187,10 +187,7 @@ type manager_op_info = { in [state] when appropriate. *) } -type manager_op_weight = { - operation_hash : Tezos_crypto.Operation_hash.t; - weight : Q.t; -} +type manager_op_weight = {operation_hash : Operation_hash.t; weight : Q.t} (** Build a {!manager_op_weight} from operation hash and {!manager_op_info}. *) let mk_op_weight oph (info : manager_op_info) = @@ -199,7 +196,7 @@ let mk_op_weight oph (info : manager_op_info) = let compare_manager_op_weight op1 op2 = let c = Q.compare op1.weight op2.weight in if c <> 0 then c - else Tezos_crypto.Operation_hash.compare op1.operation_hash op2.operation_hash + else Operation_hash.compare op1.operation_hash op2.operation_hash module ManagerOpWeightSet = Set.Make (struct type t = manager_op_weight @@ -224,10 +221,10 @@ type ops_state = { (** Number of prechecked manager operations. Invariants: - [prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal prechecked_manager_ops + = Operation_hash.Map.cardinal prechecked_manager_ops = ManagerOpWeightSet.cardinal prechecked_op_weights] - [prechecked_manager_op_count <= max_prechecked_manager_operations] *) - prechecked_manager_ops : manager_op_info Tezos_crypto.Operation_hash.Map.t; + prechecked_manager_ops : manager_op_info Operation_hash.Map.t; (** All prechecked manager operations. See {!manager_op_info}. *) prechecked_op_weights : ManagerOpWeightSet.t; (** The {!manager_op_weight} of all prechecked manager operations. *) @@ -243,7 +240,7 @@ type state = {state_info : state_info; ops_state : ops_state} let empty_ops_state = { prechecked_manager_op_count = 0; - prechecked_manager_ops = Tezos_crypto.Operation_hash.Map.empty; + prechecked_manager_ops = Operation_hash.Map.empty; prechecked_op_weights = ManagerOpWeightSet.empty; min_prechecked_op_weight = None; } @@ -352,7 +349,7 @@ let () = (fun () -> Fees_too_low) type Environment.Error_monad.error += - | Manager_restriction of {oph : Tezos_crypto.Operation_hash.t; fee : Tez.t} + | Manager_restriction of {oph : Operation_hash.t; fee : Tez.t} let () = Environment.Error_monad.register_error_kind @@ -366,21 +363,21 @@ let () = "Only one manager operation per manager per block allowed (found %a \ with %atez fee. You may want to use --replace to provide adequate fee \ and replace it)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Tez.pp fee) Data_encoding.( obj2 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation_fee" Tez.encoding)) (function Manager_restriction {oph; fee} -> Some (oph, fee) | _ -> None) (fun (oph, fee) -> Manager_restriction {oph; fee}) type Environment.Error_monad.error += | Manager_operation_replaced of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } let () = @@ -393,13 +390,13 @@ let () = Format.fprintf ppf "The manager operation %a has been replaced with %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Manager_operation_replaced {old_hash; new_hash} -> Some (old_hash, new_hash) @@ -827,17 +824,13 @@ let pre_filter config ~filter_state (** Remove a manager operation hash from the ops_state. Do nothing if the operation was not in the state. *) let remove_operation ops_state oph = - match - Tezos_crypto.Operation_hash.Map.find oph ops_state.prechecked_manager_ops - with + match Operation_hash.Map.find oph ops_state.prechecked_manager_ops with | None -> (* Not present in the ops_state: nothing to do. *) ops_state | Some info -> let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.remove - oph - ops_state.prechecked_manager_ops + Operation_hash.Map.remove oph ops_state.prechecked_manager_ops in let prechecked_manager_op_count = ops_state.prechecked_manager_op_count - 1 @@ -851,9 +844,8 @@ let remove_operation ops_state oph = match ops_state.min_prechecked_op_weight with | None -> None | Some min_op_weight -> - if - Tezos_crypto.Operation_hash.equal min_op_weight.operation_hash oph - then ManagerOpWeightSet.min_elt prechecked_op_weights + if Operation_hash.equal min_op_weight.operation_hash oph then + ManagerOpWeightSet.min_elt prechecked_op_weights else Some min_op_weight in { @@ -876,18 +868,15 @@ let add_manager_op ops_state oph info replacement = | `No_replace -> ops_state | `Replace (oph, _classification) -> remove_operation ops_state oph in - if Tezos_crypto.Operation_hash.Map.mem oph ops_state.prechecked_manager_ops - then (* Already present in the ops_state: nothing to do. *) + if Operation_hash.Map.mem oph ops_state.prechecked_manager_ops then + (* Already present in the ops_state: nothing to do. *) ops_state else let prechecked_manager_op_count = ops_state.prechecked_manager_op_count + 1 in let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - ops_state.prechecked_manager_ops + Operation_hash.Map.add oph info ops_state.prechecked_manager_ops in let op_weight = mk_op_weight oph info in let prechecked_op_weights = @@ -1011,8 +1000,8 @@ let is_manager_operation op = of the call to {!Operation.compare}). *) let conflict_handler config : Mempool.conflict_handler = fun ~existing_operation ~new_operation -> - let (_ : Tezos_crypto.Operation_hash.t), old_op = existing_operation in - let (_ : Tezos_crypto.Operation_hash.t), new_op = new_operation in + let (_ : Operation_hash.t), old_op = existing_operation in + let (_ : Operation_hash.t), new_op = new_operation in if is_manager_operation old_op && is_manager_operation new_op then let new_op_is_better = let open Result_syntax in diff --git a/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml b/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml index c63c5a825ac0..1c7775bca0d9 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/test/generators.ml @@ -39,10 +39,10 @@ let public_key_hash_gen : (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) -let operation_hash_gen : Tezos_crypto.Operation_hash.t QCheck2.Gen.t = +let operation_hash_gen : Operation_hash.t QCheck2.Gen.t = let open QCheck2.Gen in let+ s = QCheck2.Gen.string_size (return 32) in - Tezos_crypto.Operation_hash.of_string_exn s + Operation_hash.of_string_exn s let dummy_manager_op_info = let fee = Alpha_context.Tez.zero in @@ -61,7 +61,7 @@ let dummy_manager_op_info = let protocol_data = {contents; signature = Some Tezos_crypto.Signature.V0.zero} in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in Mempool.Manager_op {shell = {branch}; protocol_data} in Mempool.{manager_op; fee; gas_limit; weight = Q.zero} @@ -77,8 +77,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = let+ ops = small_list oph_and_info_gen in List.fold_left (fun state (oph, info) -> - if Tezos_crypto.Operation_hash.Map.mem oph state.prechecked_manager_ops - then state + if Operation_hash.Map.mem oph state.prechecked_manager_ops then state else let prechecked_manager_op_count = state.prechecked_manager_op_count + 1 @@ -94,10 +93,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = { prechecked_manager_op_count; prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - state.prechecked_manager_ops; + Operation_hash.Map.add oph info state.prechecked_manager_ops; prechecked_op_weights = ManagerOpWeightSet.add op_weight state.prechecked_op_weights; min_prechecked_op_weight; @@ -109,25 +105,20 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = even odds of belonging to the given filter_state or being fresh. *) let with_filter_state_operation_gen : Plugin.Mempool.ops_state -> - (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - QCheck2.Gen.t = + (Operation_hash.t * Plugin.Mempool.manager_op_info) QCheck2.Gen.t = fun state -> let open QCheck2.Gen in let* use_fresh = bool in - if - use_fresh - || Tezos_crypto.Operation_hash.Map.is_empty state.prechecked_manager_ops - then oph_and_info_gen - else - oneofl - (Tezos_crypto.Operation_hash.Map.bindings state.prechecked_manager_ops) + if use_fresh || Operation_hash.Map.is_empty state.prechecked_manager_ops then + oph_and_info_gen + else oneofl (Operation_hash.Map.bindings state.prechecked_manager_ops) (** Generate both a filter_state, and a pair of operation hash and manager_op_info. The pair has even odds of belonging to the filter_state or being fresh. *) let filter_state_with_operation_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in filter_state_gen >>= fun state -> @@ -138,8 +129,8 @@ let filter_state_with_operation_gen : to the filter_state or being fresh. *) let filter_state_with_two_operations_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in let* filter_state = filter_state_gen in diff --git a/src/proto_015_PtLimaPt/lib_plugin/test/test_conflict_handler.ml b/src/proto_015_PtLimaPt/lib_plugin/test/test_conflict_handler.ml index d84714a3b984..1b5d344cd38b 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/test/test_conflict_handler.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/test/test_conflict_handler.ml @@ -38,7 +38,7 @@ let check_answer ?__LOC__ expected actual = assert (Qcheck2_helpers.qcheck_eq ~pp:pp_answer ?__LOC__ expected actual : bool) -let is_manager_op ((_ : Tezos_crypto.Operation_hash.t), op) = +let is_manager_op ((_ : Operation_hash.t), op) = (* This is implemented differently from [Plugin.Mempool.is_manager_operation] (which relies on [Alpha_context.Operation.acceptable_pass]), used in diff --git a/src/proto_015_PtLimaPt/lib_plugin/test/test_filter_state.ml b/src/proto_015_PtLimaPt/lib_plugin/test/test_filter_state.ml index 82868acd43f2..bb48f3b41809 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/test/test_filter_state.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/test/test_filter_state.ml @@ -46,14 +46,13 @@ let check_filter_state_invariants filter_state = filter_state) ~cond:(fun filter_state -> filter_state.prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal - filter_state.prechecked_manager_ops + = Operation_hash.Map.cardinal filter_state.prechecked_manager_ops && filter_state.prechecked_manager_op_count = ManagerOpWeightSet.cardinal filter_state.prechecked_op_weights && ManagerOpWeightSet.for_all (fun {operation_hash; weight} -> match - Tezos_crypto.Operation_hash.Map.find + Operation_hash.Map.find operation_hash filter_state.prechecked_manager_ops with @@ -80,7 +79,7 @@ let test_add_manager_op = already present in [filter_state] or fresh. *) let replacement = if should_replace then ( - assume (not (Tezos_crypto.Operation_hash.equal oph_to_replace oph)) ; + assume (not (Operation_hash.equal oph_to_replace oph)) ; `Replace (oph_to_replace, ())) else `No_replace in @@ -91,11 +90,11 @@ let test_add_manager_op = Format.fprintf fmt "%a was not found in prechecked_manager_ops: %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph pp_prechecked_manager_ops set) - ~cond:(Tezos_crypto.Operation_hash.Map.mem oph) + ~cond:(Operation_hash.Map.mem oph) filter_state.prechecked_manager_ops () && @@ -105,11 +104,11 @@ let test_add_manager_op = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph_to_replace) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph_to_replace filter_state.prechecked_manager_ops)) () @@ -132,10 +131,7 @@ let test_remove_present = -> (* Add a fresh operation [oph] to the state. *) assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let replacement = if should_replace then `Replace (oph_to_replace, ()) else `No_replace in @@ -151,11 +147,11 @@ let test_remove_present = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph filter_state.prechecked_manager_ops)) () @@ -183,10 +179,7 @@ let test_remove_unknown = (Gen.pair Generators.filter_state_gen Generators.operation_hash_gen) (fun (initial_state, oph) -> assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let filter_state = remove_operation initial_state oph in qcheck_eq ~pp:pp_state ~eq:eq_state initial_state filter_state) diff --git a/src/proto_015_PtLimaPt/lib_plugin/test/test_utils.ml b/src/proto_015_PtLimaPt/lib_plugin/test/test_utils.ml index 0b92f1f4ca4c..57402233a49e 100644 --- a/src/proto_015_PtLimaPt/lib_plugin/test/test_utils.ml +++ b/src/proto_015_PtLimaPt/lib_plugin/test/test_utils.ml @@ -44,7 +44,7 @@ let pp_prechecked_manager_ops fmt set = Format.fprintf ppf "(%a -> {fee: %a; gas: %a; weight: %a})" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Alpha_context.Tez.pp op_info.fee @@ -52,13 +52,13 @@ let pp_prechecked_manager_ops fmt set = op_info.gas_limit Q.pp_print op_info.weight)) - (Tezos_crypto.Operation_hash.Map.bindings set) + (Operation_hash.Map.bindings set) let pp_manager_op_weight fmt weight = Format.fprintf fmt "{oph: %a; weight: %a}" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp weight.operation_hash Q.pp_print weight.weight @@ -95,7 +95,7 @@ let pp_state fmt state = state.min_prechecked_op_weight let eq_prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.equal + Operation_hash.Map.equal (fun {manager_op = _; fee = fee1; gas_limit = gas1; weight = w1} {manager_op = _; fee = fee2; gas_limit = gas2; weight = w2} @@ -103,9 +103,7 @@ let eq_prechecked_manager_ops = let eq_op_weight_opt = Option.equal (fun op_weight1 op_weight2 -> - Tezos_crypto.Operation_hash.equal - op_weight1.operation_hash - op_weight2.operation_hash + Operation_hash.equal op_weight1.operation_hash op_weight2.operation_hash && Q.equal op_weight1.weight op_weight2.weight) (* This function needs to be updated if the filter state is extended *) diff --git a/src/proto_015_PtLimaPt/lib_protocol/dune b/src/proto_015_PtLimaPt/lib_protocol/dune index 877e1a528f8a..2e69c4ff73d3 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/dune +++ b/src/proto_015_PtLimaPt/lib_protocol/dune @@ -283,7 +283,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW\"\nlet name = Tezos_protocol_environment_015_PtLimaPt.Name.name\ninclude Tezos_raw_protocol_015_PtLimaPt\ninclude Tezos_raw_protocol_015_PtLimaPt.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW\"\nlet name = Tezos_protocol_environment_015_PtLimaPt.Name.name\ninclude Tezos_raw_protocol_015_PtLimaPt\ninclude Tezos_raw_protocol_015_PtLimaPt.Main\n"))) (rule (targets tezos_protocol_015_PtLimaPt.ml) 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 f96f148c9616..2fbfdaee8931 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/assert.ml @@ -171,23 +171,21 @@ let not_equal_pkh ~loc (a : Tezos_crypto.Signature.V0.Public_key_hash.t) not_equal ~loc PKH.equal "Public key hashes are equal" PKH.pp a b (* protocol hash *) -let equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes aren't equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b -let not_equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let not_equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = not_equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes are equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b 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 ccb3d64f6c9e..c00f911be690 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml @@ -31,7 +31,7 @@ open Alpha_context (* This type collects a block and the context that results from its application *) type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; @@ -185,7 +185,7 @@ module Forge = struct (* We don't care of the following values, only the shell validates them. *) proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } let set_seed_nonce_hash seed_nonce_hash @@ -247,8 +247,7 @@ module Forge = struct >|=? fun seed_nonce_hash -> let hashes = List.map Operation.hash_packed operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [Tezos_crypto.Operation_list_hash.compute hashes] + Operation_list_list_hash.compute [Operation_list_hash.compute hashes] in let shell = make_shell @@ -263,9 +262,7 @@ module Forge = struct List.concat (match List.tl operations with None -> [] | Some l -> l) in let hashes = List.map Operation.hash_packed non_consensus_operations in - let non_consensus_operations_hash = - Tezos_crypto.Operation_list_hash.compute hashes - in + let non_consensus_operations_hash = Operation_list_hash.compute hashes in let payload_round = match payload_round with None -> round | Some r -> r in @@ -413,7 +410,7 @@ let initial_alpha_context ?(commitments = []) constants let genesis_with_parameters parameters = let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let fitness = @@ -429,7 +426,7 @@ let genesis_with_parameters parameters = ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in let contents = Forge.make_contents @@ -620,7 +617,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum >>=? fun () -> check_constants_consistency constants >>=? fun () -> let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let level = Option.value ~default:0l level in @@ -637,7 +634,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in validate_initial_accounts initial_accounts constants.minimal_stake (* Perhaps this could return a new type signifying its name *) 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 ace3a64907ce..419c1c7f413f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli @@ -29,7 +29,7 @@ open Protocol open Alpha_context type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; (** Resulting context *) @@ -292,9 +292,7 @@ val prepare_initial_context_params : ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> (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, + ( Constants.Parametric.t * Block_header.shell_header * Block_hash.t, tztrace ) result Lwt.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 ec12b5ee131b..08d3dba8e0ee 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml @@ -272,7 +272,7 @@ module Vote = struct type delegate_info = Alpha_context.Vote.delegate_info = { voting_power : Int64.t option; current_ballot : Alpha_context.Vote.ballot option; - current_proposals : Tezos_crypto.Protocol_hash.t list; + current_proposals : Protocol_hash.t list; remaining_proposals : int; } 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 7e24aa16026b..9ab8d2d67e77 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli @@ -30,7 +30,7 @@ open Environment type t = B of Block.t | I of Incremental.t -val branch : t -> Tezos_crypto.Block_hash.t +val branch : t -> Block_hash.t val get_level : t -> Raw_level.t tzresult @@ -128,10 +128,9 @@ module Vote : sig val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t - val get_current_proposal : - t -> Tezos_crypto.Protocol_hash.t option tzresult Lwt.t + val get_current_proposal : t -> Protocol_hash.t option tzresult Lwt.t - val get_protocol : Block.t -> Tezos_crypto.Protocol_hash.t Lwt.t + val get_protocol : Block.t -> Protocol_hash.t Lwt.t val set_participation_ema : Block.t -> int32 -> Block.t Lwt.t 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 1d7ecf55267b..65abde811ad0 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml @@ -54,7 +54,7 @@ let rpc_context st = let fitness = (header st).shell.fitness in let result = Alpha_context.finalize (alpha_ctxt st) fitness in { - Environment.Updater.block_hash = Tezos_crypto.Block_hash.zero; + Environment.Updater.block_hash = Block_hash.zero; block_header = {st.header.shell with fitness = result.fitness}; context = result.context; } @@ -115,8 +115,8 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) fitness = predecessor.header.shell.fitness; timestamp; level = predecessor.header.shell.level; - context = Tezos_crypto.Context_hash.zero; - operations_hash = Tezos_crypto.Operation_list_list_hash.zero; + context = Context_hash.zero; + operations_hash = Operation_list_list_hash.zero; }; protocol_data = {contents; signature = Tezos_crypto.Signature.V0.zero}; } @@ -244,11 +244,8 @@ let finalize_block st = let open Lwt_result_syntax in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let shell_header = { @@ -263,11 +260,8 @@ let finalize_block st = let*? validation_result, _ = Environment.wrap_tzresult res in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let header = { 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 d16ef42873da..db20e37d697e 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml @@ -53,9 +53,7 @@ let mk_block_payload_hash pred_hash payload_round (b : Block.t) = List.concat (match List.tl ops with None -> [] | Some l -> l) in let hashes = List.map Operation.hash_packed non_consensus_operations in - let non_consensus_operations_hash = - Tezos_crypto.Operation_list_hash.compute hashes - in + let non_consensus_operations_hash = Operation_list_hash.compute hashes in Block_payload.hash ~predecessor:pred_hash payload_round @@ -201,7 +199,7 @@ let combine_operations ?public_key ?counter ?spurious_operation ~source ctxt assert ( List.for_all (fun {shell = {Tezos_base.Operation.branch = b; _}; _} -> - Tezos_crypto.Block_hash.(branch = b)) + Block_hash.(branch = b)) packed_operations) ; (* TODO? : check signatures consistency *) let unpacked_operations = 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 81f688cb95c9..a87292d3c40f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli @@ -316,7 +316,7 @@ val proposals_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals contents_list tzresult Lwt.t (** Craft a Proposals operation. @@ -329,7 +329,7 @@ val proposals : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Operation.packed tzresult Lwt.t (** Craft the [contents_list] for a Ballot operation. @@ -342,7 +342,7 @@ val ballot_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot contents_list tzresult Lwt.t @@ -356,7 +356,7 @@ val ballot : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Operation.packed tzresult Lwt.t @@ -496,7 +496,7 @@ val tx_rollup_dispatch_tickets : message_result_path:Tx_rollup_commitment.Merkle.path -> Tx_rollup.t -> Tx_rollup_level.t -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> Tx_rollup_reveal.t list -> (packed_operation, tztrace) result Lwt.t 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 06b2c0f01df6..e949b07ae1b5 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 @@ -122,7 +122,7 @@ let pp_kind fmt k = let block_hashes = List.map - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn [ "BLbcVY1kYiKQy2MJJfoHJMN2xRk5QPG1PEKWMDSyW2JMxBsMmiL"; "BLFhLKqQQn32Cc9QXqtEqysYqWNCowNKaypVHP5zEyZcywbXcHo"; @@ -228,7 +228,7 @@ let random_sc_rollup = QCheck2.Gen.oneofl sc_rollups let protos = List.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [ "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; @@ -568,7 +568,7 @@ let generate_tx_rollup_rejection = { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } in @@ -606,7 +606,7 @@ let generate_tx_dispatch_tickets = let level = Tx_rollup_level.root in let message_index = 0 in let message_result_path = Tx_rollup_commitment.Merkle.dummy_path in - let context_hash = Tezos_crypto.Context_hash.zero in + let context_hash = Context_hash.zero in let reveal = Tx_rollup_reveal. { 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 54b91e324963..38feb23f0c56 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 @@ -52,7 +52,7 @@ let block_fork ?policy (contract_a, contract_b) b = let order_block_hashes ~correct_order bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if correct_order then if c < 0 then (bh1, bh2) else (bh2, bh1) else if c < 0 then (bh2, bh1) else (bh1, bh2) @@ -95,7 +95,7 @@ let test_valid_double_baking_evidence () = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) 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 fe6b64532d72..c850d1ab4126 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 @@ -52,7 +52,7 @@ let block_fork b = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) 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 367d7638c59c..f8fd3b785bc8 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 @@ -177,7 +177,7 @@ end = struct let order_preendorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) 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 7fc6ef508ec0..0df656f6fef4 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 @@ -1570,7 +1570,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]); + (Context_hash.hash_string ["first"]); } in let commitment2 = @@ -1579,7 +1579,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]); + (Context_hash.hash_string ["second"]); } in @@ -1677,14 +1677,14 @@ let init_with_conflict () = let* block, rollup = sc_originate block account1 "unit" in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]) + (Context_hash.hash_string ["first"]) in let* commitment1 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]) + (Context_hash.hash_string ["second"]) in let* commitment2 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup 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 dcfd3149f7e5..19b4451e1730 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 @@ -411,7 +411,7 @@ let make_deposit b tx_rollup l1_src addr = (** Create an incomplete (but valid) commitment for a given level. It is incomplete in the sense that the Merkle roots for each message are generated - with [Tezos_crypto.Context_hash.hash_string message_index]. In the meantime provides the + with [Context_hash.hash_string message_index]. In the meantime provides the list of withdraw in a association list of [batch_index -> withdraw_list]. Be careful not to provide a too-big withdraw_list as the construction is expensive *) @@ -422,8 +422,7 @@ let make_incomplete_commitment_for_batch context level tx_rollup withdraw_list = Data_encoding.Binary.to_string_exn Tx_rollup_inbox.encoding metadata in List.init ~when_negative_length:[] metadata.inbox_length (fun i -> - Tezos_crypto.Context_hash.hash_string - [str_for_context_hash ^ string_of_int i]) + Context_hash.hash_string [str_for_context_hash ^ string_of_int i]) >>?= fun batches_result -> let messages = List.mapi @@ -1602,7 +1601,7 @@ let test_commitment_duplication () = let batches2 : Tx_rollup_message_result_hash.t list = [Bytes.make 20 '1'; Bytes.make 20 '2'] |> List.map (fun hash -> - let context_hash = Tezos_crypto.Context_hash.hash_bytes [hash] in + let context_hash = Context_hash.hash_bytes [hash] in Tx_rollup_message_result_hash.hash_uncarbonated { context_hash; @@ -2269,7 +2268,7 @@ module Rejection = struct Tx_rollup_message_result_hash.hash_uncarbonated { context_hash = - Tezos_crypto.Context_hash.of_b58check_exn + Context_hash.of_b58check_exn "CoUiEnajKeukmYFUgWTJF2z3v24MycpTaomF8a9hRzVy7as9hvgy"; withdraw_list_hash = Tx_rollup_withdraw_list_hash.empty; }; @@ -2339,8 +2338,7 @@ module Rejection = struct let* store = init_l2_store () in let* hash_tree = hash_tree_from_store store in assert ( - Tezos_crypto.Context_hash.( - hash_tree = Tx_rollup_message_result.empty_l2_context_hash)) ; + Context_hash.(hash_tree = Tx_rollup_message_result.empty_l2_context_hash)) ; return_unit (** [make_proof store msg] applies [msg] on [store] and returns the @@ -2368,7 +2366,7 @@ module Rejection = struct { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } @@ -2746,7 +2744,7 @@ module Rejection = struct let level1 = tx_level 1l in make_invalid_commitment b level0 l2_context_hash >>=? fun (b, commitment0) -> - make_invalid_commitment b level1 Tezos_crypto.Context_hash.zero + make_invalid_commitment b level1 Context_hash.zero >>=? fun (b, commitment1) -> Context.get_constants (B b) >>=? fun constants -> let bond_cost = constants.parametric.tx_rollup.commitment_bond in @@ -2982,7 +2980,7 @@ module Rejection = struct let previous_message_result : Tx_rollup_message_result.t = { (* Expected is Tx_rollup_commitment.empty_l2_context_hash *) - context_hash = Tezos_crypto.Context_hash.zero; + context_hash = Context_hash.zero; withdraw_list_hash = Tx_rollup_withdraw_list_hash.empty; } in @@ -4560,7 +4558,7 @@ module Withdraw = struct ~message_result_path:Tx_rollup_commitment.Merkle.dummy_path tx_rollup Tx_rollup_level.root - (Tezos_crypto.Context_hash.hash_bytes [Bytes.make 20 'c']) + (Context_hash.hash_bytes [Bytes.make 20 'c']) (* any context hash will fail *) [ticket_info] (* any non-empty list will fail *) 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 1562c0e65575..564da54a3ddd 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 @@ -77,7 +77,7 @@ let expected_qr_num participation_ema = (* Protocol_hash.zero is "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i" *) let protos = Array.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [| "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; @@ -230,9 +230,9 @@ let equal_delegate_info a b = Option.equal Int64.equal a.Vote.voting_power b.Vote.voting_power && Option.equal Vote.equal_ballot a.current_ballot b.current_ballot && List.equal - Tezos_crypto.Protocol_hash.equal - (List.sort Tezos_crypto.Protocol_hash.compare a.current_proposals) - (List.sort Tezos_crypto.Protocol_hash.compare b.current_proposals) + Protocol_hash.equal + (List.sort Protocol_hash.compare a.current_proposals) + (List.sort Protocol_hash.compare b.current_proposals) && Int.equal a.remaining_proposals b.remaining_proposals let assert_equal_info ~loc a b = @@ -470,9 +470,8 @@ let test_successful_vote num_delegates () = let props = List.map (fun i -> protos.(i)) (2 -- Constants.max_proposals_per_delegate) in - Op.proposals (B b) del1 (Tezos_crypto.Protocol_hash.zero :: props) - >>=? fun ops1 -> - Op.proposals (B b) del2 [Tezos_crypto.Protocol_hash.zero] >>=? fun ops2 -> + Op.proposals (B b) del1 (Protocol_hash.zero :: props) >>=? fun ops1 -> + Op.proposals (B b) del2 [Protocol_hash.zero] >>=? fun ops2 -> Block.bake ~operations:[ops1; ops2] b >>=? fun b -> Context.Delegate.voting_info (B b) pkh1 >>=? fun info1 -> Context.Delegate.voting_info (B b) pkh2 >>=? fun info2 -> @@ -482,7 +481,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow1; current_ballot = None; - current_proposals = Tezos_crypto.Protocol_hash.zero :: props; + current_proposals = Protocol_hash.zero :: props; remaining_proposals = 0; } >>=? fun () -> @@ -492,7 +491,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow2; current_ballot = None; - current_proposals = [Tezos_crypto.Protocol_hash.zero]; + current_proposals = [Protocol_hash.zero]; remaining_proposals = Constants.max_proposals_per_delegate - 1; } >>=? fun () -> @@ -514,7 +513,7 @@ let test_successful_vote num_delegates () = assert_validate_proposals_fails ~expected_error:too_many_proposals ~proposer:del1 - ~proposals:(Tezos_crypto.Protocol_hash.zero :: props) + ~proposals:(Protocol_hash.zero :: props) b __LOC__ >>=? fun () -> @@ -545,13 +544,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during exploration period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p2 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p2 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -572,7 +571,7 @@ let test_successful_vote num_delegates () = assert_validate_ballot_fails ~expected_error:already_submitted_a_ballot ~voter:del1 - ~proposal:Tezos_crypto.Protocol_hash.zero + ~proposal:Protocol_hash.zero ~ballot:Vote.Nay b __LOC__ @@ -623,13 +622,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during promotion period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p4 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p4 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -664,11 +663,11 @@ let test_successful_vote num_delegates () = Context.Vote.get_protocol b >>= fun p -> Assert.equal ~loc:__LOC__ - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Unexpected proposal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p - Tezos_crypto.Protocol_hash.zero + Protocol_hash.zero >>=? fun () -> return_unit (* given a list of active delegates, @@ -720,8 +719,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -743,7 +741,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -775,8 +773,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -792,7 +789,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -823,7 +820,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -947,7 +944,7 @@ let test_supermajority_in_exploration supermajority () = (* assert our proposal won *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal proposal v) then return_unit + if Protocol_hash.(equal proposal v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> @@ -1010,7 +1007,7 @@ let test_quorum_capped_maximum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1050,7 +1047,7 @@ let test_quorum_capped_minimum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1281,7 +1278,7 @@ let test_proposals_wrong_voting_period_index () = assert_validate_proposals_fails ~expected_error:(wrong_voting_period_index ~current_index ~op_index) ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] ~period:op_index block __LOC__ @@ -1341,14 +1338,14 @@ let test_proposals_source_not_in_vote_listings () = assert_validate_proposals_fails ~expected_error:proposals_from_unregistered_delegate ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in let assert_fails_with_source_not_in_vote_listings block = assert_validate_proposals_fails ~expected_error:source_not_in_vote_listings ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in (* Fail when the source has no contract in the storage. *) @@ -1919,7 +1916,7 @@ let observe_ballot pre_state post_state op caller_loc = let* current_proposal = Assert.get_some ~loc:(make_loc __LOC__) current_proposal in - assert (Tezos_crypto.Protocol_hash.equal proposal current_proposal) ; + assert (Protocol_hash.equal proposal current_proposal) ; (* Observations *) let* post_voting_infos = Context.Delegate.voting_info (B post_state) source in let* recorded_ballot = 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 1ccd4bb94fbc..45caf4c30d47 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 @@ -54,7 +54,7 @@ let very_small_random_amount () = | Some x -> x let nonce_zero = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero + Origination_nonce.Internal_for_tests.initial Operation_hash.zero let mk_tx_rollup ?(nonce = nonce_zero) () = ( Tx_rollup.Internal_for_tests.originated_tx_rollup nonce, 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 3ac42bda8082..74fbac6c983e 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 @@ -52,8 +52,7 @@ let random_amount () = | None -> assert false | Some x -> x -let nonce = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero +let nonce = Origination_nonce.Internal_for_tests.initial Operation_hash.zero let mk_rollup () = Tx_rollup.Internal_for_tests.originated_tx_rollup nonce diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.ml index 52f430772629..d33e29fc1868 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.ml @@ -42,7 +42,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; @@ -128,10 +128,7 @@ let ballot_exploration_prelude state = let* props = List.map_es (fun voter -> - Op.proposals - (B state.block) - voter - [Tezos_crypto.Protocol_hash.zero]) + Op.proposals (B state.block) voter [Protocol_hash.zero]) voters in return (prop :: props, state) @@ -182,11 +179,7 @@ let ballot_exploration_descriptor = in assert (voting_period_info.voting_period.kind = Exploration) ; let ballot = pick_one ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -207,10 +200,7 @@ let proposal_descriptor = Context.Vote.get_current_period (B state.block) in assert (voting_period_info.voting_period.kind = Proposal) ; - Op.proposals - (B state.block) - contract - [Tezos_crypto.Protocol_hash.zero] + Op.proposals (B state.block) contract [Protocol_hash.zero] in List.map_es gen state.voters); } @@ -255,11 +245,7 @@ let ballot_promotion_descriptor = let* ops = List.map_es (fun voter -> - Op.ballot - (B state.block) - voter - Tezos_crypto.Protocol_hash.zero - Vote.Yay) + Op.ballot (B state.block) voter Protocol_hash.zero Vote.Yay) state.voters in return (ops, state) @@ -273,11 +259,7 @@ let ballot_promotion_descriptor = in assert (voting_period_info.voting_period.kind = Promotion) ; let ballot = Stdlib.List.hd ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -377,9 +359,7 @@ let dbl_endorsement_prelude state = in let op1, op2 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op1) - (Operation.hash op2) + Operation_hash.compare (Operation.hash op1) (Operation.hash op2) in assert (comp <> 0) ; if comp < 0 then (op1, op2) else (op2, op1) @@ -395,9 +375,7 @@ let dbl_endorsement_prelude state = in let op3, op4 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op3) - (Operation.hash op4) + Operation_hash.compare (Operation.hash op3) (Operation.hash op4) in assert (comp <> 0) ; if comp < 0 then (op3, op4) else (op4, op3) @@ -445,7 +423,7 @@ let double_baking_descriptor = let order_block_header bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if c < 0 then (bh1, bh2) else (bh2, bh1) in let* ctxt = Context.to_alpha_ctxt (B state.block) in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.mli b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.mli index 1b9add80bfa6..df118ca15c6f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.mli +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/generator_descriptors.mli @@ -57,7 +57,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; 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 2644cd2788d3..c3a847e25293 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 @@ -899,7 +899,7 @@ let mk_tx_rollup_reject (oinfos : operation_req) (infos : infos) = { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } in @@ -984,7 +984,7 @@ let mk_tx_rollup_dispacth_ticket (oinfos : operation_req) (infos : infos) = ~message_result_path:Tx_rollup_commitment.Merkle.dummy_path tx_rollup Tx_rollup_level.root - Tezos_crypto.Context_hash.zero + Context_hash.zero [reveal] let mk_sc_rollup_origination (oinfos : operation_req) (infos : infos) = diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml index 3630b43d1918..260132a4fcb8 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml @@ -84,16 +84,14 @@ let assert_operation_present_in_mempool ~__LOC__ mempool ophl = let resulting_mempool_operations = Environment.Operation_hash.Map.bindings operations |> List.map fst - |> List.sort Tezos_crypto.Operation_hash.compare - in - let expected_operations = - List.sort Tezos_crypto.Operation_hash.compare ophl + |> List.sort Operation_hash.compare in + let expected_operations = List.sort Operation_hash.compare ophl in Assert.assert_equal_list ~loc:__LOC__ - Tezos_crypto.Operation_hash.equal + Operation_hash.equal "operations present in mempool" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp resulting_mempool_operations expected_operations 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 375fdcc75665..a2f198ea176a 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 @@ -61,7 +61,7 @@ let ballots = Vote.[Yay; Nay; Pass] let protos = List.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [ "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/regression/test_logging.ml b/src/proto_015_PtLimaPt/lib_protocol/test/regression/test_logging.ml index 7a72864cc718..6ab68e63171f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/regression/test_logging.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/regression/test_logging.ml @@ -219,9 +219,7 @@ let run_script transaction () = let* inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in let ctxt = - Alpha_context.Origination_nonce.init - ctxt - Tezos_crypto.Operation_hash.zero + Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in return (parameter, ctxt) in 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 d60870eaed66..db3f0dbc5c79 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 @@ -47,7 +47,7 @@ module Test_contract_repr = struct open Contract_repr let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_destination_repr.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_destination_repr.ml index fa610715c7c6..830251241aec 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_destination_repr.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_destination_repr.ml @@ -36,7 +36,7 @@ open Protocol open Tztest let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash 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 bb41400a8ba2..243679fc3950 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 @@ -89,8 +89,7 @@ let test_encodings () = test_encodings Initial_commitments >>=? fun () -> test_encodings Minted >>=? fun () -> let nonce = - Origination_nonce.Internal_for_tests.initial - Tezos_crypto.Operation_hash.zero + Origination_nonce.Internal_for_tests.initial Operation_hash.zero in let tx_rollup = Tx_rollup.Internal_for_tests.originated_tx_rollup nonce in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_game.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_game.ml index 19cbc3fe4bdb..6e828799992d 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_game.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_sc_rollup_game.ml @@ -59,7 +59,7 @@ let check_reason ~loc (game_result : Sc_rollup_game_repr.game_result option) s = let tick_of_int_exn n = match Tick.of_int n with None -> assert false | Some t -> t -let context_hash_of_string s = Tezos_crypto.Context_hash.hash_string [s] +let context_hash_of_string s = Context_hash.hash_string [s] let hash_string s = Sc_rollup_repr.State_hash.context_hash_to_state_hash 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 3c414d957337..e210c85abae5 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 @@ -60,9 +60,7 @@ let new_context_with_stakers nb_stakers = let+ inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in (* Necessary to originate rollups. *) - let ctxt = - Alpha_context.Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in let ctxt = Alpha_context.Internal_for_tests.to_raw ctxt in let stakers = List.map @@ -2361,7 +2359,7 @@ let test_zero_tick_commitment_cannot_change_state () = number_of_ticks = number_of_ticks_exn 0L; compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["wxyz"]); + (Context_hash.hash_string ["wxyz"]); } in let* () = 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 d3d748ce1b34..8b833c33f334 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 @@ -103,7 +103,7 @@ module Raw_context_tests = struct ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp in - let nonce = Tezos_crypto.Operation_hash.hash_string ["nonce_hash"] in + let nonce = Operation_hash.hash_string ["nonce_hash"] in return (Raw_context.init_origination_nonce ctx nonce, contract) (* Context with an originated ZKRU *) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml index 7b683e61678b..88b2ebaafcf9 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml @@ -31,7 +31,7 @@ open Alpha_context type block_id = [ `Head | `L2_block of L2block.hash - | `Tezos_block of Tezos_crypto.Block_hash.t + | `Tezos_block of Block_hash.t | `Level of L2block.level ] type context_id = [block_id | `Context of Tx_rollup_l2_context_hash.t] @@ -62,7 +62,7 @@ let context_of_id state context_id = let construct_block_id = function | `Head -> "head" | `L2_block h -> L2block.Hash.to_b58check h - | `Tezos_block h -> Tezos_crypto.Block_hash.to_b58check h + | `Tezos_block h -> Block_hash.to_b58check h | `Level l -> L2block.level_to_string l let destruct_block_id h = @@ -76,7 +76,7 @@ let destruct_block_id h = | Error _ -> Error "Invalid rollup level" | Ok l -> Ok (`Level l)) | None -> ( - match Tezos_crypto.Block_hash.of_b58check_opt h with + match Block_hash.of_b58check_opt h with | Some b -> Ok (`Tezos_block b) | None -> ( match L2block.Hash.of_b58check_opt h with @@ -344,8 +344,7 @@ module Block = struct | None -> return_none | Some block -> ( match block_id with - | `Tezos_block b - when Tezos_crypto.Block_hash.(block.header.tezos_block <> b) -> + | `Tezos_block b when Block_hash.(block.header.tezos_block <> b) -> (* Tezos block has no l2 inbox *) return_none | _ -> return_some block.inbox) @@ -358,13 +357,9 @@ module Block = struct | Some block -> let*? () = match block_id with - | `Tezos_block b - when Tezos_crypto.Block_hash.(block.header.tezos_block <> b) -> + | `Tezos_block b when Block_hash.(block.header.tezos_block <> b) -> (* Tezos block has no l2 inbox *) - error_with - "The tezos block (%a) has not L2 inbox" - Tezos_crypto.Block_hash.pp - b + error_with "The tezos block (%a) has not L2 inbox" Block_hash.pp b | _ -> ok () in let*? () = diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli index e3062f64be6b..f15657a1fca1 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli @@ -30,7 +30,7 @@ open Protocol type block_id = [ `Head | `L2_block of L2block.hash - | `Tezos_block of Tezos_crypto.Block_hash.t + | `Tezos_block of Block_hash.t | `Level of L2block.level ] val destruct_block_id : string -> (block_id, string) result diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/context.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/context.ml index bf3f172fc419..d34031bfb9ac 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/context.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/context.ml @@ -88,12 +88,10 @@ end include Protocol.Tx_rollup_l2_context.Make (Irmin_storage) let context_hash_to_l2 hash = - Tezos_crypto.Context_hash.to_bytes hash - |> Protocol.Tx_rollup_l2_context_hash.of_bytes_exn + Context_hash.to_bytes hash |> Protocol.Tx_rollup_l2_context_hash.of_bytes_exn let l2_to_context_hash hash = - Protocol.Tx_rollup_l2_context_hash.to_bytes hash - |> Tezos_crypto.Context_hash.of_bytes_exn + Protocol.Tx_rollup_l2_context_hash.to_bytes hash |> Context_hash.of_bytes_exn let exists index hash = Raw.exists index (l2_to_context_hash hash) @@ -225,7 +223,7 @@ let init_context index = let* tree = Prover_context.Ticket_index.init_counter tree in let tree_hash = hash_tree tree in assert ( - Tezos_crypto.Context_hash.( + Context_hash.( tree_hash = Protocol.Tx_rollup_message_result_repr.empty_l2_context_hash)) ; let* ctxt, _ = add_tree ctxt tree in return ctxt diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/context.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/context.mli index 154f5818a386..5c781082268d 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/context.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/context.mli @@ -119,7 +119,7 @@ val produce_proof : (tree -> 'a produce_proof_result Lwt.t) -> (Protocol.Tx_rollup_l2_proof.t * 'a produce_proof_result) tzresult Lwt.t -val hash_tree : tree -> Tezos_crypto.Context_hash.t +val hash_tree : tree -> Context_hash.t (** [add_tree ctxt tree] adds [tree] in the [ctxt]. In order to perform actions on the tree (e.g. proof production), it needs to be persistent. Thus, @@ -133,7 +133,7 @@ val hash_tree : tree -> Tezos_crypto.Context_hash.t val add_tree : context -> tree -> (context * Protocol.Tx_rollup_l2_context_hash.t) Lwt.t -val tree_hash_of_context : context -> Tezos_crypto.Context_hash.t tzresult Lwt.t +val tree_hash_of_context : context -> Context_hash.t tzresult Lwt.t (** {2 Sub-context for tickets } *) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/error.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/error.ml index 5e95ec3c32f2..13277743addf 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/error.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/error.ml @@ -217,8 +217,8 @@ let () = type error += | Tx_rollup_different_disk_stored_origination_rollup_and_given_rollup_genesis of { - disk_rollup_origination : Tezos_crypto.Block_hash.t; - given_rollup_genesis : Tezos_crypto.Block_hash.t; + disk_rollup_origination : Block_hash.t; + given_rollup_genesis : Block_hash.t; } let () = @@ -233,15 +233,15 @@ let () = ppf "Rollup origination on disk (%a) is different from the provided rollup \ genesis (%a)" - Tezos_crypto.Block_hash.pp + Block_hash.pp disk_rollup - Tezos_crypto.Block_hash.pp + Block_hash.pp given_rollup) `Permanent Data_encoding.( obj2 - (req "disk_rollup" Tezos_crypto.Block_hash.encoding) - (req "given_rollup" Tezos_crypto.Block_hash.encoding)) + (req "disk_rollup" Block_hash.encoding) + (req "given_rollup" Block_hash.encoding)) (function | Tx_rollup_different_disk_stored_origination_rollup_and_given_rollup_genesis {disk_rollup_origination; given_rollup_genesis} -> @@ -251,7 +251,7 @@ let () = Tx_rollup_different_disk_stored_origination_rollup_and_given_rollup_genesis {disk_rollup_origination; given_rollup_genesis}) -type error += Tx_rollup_no_operation_metadata of Tezos_crypto.Operation_hash.t +type error += Tx_rollup_no_operation_metadata of Operation_hash.t let () = register_error_kind @@ -264,10 +264,10 @@ let () = "The operation receipt of %a is unavailable. Please make sure that the \ history mode of the Tezos node you are connecting to matches the \ requirements." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op) `Permanent - Data_encoding.(obj1 (req "context" Tezos_crypto.Operation_hash.encoding)) + Data_encoding.(obj1 (req "context" Operation_hash.encoding)) (function Tx_rollup_no_operation_metadata o -> Some o | _ -> None) (fun o -> Tx_rollup_no_operation_metadata o) @@ -287,7 +287,7 @@ let () = (function Tx_rollup_mismatch -> Some () | _ -> None) (fun () -> Tx_rollup_mismatch) -type error += Tx_rollup_cannot_fetch_tezos_block of Tezos_crypto.Block_hash.t +type error += Tx_rollup_cannot_fetch_tezos_block of Block_hash.t let () = register_error_kind @@ -298,10 +298,10 @@ let () = Format.fprintf ppf "The Tezos block %a cannot be fetched from the node." - Tezos_crypto.Block_hash.pp + Block_hash.pp b) `Permanent - Data_encoding.(obj1 (req "block" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "block" Block_hash.encoding)) (function Tx_rollup_cannot_fetch_tezos_block b -> Some b | _ -> None) (fun b -> Tx_rollup_cannot_fetch_tezos_block b) @@ -396,7 +396,7 @@ let () = type error += | Tx_rollup_no_proto_inbox of - Protocol.Alpha_context.Tx_rollup_level.t * Tezos_crypto.Block_hash.t + Protocol.Alpha_context.Tx_rollup_level.t * Block_hash.t let () = register_error_kind @@ -409,13 +409,13 @@ let () = "No inbox on L1 for rollup level %a at block %a" Protocol.Alpha_context.Tx_rollup_level.pp l - Tezos_crypto.Block_hash.pp + Block_hash.pp b) `Permanent Data_encoding.( obj2 (req "level" Protocol.Alpha_context.Tx_rollup_level.encoding) - (req "block" Tezos_crypto.Block_hash.encoding)) + (req "block" Block_hash.encoding)) (function Tx_rollup_no_proto_inbox (l, b) -> Some (l, b) | _ -> None) (fun (l, b) -> Tx_rollup_no_proto_inbox (l, b)) @@ -543,7 +543,7 @@ let () = (function Tx_rollup_deposit_not_allowed -> Some () | _ -> None) (fun () -> Tx_rollup_deposit_not_allowed) -type error += Tx_rollup_deposit_slashed of Tezos_crypto.Operation_hash.t +type error += Tx_rollup_deposit_slashed of Operation_hash.t let () = register_error_kind @@ -555,10 +555,10 @@ let () = ppf "The deposit for our operator was slashed in operation %a. Aborting to \ investigate." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op) `Permanent - Data_encoding.(obj1 (req "operation" Tezos_crypto.Operation_hash.encoding)) + Data_encoding.(obj1 (req "operation" Operation_hash.encoding)) (function Tx_rollup_deposit_slashed o -> Some o | _ -> None) (fun o -> Tx_rollup_deposit_slashed o) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/error.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/error.mli index 2d2f7286b60f..5c396b5a3671 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/error.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/error.mli @@ -69,18 +69,18 @@ type error += Tx_rollup_no_rollup_info_on_disk_and_no_rollup_genesis_given different from the given rollup genesis. *) type error += | Tx_rollup_different_disk_stored_origination_rollup_and_given_rollup_genesis of { - disk_rollup_origination : Tezos_crypto.Block_hash.t; - given_rollup_genesis : Tezos_crypto.Block_hash.t; + disk_rollup_origination : Block_hash.t; + given_rollup_genesis : Block_hash.t; } (** Error when operation metadata is not available. *) -type error += Tx_rollup_no_operation_metadata of Tezos_crypto.Operation_hash.t +type error += Tx_rollup_no_operation_metadata of Operation_hash.t (** Error when rollup stored on disk is different from the expected one. *) type error += Tx_rollup_mismatch (** Error when Tezos block cannot be fetched. *) -type error += Tx_rollup_cannot_fetch_tezos_block of Tezos_crypto.Block_hash.t +type error += Tx_rollup_cannot_fetch_tezos_block of Block_hash.t (** Error when the tree is not found in the context. *) type error += Tx_rollup_tree_not_found @@ -102,7 +102,7 @@ type error += (** Error when the tezos node does not know the inbox *) type error += | Tx_rollup_no_proto_inbox of - Protocol.Alpha_context.Tx_rollup_level.t * Tezos_crypto.Block_hash.t + Protocol.Alpha_context.Tx_rollup_level.t * Block_hash.t (** Error when the node reconstructed a different inbox than the one stored on L1 *) type error += @@ -131,6 +131,6 @@ type error += type error += Tx_rollup_deposit_not_allowed (** Error (fatal) when we are slashed *) -type error += Tx_rollup_deposit_slashed of Tezos_crypto.Operation_hash.t +type error += Tx_rollup_deposit_slashed of Operation_hash.t type error += Wrong_deposit_parameters diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/event.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/event.ml index 9a64f9f15734..e97224f42dfc 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/event.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/event.ml @@ -101,7 +101,7 @@ let new_block = ~name:"tx_rollup_node_new_block" ~msg:"new block with hash: {block_hash}" ~level:Notice - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) let processing_block = declare_2 @@ -109,8 +109,8 @@ let processing_block = ~name:"tx_rollup_node_processing_block" ~msg:"processing block: {block_hash} (pred: {predecessor_hash})" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) - ("predecessor_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) + ("predecessor_hash", Block_hash.encoding) let missing_blocks = declare_1 @@ -126,7 +126,7 @@ let look_for_origination = ~name:"tx_rollup_node_look_for_origination" ~msg:"Looking for rollup origination in block {block} level {level}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) let detected_origination = @@ -136,7 +136,7 @@ let detected_origination = ~msg:"Detected rollup {rollup} origination in {block}" ~level:Notice ("rollup", Protocol.Alpha_context.Tx_rollup.encoding) - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) let tezos_block_processed = declare_2 @@ -144,7 +144,7 @@ let tezos_block_processed = ~name:"tx_rollup_node_tezos_block_processed" ~msg:"tezos block {block_hash} at level {level} was sucessfully processed" ~level:Notice - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("level", Data_encoding.int32) let block_already_processed = @@ -155,7 +155,7 @@ let block_already_processed = "the block {block_hash} has already been processed, nothing more to be \ done" ~level:Debug - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) let processing_block_predecessor = declare_2 @@ -165,7 +165,7 @@ let processing_block_predecessor = "processing block predecessor {predecessor_hash} at level \ {predecessor_level}" ~level:Debug - ("predecessor_hash", Tezos_crypto.Block_hash.encoding) + ("predecessor_hash", Block_hash.encoding) ("predecessor_level", Data_encoding.int32) let messages_application = @@ -184,7 +184,7 @@ let rollup_block = ~level:Notice ("level", L2block.level_encoding) ("hash", L2block.Hash.encoding) - ("tezos_hash", Tezos_crypto.Block_hash.encoding) + ("tezos_hash", Block_hash.encoding) let inbox_stored = declare_4 @@ -194,7 +194,7 @@ let inbox_stored = "an inbox with size {cumulated_size} and resulting context hash \ {context_hash} has been stored for {block_hash}: {messages}" ~level:Notice - ("block_hash", Tezos_crypto.Block_hash.encoding) + ("block_hash", Block_hash.encoding) ("messages", Data_encoding.list Inbox.message_encoding) ("cumulated_size", Data_encoding.int31) ("context_hash", Protocol.Tx_rollup_l2_context_hash.encoding) @@ -213,7 +213,7 @@ let new_tezos_head = ~name:"tx_rollup_node_new_tezos_head" ~msg:"a new tezos head ({tezos_head}) is stored" ~level:Notice - ("tezos_head", Tezos_crypto.Block_hash.encoding) + ("tezos_head", Block_hash.encoding) let inject_wait = declare_1 diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml index 40bdec5a250a..0129b636d665 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml @@ -34,7 +34,7 @@ type message_result = type l2_context_hash = { irmin_hash : Tx_rollup_l2_context_hash.t; - tree_hash : Tezos_crypto.Context_hash.t; + tree_hash : Context_hash.t; } type message = { @@ -71,7 +71,7 @@ let l2_context_hash_encoding = (fun (irmin_hash, tree_hash) -> {irmin_hash; tree_hash}) (obj2 (req "irmin_hash" Tx_rollup_l2_context_hash.encoding) - (req "tree_hash" Tezos_crypto.Context_hash.encoding)) + (req "tree_hash" Context_hash.encoding)) let message_encoding = let open Data_encoding in diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.mli index 9b874b09d866..58798b6a839f 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.mli @@ -41,7 +41,7 @@ type message_result = type l2_context_hash = { irmin_hash : Tx_rollup_l2_context_hash.t; (** The context hash of the commited context, used for checkout *) - tree_hash : Tezos_crypto.Context_hash.t; + tree_hash : Context_hash.t; (** The tree hash is the hash of the underlying tree in the {!Context}, used to produce proofs *) } diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.mli index d431b65218d6..0fc583712472 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.mli @@ -34,7 +34,7 @@ type t = { } (** Hash with b58check encoding txL2(54), for hashes of L2 transactions *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for transaction hash *) type hash = Hash.t diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.ml index aa1f6ff01081..4bdac8ceef4f 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.ml @@ -48,7 +48,7 @@ type level = Tx_rollup_level.t type header = { level : level; - tezos_block : Tezos_crypto.Block_hash.t; + tezos_block : Block_hash.t; predecessor : hash option; context : Tx_rollup_l2_context_hash.t; commitment : Tx_rollup_commitment_hash.t; @@ -64,8 +64,8 @@ type 'inbox block = { type t = Inbox.t block type commitment_included_info = { - block : Tezos_crypto.Block_hash.t; - operation : Tezos_crypto.Operation_hash.t; + block : Block_hash.t; + operation : Operation_hash.t; } type metadata = { @@ -86,7 +86,7 @@ let header_encoding = {level; tezos_block; predecessor; context; commitment}) (obj5 (req "level" Tx_rollup_level.encoding) - (req "tezos_block" Tezos_crypto.Block_hash.encoding) + (req "tezos_block" Block_hash.encoding) (opt "predecessor" Hash.encoding) (req "context" Tx_rollup_l2_context_hash.encoding) (req "commitment" Tx_rollup_commitment_hash.encoding)) @@ -110,8 +110,8 @@ let commitment_included_info_encoding = (fun {block; operation} -> (block, operation)) (fun (block, operation) -> {block; operation}) (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "operation" Tezos_crypto.Operation_hash.encoding)) + (req "block" Block_hash.encoding) + (req "operation" Operation_hash.encoding)) let metadata_encoding = let open Data_encoding in diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.mli index a5176b6a5db6..b4cacf8ba1b9 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/l2block.mli @@ -29,7 +29,7 @@ open Alpha_context (** {2 Types for L2 block and header} *) (** Hash with b58check encoding BTx(53), for hashes of L2 block headers *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for block (header) hashes *) type hash = Hash.t @@ -40,7 +40,7 @@ type level = Tx_rollup_level.t (** Type of L2 block headers *) type header = { level : level; (** The level of the L2 block *) - tezos_block : Tezos_crypto.Block_hash.t; + tezos_block : Block_hash.t; (** The Tezos block on which this L2 block in anchored, i.e. the Tezos block in which the inbox was sent *) predecessor : hash option; (** The hash predecessor L2 block *) @@ -63,8 +63,8 @@ type 'inbox block = { type t = Inbox.t block type commitment_included_info = { - block : Tezos_crypto.Block_hash.t; - operation : Tezos_crypto.Operation_hash.t; + block : Block_hash.t; + operation : Operation_hash.t; } (** Metadata for the block *) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/state.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/state.ml index 21895ff640dd..8c34ba3d8740 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/state.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/state.ml @@ -30,7 +30,7 @@ open Protocol_client_context open Injector_common module Tezos_blocks_cache = Aches_lwt.Lache.Make_option - (Aches.Rache.Transfer (Aches.Rache.LRU) (Tezos_crypto.Block_hash)) + (Aches.Rache.Transfer (Aches.Rache.LRU) (Block_hash)) type rollup_info = Stores.rollup_info = { rollup_id : Tx_rollup.t; diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/state.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/state.mli index dd73a1ce51f6..34affe284b61 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/state.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/state.mli @@ -33,7 +33,7 @@ open Injector_common data. *) module Tezos_blocks_cache : - Aches_lwt.Lache.MAP_OPTION with type key = Tezos_crypto.Block_hash.t + Aches_lwt.Lache.MAP_OPTION with type key = Block_hash.t (** Information about the rollup that is kept in the state. *) type rollup_info = Stores.rollup_info = { @@ -102,12 +102,10 @@ val get_header : t -> L2block.hash -> L2block.header option Lwt.t there is no inbox for an L1 block, we associate to it the L2 block of its predecessor. So [get_tezos_l2_block_hash state h] returns L2 block hash at which the rollup was when the Tezos node was at block [h]. *) -val get_tezos_l2_block_hash : - t -> Tezos_crypto.Block_hash.t -> L2block.hash option Lwt.t +val get_tezos_l2_block_hash : t -> Block_hash.t -> L2block.hash option Lwt.t (** Same as {!get_tezos_block} but retrieves the associated L2 block at the same time. *) -val get_tezos_l2_block : - t -> Tezos_crypto.Block_hash.t -> L2block.t option Lwt.t +val get_tezos_l2_block : t -> Block_hash.t -> L2block.t option Lwt.t (** Same as {!get_level} but retrieves the associated header at the same time. *) val get_level_l2_block_header : @@ -121,9 +119,7 @@ val get_level_l2_block : t -> L2block.level -> L2block.t option Lwt.t block for the Tezos block, or [None] otherwise. It returns [`Unknown] when the Tezos block has never been processed. *) val tezos_block_already_processed : - t -> - Tezos_crypto.Block_hash.t -> - [> `Known of L2block.t option | `Unknown] Lwt.t + t -> Block_hash.t -> [> `Known of L2block.t option | `Unknown] Lwt.t (** Returns the inclusion info for a commitment. *) val get_included_commitment : @@ -149,9 +145,7 @@ val set_head : t -> L2block.t -> L2block.t reorg tzresult Lwt.t (** Set the Tezos head and returns the reorganization of L1 blocks. *) val set_tezos_head : - t -> - Tezos_crypto.Block_hash.t -> - Alpha_block_services.block_info reorg tzresult Lwt.t + t -> Block_hash.t -> Alpha_block_services.block_info reorg tzresult Lwt.t (** Save an L2 block to disk: - Save both the header and the inbox @@ -167,18 +161,18 @@ val save_level : t -> L2block.level -> L2block.hash -> unit Lwt.t predecessor as well. *) val save_tezos_block_info : t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> L2block.hash option -> level:int32 -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> unit Lwt.t (** Register a commitment as included on L1. *) val set_commitment_included : t -> Tx_rollup_commitment_hash.t -> - Tezos_crypto.Block_hash.t -> - Tezos_crypto.Operation_hash.t -> + Block_hash.t -> + Operation_hash.t -> unit Lwt.t (** Register a commitment as not included on L1. *) @@ -203,9 +197,7 @@ val rollup_operation_index : int (** Fetch a Tezos block from the cache or the node *) val fetch_tezos_block : - t -> - Tezos_crypto.Block_hash.t -> - Alpha_block_services.block_info tzresult Lwt.t + t -> Block_hash.t -> Alpha_block_services.block_info tzresult Lwt.t (** Compute the reorganization of L2 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/stores.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/stores.ml index 7687f5fbf552..0fa2bb8ff690 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/stores.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/stores.ml @@ -358,7 +358,7 @@ module L2_level_key = struct end module Operation_key = struct - include Tezos_crypto.Operation_hash + include Operation_hash (* [hash] in Tezos_crypto.Blake2B.Make is {!Stdlib.Hashtbl.hash} which is 30 bits *) let hash_size = 30 (* in bits *) @@ -461,7 +461,7 @@ module Tezos_block_info = struct type t = { l2_block : L2block.hash option; level : int32; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } let t = @@ -471,8 +471,7 @@ module Tezos_block_info = struct (fun (l2_block, level, predecessor) -> {l2_block; level; predecessor}) (fun {l2_block; level; predecessor} -> (l2_block, level, predecessor)) - let encoded_size = - L2block.Hash.size + 4 (* level *) + Tezos_crypto.Block_hash.size + let encoded_size = L2block.Hash.size + 4 (* level *) + Block_hash.size let encode v = let dst = Bytes.create encoded_size in @@ -483,9 +482,7 @@ module Tezos_block_info = struct in let offset = blit ~src:l2_block_bytes ~dst 0 in let offset = bytes_set_int32 ~dst ~src:v.level offset in - let _ = - blit ~src:(Tezos_crypto.Block_hash.to_bytes v.predecessor) ~dst offset - in + let _ = blit ~src:(Block_hash.to_bytes v.predecessor) ~dst offset in Bytes.unsafe_to_string dst let decode str offset = @@ -496,20 +493,13 @@ module Tezos_block_info = struct in let level, offset = read_int32 str offset in let predecessor, _ = - read_str - str - ~offset - ~len:Tezos_crypto.Block_hash.size - Tezos_crypto.Block_hash.of_string_exn + read_str str ~offset ~len:Block_hash.size Block_hash.of_string_exn in {l2_block; level; predecessor} end module Commitment_info = struct - type t = { - block : Tezos_crypto.Block_hash.t; - operation : Tezos_crypto.Operation_hash.t; - } + type t = {block : Block_hash.t; operation : Operation_hash.t} let t = let open Repr in @@ -518,31 +508,20 @@ module Commitment_info = struct (fun (block, operation) -> {block; operation}) (fun {block; operation} -> (block, operation)) - let encoded_size = - Tezos_crypto.Block_hash.size + Tezos_crypto.Operation_hash.size + let encoded_size = Block_hash.size + Operation_hash.size let encode v = let dst = Bytes.create encoded_size in - let offset = blit ~src:(Tezos_crypto.Block_hash.to_bytes v.block) ~dst 0 in - let _ = - blit ~src:(Tezos_crypto.Operation_hash.to_bytes v.operation) ~dst offset - in + let offset = blit ~src:(Block_hash.to_bytes v.block) ~dst 0 in + let _ = blit ~src:(Operation_hash.to_bytes v.operation) ~dst offset in Bytes.unsafe_to_string dst let decode str offset = let block, offset = - read_str - str - ~offset - ~len:Tezos_crypto.Block_hash.size - Tezos_crypto.Block_hash.of_string_exn + read_str str ~offset ~len:Block_hash.size Block_hash.of_string_exn in let operation, _ = - read_str - str - ~offset - ~len:Tezos_crypto.Operation_hash.size - Tezos_crypto.Operation_hash.of_string_exn + read_str str ~offset ~len:Operation_hash.size Operation_hash.of_string_exn in {block; operation} end @@ -551,7 +530,7 @@ module Tezos_block_store = struct type value = Tezos_block_info.t = { l2_block : L2block.hash option; level : int32; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } include @@ -569,8 +548,8 @@ module Level_store = module Commitment_store = struct type value = Commitment_info.t = { - block : Tezos_crypto.Block_hash.t; - operation : Tezos_crypto.Operation_hash.t; + block : Block_hash.t; + operation : Operation_hash.t; } include @@ -730,11 +709,11 @@ module Head_store = Make_singleton (struct end) module Tezos_head_store = Make_singleton (struct - type t = Tezos_crypto.Block_hash.t + type t = Block_hash.t let name = "tezos_head" - let encoding = Tezos_crypto.Block_hash.encoding + let encoding = Block_hash.encoding end) type rollup_info = { diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/stores.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/stores.mli index cae8329b0109..287ab3861d7c 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/stores.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/stores.mli @@ -124,13 +124,10 @@ module Tezos_block_store : sig type value = { l2_block : L2block.hash option; level : int32; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } - include - INDEXABLE_STORE - with type key := Tezos_crypto.Block_hash.t - and type value := value + include INDEXABLE_STORE with type key := Block_hash.t and type value := value end (** An index store to map L2 block level to L2 block hashes. It is composed @@ -143,9 +140,9 @@ module Level_store : (** An index store to map commitment hashes to their inclusion information. *) module Commitment_store : sig type value = { - block : Tezos_crypto.Block_hash.t; + block : Block_hash.t; (** Tezos block in which the commitment is included. *) - operation : Tezos_crypto.Operation_hash.t; + operation : Operation_hash.t; (** Operation of the block in which the commitment is included. *) } @@ -161,8 +158,7 @@ end module Head_store : SINGLETON_STORE with type value := L2block.hash (** A store composed of a single file on disk to store the current Tezos head *) -module Tezos_head_store : - SINGLETON_STORE with type value := Tezos_crypto.Block_hash.t +module Tezos_head_store : SINGLETON_STORE with type value := Block_hash.t (** Type for on disk information about a rollup *) type rollup_info = { diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/RPC_server.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/RPC_server.ml index 4fe448e05fb5..ca55fb24a41b 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/RPC_server.ml @@ -184,7 +184,7 @@ end) module Block_directory = Make_directory (struct include Sc_rollup_services.Global.Block - type context = Node_context.ro * Tezos_crypto.Block_hash.t + type context = Node_context.ro * Block_hash.t let context_of_prefix node_ctxt (((), block) : prefix) = let open Lwt_result_syntax in @@ -202,8 +202,7 @@ end) module Outbox_directory = Make_directory (struct include Sc_rollup_services.Global.Block.Outbox - type context = - Node_context.ro * Tezos_crypto.Block_hash.t * Alpha_context.Raw_level.t + type context = Node_context.ro * Block_hash.t * Alpha_context.Raw_level.t let context_of_prefix node_ctxt (((), block), level) = let open Lwt_result_syntax in diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/batcher_worker_types.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/batcher_worker_types.ml index ac2201e49d44..63afd1221a6d 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/batcher_worker_types.ml @@ -70,7 +70,7 @@ module Request = struct Format.fprintf ppf "switching to new L1 head %a at level %ld" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash level | Batch -> Format.pp_print_string ppf "batch" diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment.ml index 0c9c6fa82291..b1a5c83952f2 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment.ml @@ -148,8 +148,7 @@ module Make (PVM : Pvm.S) : Commitment_sig.S with module PVM = PVM = struct let* last_commitment_hash = let*! pred = Store.L2_blocks.find node_ctxt.store predecessor in match pred with - | None -> - failwith "Missing block %a" Tezos_crypto.Block_hash.pp predecessor + | None -> failwith "Missing block %a" Block_hash.pp predecessor | Some pred -> return (Sc_rollup_block.most_recent_commitment pred.header) in diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment_sig.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment_sig.ml index 0b5faa4c6cf2..b8527a283391 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment_sig.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/commitment_sig.ml @@ -49,7 +49,7 @@ module type S = sig the hash of to be included in the commitment. *) val process_head : Node_context.rw -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> Layer1.head -> Context.rw -> Protocol.Alpha_context.Sc_rollup.Commitment.Hash.t option tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/configuration.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/configuration.ml index 8444a987b87c..92e338776b9c 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/configuration.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/configuration.ml @@ -185,7 +185,7 @@ let protocol_max_batch_size = let open Alpha_context in let open Operation in { - shell = {branch = Tezos_crypto.Block_hash.zero}; + shell = {branch = Block_hash.zero}; protocol_data = { signature = Some Tezos_crypto.Signature.zero; diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/context.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/context.ml index 0df91a965c46..f3d0059b22e4 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/context.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/context.ml @@ -112,7 +112,7 @@ let index context = context.index module Proof (Hash : sig type t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end) (Proof_encoding : sig val proof_encoding : Environment.Context.Proof.tree Environment.Context.Proof.t Data_encoding.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/context.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/context.mli index 76a0f70c2924..ce4cfc1769bb 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/context.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/context.mli @@ -91,7 +91,7 @@ val is_empty : _ t -> bool module Proof (Hash : sig type t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end) (Proof_encoding : sig val proof_encoding : Environment.Context.Proof.tree Environment.Context.Proof.t Data_encoding.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml index 262676f62d4c..236149238d40 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon.ml @@ -230,7 +230,7 @@ module Make (PVM : Pvm.S) = struct | None -> failwith "Missing L2 predecessor %a for previous commitment" - Tezos_crypto.Block_hash.pp + Block_hash.pp predecessor | Some pred -> return (Sc_rollup_block.most_recent_commitment pred.header) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.ml index 8b99312a3dce..61958297e722 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.ml @@ -37,7 +37,7 @@ module Simple = struct ~name:"sc_rollup_daemon_process_head" ~msg:"Processing {finalized} head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) ("finalized", Data_encoding.bool) ~pp3:(fun fmt finalized -> @@ -49,7 +49,7 @@ module Simple = struct ~name:"sc_rollup_node_layer_1_new_head_processed" ~msg:"Finished processing layer 1 head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) let processing_heads_iteration = diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.mli index 6f6004363c7a..67e85d657b02 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/daemon_event.mli @@ -32,12 +32,11 @@ open Alpha_context (** [head_processing hash level ~finalized] emits the event that the block of the given [hash] and at the given [level] is being processed, and whether it is [finalized]. *) -val head_processing : - Tezos_crypto.Block_hash.t -> int32 -> finalized:bool -> unit Lwt.t +val head_processing : Block_hash.t -> int32 -> finalized:bool -> unit Lwt.t (** [new_head_processed hash level] emits the event that the daemon has finished processing the head of the given [hash] and at the given [level]. *) -val new_head_processed : Tezos_crypto.Block_hash.t -> int32 -> unit Lwt.t +val new_head_processed : Block_hash.t -> int32 -> unit Lwt.t (** [processing_heads_iteration heads] emits the event that the [heads] are going to be processed. *) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.ml index 3a1af0ef8950..66accb28c14f 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.ml @@ -47,7 +47,7 @@ let ancestor_hash ~number_of_levels {Node_context.genesis_info; l1_ctxt; _} head the slot has been confirmed after the attestation_lag has passed. *) type confirmations_info = { (* The hash of the block in which the slots have been published. *) - published_block_hash : Tezos_crypto.Block_hash.t; + published_block_hash : Block_hash.t; (* The indexes of slots that have beenp published in block with hash `published_block_hash`, and have later been confirmed. *) confirmed_slots_indexes : Bitset.t; @@ -308,7 +308,7 @@ module Confirmed_slots_history = struct "The confirmed DAL %S for block hash %a (level = %a) is not expected \ to be found in the store, but is exists." entry_kind - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Raw_level.pp block_level @@ -317,7 +317,7 @@ module Confirmed_slots_history = struct "The confirmed DAL %S for block hash %a (level = %a) is expected to \ be found in the store, but is missing." entry_kind - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Raw_level.pp block_level diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.mli index 0e77b548a601..458d3735649f 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker.mli @@ -42,14 +42,14 @@ val is_slot_confirmed : that [slot_index] is unconfirmed in the block with hash in [node_ctxt.store]. *) val save_unconfirmed_slot : - Node_context.rw -> Tezos_crypto.Block_hash.t -> Dal.Slot_index.t -> unit Lwt.t + Node_context.rw -> Block_hash.t -> Dal.Slot_index.t -> unit Lwt.t (** [save_confirmed_slot node_ctxt hash slot_index] saves in [node_ctxt.store] that [slot_index] is confirmed in the block with hashin [node_ctxt.store]. The contents of the slot are set to [pages] in [node_ctxt.store]. *) val save_confirmed_slot : Node_context.rw -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Dal.Slot_index.t -> Dal.Page.content list -> unit Lwt.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker_event.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker_event.ml index c66573018673..84ed4506c47f 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker_event.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/dal_slots_tracker_event.ml @@ -41,8 +41,8 @@ module Simple = struct {confirmed_hash}. The slot contents will be downloaded." ~level:Notice ("slot_index", Dal.Slot_index.encoding) - ("published_hash", Tezos_crypto.Block_hash.encoding) - ("confirmed_hash", Tezos_crypto.Block_hash.encoding) + ("published_hash", Block_hash.encoding) + ("confirmed_hash", Block_hash.encoding) end let slot_has_been_confirmed slot published_hash confirmed_hash = diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.ml index 07aa6a1facb4..8080b46c2a94 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.ml @@ -72,7 +72,7 @@ module State = struct (* Invariant broken, the inbox for this level should exist. *) failwith "The inbox for block hash %a (level = %ld) is missing." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash block_level else diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.mli index 4765aceb02d1..7323c3b51976 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox.mli @@ -53,8 +53,7 @@ val process_head : (** [inbox_of_hash node_ctxt block_hash] returns the rollup inbox at the end of the given validation of [block_hash]. NOTE: It requires the L2 block for [block_hash] to have been saved. *) -val inbox_of_hash : - _ Node_context.t -> Tezos_crypto.Block_hash.t -> Inbox.t tzresult Lwt.t +val inbox_of_hash : _ Node_context.t -> Block_hash.t -> Inbox.t tzresult Lwt.t (** [inbox_of_head node_ctxt block_head] returns the rollup inbox at the end of the given validation of [block_head]. NOTE: It requires the L2 block for @@ -68,7 +67,7 @@ val start : unit -> unit Lwt.t [messages] to the [inbox] using {!Inbox.add_all_messages}. *) val add_messages : predecessor_timestamp:Timestamp.time -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> Inbox.t -> Inbox_message.t list -> (Inbox_merkelized_payload_hashes.History.t @@ -84,7 +83,7 @@ val add_messages : store payloads histories (which contain merkelized skip lists) but simply messages. *) val payloads_history_of_messages : - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> predecessor_timestamp:Timestamp.time -> Sc_rollup.Inbox_message.t list -> Sc_rollup.Inbox_merkelized_payload_hashes.History.t tzresult diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.ml index b3e57760ef6b..18d83fc56dcd 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.ml @@ -52,7 +52,7 @@ module Simple = struct "Fetching {number_of_messages} messages from block {hash} at level \ {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) ("number_of_messages", Data_encoding.int32) end diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.mli index c56ea8ad6ae7..72a3b8200880 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/inbox_event.mli @@ -32,4 +32,4 @@ val stopping : unit -> unit Lwt.t (** [get_messages hash level n] emits the event that [n] messages are being fetched from the block of the given [hash] at the given [level]. *) -val get_messages : Tezos_crypto.Block_hash.t -> int32 -> int -> unit Lwt.t +val get_messages : Block_hash.t -> int32 -> int -> unit Lwt.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/interpreter.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/interpreter.ml index e3952b6503d4..6b51421e1286 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/interpreter.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/interpreter.ml @@ -73,7 +73,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let missing_boot_sector () = failwith "Boot sector not found in Tezos block %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash in Lwt.catch diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.ml index 95fc601d3ee6..b47052ff448d 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.ml @@ -35,7 +35,7 @@ open Injector_common *) -type error += Cannot_find_block of Tezos_crypto.Block_hash.t +type error += Cannot_find_block of Block_hash.t let () = register_error_kind @@ -46,14 +46,14 @@ let () = Format.fprintf ppf "Block with hash %a was not found on the L1 node." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_find_block hash -> Some hash | _ -> None) (fun hash -> Cannot_find_block hash) -type error += Cannot_find_predecessor of Tezos_crypto.Block_hash.t +type error += Cannot_find_predecessor of Block_hash.t let () = register_error_kind @@ -64,10 +64,10 @@ let () = Format.fprintf ppf "Block with hash %a has no predecessor on the L1 node." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_find_predecessor hash -> Some hash | _ -> None) (fun hash -> Cannot_find_predecessor hash) @@ -78,20 +78,18 @@ let () = *) -type head = {hash : Tezos_crypto.Block_hash.t; level : int32} +type head = {hash : Block_hash.t; level : int32} let head_encoding = Data_encoding.( conv (fun {hash; level} -> (hash, level)) (fun (hash, level) -> {hash; level}) - (obj2 - (req "hash" Tezos_crypto.Block_hash.encoding) - (req "level" Data_encoding.int32))) + (obj2 (req "hash" Block_hash.encoding) (req "level" Data_encoding.int32))) module Blocks_cache = Aches_lwt.Lache.Make_option - (Aches.Rache.Transfer (Aches.Rache.LRU) (Tezos_crypto.Block_hash)) + (Aches.Rache.Transfer (Aches.Rache.LRU) (Block_hash)) type blocks_cache = Protocol_client_context.Alpha_block_services.block_info Blocks_cache.t @@ -125,8 +123,7 @@ let predecessors_of_blocks hashes = let get_predecessor = let max_cached = 1023 and max_read = 8 in let module HM = - Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) (Block_hash) in let cache = HM.create max_cached in fun cctxt (chain : Tezos_shell_services.Chain_services.chain) ancestor -> @@ -280,7 +277,7 @@ let get_tezos_reorg_for_new_head l1_state old_head new_head = let open Lwt_result_syntax in (* old_head and new_head must have the same level when calling aux *) let rec aux reorg old_head new_head = - if Tezos_crypto.Block_hash.(old_head.hash = new_head.hash) then return reorg + if Block_hash.(old_head.hash = new_head.hash) then return reorg else let* old_head_pred = get_predecessor l1_state old_head in let* new_head_pred = get_predecessor l1_state new_head in diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.mli index 94457c0091f0..ab5c194a6212 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1.mli @@ -29,7 +29,7 @@ subscribing to the head monitoring RPC offered by the Tezos node. *) -type head = {hash : Tezos_crypto.Block_hash.t; level : int32} +type head = {hash : Block_hash.t; level : int32} val head_encoding : head Data_encoding.t @@ -76,14 +76,14 @@ val shutdown : t -> unit Lwt.t [hash]. Looks for the block in the blocks cache first, and fetches it from the L1 node otherwise. *) val fetch_tezos_shell_header : - t -> Tezos_crypto.Block_hash.t -> Block_header.shell_header tzresult Lwt.t + t -> Block_hash.t -> Block_header.shell_header tzresult Lwt.t (** [fetch_tezos_block l1_ctxt hash] returns a block info given a block hash. Looks for the block in the blocks cache first, and fetches it from the L1 node otherwise. *) val fetch_tezos_block : t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Protocol_client_context.Alpha_block_services.block_info tzresult Lwt.t (** [nth_predecessor l1_ctxt n head] return [block, history] where [block] is diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.ml index 31aae66ddb52..6e9773d48ec2 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.ml @@ -50,7 +50,7 @@ module Simple = struct ~name:"sc_rollup_node_layer_1_new_head" ~msg:"Layer 1 node has switched to head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) end diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.mli index 467da2e23f72..5b8ff83a660c 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/layer1_event.mli @@ -32,4 +32,4 @@ val stopping : unit -> unit Lwt.t (** [switched_new_head hash level] emits the event that the layer 1 has notified a new head with [hash] at some given [level]. *) -val switched_new_head : Tezos_crypto.Block_hash.t -> int32 -> unit Lwt.t +val switched_new_head : Block_hash.t -> int32 -> unit Lwt.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli index 3611b0e41cca..fc1769ceff9d 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/node_context.mli @@ -111,8 +111,7 @@ val init : (** [checkout_context node_ctxt block_hash] returns the context at block [block_hash]. *) -val checkout_context : - 'a t -> Tezos_crypto.Block_hash.t -> 'a Context.t tzresult Lwt.t +val checkout_context : 'a t -> Block_hash.t -> 'a Context.t tzresult Lwt.t (** [metadata node_ctxt] creates a {Sc_rollup.Metadata.t} using the information stored in [node_ctxt]. *) @@ -131,5 +130,4 @@ type 'a delayed_write = ('a, rw) Delayed_write_monad.t (** [get_full_l2_block node_ctxt hash] returns the full L2 block for L1 block hash [hash]. The result contains the L2 block and its content (inbox, messages, commitment). *) -val get_full_l2_block : - _ t -> Tezos_crypto.Block_hash.t -> Sc_rollup_block.full Lwt.t +val get_full_l2_block : _ t -> Block_hash.t -> Sc_rollup_block.full Lwt.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/sc_rollup_node_errors.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/sc_rollup_node_errors.ml index ceabd9516501..e4fec530e84d 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/sc_rollup_node_errors.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/sc_rollup_node_errors.ml @@ -37,9 +37,8 @@ type error += layer1_inbox : Sc_rollup.Inbox.t; inbox : Sc_rollup.Inbox.t; } - | Missing_PVM_state of Tezos_crypto.Block_hash.t * Int32.t - | Cannot_checkout_context of - Tezos_crypto.Block_hash.t * Sc_rollup_context_hash.t option + | Missing_PVM_state of Block_hash.t * Int32.t + | Cannot_checkout_context of Block_hash.t * Sc_rollup_context_hash.t option | No_batcher type error += @@ -170,11 +169,10 @@ let () = Format.fprintf ppf "Cannot retrieve PVM state for block %a at level %ld" - Tezos_crypto.Block_hash.pp + Block_hash.pp block level) - Data_encoding.( - obj2 (req "block" Tezos_crypto.Block_hash.encoding) (req "level" int32)) + Data_encoding.(obj2 (req "block" Block_hash.encoding) (req "level" int32)) (function | Missing_PVM_state (block, level) -> Some (block, level) | _ -> None) (fun (block, level) -> Missing_PVM_state (block, level)) ; @@ -193,11 +191,11 @@ let () = ~none:"" ~some:Sc_rollup_context_hash.to_b58check context_hash) - Tezos_crypto.Block_hash.pp + Block_hash.pp block) Data_encoding.( obj2 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (opt "context" Sc_rollup_context_hash.encoding)) (function | Cannot_checkout_context (block, context) -> Some (block, context) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.ml index 25d2ec2c3923..9072a8814725 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.ml @@ -36,7 +36,7 @@ module type S = sig type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } type t = { @@ -74,7 +74,7 @@ module Make (Interpreter : Interpreter.S) : type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } type t = { diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.mli index 49e0da506df7..ad4faaedfd0e 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/simulation.mli @@ -36,7 +36,7 @@ module type S = sig type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } (** Type of the state for a simulation. *) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/state.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/state.ml index 7c189136e987..9c71b60c5017 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/state.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/state.ml @@ -69,11 +69,11 @@ module Store = struct let to_path_representation = Int32.to_string end) (struct - type value = Tezos_crypto.Block_hash.t + type value = Block_hash.t let name = "block_hash" - let encoding = Tezos_crypto.Block_hash.encoding + let encoding = Block_hash.encoding end) end @@ -136,8 +136,7 @@ let block_before store tick = let rec search block_hash = let*! block = Raw_store.L2_blocks.find store block_hash in match block with - | None -> - failwith "Missing block %a" Tezos_crypto.Block_hash.pp block_hash + | None -> failwith "Missing block %a" Block_hash.pp block_hash | Some block -> if Sc_rollup.Tick.(block.initial_tick <= tick) then return_some block diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/state.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/state.mli index 3481f831c419..a5c7335a19bd 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/state.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/state.mli @@ -27,7 +27,7 @@ open Protocol.Alpha_context (** [is_processed store hash] returns [true] if the block with [hash] has already been processed by the daemon. *) -val is_processed : _ Store.t -> Tezos_crypto.Block_hash.t -> bool Lwt.t +val is_processed : _ Store.t -> Block_hash.t -> bool Lwt.t (** [mark_processed_head store head] remembers that the [head] is processed. The system should not have to come back to it. *) @@ -47,13 +47,11 @@ val get_finalized_head_opt : _ Store.t -> Layer1.head option Lwt.t (** [hash_of_level node_ctxt level] returns the current block hash for a given [level]. *) -val hash_of_level : - _ Node_context.t -> int32 -> Tezos_crypto.Block_hash.t tzresult Lwt.t +val hash_of_level : _ Node_context.t -> int32 -> Block_hash.t tzresult Lwt.t (** [hash_of_level_opt] is like {!hash_of_level} but returns [None] if the [level] is not known. *) -val hash_of_level_opt : - _ Node_context.t -> int32 -> Tezos_crypto.Block_hash.t option Lwt.t +val hash_of_level_opt : _ Node_context.t -> int32 -> Block_hash.t option Lwt.t (** [save_level store head] registers the correspondences [head.level |-> head.hash] in the store. *) @@ -61,8 +59,7 @@ val save_level : Store.rw -> Layer1.head -> unit Lwt.t (** [level_of_hash node_ctxt hash] returns the level for Tezos block hash [hash] if it is known by the Tezos Layer 1 node. *) -val level_of_hash : - _ Node_context.t -> Tezos_crypto.Block_hash.t -> int32 tzresult Lwt.t +val level_of_hash : _ Node_context.t -> Block_hash.t -> int32 tzresult Lwt.t (** [block_before store tick] returns the last layer 2 block whose initial tick is before [tick]. *) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/store.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/store.ml index 3889830f6dd2..2c7b9924c0fb 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/store.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/store.ml @@ -57,9 +57,9 @@ module L2_blocks = let path = ["state_info"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Sc_rollup_block.t @@ -72,7 +72,7 @@ module L2_blocks = (** Unaggregated messages per block *) module Messages = struct type info = { - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; predecessor_timestamp : Timestamp.t; messages : Sc_rollup.Inbox_message.t list; } @@ -85,7 +85,7 @@ module Messages = struct (fun (predecessor, predecessor_timestamp, messages) -> {predecessor; predecessor_timestamp; messages}) @@ obj3 - (req "predecessor" Tezos_crypto.Block_hash.encoding) + (req "predecessor" Block_hash.encoding) (req "predecessor_timestamp" Timestamp.encoding) (req "messages" @@ -191,9 +191,9 @@ module Dal_slot_pages = let path = ["dal"; "slot_pages"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t * Dal.Page.Index.t @@ -223,9 +223,9 @@ module Dal_processed_slots = let path = ["dal"; "processed_slots"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t @@ -265,9 +265,9 @@ module Dal_slots_headers = let path = ["dal"; "slot_headers"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t @@ -301,9 +301,9 @@ module Dal_confirmed_slots_history = let path = ["dal"; "confirmed_slots_history"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Dal.Slots_history.t @@ -323,9 +323,9 @@ module Dal_confirmed_slots_histories = let path = ["dal"; "confirmed_slots_histories_cache"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Dal.Slots_history.History_cache.t diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/store.mli b/src/proto_016_PtMumbai/bin_sc_rollup_node/store.mli index c30861a40e78..05766389c95a 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/store.mli +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/store.mli @@ -58,14 +58,14 @@ val readonly : _ t -> ro module L2_blocks : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Sc_rollup_block.t and type 'a store := 'a store (** Storage for persisting messages downloaded from the L1 node. *) module Messages : sig type info = { - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; predecessor_timestamp : Timestamp.t; messages : Sc_rollup.Inbox_message.t list; } @@ -114,14 +114,14 @@ module Commitments_published_at_level : list into a [Dal.Slot_index.t]-indexed map. *) module Dal_slots_headers : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t and type value := Dal.Slot.Header.t and type 'a store := 'a store module Dal_confirmed_slots_history : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Dal.Slots_history.t and type 'a store := 'a store @@ -129,7 +129,7 @@ module Dal_confirmed_slots_history : {Dal_slot_repr.Slots_history} for more details. *) module Dal_confirmed_slots_histories : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Dal.Slots_history.History_cache.t and type 'a store := 'a store @@ -141,7 +141,7 @@ module Dal_confirmed_slots_histories : *) module Dal_slot_pages : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t * Dal.Page.Index.t and type value := Dal.Page.content and type 'a store := 'a store @@ -155,7 +155,7 @@ module Dal_slot_pages : *) module Dal_processed_slots : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t and type value := [`Confirmed | `Unconfirmed] and type 'a store := 'a store diff --git a/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml b/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml index 2003cedff97d..c6c80fa3bf4e 100644 --- a/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml +++ b/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml @@ -90,6 +90,6 @@ let make ~rng_state = (* Required for eg Create_contract *) Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in return (ctxt, step_constants) diff --git a/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml b/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml index c9a9d36e0612..5162851c02af 100644 --- a/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml @@ -107,7 +107,6 @@ end) : S = struct let _, _, sk = generate_key ~seed () in Tezos_crypto.Signature.of_bls (sign sk msg) | _ -> - let open Tezos_crypto.Signature in let bytes = Base_samplers.uniform_bytes ~nbytes:Tezos_crypto.Ed25519.size diff --git a/src/proto_016_PtMumbai/lib_benchmark/test/test_helpers.ml b/src/proto_016_PtMumbai/lib_benchmark/test/test_helpers.ml index 5677355b0bb9..8d5db86cc9ed 100644 --- a/src/proto_016_PtMumbai/lib_benchmark/test/test_helpers.ml +++ b/src/proto_016_PtMumbai/lib_benchmark/test/test_helpers.ml @@ -71,7 +71,7 @@ let typecheck_by_tezos = return @@ Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in fun bef node -> Stdlib.Result.get_ok diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml index cffa19ba6874..37f91ab77e95 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml @@ -72,7 +72,7 @@ let default_raw_context () = context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero ~typecheck in Lwt.return @@ Environment.wrap_tzresult e diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml index 1e05cabccde1..237da10839e0 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/ticket_benchmarks.ml @@ -154,7 +154,7 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let benchmark rng_state _conf () = let bytes = Base_samplers.bytes rng_state ~size:{min = 32; max = 64} in - let branch = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let branch = Block_hash.hash_bytes [bytes] in let op_hash = Operation.hash_raw {shell = {branch}; proto = bytes} in let nonce = Origination_nonce.Internal_for_tests.initial op_hash in let contract = Contract.Internal_for_tests.originated_contract nonce in diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_args.ml b/src/proto_016_PtMumbai/lib_client/client_proto_args.ml index be80dbb4b9fb..330e5aab280c 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_args.ml +++ b/src/proto_016_PtMumbai/lib_client/client_proto_args.ml @@ -674,7 +674,7 @@ module Tx_rollup = struct let context_hash_parameter = Tezos_clic.parameter (fun _ s -> - match Tezos_crypto.Context_hash.of_b58check_opt s with + match Context_hash.of_b58check_opt s with | Some hash -> return hash | None -> failwith diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_args.mli b/src/proto_016_PtMumbai/lib_client/client_proto_args.mli index bf35ce4dae9c..5b600ccc4d50 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_args.mli +++ b/src/proto_016_PtMumbai/lib_client/client_proto_args.mli @@ -183,7 +183,7 @@ module Tx_rollup : sig ?name:string -> usage:string -> ('a, full) Tezos_clic.params -> - (Tezos_crypto.Context_hash.t -> 'a, full) Tezos_clic.params + (Context_hash.t -> 'a, full) Tezos_clic.params val message_result_path_param : ?name:string -> diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_context.ml b/src/proto_016_PtMumbai/lib_client/client_proto_context.ml index d3baa40fd962..d6b0426b818c 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_context.ml +++ b/src/proto_016_PtMumbai/lib_client/client_proto_context.ml @@ -808,7 +808,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -916,7 +916,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_context.mli b/src/proto_016_PtMumbai/lib_client/client_proto_context.mli index b078fc504922..12b34df096b1 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_context.mli +++ b/src/proto_016_PtMumbai/lib_client/client_proto_context.mli @@ -455,7 +455,7 @@ val activate_account : (** Activate an existing account, by calling {!Injection.inject_operation} with [activation code]. - It fails if the account is unknown or if the account is not [Tezos_crypto.Ed25519]. *) + It fails if the account is unknown or if the account is not [Signature.Ed25519]. *) val activate_existing_account : #Protocol_client_context.full -> chain:Shell_services.chain -> @@ -470,7 +470,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -523,7 +523,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t (** Calls {!Injection.inject_operation} @@ -538,7 +538,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -548,7 +548,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t (** Calls {!Tezos_protocol_alpha.Protocol.Alpha_services.Cache.cached_contracts} *) @@ -597,7 +597,7 @@ val originate_tx_rollup : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_origination Kind.manager contents * Kind.tx_rollup_origination Kind.manager Apply_results.contents_result) tzresult @@ -623,7 +623,7 @@ val submit_tx_rollup_batch : content:string -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_submit_batch Kind.manager contents * Kind.tx_rollup_submit_batch Kind.manager Apply_results.contents_result) tzresult @@ -651,7 +651,7 @@ val submit_tx_rollup_commitment : predecessor:Tx_rollup_commitment_hash.t option -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_commit Kind.manager contents * Kind.tx_rollup_commit Kind.manager Apply_results.contents_result) tzresult @@ -675,7 +675,7 @@ val submit_tx_rollup_finalize_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_finalize_commitment Kind.manager contents * Kind.tx_rollup_finalize_commitment Kind.manager Apply_results.contents_result) @@ -700,7 +700,7 @@ val submit_tx_rollup_remove_commitment : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_remove_commitment Kind.manager contents * Kind.tx_rollup_remove_commitment Kind.manager Apply_results.contents_result) tzresult @@ -729,12 +729,12 @@ val submit_tx_rollup_rejection : message_path:Tx_rollup_inbox.Merkle.path -> message_result_hash:Tx_rollup_message_result_hash.t -> message_result_path:Tx_rollup_commitment.Merkle.path -> - previous_context_hash:Tezos_crypto.Context_hash.t -> + previous_context_hash:Context_hash.t -> previous_withdraw_list_hash:Tx_rollup_withdraw_list_hash.t -> previous_message_result_path:Tx_rollup_commitment.Merkle.path -> proof:Tx_rollup_l2_proof.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_rejection Kind.manager contents * Kind.tx_rollup_rejection Kind.manager Apply_results.contents_result) tzresult @@ -758,7 +758,7 @@ val submit_tx_rollup_return_bond : fee_parameter:Injection.fee_parameter -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_return_bond Kind.manager contents * Kind.tx_rollup_return_bond Kind.manager Apply_results.contents_result) tzresult @@ -781,13 +781,13 @@ val tx_rollup_dispatch_tickets : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> level:Tx_rollup_level.t -> - context_hash:Tezos_crypto.Context_hash.t -> + context_hash:Context_hash.t -> message_position:int -> message_result_path:Tx_rollup_commitment.Merkle.path -> tickets_info:Tx_rollup_reveal.t list -> tx_rollup:Tx_rollup.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.tx_rollup_dispatch_tickets Kind.manager contents * Kind.tx_rollup_dispatch_tickets Kind.manager Apply_results.contents_result) tzresult @@ -816,7 +816,7 @@ val transfer_ticket : destination:Contract.t -> entrypoint:Entrypoint.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.transfer_ticket Kind.manager contents * Kind.transfer_ticket Kind.manager Apply_results.contents_result) tzresult @@ -842,7 +842,7 @@ val sc_rollup_originate : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_originate Kind.manager contents * Kind.sc_rollup_originate Kind.manager Apply_results.contents_result, tztrace ) @@ -867,7 +867,7 @@ val sc_rollup_add_messages : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_add_messages Kind.manager contents * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult @@ -892,7 +892,7 @@ val sc_rollup_cement : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_cement Kind.manager contents * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) tzresult @@ -917,7 +917,7 @@ val sc_rollup_publish : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_publish Kind.manager contents * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult @@ -943,7 +943,7 @@ val sc_rollup_execute_outbox_message : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.sc_rollup_execute_outbox_message Kind.manager contents * Kind.sc_rollup_execute_outbox_message Kind.manager Apply_results.contents_result, @@ -970,7 +970,7 @@ val sc_rollup_recover_bond : sc_rollup:Sc_rollup.t -> staker:public_key_hash -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_recover_bond Kind.manager contents * Kind.sc_rollup_recover_bond Kind.manager Apply_results.contents_result) tzresult @@ -996,7 +996,7 @@ val sc_rollup_refute : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_refute Kind.manager contents * Kind.sc_rollup_refute Kind.manager Apply_results.contents_result) tzresult @@ -1022,7 +1022,7 @@ val sc_rollup_timeout : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_timeout Kind.manager contents * Kind.sc_rollup_timeout Kind.manager Apply_results.contents_result) tzresult @@ -1049,7 +1049,7 @@ val zk_rollup_originate : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_origination Kind.manager contents * Kind.zk_rollup_origination Kind.manager Apply_results.contents_result, tztrace ) @@ -1075,7 +1075,7 @@ val zk_rollup_publish : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_publish Kind.manager contents * Kind.zk_rollup_publish Kind.manager Apply_results.contents_result, tztrace ) @@ -1101,7 +1101,7 @@ val zk_rollup_update : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_update Kind.manager contents * Kind.zk_rollup_update Kind.manager Apply_results.contents_result, tztrace ) diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_utils.mli b/src/proto_016_PtMumbai/lib_client/client_proto_utils.mli index e222f1745aff..3c06f0108ea8 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_utils.mli +++ b/src/proto_016_PtMumbai/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_016_PtMumbai/lib_client/injection.ml b/src/proto_016_PtMumbai/lib_client/injection.ml index 307aea3af98e..291a17304bee 100644 --- a/src/proto_016_PtMumbai/lib_client/injection.ml +++ b/src/proto_016_PtMumbai/lib_client/injection.ml @@ -57,15 +57,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee (contents : packed_contents_list) = let l = Operation.to_list contents in @@ -187,7 +184,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -1068,12 +1065,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -1084,8 +1081,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -1097,10 +1093,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -1161,10 +1157,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op, result.contents) @@ -1385,7 +1381,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch ~(src_pk : public_key) ~src_sk ~fee ~gas_limit ~storage_limit ?counter ?(replace_by_fees = false) ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * kind Kind.manager contents_list * kind Kind.manager contents_result_list) diff --git a/src/proto_016_PtMumbai/lib_client/injection.mli b/src/proto_016_PtMumbai/lib_client/injection.mli index c9d649eeb41b..18d87a3c0ba7 100644 --- a/src/proto_016_PtMumbai/lib_client/injection.mli +++ b/src/proto_016_PtMumbai/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -63,9 +63,7 @@ val simulate : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -85,8 +83,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> @@ -116,7 +113,7 @@ val inject_manager_operation : ?replace_by_fees:bool -> fee_parameter:fee_parameter -> 'kind Annotated_manager_operation.annotated_list -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * 'kind Kind.manager contents_list * 'kind Kind.manager contents_result_list) diff --git a/src/proto_016_PtMumbai/lib_client/mockup.ml b/src/proto_016_PtMumbai/lib_client/mockup.ml index ad1b10ea3158..09e517f76749 100644 --- a/src/proto_016_PtMumbai/lib_client/mockup.ml +++ b/src/proto_016_PtMumbai/lib_client/mockup.ml @@ -239,7 +239,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -259,14 +259,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -275,7 +275,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -451,7 +451,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in (match bootstrap_accounts_json with | None -> return None @@ -495,10 +495,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.generate_key () in diff --git a/src/proto_016_PtMumbai/lib_client/operation_result.ml b/src/proto_016_PtMumbai/lib_client/operation_result.ml index eeb1cd6def28..4a18ff228b63 100644 --- a/src/proto_016_PtMumbai/lib_client/operation_result.ml +++ b/src/proto_016_PtMumbai/lib_client/operation_result.ml @@ -1025,9 +1025,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -1080,9 +1080,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1095,9 +1095,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1119,7 +1119,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_result -> Format.fprintf @@ -1128,7 +1128,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_016_PtMumbai/lib_client/proxy.ml b/src/proto_016_PtMumbai/lib_client/proxy.ml index b499c4fc1233..2f1445844d70 100644 --- a/src/proto_016_PtMumbai/lib_client/proxy.ml +++ b/src/proto_016_PtMumbai/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = diff --git a/src/proto_016_PtMumbai/lib_client_commands/client_proto_context_commands.ml b/src/proto_016_PtMumbai/lib_client_commands/client_proto_context_commands.ml index 10cd36208859..632bda85d7c6 100644 --- a/src/proto_016_PtMumbai/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_016_PtMumbai/lib_client_commands/client_proto_context_commands.ml @@ -87,7 +87,7 @@ let report_michelson_errors ?(no_print_source = false) ~msg let block_hash_param = Tezos_clic.parameter (fun _ s -> - try Lwt_result_syntax.return (Tezos_crypto.Block_hash.of_b58check_exn s) + try Lwt_result_syntax.return (Block_hash.of_b58check_exn s) with _ -> failwith "Parameter '%s' is an invalid block hash" s) let group = @@ -616,7 +616,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ stop) @@ -660,10 +660,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -682,16 +679,13 @@ let commands_ro () = fprintf ppf "* %a %a %s (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p Tez.pp (Tez.of_mutez_exn w) Operation_result.tez_sym (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; @@ -1137,7 +1131,7 @@ let commands_rw () = (Some delegate) in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * _ contents * _ Apply_results.contents_result) option) = @@ -1432,7 +1426,7 @@ let commands_rw () = contents in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * _ contents_list * _ Apply_results.contents_result_list) @@ -2130,7 +2124,7 @@ let commands_rw () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun _ x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ prefixes ["to"; "be"; "included"] @@ -2139,7 +2133,7 @@ let commands_rw () = operation_hash (ctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* (_ : Tezos_crypto.Block_hash.t * int * int) = + let* (_ : Block_hash.t * int * int) = Client_confirmations.wait_for_operation_inclusion ctxt ~chain:ctxt#chain @@ -2170,7 +2164,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> Error_monad.failwith "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)))) @@ -2234,9 +2228,7 @@ let commands_rw () = (List.length proposals) Constants.max_proposals_per_delegate ; (match - Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare - proposals + Base.List.find_all_dups ~compare:Protocol_hash.compare proposals with | [] -> () | dups -> @@ -2248,19 +2240,16 @@ let commands_rw () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem ~equal:Tezos_crypto.Protocol_hash.equal p known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else - error - "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp - p) + error "Protocol %a is not a known proposal." Protocol_hash.pp p) proposals ; if not has_voting_power then error @@ -2350,7 +2339,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun _ x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> failwith "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ param @@ -2390,13 +2379,12 @@ let commands_rw () = let* () = match (info.current_period_kind, current_proposal) with | (Exploration | Promotion), Some current_proposal -> - if Tezos_crypto.Protocol_hash.equal proposal current_proposal then - return_unit + if Protocol_hash.equal proposal current_proposal then return_unit else let*! () = (if force then cctxt#warning else cctxt#error) "Unexpected proposal, expected: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp current_proposal in return_unit diff --git a/src/proto_016_PtMumbai/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_016_PtMumbai/lib_client_commands/client_proto_stresstest_commands.ml index c98cd68feaa3..62dcac500b99 100644 --- a/src/proto_016_PtMumbai/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_016_PtMumbai/lib_client_commands/client_proto_stresstest_commands.ml @@ -100,18 +100,17 @@ type transfer = { type state = { rng_state : Random.State.t; - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; 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 last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; - mutable target_block : Tezos_crypto.Block_hash.t; + mutable target_block : Block_hash.t; (** The block on top of which we are injecting transactions (HEAD~2). *) new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } (** Cost estimations for every kind of transaction used in the stress test. @@ -187,8 +186,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let transaction_costs_encoding = let open Data_encoding in @@ -347,7 +346,7 @@ let rec get_source_from_shuffled_pool state cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) in Lwt.return source @@ -355,7 +354,7 @@ let rec get_source_from_shuffled_pool state let* () = cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block in let* () = Lwt_condition.wait state.new_block_condition in @@ -377,9 +376,7 @@ let generate_fresh_source state = [promise] resolved when the stream is closed. [stopper ()] closes the stream. *) let heads_iter (cctxt : Protocol_client_context.full) - (f : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in @@ -394,7 +391,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -403,10 +400,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) - then + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let* () = f block_hash_and_header in loop () else @@ -415,7 +409,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -429,7 +423,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return (promise, stopper) @@ -653,18 +647,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Debug (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) in let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> let*! () = @@ -681,7 +672,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -704,10 +695,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = let* current_head_on_exit = Shell_services.Blocks.hash cctxt () in let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -739,7 +730,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -753,9 +744,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = log Debug (fun () -> cctxt#message "injected : [%a]@.included: [%a]" - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) injected_ops - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) included_ops) in let injected_ops_count = List.length injected_ops in @@ -849,8 +840,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) loop () in let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t = + Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t = (* Because of how Tenderbake works the target block should stay 2 blocks in the past because this guarantees that we are targeting a block that is decided. *) @@ -864,8 +854,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) in fun (new_block_hash, new_block_header) -> let* () = update_target_block () in - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1216,7 +1205,7 @@ let generate_random_transactions = cctxt#error "The level of the head (%a) needs to be greater than 2 and is \ actually %ld." - Tezos_crypto.Block_hash.pp + Block_hash.pp current_head_on_start header_on_start.level else return_unit @@ -1239,7 +1228,7 @@ let generate_random_transactions = last_level = Int32.to_int header_on_start.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.ml b/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.ml index 54b73da7c42f..2e54f32fdc13 100644 --- a/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.ml +++ b/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.ml @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.mli b/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.mli index 9a825a143620..5a280d04ac57 100644 --- a/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.mli +++ b/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.mli @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_cache.ml b/src/proto_016_PtMumbai/lib_delegate/baking_cache.ml index 1d5ffa81cdd2..2af2842c7777 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_cache.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_cache.ml @@ -30,8 +30,7 @@ open Protocol.Alpha_context type round = Round.t module Block_cache = - Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) (Block_hash) (** The [Timestamp_of_round_tbl] module allows to create memoization tables to store function calls of [Round.timestamp_of_round]. *) diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_configuration.ml b/src/proto_016_PtMumbai/lib_delegate/baking_configuration.ml index db13c684bf3c..2b8dca57b0f6 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_configuration.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_configuration.ml @@ -81,7 +81,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -221,7 +221,7 @@ let retries_on_failure_config_encoding = Data_encoding.int31 let user_activate_upgrades_config_encoding = let open Data_encoding in - list (tup2 int32 Tezos_crypto.Protocol_hash.encoding) + list (tup2 int32 Protocol_hash.encoding) let liquidity_baking_toggle_vote_config_encoding = Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote_encoding diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_configuration.mli b/src/proto_016_PtMumbai/lib_delegate/baking_configuration.mli index cd5b5a445f41..a1908d29dd22 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_configuration.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_configuration.mli @@ -56,7 +56,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -73,8 +73,7 @@ val default_nonce_config : nonce_config val default_retries_on_failure_config : int -val default_user_activated_upgrades : - (int32 * Tezos_crypto.Protocol_hash.t) list +val default_user_activated_upgrades : (int32 * Protocol_hash.t) list val default_liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote @@ -96,7 +95,7 @@ val make : ?nonce:nonce_config -> ?context_path:string -> ?retries_on_failure:int -> - ?user_activated_upgrades:(int32 * Tezos_crypto.Protocol_hash.t) list -> + ?user_activated_upgrades:(int32 * Protocol_hash.t) list -> ?liquidity_baking_toggle_vote: Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> ?per_block_vote_file:string -> @@ -115,7 +114,7 @@ val nonce_config_encoding : nonce_config Data_encoding.t val retries_on_failure_config_encoding : int Data_encoding.t val user_activate_upgrades_config_encoding : - (int32 * Tezos_crypto.Protocol_hash.t) list Data_encoding.t + (int32 * Protocol_hash.t) list Data_encoding.t val liquidity_baking_toggle_vote_config_encoding : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_events.ml b/src/proto_016_PtMumbai/lib_delegate/baking_events.ml index 2f1383b08951..0dd45ce85c65 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_events.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_events.ml @@ -43,8 +43,8 @@ module State_transitions = struct ~name:"new_head" ~level:Notice ~msg:"received new head {block} at level {level}, round {round}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) ~pp3:Round.pp @@ -119,12 +119,12 @@ module State_transitions = struct ~msg: "proposal {new_proposal} for current round ({current_round}) has \ already been seen {previous_proposal}" - ~pp1:Tezos_crypto.Block_hash.pp - ("new_proposal", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("new_proposal", Block_hash.encoding) ~pp2:Round.pp ("current_round", Round.encoding) - ~pp3:Tezos_crypto.Block_hash.pp - ("previous_proposal", Tezos_crypto.Block_hash.encoding) + ~pp3:Block_hash.pp + ("previous_proposal", Block_hash.encoding) let updating_latest_proposal = declare_1 @@ -132,8 +132,8 @@ module State_transitions = struct ~name:"updating_latest_proposal" ~msg:"updating latest proposal to {block_hash}" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let baker_is_ahead_of_node = declare_2 @@ -156,10 +156,10 @@ module State_transitions = struct ~msg: "received a proposal on another branch - current: current \ pred{current_branch}, new pred {new_branch}" - ~pp1:Tezos_crypto.Block_hash.pp - ("current_branch", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("new_branch", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("current_branch", Block_hash.encoding) + ~pp2:Block_hash.pp + ("new_branch", Block_hash.encoding) let switching_branch = declare_0 @@ -215,8 +215,8 @@ module State_transitions = struct ~name:"attempting_preendorsing_proposal" ~level:Info ~msg:"attempting to preendorse proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let skipping_invalid_proposal = declare_0 @@ -232,8 +232,8 @@ module State_transitions = struct ~name:"outdated_proposal" ~level:Debug ~msg:"outdated proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let proposing_fresh_block = declare_2 @@ -271,10 +271,10 @@ module State_transitions = struct ~msg: "unexpected prequorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let unexpected_quorum_received = declare_2 @@ -284,10 +284,10 @@ module State_transitions = struct ~msg: "unexpected quorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let step_current_phase = declare_2 @@ -321,8 +321,8 @@ module Node_rpc = struct ~name:"raw_info" ~level:Debug ~msg:"raw info for {block_hash} at level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) end @@ -451,8 +451,8 @@ module Scheduling = struct ~name:"proposal_in_the_future" ~level:Debug ~msg:"received proposal in the future {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let process_proposal_in_the_future = declare_1 @@ -460,8 +460,8 @@ module Scheduling = struct ~name:"process_proposal_in_the_future" ~level:Debug ~msg:"process proposal received in the future with hash {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) end module Lib = struct @@ -543,8 +543,8 @@ module Actions = struct ~name:"preendorsement_injected" ~level:Notice ~msg:"injected preendorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -554,8 +554,8 @@ module Actions = struct ~name:"endorsement_injected" ~level:Notice ~msg:"injected endorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -565,8 +565,8 @@ module Actions = struct ~name:"synchronizing_round" ~level:Info ~msg:"synchronizing round after block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let forging_block = declare_3 @@ -601,11 +601,11 @@ module Actions = struct ~level:Notice ~msg: "block {block} at level {level}, round {round} injected for {delegate}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:pp_int32 ~pp3:Round.pp ~pp4:Baking_state.pp_consensus_key_and_delegate - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("round", Round.encoding) ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -680,8 +680,8 @@ module VDF = struct ("cycle", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let vdf_daemon_start = declare_1 @@ -729,8 +729,8 @@ module Nonces = struct ~name:"found_nonce_to_reveal" ~level:Notice ~msg:"found nonce to reveal for block {block}, level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) @@ -746,8 +746,8 @@ module Nonces = struct ("level", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let cannot_fetch_chain_head_level = declare_0 @@ -821,8 +821,8 @@ module Nonces = struct ~name:"registering_nonce" ~level:Info ~msg:"registering nonce for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let nothing_to_reveal = declare_1 @@ -830,8 +830,8 @@ module Nonces = struct ~name:"nothing_to_reveal" ~level:Info ~msg:"nothing to reveal for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let revelation_worker_started = declare_0 @@ -916,8 +916,8 @@ module Selection = struct ~name:"invalid_operation_filtered" ~level:Warning ~msg:"filtered invalid operation {op}: {errors}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.(TzTrace.encoding error_encoding)) @@ -927,6 +927,6 @@ module Selection = struct ~name:"cannot_serialize_operation_metadata" ~level:Warning ~msg:"cannot serialize operation {op} metadata" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) end diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_lib.ml b/src/proto_016_PtMumbai/lib_delegate/baking_lib.ml index f1b23c4582c1..7ec3ae000cd5 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_lib.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_lib.ml @@ -268,7 +268,7 @@ let propose_at_next_level ~minimal_timestamp state = "Proposed block at round %a on top of %a " Round.pp block_to_bake.round - Tezos_crypto.Block_hash.pp + Block_hash.pp block_to_bake.predecessor.hash in return state @@ -411,7 +411,7 @@ let bake_using_automaton config state block_stream = let*! () = cctxt#message "Block %a (%ld) injected" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash proposal.block.shell.level in diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.ml b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.ml index 3acc87f16377..5af73f61735e 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.ml @@ -33,34 +33,27 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -let empty = Tezos_crypto.Block_hash.Map.empty +let empty = Block_hash.Map.empty let encoding = let open Data_encoding in def "seed_nonce" @@ conv (fun m -> - Tezos_crypto.Block_hash.Map.fold - (fun hash nonce acc -> (hash, nonce) :: acc) - m - []) + Block_hash.Map.fold (fun hash nonce acc -> (hash, nonce) :: acc) m []) (fun l -> List.fold_left - (fun map (hash, nonce) -> - Tezos_crypto.Block_hash.Map.add hash nonce map) - Tezos_crypto.Block_hash.Map.empty + (fun map (hash, nonce) -> Block_hash.Map.add hash nonce map) + Block_hash.Map.empty l) - @@ list - (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "nonce" Nonce.encoding)) + @@ list (obj2 (req "block" Block_hash.encoding) (req "nonce" Nonce.encoding)) let may_migrate (wallet : Protocol_client_context.full) location = let base_dir = wallet#get_base_dir in @@ -85,16 +78,16 @@ let load (wallet : #Client_context.wallet) location = let save (wallet : #Client_context.wallet) location nonces = wallet#write (Baking_files.filename location) nonces encoding -let mem nonces hash = Tezos_crypto.Block_hash.Map.mem hash nonces +let mem nonces hash = Block_hash.Map.mem hash nonces -let find_opt nonces hash = Tezos_crypto.Block_hash.Map.find hash nonces +let find_opt nonces hash = Block_hash.Map.find hash nonces -let add nonces hash nonce = Tezos_crypto.Block_hash.Map.add hash nonce nonces +let add nonces hash nonce = Block_hash.Map.add hash nonce nonces -let remove nonces hash = Tezos_crypto.Block_hash.Map.remove hash nonces +let remove nonces hash = Block_hash.Map.remove hash nonces let remove_all nonces nonces_to_remove = - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash _ acc -> remove acc hash) nonces_to_remove nonces @@ -123,7 +116,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let block_cycle = Int32.(div block_level blocks_per_cycle) in Int32.sub current_cycle block_cycle > Int32.of_int preserved_cycles in - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash nonce acc -> acc >>=? fun (orphans, outdated) -> get_block_level_opt cctxt ~chain ~block:(`Hash (hash, 0)) >>= function @@ -138,7 +131,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let filter_outdated_nonces state nonces = get_outdated_nonces state nonces >>=? fun (orphans, outdated_nonces) -> when_ - (Tezos_crypto.Block_hash.Map.cardinal orphans >= 50) + (Block_hash.Map.cardinal orphans >= 50) (fun () -> Events.( emit too_many_nonces (Baking_files.filename state.nonces_location ^ "s")) @@ -263,9 +256,8 @@ let reveal_potential_nonces state new_proposal = let {cctxt; chain; nonces_location; last_predecessor; _} = state in let new_predecessor_hash = new_proposal.Baking_state.predecessor.hash in if - Tezos_crypto.Block_hash.(last_predecessor <> new_predecessor_hash) - && Tezos_crypto.Protocol_hash.( - new_proposal.predecessor.protocol = Protocol.hash) + Block_hash.(last_predecessor <> new_predecessor_hash) + && Protocol_hash.(new_proposal.predecessor.protocol = Protocol.hash) then ( (* only try revealing nonces when the proposal's predecessor is a new one *) state.last_predecessor <- new_predecessor_hash ; @@ -316,7 +308,7 @@ let start_revelation_worker cctxt config chain_id constants block_stream = constants; config; nonces_location; - last_predecessor = Tezos_crypto.Block_hash.zero; + last_predecessor = Block_hash.zero; } in let rec worker_loop () = diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli index df34657eb901..8809adad843e 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli @@ -32,35 +32,31 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -val empty : Nonce.t Tezos_crypto.Block_hash.Map.t +val empty : Nonce.t Block_hash.Map.t -val encoding : Nonce.t Tezos_crypto.Block_hash.Map.t Data_encoding.t +val encoding : Nonce.t Block_hash.Map.t Data_encoding.t val load : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + Nonce.t Block_hash.Map.t tzresult Lwt.t val save : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> + Nonce.t Block_hash.Map.t -> unit tzresult Lwt.t -val mem : - Nonce.t Tezos_crypto.Block_hash.Map.t -> Tezos_crypto.Block_hash.t -> bool +val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool -val find_opt : - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Tezos_crypto.Block_hash.t -> - Nonce.t option +val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : #Tezos_rpc.Context.simple -> @@ -70,28 +66,21 @@ val get_block_level_opt : val get_outdated_nonces : t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Nonce.t Tezos_crypto.Block_hash.Map.t - * Nonce.t Tezos_crypto.Block_hash.Map.t) - tzresult - Lwt.t + Nonce.t Block_hash.Map.t -> + (Nonce.t Block_hash.Map.t * Nonce.t Block_hash.Map.t) tzresult Lwt.t val filter_outdated_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> Nonce.t Block_hash.Map.t tzresult Lwt.t val blocks_from_current_cycle : t -> Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t val get_unrevealed_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Raw_level.t * Nonce.t) list tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> (Raw_level.t * Nonce.t) list tzresult Lwt.t val generate_seed_nonce : Baking_configuration.nonce_config -> @@ -102,7 +91,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -110,7 +99,7 @@ val inject_seed_nonce_revelation : #Protocol_client_context.full -> chain:Chain_services.chain -> block:Block_services.block -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> (Raw_level.t * Nonce.t) list -> unit tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_scheduling.ml b/src/proto_016_PtMumbai/lib_delegate/baking_scheduling.ml index bca851f697d8..38d42a06cc3d 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_scheduling.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_scheduling.ml @@ -211,10 +211,8 @@ let compute_next_round_time state = | None -> state.level_state.latest_proposal | Some {proposal; _} -> proposal in - if - Tezos_crypto.Protocol_hash.( - proposal.predecessor.next_protocol <> Protocol.hash) - then None + if Protocol_hash.(proposal.predecessor.next_protocol <> Protocol.hash) then + None else match state.level_state.next_level_proposed_round with | Some _proposed_round -> @@ -632,7 +630,7 @@ let create_initial_state cctxt ?(synchronize = true) ~chain config >>=? fun next_level_delegate_slots -> let elected_block = if - Tezos_crypto.Protocol_hash.( + Protocol_hash.( current_proposal.block.protocol <> Protocol.hash && current_proposal.block.next_protocol = Protocol.hash) then diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.ml b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.ml index c4bcd1aa80dc..2d09542279ad 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.ml @@ -99,9 +99,9 @@ let begin_construction ~timestamp ~protocol_data fitness = pred_shell.fitness; timestamp; level = pred_shell.level; - context = Tezos_crypto.Context_hash.zero (* fake context hash *); + context = Context_hash.zero (* fake context hash *); operations_hash = - Tezos_crypto.Operation_list_list_hash.zero (* fake op hash *); + Operation_list_list_hash.zero (* fake op hash *); } in let mode = diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli index d6d45255028e..1643296eb489 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli @@ -39,7 +39,7 @@ val load_context : (** Make sure that the given context is consistent by trying to read in it *) val check_context_consistency : - Abstract_context_index.t -> Tezos_crypto.Context_hash.t -> unit tzresult Lwt.t + Abstract_context_index.t -> Context_hash.t -> unit tzresult Lwt.t val begin_construction : timestamp:Time.Protocol.t -> diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_state.ml b/src/proto_016_PtMumbai/lib_delegate/baking_state.ml index a5cb4ae67159..ba8632e23bd7 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_state.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_state.ml @@ -110,18 +110,18 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; } type cache = { @@ -225,19 +225,19 @@ let block_info_encoding = }) (merge_objs (obj10 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "shell" Block_header.shell_header_encoding) - (req "resulting_context_hash" Tezos_crypto.Context_hash.encoding) + (req "resulting_context_hash" Context_hash.encoding) (req "payload_hash" Block_payload_hash.encoding) (req "payload_round" Round.encoding) (req "round" Round.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding) (req "prequorum" (option prequorum_encoding)) (req "quorum" (list (dynamic_size Operation.encoding)))) (obj2 (req "payload" Operation_pool.payload_encoding) - (req "live_blocks" Tezos_crypto.Block_hash.Set.encoding))) + (req "live_blocks" Block_hash.Set.encoding))) let round_of_shell_header shell_header = Environment.wrap_tzresult @@ -447,17 +447,17 @@ let event_encoding = happen once. *) type legacy_block_info = { - legacy_hash : Tezos_crypto.Block_hash.t; + legacy_hash : Block_hash.t; legacy_shell : Block_header.shell_header; legacy_payload_hash : Block_payload_hash.t; legacy_payload_round : Round.t; legacy_round : Round.t; - legacy_protocol : Tezos_crypto.Protocol_hash.t; - legacy_next_protocol : Tezos_crypto.Protocol_hash.t; + legacy_protocol : Protocol_hash.t; + legacy_next_protocol : Protocol_hash.t; legacy_prequorum : prequorum option; legacy_quorum : Kind.endorsement operation list; legacy_payload : Operation_pool.payload; - legacy_live_blocks : Tezos_crypto.Block_hash.Set.t; + legacy_live_blocks : Block_hash.Set.t; } let legacy_block_info_encoding : legacy_block_info Data_encoding.t = @@ -515,17 +515,17 @@ let legacy_block_info_encoding : legacy_block_info Data_encoding.t = }) (merge_objs (obj10 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "shell" Block_header.shell_header_encoding) (req "payload_hash" Block_payload_hash.encoding) (req "payload_round" Round.encoding) (req "round" Round.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding) (req "prequorum" (option prequorum_encoding)) (req "quorum" (list (dynamic_size Operation.encoding))) (req "payload" Operation_pool.payload_encoding)) - (obj1 (req "live_blocks" Tezos_crypto.Block_hash.Set.encoding))) + (obj1 (req "live_blocks" Block_hash.Set.encoding))) type legacy_proposal = { legacy_block : legacy_block_info; @@ -877,16 +877,16 @@ let pp_block_info fmt "@[<v 2>Block:@ hash: %a@ payload_hash: %a@ level: %ld@ round: %a@ \ protocol: %a@ next protocol: %a@ prequorum: %a@ quorum: %d endorsements@ \ payload: %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash Block_payload_hash.pp_short payload_hash shell.level Round.pp round - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short protocol - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short next_protocol (pp_option pp_prequorum) prequorum @@ -909,7 +909,7 @@ let pp_endorsable_payload fmt {proposal; prequorum} = Format.fprintf fmt "proposal: %a, prequorum: %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash pp_prequorum prequorum @@ -1026,7 +1026,7 @@ let pp_event fmt = function round %a" (List.length preendos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched @@ -1036,7 +1036,7 @@ let pp_event fmt = function "quorum reached with %d endorsements (power: %d) for %a at round %a" (List.length endos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_state.mli b/src/proto_016_PtMumbai/lib_delegate/baking_state.mli index bf7caa0ff186..3e3c0efe6e37 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_state.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_state.mli @@ -56,18 +56,18 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; (** Set of live blocks for this block that is used to filter old or too recent operations. *) } diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_vdf.ml b/src/proto_016_PtMumbai/lib_delegate/baking_vdf.ml index 6dc6d5e9abb1..8d2caefb709b 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_vdf.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_vdf.ml @@ -182,7 +182,7 @@ let process_new_block (cctxt : #Protocol_client_context.full) state let* level_info = get_level_info cctxt level in let level_str = Int32.to_string (Raw_level.to_int32 level) in let* () = check_new_cycle state level_info in - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then let*! () = D_Events.(emit protocol_change_detected) () in return_unit else diff --git a/src/proto_016_PtMumbai/lib_delegate/block_forge.ml b/src/proto_016_PtMumbai/lib_delegate/block_forge.ml index 0df28bfea484..917133e0e553 100644 --- a/src/proto_016_PtMumbai/lib_delegate/block_forge.ml +++ b/src/proto_016_PtMumbai/lib_delegate/block_forge.ml @@ -117,7 +117,7 @@ let finalize_block_header shell_header timestamp validation_result let retain_live_operations_only ~live_blocks operation_pool = Operation_pool.Prioritized.filter (fun ({shell; _} : packed_operation) -> - Tezos_crypto.Block_hash.Set.mem shell.branch live_blocks) + Block_hash.Set.mem shell.branch live_blocks) operation_pool let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info @@ -141,7 +141,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info | None -> next_protocol | Some hash -> hash in - return Tezos_crypto.Protocol_hash.(Protocol.hash <> next_protocol) + return Protocol_hash.(Protocol.hash <> next_protocol) in let filter_via_node ~operation_pool = let filtered_operations = @@ -301,11 +301,10 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info >>=? fun (incremental, ordered_pool) -> let operations = Operation_pool.ordered_to_list_list ordered_pool in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in (* We need to compute the final [operations_hash] before diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml index e192aa649a72..9be4d3735d52 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml @@ -28,16 +28,16 @@ open Alpha_context open Protocol_client_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } let raw_info cctxt ?(chain = `Main) hash shell_header = @@ -80,7 +80,7 @@ let info cctxt ?(chain = `Main) block = module Block_seen_event = struct type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Tezos_base.Block_header.t; occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; } @@ -101,7 +101,7 @@ module Block_seen_event = struct (function {hash; header; occurrence} -> (hash, occurrence, header)) (fun (hash, occurrence, header) -> make hash header occurrence) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (* Occurrence has to come before header, because: (Invalid_argument "Cannot merge two objects when the left element is of @@ -133,7 +133,7 @@ module Block_seen_event = struct With_version.(encoding ~name (first_version v0_encoding)) let pp ~short:_ ppf {hash; _} = - Format.fprintf ppf "Saw block %a" Tezos_crypto.Block_hash.pp_short hash + Format.fprintf ppf "Saw block %a" Block_hash.pp_short hash let doc = "Block observed while monitoring a blockchain." @@ -173,7 +173,7 @@ let monitor_heads cctxt ~next_protocols chain = type error += | Unexpected_empty_block_list of { chain : string; - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; length : int; } @@ -190,13 +190,13 @@ let () = "Unexpected empty block list retrieved from chain %s at block %a, \ length %d" chain - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash length) Data_encoding.( obj3 (req "chain" string) - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "length" int31)) (function | Unexpected_empty_block_list {chain; block_hash; length} -> diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli index 07d582b6ed9b..e3b8a7621d56 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli @@ -27,16 +27,16 @@ open Protocol open Alpha_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } val info : @@ -48,14 +48,14 @@ val info : val monitor_valid_blocks : #Protocol_client_context.rpc_context -> ?chains:Chain_services.chain list -> - ?protocols:Tezos_crypto.Protocol_hash.t list -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + ?protocols:Protocol_hash.t list -> + next_protocols:Protocol_hash.t list option -> unit -> (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + next_protocols:Protocol_hash.t list option -> Chain_services.chain -> block_info tzresult Lwt_stream.t tzresult Lwt.t @@ -65,4 +65,4 @@ val blocks_from_current_cycle : Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml b/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml index 21b58428d339..19a7712b1698 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml @@ -49,8 +49,7 @@ module Slot_Map = Slot.Map (* type of operations stream, as returned by monitor_operations RPC *) type ops_stream = - ((Tezos_crypto.Operation_hash.t * packed_operation) * error trace option) list - Lwt_stream.t + ((Operation_hash.t * packed_operation) * error trace option) list Lwt_stream.t type 'a state = { (* Endorsements seen so far *) @@ -58,7 +57,7 @@ type 'a state = { (* Preendorsements seen so far *) preendorsements_table : Kind.preendorsement operation Slot_Map.t HLevel.t; (* Blocks received so far *) - blocks_table : Tezos_crypto.Block_hash.t Delegate_Map.t HLevel.t; + blocks_table : Block_hash.t Delegate_Map.t HLevel.t; (* Maximum delta of level to register *) preserved_levels : int; (* Highest level seen in a block *) @@ -127,7 +126,7 @@ let double_consensus_op_evidence (type kind) : kind consensus_operation_type -> #Protocol_client_context.full -> 'a -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> op1:kind Alpha_context.operation -> op2:kind Alpha_context.operation -> unit -> @@ -160,7 +159,7 @@ let process_consensus_op (type kind) cctxt (Operation.hash new_op, Operation.hash existing_op) in let op1, op2 = - if Tezos_crypto.Operation_hash.(new_op_hash < existing_op_hash) then + if Operation_hash.(new_op_hash < existing_op_hash) then (new_op, existing_op) else (existing_op, new_op) in @@ -274,8 +273,7 @@ let process_block (cctxt : #Protocol_client_context.full) state state.blocks_table (chain_id, level, round) (Delegate_Map.add baker.delegate new_hash map) - | Some existing_hash - when Tezos_crypto.Block_hash.(existing_hash = new_hash) -> + | Some existing_hash when Block_hash.(existing_hash = new_hash) -> (* This case should never happen *) Events.(emit double_baking_but_not) () >>= fun () -> return @@ -291,8 +289,7 @@ let process_block (cctxt : #Protocol_client_context.full) state let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in let bh1, bh2 = - if Tezos_crypto.Block_hash.(hash1 < hash2) then (bh1, bh2) - else (bh2, bh1) + if Block_hash.(hash1 < hash2) then (bh1, bh2) else (bh2, bh1) in (* If the blocks are on different chains then skip it *) get_block_offset level >>= fun block -> @@ -353,7 +350,7 @@ let cleanup_old_operations state = *) let process_new_block (cctxt : #Protocol_client_context.full) state {hash; chain_id; level; protocol; next_protocol; _} = - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then Events.(emit protocol_change_detected) () >>= fun () -> return_unit else Events.(emit accuser_saw_block) (level, hash) >>= fun () -> diff --git a/src/proto_016_PtMumbai/lib_delegate/client_daemon.ml b/src/proto_016_PtMumbai/lib_delegate/client_daemon.ml index 836c95f1ad9a..ba2cfdac03b3 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_daemon.ml +++ b/src/proto_016_PtMumbai/lib_delegate/client_daemon.ml @@ -91,7 +91,7 @@ module Baker = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> let canceler = Lwt_canceler.create () in @@ -121,7 +121,7 @@ module Accuser = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> Client_baking_blocks.monitor_valid_blocks @@ -159,7 +159,7 @@ module VDF = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash in let* chain_id = Shell_services.Chain.chain_id cctxt ~chain () in diff --git a/src/proto_016_PtMumbai/lib_delegate/delegate_events.ml b/src/proto_016_PtMumbai/lib_delegate/delegate_events.ml index ca4361b2dc96..20f5d091dd9c 100644 --- a/src/proto_016_PtMumbai/lib_delegate/delegate_events.ml +++ b/src/proto_016_PtMumbai/lib_delegate/delegate_events.ml @@ -50,8 +50,8 @@ module Denunciator = struct ~level ~name:"double_endorsement_detected" ~msg:"double endorsement detected" - ("existing_endorsement", Tezos_crypto.Operation_hash.encoding) - ("new_endorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_endorsement", Operation_hash.encoding) + ("new_endorsement", Operation_hash.encoding) let double_endorsement_denounced = declare_2 @@ -59,7 +59,7 @@ module Denunciator = struct ~level ~name:"double_endorsement_denounced" ~msg:"double endorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -69,8 +69,8 @@ module Denunciator = struct ~level ~name:"double_preendorsement_detected" ~msg:"double preendorsement detected" - ("existing_preendorsement", Tezos_crypto.Operation_hash.encoding) - ("new_preendorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_preendorsement", Operation_hash.encoding) + ("new_preendorsement", Operation_hash.encoding) let double_preendorsement_denounced = declare_2 @@ -78,7 +78,7 @@ module Denunciator = struct ~level ~name:"double_preendorsement_denounced" ~msg:"double preendorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -88,7 +88,7 @@ module Denunciator = struct ~level:Error ~name:"inconsistent_endorsement" ~msg:"inconsistent endorsement found {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) let unexpected_pruned_block = declare_1 @@ -96,7 +96,7 @@ module Denunciator = struct ~level:Error ~name:"unexpected_pruned_block" ~msg:"unexpected pruned block: {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let double_baking_but_not = declare_0 @@ -120,7 +120,7 @@ module Denunciator = struct ~level ~name:"double_baking_denounced" ~msg:"double baking evidence injected {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -139,7 +139,7 @@ module Denunciator = struct ~name:"accuser_saw_block" ~msg:"block level: {level}" ("level", Alpha_context.Raw_level.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetch_operations_error = declare_1 @@ -147,8 +147,8 @@ module Denunciator = struct ~level:Error ~name:"fetch_operations_error" ~msg:"error while fetching operations of block {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) - ~pp1:Tezos_crypto.Block_hash.pp + ("hash", Block_hash.encoding) + ~pp1:Block_hash.pp let accuser_processed_block = declare_1 @@ -156,7 +156,7 @@ module Denunciator = struct ~level ~name:"accuser_processed_block" ~msg:"block {hash} registered" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let accuser_block_error = declare_2 @@ -165,7 +165,7 @@ module Denunciator = struct ~name:"accuser_block_error" ~msg:"error while processing block {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end diff --git a/src/proto_016_PtMumbai/lib_delegate/logging.ml b/src/proto_016_PtMumbai/lib_delegate/logging.ml index 6756e73e07e6..ed9cb18c9db3 100644 --- a/src/proto_016_PtMumbai/lib_delegate/logging.ml +++ b/src/proto_016_PtMumbai/lib_delegate/logging.ml @@ -147,9 +147,9 @@ let conflicting_endorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) let conflicting_preendorsements_tag = @@ -161,7 +161,7 @@ let conflicting_preendorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) diff --git a/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml b/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml index 94be468c039b..a6d3d71cc15e 100644 --- a/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml +++ b/src/proto_016_PtMumbai/lib_delegate/node_rpc.ml @@ -70,9 +70,7 @@ let raw_info cctxt ~chain ~block_hash shell resulting_context_hash payload_hash >>= fun () -> let open Protocol_client_context in let block = `Hash (block_hash, 0) in - let is_in_protocol = - Tezos_crypto.Protocol_hash.(current_protocol = Protocol.hash) - in + let is_in_protocol = Protocol_hash.(current_protocol = Protocol.hash) in (if is_in_protocol then Alpha_block_services.Operations.operations cctxt ~chain ~block () >>=? fun operations -> @@ -126,7 +124,7 @@ let info cctxt ~chain ~block () = >>=? fun {current_protocol; next_protocol} -> Shell_services.Blocks.resulting_context_hash cctxt ~chain ~block () >>=? fun resulting_context_hash -> - (if Tezos_crypto.Protocol_hash.(current_protocol <> Protocol.hash) then + (if Protocol_hash.(current_protocol <> Protocol.hash) then Block_services.Header.shell_header cctxt ~chain ~block () >>=? fun shell -> Chain_services.Blocks.Header.raw_protocol_data cctxt ~chain ~block () >>=? fun protocol_data -> @@ -161,7 +159,7 @@ let info cctxt ~chain ~block () = (Chain_services.Blocks.live_blocks cctxt ~chain ~block () >>= function | Error _ -> (* The RPC might fail when a block's metadata is not available *) - Lwt.return Tezos_crypto.Block_hash.Set.empty + Lwt.return Block_hash.Set.empty | Ok live_blocks -> Lwt.return live_blocks) >>= fun live_blocks -> raw_info diff --git a/src/proto_016_PtMumbai/lib_delegate/node_rpc.mli b/src/proto_016_PtMumbai/lib_delegate/node_rpc.mli index 55694e129b55..2dd0468ef6f1 100644 --- a/src/proto_016_PtMumbai/lib_delegate/node_rpc.mli +++ b/src/proto_016_PtMumbai/lib_delegate/node_rpc.mli @@ -37,13 +37,13 @@ val inject_block : chain:Shell_services.chain -> Block_header.t -> Tezos_base.Operation.t list list -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t (** Preapply a block using the node validation mechanism.*) val preapply_block : #Protocol_client_context.full -> chain:Shell_services.chain -> - head:Tezos_crypto.Block_hash.t -> + head:Block_hash.t -> timestamp:Time.Protocol.t -> protocol_data:Protocol.block_header_data -> packed_operation list list -> @@ -58,7 +58,7 @@ val proposal : #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Baking_state.proposal tzresult Lwt.t (** Monitor proposals from the node.*) diff --git a/src/proto_016_PtMumbai/lib_delegate/operation_pool.ml b/src/proto_016_PtMumbai/lib_delegate/operation_pool.ml index 16ec9eda7cdb..7e0a7612054e 100644 --- a/src/proto_016_PtMumbai/lib_delegate/operation_pool.ml +++ b/src/proto_016_PtMumbai/lib_delegate/operation_pool.ml @@ -41,7 +41,7 @@ let compare_op op1 op2 = (* FIXME some operations (e.g. tx_rollup_rejection) pack functional values which could raise an exception. In this specific case, we default to comparing their hashes. *) - Tezos_crypto.Operation_hash.compare + Operation_hash.compare (Alpha_context.Operation.hash_packed op1) (Alpha_context.Operation.hash_packed op2) diff --git a/src/proto_016_PtMumbai/lib_delegate/operation_selection.ml b/src/proto_016_PtMumbai/lib_delegate/operation_selection.ml index 83543149b056..089f4b439a93 100644 --- a/src/proto_016_PtMumbai/lib_delegate/operation_selection.ml +++ b/src/proto_016_PtMumbai/lib_delegate/operation_selection.ml @@ -165,7 +165,7 @@ type simulation_result = { validation_result : Tezos_protocol_environment.validation_result; block_header_metadata : block_header_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } let validate_operation inc op = @@ -250,11 +250,10 @@ let filter_operations_with_simulation initial_inc fees_config >>= fun (inc, managers) -> let operations = [consensus; votes; anonymous; managers] in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in let inc = {inc with header = {inc.header with operations_hash}} in diff --git a/src/proto_016_PtMumbai/lib_delegate/operation_selection.mli b/src/proto_016_PtMumbai/lib_delegate/operation_selection.mli index 3ab72a91347c..78caab5c158c 100644 --- a/src/proto_016_PtMumbai/lib_delegate/operation_selection.mli +++ b/src/proto_016_PtMumbai/lib_delegate/operation_selection.mli @@ -31,7 +31,7 @@ type simulation_result = { validation_result : validation_result; block_header_metadata : Apply_results.block_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } val filter_operations_with_simulation : diff --git a/src/proto_016_PtMumbai/lib_delegate/operation_worker.ml b/src/proto_016_PtMumbai/lib_delegate/operation_worker.ml index 5589f585649f..66cec5723476 100644 --- a/src/proto_016_PtMumbai/lib_delegate/operation_worker.ml +++ b/src/proto_016_PtMumbai/lib_delegate/operation_worker.ml @@ -145,7 +145,7 @@ module Events = struct end type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } @@ -158,7 +158,7 @@ let candidate_encoding = (fun (hash, round_watched, payload_hash_watched) -> {hash; round_watched; payload_hash_watched}) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "round_watched" Round.encoding) (req "payload_hash_watched" Block_payload_hash.encoding)) @@ -539,8 +539,7 @@ let retrieve_pending_operations cctxt state = state.operation_pool (List.rev_map (fun (_, (op, _)) -> op) - (Tezos_crypto.Operation_hash.Map.bindings - pending_mempool.branch_delayed)) ; + (Operation_hash.Map.bindings pending_mempool.branch_delayed)) ; return_unit let get_current_operations state = state.operation_pool diff --git a/src/proto_016_PtMumbai/lib_delegate/operation_worker.mli b/src/proto_016_PtMumbai/lib_delegate/operation_worker.mli index ab66270bfd91..eecbc990f2d1 100644 --- a/src/proto_016_PtMumbai/lib_delegate/operation_worker.mli +++ b/src/proto_016_PtMumbai/lib_delegate/operation_worker.mli @@ -34,7 +34,7 @@ open Alpha_context type t type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } diff --git a/src/proto_016_PtMumbai/lib_delegate/state_transitions.ml b/src/proto_016_PtMumbai/lib_delegate/state_transitions.ml index 71c79251fe67..6e8dd27e6284 100644 --- a/src/proto_016_PtMumbai/lib_delegate/state_transitions.ml +++ b/src/proto_016_PtMumbai/lib_delegate/state_transitions.ml @@ -47,9 +47,8 @@ let is_acceptable_proposal_for_current_level state let previous_proposal = state.level_state.latest_proposal in if Round.(proposal.block.round = previous_proposal.block.round) - && Tezos_crypto.Block_hash.( - proposal.block.hash <> previous_proposal.block.hash) - && Tezos_crypto.Block_hash.( + && Block_hash.(proposal.block.hash <> previous_proposal.block.hash) + && Block_hash.( proposal.predecessor.hash = previous_proposal.predecessor.hash) then (* An existing proposal was found at the same round: the @@ -118,9 +117,7 @@ let may_update_proposal state (proposal : proposal) = else Lwt.return state let preendorse state proposal = - if - Tezos_crypto.Protocol_hash.( - proposal.block.protocol <> proposal.block.next_protocol) + if Protocol_hash.(proposal.block.protocol <> proposal.block.next_protocol) then (* We do not preendorse the first transition block *) let new_round_state = {state.round_state with current_phase = Idle} in @@ -203,7 +200,7 @@ let rec handle_new_proposal state (new_proposal : proposal) = let's check if it's a valid one for us. *) let current_proposal = state.level_state.latest_proposal in if - Tezos_crypto.Block_hash.( + Block_hash.( current_proposal.predecessor.hash <> new_proposal.predecessor.hash) then Events.( @@ -537,8 +534,7 @@ let end_of_round state current_round = do_nothing new_state | Some (delegate, _) -> let last_proposal = state.level_state.latest_proposal.block in - if Tezos_crypto.Protocol_hash.(last_proposal.protocol <> Protocol.hash) - then + if Protocol_hash.(last_proposal.protocol <> Protocol.hash) then (* Do not inject a block for the previous protocol! (Let the baker of the previous protocol do it.) *) do_nothing new_state @@ -610,9 +606,7 @@ let make_endorse_action state proposal = let prequorum_reached_when_awaiting_preendorsements state candidate preendorsements = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit @@ -652,9 +646,7 @@ let prequorum_reached_when_awaiting_preendorsements state candidate let quorum_reached_when_waiting_endorsements state candidate endorsement_qc = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit diff --git a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_services.ml index ff2b7871d752..624565b40889 100644 --- a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_services.ml @@ -10,7 +10,7 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) val monitor_heads : - unit -> (Tezos_crypto.Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -23,7 +23,7 @@ module type Mocked_services_hooks = sig (** [resulting_context_hash] returns the context resulting hash of the given block. *) val resulting_context_hash : - Block_services.block -> Tezos_crypto.Context_hash.t tzresult Lwt.t + Block_services.block -> Context_hash.t tzresult Lwt.t (** [operations] returns all operations included in the block. *) val operations : @@ -34,15 +34,14 @@ module type Mocked_services_hooks = sig [Tezos_shell_services.Injection_services.S.block], after checking that the block header can be deserialized. *) val inject_block : - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t (** [inject_operation] is used by the endorser (or the client) to inject operations, including endorsements. *) - val inject_operation : - Operation.t -> Tezos_crypto.Operation_hash.t tzresult Lwt.t + val inject_operation : Operation.t -> Operation_hash.t tzresult Lwt.t (** [pending_operations] returns the current contents of the mempool. It is used by the baker to fetch operations to potentially include in the @@ -59,9 +58,7 @@ module type Mocked_services_hooks = sig branch_delayed:bool -> branch_refused:bool -> refused:bool -> - ((Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) - * error trace option) - list + ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted @@ -69,16 +66,15 @@ module type Mocked_services_hooks = sig chain. Optional arguments allow to return the list of predecessors of a given block or of a set of blocks. *) val list_blocks : - heads:Tezos_crypto.Block_hash.t list -> + heads:Block_hash.t list -> length:int option -> min_date:Time.Protocol.t option -> - Tezos_crypto.Block_hash.t list list tzresult Lwt.t + Block_hash.t list list tzresult Lwt.t (** List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. *) - val live_blocks : - Block_services.block -> Tezos_crypto.Block_hash.Set.t tzresult Lwt.t + val live_blocks : Block_services.block -> Block_hash.Set.t tzresult Lwt.t (** [rpc_context_callback] is used in the implementations of several RPCs (see local_services.ml). It should correspond to the @@ -95,7 +91,7 @@ module type Mocked_services_hooks = sig to all nodes. *) val broadcast_block : ?dests:int list -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t @@ -110,8 +106,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> - (Tezos_crypto.Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -200,7 +195,7 @@ module Make (Hooks : Mocked_services_hooks) = struct match Block_header.of_bytes bytes with | None -> failwith "faked_services.inject_block: can't deserialize" | Some block_header -> - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in Hooks.inject_block block_hash block_header operations >>=? fun () -> return block_hash) @@ -219,7 +214,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Broadcast_services.S.block (fun () dests (block_header, operations) -> let bytes = Block_header.to_bytes block_header in - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in let dests = match dests#dests with [] -> None | dests -> Some dests in Hooks.broadcast_block ?dests block_hash block_header operations) diff --git a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml index b97417ed1807..b391b3b272bd 100644 --- a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -28,7 +28,7 @@ type block = { protocol_data : Protocol.Alpha_context.Block_header.protocol_data; raw_protocol_data : Bytes.t; operations : Mockup.M.Block_services.operation list list; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } type chain = block list @@ -36,10 +36,8 @@ type chain = block list (** As new blocks and operations are received they are pushed to an Lwt_pipe wrapped into this type. *) type broadcast = - | Broadcast_block of - Tezos_crypto.Block_hash.t * Block_header.t * Operation.t list list - | Broadcast_op of - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation + | Broadcast_block of Block_hash.t * Block_header.t * Operation.t list list + | Broadcast_op of Operation_hash.t * Alpha_context.packed_operation (** The state of a mockup node. *) type state = { @@ -49,33 +47,29 @@ type state = { live_depth : int; (** How many blocks (counting from the head into the past) are considered live? *) mutable chain : chain; (** The chain as seen by this fake "node". *) - mutable mempool : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list; + mutable mempool : (Operation_hash.t * Mockup.M.Protocol.operation) list; (** Mempool of this fake "node". *) - chain_table : chain Tezos_crypto.Block_hash.Table.t; + chain_table : chain Block_hash.Table.t; (** The chain table of this fake "node". It maps from block hashes to blocks. *) - global_chain_table : block Tezos_crypto.Block_hash.Table.t; + global_chain_table : block Block_hash.Table.t; (** The global chain table that allows us to look up blocks that may be missing in [chain_table], i.e. not known to this particular node. This is used to find unknown predecessors. The real node can ask about an unknown block and receive it on request, this is supposed to emulate that functionality. *) - ctxt_table : - Tezos_protocol_environment.rpc_context Tezos_crypto.Context_hash.Table.t; + ctxt_table : Tezos_protocol_environment.rpc_context Context_hash.Table.t; (** The context table allows us to look up rpc_context by its hash. *) - heads_pipe : - (Tezos_crypto.Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; + heads_pipe : (Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; (** [heads_pipe] is used to implement the [monitor_heads] RPC. *) operations_pipe : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) option - Lwt_pipe.Unbounded.t; + (Operation_hash.t * Mockup.M.Protocol.operation) option Lwt_pipe.Unbounded.t; (** [operations_pipe] is used to implement the [operations_pipe] RPC. *) mutable streaming_operations : bool; (** A helper flag used to implement the monitor operations RPC. *) broadcast_pipes : broadcast Lwt_pipe.Unbounded.t list; (** Broadcast pipes per node. *) - genesis_block_true_hash : Tezos_crypto.Block_hash.t; + genesis_block_true_hash : Block_hash.t; (** True hash of the genesis block as calculated by the [Block_header.hash] function. *) @@ -86,10 +80,10 @@ let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" -let genesis_predecessor_block_hash = Tezos_crypto.Block_hash.zero +let genesis_predecessor_block_hash = Block_hash.zero type propagation = Block | Pass | Delay of float @@ -99,40 +93,34 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -141,7 +129,7 @@ module type Hooks = sig level:int32 -> round:int32 -> chain:chain -> unit tzresult Lwt.t val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t val stop_on_event : Baking_state.event -> bool @@ -162,12 +150,9 @@ let locate_blocks (state : state) block list tzresult Lwt.t = match block with | `Hash (hash, rel) -> ( - match Tezos_crypto.Block_hash.Table.find state.chain_table hash with + match Block_hash.Table.find state.chain_table hash with | None -> - failwith - "locate_blocks: can't find the block %a" - Tezos_crypto.Block_hash.pp - hash + failwith "locate_blocks: can't find the block %a" Block_hash.pp hash | Some chain0 -> let _, chain = List.split_n rel chain0 in return chain) @@ -193,8 +178,8 @@ let live_blocks (state : state) block = (List.fold_left (fun set ({rpc_context; _} : block) -> let hash = rpc_context.Tezos_protocol_environment.block_hash in - Tezos_crypto.Block_hash.Set.add hash set) - (Tezos_crypto.Block_hash.Set.singleton state.genesis_block_true_hash) + Block_hash.Set.add hash set) + (Block_hash.Set.singleton state.genesis_block_true_hash) segment) (** Extract the round number from raw fitness. *) @@ -288,27 +273,25 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : match block with | `Hash (requested_hash, rel) -> Int.equal rel 0 - && Tezos_crypto.Block_hash.equal - requested_hash - genesis_predecessor_block_hash + && Block_hash.equal requested_hash genesis_predecessor_block_hash | _ -> false in (* It is important to tell the baker that the genesis block is not in - the alpha protocol (we use Tezos_crypto.Protocol_hash.zero). This will make the + the alpha protocol (we use Protocol_hash.zero). This will make the baker not try to propose alternatives to that block and just accept - it as final in that Tezos_crypto.Protocol_hash.zero protocol. The same for - predecessor of genesis, it should be in Tezos_crypto.Protocol_hash.zero. *) + it as final in that Protocol_hash.zero protocol. The same for + predecessor of genesis, it should be in Protocol_hash.zero. *) return Tezos_shell_services.Block_services. { current_protocol = (if - Tezos_crypto.Block_hash.equal hash genesis_block_hash + Block_hash.equal hash genesis_block_hash || is_predecessor_of_genesis - then Tezos_crypto.Protocol_hash.zero + then Protocol_hash.zero else Protocol.hash); next_protocol = - (if is_predecessor_of_genesis then Tezos_crypto.Protocol_hash.zero + (if is_predecessor_of_genesis then Protocol_hash.zero else Protocol.hash); } @@ -325,7 +308,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : let resulting_context_hash (block : Tezos_shell_services.Block_services.block) : - Tezos_crypto.Context_hash.t tzresult Lwt.t = + Context_hash.t tzresult Lwt.t = locate_block state block >>=? fun x -> return x.resulting_context_hash let operations block = @@ -410,11 +393,11 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : Mockup.M.Block_services.Mempool. { applied = ops; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; - unprocessed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; + unprocessed = Operation_hash.Map.empty; } let monitor_operations ~applied ~branch_delayed ~branch_refused ~refused = @@ -494,12 +477,11 @@ let clear_mempool state = (fun (_oph, (op : Mockup.M.Protocol.operation)) -> let included_in_head = List.mem - ~equal:Tezos_crypto.Operation_hash.equal + ~equal:Operation_hash.equal (Alpha_context.Operation.hash_packed op) included_ops_hashes in - Tezos_crypto.Block_hash.Set.mem op.shell.branch live_set - && not included_in_head) + Block_hash.Set.mem op.shell.branch live_set && not included_in_head) state.mempool in state.mempool <- mempool ; @@ -573,17 +555,13 @@ let rec process_block state block_hash (block_header : Block_header.t) let get_predecessor () = let predecessor_hash = block_header.Block_header.shell.predecessor in head state >>=? fun head -> - match - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash - with + match Block_hash.Table.find state.chain_table predecessor_hash with | None | Some [] -> ( (* Even if the predecessor is not known locally, it might be known by some node in the network. The code below "requests" information about the block by its hash. *) match - Tezos_crypto.Block_hash.Table.find - state.global_chain_table - predecessor_hash + Block_hash.Table.find state.global_chain_table predecessor_hash with | None -> failwith "get_predecessor: unknown predecessor block" | Some predecessor -> @@ -626,7 +604,7 @@ let rec process_block state block_hash (block_header : Block_header.t) then return predecessor else failwith "get_predecessor: the predecessor block is too old" in - match Tezos_crypto.Block_hash.Table.find state.chain_table block_hash with + match Block_hash.Table.find state.chain_table block_hash with | Some _ -> (* The block is already known. *) return_unit @@ -650,7 +628,7 @@ let rec process_block state block_hash (block_header : Block_header.t) (fun pass -> List.map (fun (Operation.{shell; proto} as op) -> - let hash : Tezos_crypto.Operation_hash.t = Operation.hash op in + let hash : Operation_hash.t = Operation.hash op in let protocol_data : Alpha_context.packed_protocol_data = Data_encoding.Binary.of_bytes_exn Protocol.operation_data_encoding @@ -678,19 +656,13 @@ let rec process_block state block_hash (block_header : Block_header.t) in let predecessor_hash = block_header.Block_header.shell.predecessor in let tail = - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash + Block_hash.Table.find state.chain_table predecessor_hash |> WithExceptions.Option.get ~loc:__LOC__ in let new_chain = new_block :: tail in - Tezos_crypto.Block_hash.Table.replace - state.chain_table - block_hash - new_chain ; - Tezos_crypto.Block_hash.Table.replace - state.global_chain_table - block_hash - new_block ; - Tezos_crypto.Context_hash.Table.replace + Block_hash.Table.replace state.chain_table block_hash new_chain ; + Block_hash.Table.replace state.global_chain_table block_hash new_block ; + Context_hash.Table.replace state.ctxt_table resulting_context_hash rpc_context ; @@ -780,7 +752,7 @@ let create_fake_node_state ~i ~live_depth mempool = []; chain = chain0; chain_table = - Tezos_crypto.Block_hash.Table.of_seq + Block_hash.Table.of_seq (List.to_seq [ (rpc_context0.block_hash, chain0); @@ -789,7 +761,7 @@ let create_fake_node_state ~i ~live_depth ]); global_chain_table; ctxt_table = - Tezos_crypto.Context_hash.Table.of_seq + Context_hash.Table.of_seq (List.to_seq [ ( rpc_context0.Tezos_protocol_environment.block_header @@ -850,7 +822,7 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir sync_fun = Lwt.return; checkout_fun = (fun hash -> - Tezos_crypto.Context_hash.Table.find state.ctxt_table hash + Context_hash.Table.find state.ctxt_table hash |> Option.map (fun Tezos_protocol_environment.{context; _} -> context) |> Lwt.return); finalize_fun = Lwt.return; @@ -871,8 +843,8 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir User_hooks.check_chain_on_success ~chain:state.chain let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) - (predecessor_hash : Tezos_crypto.Block_hash.t) - (block_header : Block_header.shell_header) : Bytes.t = + (predecessor_hash : Block_hash.t) (block_header : Block_header.shell_header) + : Bytes.t = let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -1168,7 +1140,7 @@ let run ?(config = default_config) bakers_spec = | Error () -> failwith "impossible: negative length of the baker spec" | Ok xs -> return xs) >>=? fun broadcast_pipes -> - let global_chain_table = Tezos_crypto.Block_hash.Table.create 10 in + let global_chain_table = Block_hash.Table.create 10 in Tezos_mockup_commands.Mockup_wallet.default_bootstrap_accounts >>=? fun bootstrap_secrets -> let accounts_with_secrets = @@ -1253,15 +1225,13 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) else failwith "unexpected signature for %a; tried with %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Tezos_crypto.Signature.Public_key.pp public_key type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t let mempool_count_ops ~mempool ~predicate = List.map_es (fun (op_hash, op) -> predicate op_hash op) mempool @@ -1280,7 +1250,7 @@ let mempool_has_op_ref ~mempool ~predicate ~var = if result then var := true ; return_unit -let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_signed_by ~public_key (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1293,17 +1263,13 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) | _ -> Tezos_crypto.Signature.Generic_operation) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) >>=? fun watermark -> match d.signature with | None -> failwith "did not find a signature for op %a@." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash | Some signature -> let unsigned_operation_bytes = @@ -1318,7 +1284,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) signature unsigned_operation_bytes)) -let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_preendorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1344,13 +1310,9 @@ let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) -let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_endorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1376,11 +1338,7 @@ let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) let op_is_both f g op_hash op = f op_hash op >>=? fun f_result -> diff --git a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.mli b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.mli index ef4db4d8b7cb..2fc5f544597a 100644 --- a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.mli +++ b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.mli @@ -29,7 +29,7 @@ type block = { protocol_data : Protocol.Alpha_context.Block_header.protocol_data; raw_protocol_data : Bytes.t; operations : Mockup.M.Block_services.operation list list; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } (** Chain is a list of blocks. *) @@ -57,25 +57,20 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t (** This function is called on injection of an operation. It is similar to [on_inject_block], which see. *) val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t @@ -83,23 +78,22 @@ module type Hooks = sig a "monitor heads" RPC call. Returning [None] here terminates the process for the baker. *) val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t (** This is called when a new operation is going to be sent as the response to a "monitor operations" RPC call. Returning [None] here indicates that the node has advanced to the next level. *) val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t (** Check a block before processing it in the mockup. *) val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -110,7 +104,7 @@ module type Hooks = sig (** Check operations in the mempool after injecting an operation. *) val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t (** This hook is used to decide when the baker is supposed to shut down. @@ -190,35 +184,33 @@ val bootstrap5 : Tezos_crypto.Signature.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_hash:Block_hash.t -> block_header:Block_header.t -> public_key:Tezos_crypto.Signature.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t (** Count the number of operations in the mempool that satisfy the given predicate. *) val mempool_count_ops : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> int tzresult Lwt.t (** Check if the mempool has at least one operation that satisfies the given predicate. *) val mempool_has_op : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> bool tzresult Lwt.t (** Similar to [mempool_has_op] but instead of returning a [bool] it sets the given [bool ref]. *) val mempool_has_op_ref : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> var:bool ref -> unit tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/lib_injector/disk_persistence.ml b/src/proto_016_PtMumbai/lib_injector/disk_persistence.ml index f8585e929ff4..e31f9ca0b66d 100644 --- a/src/proto_016_PtMumbai/lib_injector/disk_persistence.ml +++ b/src/proto_016_PtMumbai/lib_injector/disk_persistence.ml @@ -276,7 +276,7 @@ end module Make_queue (N : sig val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_016_PtMumbai/lib_injector/disk_persistence.mli b/src/proto_016_PtMumbai/lib_injector/disk_persistence.mli index 048ec2a1309f..b79cc251fb93 100644 --- a/src/proto_016_PtMumbai/lib_injector/disk_persistence.mli +++ b/src/proto_016_PtMumbai/lib_injector/disk_persistence.mli @@ -106,7 +106,7 @@ module Make_queue (N : sig to store the persistent information for this queue. *) val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_016_PtMumbai/lib_injector/injector_common.ml b/src/proto_016_PtMumbai/lib_injector/injector_common.ml index e6db79b79345..ad6336e2a24c 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_common.ml +++ b/src/proto_016_PtMumbai/lib_injector/injector_common.ml @@ -75,7 +75,7 @@ let fetch_tezos_shell_header ~find_in_cache (cctxt : #full) hash : i.e. calls {!fetch} for cache misses. *) error_with "Fetching Tezos block %a failed unexpectedly" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash | None, Some errs -> Error errs | Some shell_header, _ -> Ok shell_header @@ -106,7 +106,7 @@ let fetch_tezos_block ~find_in_cache (cctxt : #full) hash : i.e. calls {!fetch} for cache misses. *) error_with "Fetching Tezos block %a failed unexpectedly" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash | None, Some errs -> Error errs | Some block, _ -> Ok block @@ -117,7 +117,7 @@ let tezos_reorg fetch_tezos_block ~old_head_hash ~new_head_hash = let open Alpha_block_services in let open Lwt_result_syntax in let rec loop old_chain new_chain old_head_hash new_head_hash = - if Tezos_crypto.Block_hash.(old_head_hash = new_head_hash) then + if Block_hash.(old_head_hash = new_head_hash) then return {old_chain = List.rev old_chain; new_chain = List.rev new_chain} else let* new_head = fetch_tezos_block new_head_hash in diff --git a/src/proto_016_PtMumbai/lib_injector/injector_common.mli b/src/proto_016_PtMumbai/lib_injector/injector_common.mli index 7d4dd86089ee..c5bfb943322f 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_common.mli +++ b/src/proto_016_PtMumbai/lib_injector/injector_common.mli @@ -63,11 +63,11 @@ type shell_header := Block_header.shell_header {!Aches_lwt.Lache.MAP_RESULT}. *) val fetch_tezos_shell_header : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> shell_header option Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> shell_header option Lwt.t) -> shell_header option Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> shell_header tzresult Lwt.t (** [fetch_tezos_block ~find_in_cache cctxt hash] returns [Some block_info] @@ -77,18 +77,18 @@ val fetch_tezos_shell_header : {!Aches_lwt.Lache.MAP_RESULT}. *) val fetch_tezos_block : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> block_info option Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> block_info option Lwt.t) -> block_info option Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info tzresult Lwt.t (** [tezos_reorg fetch ~old_head_hash ~new_head_hash] computes the reorganization of L1 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) val tezos_reorg : - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> - old_head_hash:Tezos_crypto.Block_hash.t -> - new_head_hash:Tezos_crypto.Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> + old_head_hash:Block_hash.t -> + new_head_hash:Block_hash.t -> block_info reorg tzresult Lwt.t diff --git a/src/proto_016_PtMumbai/lib_injector/injector_events.ml b/src/proto_016_PtMumbai/lib_injector/injector_events.ml index 256903f6a5e9..b1a4cedb3371 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_events.ml +++ b/src/proto_016_PtMumbai/lib_injector/injector_events.ml @@ -113,7 +113,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"new_tezos_head" ~msg:"processing new Tezos head {head}" ~level:Debug - ("head", Tezos_crypto.Block_hash.encoding) + ("head", Block_hash.encoding) let injecting_pending = declare_1 @@ -169,7 +169,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~msg:"Injected {nb} operations in {oph}" ~level:Notice ("nb", Data_encoding.int31) - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let add_pending = declare_1 @@ -192,7 +192,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"included" ~msg:"Included operations of {block} at level {level}: {operations}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("operations", Data_encoding.list L1_operation.Hash.encoding) ~pp3:pp_operations_hash_list diff --git a/src/proto_016_PtMumbai/lib_injector/injector_functor.ml b/src/proto_016_PtMumbai/lib_injector/injector_functor.ml index 1af48370900a..898aeb1f96e1 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_functor.ml +++ b/src/proto_016_PtMumbai/lib_injector/injector_functor.ml @@ -84,15 +84,15 @@ module Make (Rollup : PARAMETERS) = struct end) module Injected_ophs = Disk_persistence.Make_table (struct - include Tezos_crypto.Operation_hash.Table + include Operation_hash.Table type value = L1_operation.Hash.t list let name = "injected_ophs" - let string_of_key = Tezos_crypto.Operation_hash.to_b58check + let string_of_key = Operation_hash.to_b58check - let key_of_string = Tezos_crypto.Operation_hash.of_b58check_opt + let key_of_string = Operation_hash.of_b58check_opt let value_encoding = Data_encoding.list L1_operation.Hash.encoding end) @@ -123,15 +123,15 @@ module Make (Rollup : PARAMETERS) = struct end) module Included_in_blocks = Disk_persistence.Make_table (struct - include Tezos_crypto.Block_hash.Table + include Block_hash.Table type value = int32 * L1_operation.Hash.t list let name = "included_in_blocks" - let string_of_key = Tezos_crypto.Block_hash.to_b58check + let string_of_key = Block_hash.to_b58check - let key_of_string = Tezos_crypto.Block_hash.of_b58check_opt + let key_of_string = Block_hash.of_b58check_opt let value_encoding = let open Data_encoding in @@ -635,7 +635,7 @@ module Make (Rollup : PARAMETERS) = struct | Ok packed_contents_list -> packed_contents_list in let signature = Tezos_crypto.Signature.zero in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; diff --git a/src/proto_016_PtMumbai/lib_injector/injector_sigs.ml b/src/proto_016_PtMumbai/lib_injector/injector_sigs.ml index 1f19298c3703..3b77944a9825 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_sigs.ml +++ b/src/proto_016_PtMumbai/lib_injector/injector_sigs.ml @@ -68,7 +68,7 @@ type retry_action = node. *) type injected_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) } @@ -77,10 +77,10 @@ type injected_info = { block. *) type included_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) - l1_block : Tezos_crypto.Block_hash.t; + l1_block : Block_hash.t; (** The hash of the L1 block in which the operation was included. *) l1_level : int32; (** The level of [l1_block]. *) } @@ -101,9 +101,7 @@ let injected_info_encoding = @@ merge_objs L1_operation.encoding (obj1 - (req - "layer1" - (obj1 (req "operation_hash" Tezos_crypto.Operation_hash.encoding)))) + (req "layer1" (obj1 (req "operation_hash" Operation_hash.encoding)))) let included_info_encoding = let open Data_encoding in @@ -116,8 +114,8 @@ let included_info_encoding = (req "layer1" (obj3 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "operation_hash" Operation_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "level" int32)))) (** Signature for tags used in injector *) diff --git a/src/proto_016_PtMumbai/lib_injector/injector_worker_types.ml b/src/proto_016_PtMumbai/lib_injector/injector_worker_types.ml index 7f86e158a775..8ea98a4b4871 100644 --- a/src/proto_016_PtMumbai/lib_injector/injector_worker_types.ml +++ b/src/proto_016_PtMumbai/lib_injector/injector_worker_types.ml @@ -84,7 +84,7 @@ module Request = struct Format.fprintf ppf "switching to new Tezos head %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.Alpha_block_services.hash ; if r.old_chain <> [] || r.new_chain <> [] then Format.fprintf diff --git a/src/proto_016_PtMumbai/lib_injector/l1_operation.mli b/src/proto_016_PtMumbai/lib_injector/l1_operation.mli index 21b13fbf32ff..6dc5bdeb9cd8 100644 --- a/src/proto_016_PtMumbai/lib_injector/l1_operation.mli +++ b/src/proto_016_PtMumbai/lib_injector/l1_operation.mli @@ -26,7 +26,7 @@ open Protocol.Alpha_context (** Hash with b58check encoding mop(53), for hashes of L1 manager operations *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for L1 operations hashes *) type hash = Hash.t diff --git a/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.ml b/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.ml index 7f8742082e1c..64f23841d330 100644 --- a/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.ml +++ b/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.ml @@ -29,7 +29,7 @@ open Apply_results open Protocol_client_context open Alpha_block_services -type error += Cannot_read_block_metadata of Tezos_crypto.Block_hash.t +type error += Cannot_read_block_metadata of Block_hash.t let () = register_error_kind @@ -40,10 +40,10 @@ let () = Format.fprintf ppf "Could not read block receipt for block with hash %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_read_block_metadata hash -> Some hash | _ -> None) (fun hash -> Cannot_read_block_metadata hash) diff --git a/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.mli b/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.mli index 1255d70b764e..4cb30e48b0a5 100644 --- a/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.mli +++ b/src/proto_016_PtMumbai/lib_layer2_utils/layer1_services.mli @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Protocol_client_context.Alpha_block_services -type error += Cannot_read_block_metadata of Tezos_crypto.Block_hash.t +type error += Cannot_read_block_metadata of Block_hash.t type 'accu successful_operation_processor = { apply : diff --git a/src/proto_016_PtMumbai/lib_plugin/RPC.ml b/src/proto_016_PtMumbai/lib_plugin/RPC.ml index 91183c254b4c..359c8787ac65 100644 --- a/src/proto_016_PtMumbai/lib_plugin/RPC.ml +++ b/src/proto_016_PtMumbai/lib_plugin/RPC.ml @@ -949,7 +949,7 @@ module Scripts = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero in + let ctxt = Origination_nonce.init ctxt Operation_hash.zero in Contract.fresh_contract_from_current_nonce ctxt >>?= fun (ctxt, dummy_contract_hash) -> let dummy_contract = Contract.Originated dummy_contract_hash in diff --git a/src/proto_016_PtMumbai/lib_plugin/mempool.ml b/src/proto_016_PtMumbai/lib_plugin/mempool.ml index c4131028861d..bdec72bfb938 100644 --- a/src/proto_016_PtMumbai/lib_plugin/mempool.ml +++ b/src/proto_016_PtMumbai/lib_plugin/mempool.ml @@ -187,10 +187,7 @@ type manager_op_info = { in [state] when appropriate. *) } -type manager_op_weight = { - operation_hash : Tezos_crypto.Operation_hash.t; - weight : Q.t; -} +type manager_op_weight = {operation_hash : Operation_hash.t; weight : Q.t} (** Build a {!manager_op_weight} from operation hash and {!manager_op_info}. *) let mk_op_weight oph (info : manager_op_info) = @@ -199,7 +196,7 @@ let mk_op_weight oph (info : manager_op_info) = let compare_manager_op_weight op1 op2 = let c = Q.compare op1.weight op2.weight in if c <> 0 then c - else Tezos_crypto.Operation_hash.compare op1.operation_hash op2.operation_hash + else Operation_hash.compare op1.operation_hash op2.operation_hash module ManagerOpWeightSet = Set.Make (struct type t = manager_op_weight @@ -224,10 +221,10 @@ type ops_state = { (** Number of prechecked manager operations. Invariants: - [prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal prechecked_manager_ops + = Operation_hash.Map.cardinal prechecked_manager_ops = ManagerOpWeightSet.cardinal prechecked_op_weights] - [prechecked_manager_op_count <= max_prechecked_manager_operations] *) - prechecked_manager_ops : manager_op_info Tezos_crypto.Operation_hash.Map.t; + prechecked_manager_ops : manager_op_info Operation_hash.Map.t; (** All prechecked manager operations. See {!manager_op_info}. *) prechecked_op_weights : ManagerOpWeightSet.t; (** The {!manager_op_weight} of all prechecked manager operations. *) @@ -243,7 +240,7 @@ type state = {state_info : state_info; ops_state : ops_state} let empty_ops_state = { prechecked_manager_op_count = 0; - prechecked_manager_ops = Tezos_crypto.Operation_hash.Map.empty; + prechecked_manager_ops = Operation_hash.Map.empty; prechecked_op_weights = ManagerOpWeightSet.empty; min_prechecked_op_weight = None; } @@ -352,7 +349,7 @@ let () = (fun () -> Fees_too_low) type Environment.Error_monad.error += - | Manager_restriction of {oph : Tezos_crypto.Operation_hash.t; fee : Tez.t} + | Manager_restriction of {oph : Operation_hash.t; fee : Tez.t} let () = Environment.Error_monad.register_error_kind @@ -366,21 +363,21 @@ let () = "Only one manager operation per manager per block allowed (found %a \ with %atez fee. You may want to use --replace to provide adequate fee \ and replace it)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Tez.pp fee) Data_encoding.( obj2 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation_fee" Tez.encoding)) (function Manager_restriction {oph; fee} -> Some (oph, fee) | _ -> None) (fun (oph, fee) -> Manager_restriction {oph; fee}) type Environment.Error_monad.error += | Manager_operation_replaced of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } let () = @@ -393,13 +390,13 @@ let () = Format.fprintf ppf "The manager operation %a has been replaced with %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Manager_operation_replaced {old_hash; new_hash} -> Some (old_hash, new_hash) @@ -827,17 +824,13 @@ let pre_filter config ~filter_state (** Remove a manager operation hash from the ops_state. Do nothing if the operation was not in the state. *) let remove_operation ops_state oph = - match - Tezos_crypto.Operation_hash.Map.find oph ops_state.prechecked_manager_ops - with + match Operation_hash.Map.find oph ops_state.prechecked_manager_ops with | None -> (* Not present in the ops_state: nothing to do. *) ops_state | Some info -> let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.remove - oph - ops_state.prechecked_manager_ops + Operation_hash.Map.remove oph ops_state.prechecked_manager_ops in let prechecked_manager_op_count = ops_state.prechecked_manager_op_count - 1 @@ -851,9 +844,8 @@ let remove_operation ops_state oph = match ops_state.min_prechecked_op_weight with | None -> None | Some min_op_weight -> - if - Tezos_crypto.Operation_hash.equal min_op_weight.operation_hash oph - then ManagerOpWeightSet.min_elt prechecked_op_weights + if Operation_hash.equal min_op_weight.operation_hash oph then + ManagerOpWeightSet.min_elt prechecked_op_weights else Some min_op_weight in { @@ -876,18 +868,15 @@ let add_manager_op ops_state oph info replacement = | `No_replace -> ops_state | `Replace (oph, _classification) -> remove_operation ops_state oph in - if Tezos_crypto.Operation_hash.Map.mem oph ops_state.prechecked_manager_ops - then (* Already present in the ops_state: nothing to do. *) + if Operation_hash.Map.mem oph ops_state.prechecked_manager_ops then + (* Already present in the ops_state: nothing to do. *) ops_state else let prechecked_manager_op_count = ops_state.prechecked_manager_op_count + 1 in let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - ops_state.prechecked_manager_ops + Operation_hash.Map.add oph info ops_state.prechecked_manager_ops in let op_weight = mk_op_weight oph info in let prechecked_op_weights = @@ -1011,8 +1000,8 @@ let is_manager_operation op = of the call to {!Operation.compare}). *) let conflict_handler config : Mempool.conflict_handler = fun ~existing_operation ~new_operation -> - let (_ : Tezos_crypto.Operation_hash.t), old_op = existing_operation in - let (_ : Tezos_crypto.Operation_hash.t), new_op = new_operation in + let (_ : Operation_hash.t), old_op = existing_operation in + let (_ : Operation_hash.t), new_op = new_operation in if is_manager_operation old_op && is_manager_operation new_op then let new_op_is_better = let open Result_syntax in diff --git a/src/proto_016_PtMumbai/lib_plugin/test/generators.ml b/src/proto_016_PtMumbai/lib_plugin/test/generators.ml index 426dadd70939..affc95dd5a77 100644 --- a/src/proto_016_PtMumbai/lib_plugin/test/generators.ml +++ b/src/proto_016_PtMumbai/lib_plugin/test/generators.ml @@ -39,10 +39,10 @@ let public_key_hash_gen : (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) -let operation_hash_gen : Tezos_crypto.Operation_hash.t QCheck2.Gen.t = +let operation_hash_gen : Operation_hash.t QCheck2.Gen.t = let open QCheck2.Gen in let+ s = QCheck2.Gen.string_size (return 32) in - Tezos_crypto.Operation_hash.of_string_exn s + Operation_hash.of_string_exn s let dummy_manager_op_info = let fee = Alpha_context.Tez.zero in @@ -61,7 +61,7 @@ let dummy_manager_op_info = let protocol_data = {contents; signature = Some Tezos_crypto.Signature.zero} in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in Mempool.Manager_op {shell = {branch}; protocol_data} in Mempool.{manager_op; fee; gas_limit; weight = Q.zero} @@ -77,8 +77,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = let+ ops = small_list oph_and_info_gen in List.fold_left (fun state (oph, info) -> - if Tezos_crypto.Operation_hash.Map.mem oph state.prechecked_manager_ops - then state + if Operation_hash.Map.mem oph state.prechecked_manager_ops then state else let prechecked_manager_op_count = state.prechecked_manager_op_count + 1 @@ -94,10 +93,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = { prechecked_manager_op_count; prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - state.prechecked_manager_ops; + Operation_hash.Map.add oph info state.prechecked_manager_ops; prechecked_op_weights = ManagerOpWeightSet.add op_weight state.prechecked_op_weights; min_prechecked_op_weight; @@ -109,25 +105,20 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = even odds of belonging to the given filter_state or being fresh. *) let with_filter_state_operation_gen : Plugin.Mempool.ops_state -> - (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - QCheck2.Gen.t = + (Operation_hash.t * Plugin.Mempool.manager_op_info) QCheck2.Gen.t = fun state -> let open QCheck2.Gen in let* use_fresh = bool in - if - use_fresh - || Tezos_crypto.Operation_hash.Map.is_empty state.prechecked_manager_ops - then oph_and_info_gen - else - oneofl - (Tezos_crypto.Operation_hash.Map.bindings state.prechecked_manager_ops) + if use_fresh || Operation_hash.Map.is_empty state.prechecked_manager_ops then + oph_and_info_gen + else oneofl (Operation_hash.Map.bindings state.prechecked_manager_ops) (** Generate both a filter_state, and a pair of operation hash and manager_op_info. The pair has even odds of belonging to the filter_state or being fresh. *) let filter_state_with_operation_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in filter_state_gen >>= fun state -> @@ -138,8 +129,8 @@ let filter_state_with_operation_gen : to the filter_state or being fresh. *) let filter_state_with_two_operations_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in let* filter_state = filter_state_gen in diff --git a/src/proto_016_PtMumbai/lib_plugin/test/test_conflict_handler.ml b/src/proto_016_PtMumbai/lib_plugin/test/test_conflict_handler.ml index d84714a3b984..1b5d344cd38b 100644 --- a/src/proto_016_PtMumbai/lib_plugin/test/test_conflict_handler.ml +++ b/src/proto_016_PtMumbai/lib_plugin/test/test_conflict_handler.ml @@ -38,7 +38,7 @@ let check_answer ?__LOC__ expected actual = assert (Qcheck2_helpers.qcheck_eq ~pp:pp_answer ?__LOC__ expected actual : bool) -let is_manager_op ((_ : Tezos_crypto.Operation_hash.t), op) = +let is_manager_op ((_ : Operation_hash.t), op) = (* This is implemented differently from [Plugin.Mempool.is_manager_operation] (which relies on [Alpha_context.Operation.acceptable_pass]), used in diff --git a/src/proto_016_PtMumbai/lib_plugin/test/test_filter_state.ml b/src/proto_016_PtMumbai/lib_plugin/test/test_filter_state.ml index 82868acd43f2..bb48f3b41809 100644 --- a/src/proto_016_PtMumbai/lib_plugin/test/test_filter_state.ml +++ b/src/proto_016_PtMumbai/lib_plugin/test/test_filter_state.ml @@ -46,14 +46,13 @@ let check_filter_state_invariants filter_state = filter_state) ~cond:(fun filter_state -> filter_state.prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal - filter_state.prechecked_manager_ops + = Operation_hash.Map.cardinal filter_state.prechecked_manager_ops && filter_state.prechecked_manager_op_count = ManagerOpWeightSet.cardinal filter_state.prechecked_op_weights && ManagerOpWeightSet.for_all (fun {operation_hash; weight} -> match - Tezos_crypto.Operation_hash.Map.find + Operation_hash.Map.find operation_hash filter_state.prechecked_manager_ops with @@ -80,7 +79,7 @@ let test_add_manager_op = already present in [filter_state] or fresh. *) let replacement = if should_replace then ( - assume (not (Tezos_crypto.Operation_hash.equal oph_to_replace oph)) ; + assume (not (Operation_hash.equal oph_to_replace oph)) ; `Replace (oph_to_replace, ())) else `No_replace in @@ -91,11 +90,11 @@ let test_add_manager_op = Format.fprintf fmt "%a was not found in prechecked_manager_ops: %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph pp_prechecked_manager_ops set) - ~cond:(Tezos_crypto.Operation_hash.Map.mem oph) + ~cond:(Operation_hash.Map.mem oph) filter_state.prechecked_manager_ops () && @@ -105,11 +104,11 @@ let test_add_manager_op = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph_to_replace) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph_to_replace filter_state.prechecked_manager_ops)) () @@ -132,10 +131,7 @@ let test_remove_present = -> (* Add a fresh operation [oph] to the state. *) assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let replacement = if should_replace then `Replace (oph_to_replace, ()) else `No_replace in @@ -151,11 +147,11 @@ let test_remove_present = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph filter_state.prechecked_manager_ops)) () @@ -183,10 +179,7 @@ let test_remove_unknown = (Gen.pair Generators.filter_state_gen Generators.operation_hash_gen) (fun (initial_state, oph) -> assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let filter_state = remove_operation initial_state oph in qcheck_eq ~pp:pp_state ~eq:eq_state initial_state filter_state) diff --git a/src/proto_016_PtMumbai/lib_plugin/test/test_utils.ml b/src/proto_016_PtMumbai/lib_plugin/test/test_utils.ml index 0b92f1f4ca4c..57402233a49e 100644 --- a/src/proto_016_PtMumbai/lib_plugin/test/test_utils.ml +++ b/src/proto_016_PtMumbai/lib_plugin/test/test_utils.ml @@ -44,7 +44,7 @@ let pp_prechecked_manager_ops fmt set = Format.fprintf ppf "(%a -> {fee: %a; gas: %a; weight: %a})" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Alpha_context.Tez.pp op_info.fee @@ -52,13 +52,13 @@ let pp_prechecked_manager_ops fmt set = op_info.gas_limit Q.pp_print op_info.weight)) - (Tezos_crypto.Operation_hash.Map.bindings set) + (Operation_hash.Map.bindings set) let pp_manager_op_weight fmt weight = Format.fprintf fmt "{oph: %a; weight: %a}" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp weight.operation_hash Q.pp_print weight.weight @@ -95,7 +95,7 @@ let pp_state fmt state = state.min_prechecked_op_weight let eq_prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.equal + Operation_hash.Map.equal (fun {manager_op = _; fee = fee1; gas_limit = gas1; weight = w1} {manager_op = _; fee = fee2; gas_limit = gas2; weight = w2} @@ -103,9 +103,7 @@ let eq_prechecked_manager_ops = let eq_op_weight_opt = Option.equal (fun op_weight1 op_weight2 -> - Tezos_crypto.Operation_hash.equal - op_weight1.operation_hash - op_weight2.operation_hash + Operation_hash.equal op_weight1.operation_hash op_weight2.operation_hash && Q.equal op_weight1.weight op_weight2.weight) (* This function needs to be updated if the filter state is extended *) diff --git a/src/proto_016_PtMumbai/lib_protocol/dune b/src/proto_016_PtMumbai/lib_protocol/dune index 250322901123..f77c31538d77 100644 --- a/src/proto_016_PtMumbai/lib_protocol/dune +++ b/src/proto_016_PtMumbai/lib_protocol/dune @@ -299,7 +299,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc\"\nlet name = Tezos_protocol_environment_016_PtMumbai.Name.name\ninclude Tezos_raw_protocol_016_PtMumbai\ninclude Tezos_raw_protocol_016_PtMumbai.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc\"\nlet name = Tezos_protocol_environment_016_PtMumbai.Name.name\ninclude Tezos_raw_protocol_016_PtMumbai\ninclude Tezos_raw_protocol_016_PtMumbai.Main\n"))) (rule (targets tezos_protocol_016_PtMumbai.ml) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/assert.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/assert.ml index 24d1953a35e3..983cc13fc8e9 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/assert.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/assert.ml @@ -174,23 +174,21 @@ let not_equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) not_equal ~loc PKH.equal "Public key hashes are equal" PKH.pp a b (* protocol hash *) -let equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes aren't equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b -let not_equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let not_equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = not_equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes are equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml index 47c571e7df23..1ac9547490fe 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml @@ -31,7 +31,7 @@ open Alpha_context (* This type collects a block and the context that results from its application *) type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; @@ -185,7 +185,7 @@ module Forge = struct (* We don't care of the following values, only the shell validates them. *) proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } let set_seed_nonce_hash seed_nonce_hash @@ -247,8 +247,7 @@ module Forge = struct >|=? fun seed_nonce_hash -> let hashes = List.map Operation.hash_packed operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [Tezos_crypto.Operation_list_hash.compute hashes] + Operation_list_list_hash.compute [Operation_list_hash.compute hashes] in let shell = make_shell @@ -405,7 +404,7 @@ let initial_alpha_context ?(commitments = []) constants let genesis_with_parameters parameters = let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let fitness = @@ -421,7 +420,7 @@ let genesis_with_parameters parameters = ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in let contents = Forge.make_contents @@ -591,7 +590,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum in check_constants_consistency constants >>=? fun () -> let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let level = Option.value ~default:0l level in @@ -608,7 +607,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in return (constants, shell, hash) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.mli b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.mli index 80bd8fe6ad35..86da06f1bef2 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.mli +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.mli @@ -29,7 +29,7 @@ open Protocol open Alpha_context type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; (** Resulting context *) @@ -304,9 +304,7 @@ val prepare_initial_context_params : ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> unit -> - ( Constants.Parametric.t - * Block_header.shell_header - * Tezos_crypto.Block_hash.t, + ( Constants.Parametric.t * Block_header.shell_header * Block_hash.t, tztrace ) result Lwt.t diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml index 8bb697a7917e..e0fea8f7640c 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml @@ -276,7 +276,7 @@ module Vote = struct type delegate_info = Alpha_context.Vote.delegate_info = { voting_power : Int64.t option; current_ballot : Alpha_context.Vote.ballot option; - current_proposals : Tezos_crypto.Protocol_hash.t list; + current_proposals : Protocol_hash.t list; remaining_proposals : int; } @@ -603,6 +603,6 @@ let default_raw_context () = context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero ~typecheck >>= fun e -> Lwt.return @@ Environment.wrap_tzresult e diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.mli b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.mli index f73c78a98ec4..4f6681585666 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.mli +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.mli @@ -30,9 +30,9 @@ open Environment type t = B of Block.t | I of Incremental.t -val branch : t -> Tezos_crypto.Block_hash.t +val branch : t -> Block_hash.t -val pred_branch : t -> Tezos_crypto.Block_hash.t +val pred_branch : t -> Block_hash.t val get_level : t -> Raw_level.t tzresult @@ -130,17 +130,16 @@ module Vote : sig val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t - val get_current_proposal : - t -> Tezos_crypto.Protocol_hash.t option tzresult Lwt.t + val get_current_proposal : t -> Protocol_hash.t option tzresult Lwt.t - val get_protocol : Block.t -> Tezos_crypto.Protocol_hash.t Lwt.t + val get_protocol : Block.t -> Protocol_hash.t Lwt.t val set_participation_ema : Block.t -> int32 -> Block.t Lwt.t type delegate_info = Alpha_context.Vote.delegate_info = { voting_power : Int64.t option; current_ballot : Alpha_context.Vote.ballot option; - current_proposals : Tezos_crypto.Protocol_hash.t list; + current_proposals : Protocol_hash.t list; remaining_proposals : int; } diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml index 1cf523719e41..c1c382ffbe86 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml @@ -54,7 +54,7 @@ let rpc_context st = let fitness = (header st).shell.fitness in let result = Alpha_context.finalize (alpha_ctxt st) fitness in { - Environment.Updater.block_hash = Tezos_crypto.Block_hash.zero; + Environment.Updater.block_hash = Block_hash.zero; block_header = {st.header.shell with fitness = result.fitness}; context = result.context; } @@ -115,8 +115,8 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) fitness = predecessor.header.shell.fitness; timestamp; level = predecessor.header.shell.level; - context = Tezos_crypto.Context_hash.zero; - operations_hash = Tezos_crypto.Operation_list_list_hash.zero; + context = Context_hash.zero; + operations_hash = Operation_list_list_hash.zero; }; protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; } @@ -244,11 +244,8 @@ let finalize_block st = let open Lwt_result_syntax in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let shell_header = { @@ -263,11 +260,8 @@ let finalize_block st = let*? validation_result, _ = Environment.wrap_tzresult res in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let header = { diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml index 429a4f52c4cd..884dbe2171b8 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml @@ -241,7 +241,7 @@ let combine_operations ?public_key ?counter ?spurious_operation ~source ctxt assert ( List.for_all (fun {shell = {Tezos_base.Operation.branch = b; _}; _} -> - Tezos_crypto.Block_hash.(branch = b)) + Block_hash.(branch = b)) packed_operations) ; (* TODO? : check signatures consistency *) let unpacked_operations = @@ -555,7 +555,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" + Ed25519 encrypted public key hash" Tezos_crypto.Signature.Public_key_hash.pp pkh) >|=? fun id -> diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.mli b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.mli index c24b7551d5d5..24a03b9eb408 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.mli +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.mli @@ -47,7 +47,7 @@ val pack_operation : val sign : ?watermark:Tezos_crypto.Signature.watermark -> Tezos_crypto.Signature.secret_key -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> packed_contents_list -> packed_operation @@ -66,7 +66,7 @@ val raw_endorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Kind.endorsement Operation.t tzresult Lwt.t @@ -80,7 +80,7 @@ val raw_preendorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Kind.preendorsement Operation.t tzresult Lwt.t @@ -92,7 +92,7 @@ val endorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Operation.packed tzresult Lwt.t @@ -104,7 +104,7 @@ val preendorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Operation.packed tzresult Lwt.t @@ -343,7 +343,7 @@ val proposals_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals contents_list tzresult Lwt.t (** Craft a Proposals operation. @@ -356,7 +356,7 @@ val proposals : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Operation.packed tzresult Lwt.t (** Craft the [contents_list] for a Ballot operation. @@ -369,7 +369,7 @@ val ballot_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot contents_list tzresult Lwt.t @@ -383,7 +383,7 @@ val ballot : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Operation.packed tzresult Lwt.t @@ -523,7 +523,7 @@ val tx_rollup_dispatch_tickets : message_result_path:Tx_rollup_commitment.Merkle.path -> Tx_rollup.t -> Tx_rollup_level.t -> - Tezos_crypto.Context_hash.t -> + Context_hash.t -> Tx_rollup_reveal.t list -> (packed_operation, tztrace) result Lwt.t diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml index 63e0b62bf26e..a9f28dc80300 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml @@ -134,7 +134,7 @@ end (** {3 Selection in hashes list} *) let gen_block_hash = - let module G = Gen_hash (Tezos_crypto.Block_hash) in + let module G = Gen_hash (Block_hash) in G.gen let random_payload_hash = @@ -253,7 +253,7 @@ let random_block_header = QCheck2.Gen.oneofl block_headers let random_tx_rollup = let open QCheck2.Gen in - let module G = Gen_hash (Tezos_crypto.Operation_hash) in + let module G = Gen_hash (Operation_hash) in let+ oph = G.gen in let nonce = Origination_nonce.Internal_for_tests.initial oph in Tx_rollup.Internal_for_tests.originated_tx_rollup nonce @@ -263,7 +263,7 @@ let random_sc_rollup = G.gen let random_proto = - let module G = Gen_hash (Tezos_crypto.Protocol_hash) in + let module G = Gen_hash (Protocol_hash) in G.gen let random_code = @@ -581,7 +581,7 @@ let generate_tx_rollup_rejection = { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } in @@ -619,7 +619,7 @@ let generate_tx_dispatch_tickets = let level = Tx_rollup_level.root in let message_index = 0 in let message_result_path = Tx_rollup_commitment.Merkle.dummy_path in - let context_hash = Tezos_crypto.Context_hash.zero in + let context_hash = Context_hash.zero in let reveal = Tx_rollup_reveal. { diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/sc_rollup_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sc_rollup_helpers.ml index eadb4e700224..9831d1fafba0 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/sc_rollup_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sc_rollup_helpers.ml @@ -39,8 +39,8 @@ module Make_in_memory_context (Context : sig Tezos_context_sigs.Context.TEZOS_CONTEXT with type memory_context_tree := tree and type tree := tree - and type value_key = Tezos_crypto.Context_hash.t - and type node_key = Tezos_crypto.Context_hash.t + and type value_key = Context_hash.t + and type node_key = Context_hash.t end) = struct module Tree = struct @@ -280,7 +280,7 @@ type message = { input : Sc_rollup.input; message : [ `SOL - | `Info_per_level of Timestamp.t * Tezos_crypto.Block_hash.t + | `Info_per_level of Timestamp.t * Block_hash.t | `Message of string | `EOL ]; } @@ -299,8 +299,7 @@ type payloads_per_level = { (** List of external serialized messages. *) predecessor_timestamp : Time.Protocol.t; (** predecessor timestamp of the [Info_per_level]. *) - predecessor : Tezos_crypto.Block_hash.t; - (** Predecessor of the [Info_per_level]. *) + predecessor : Block_hash.t; (** Predecessor of the [Info_per_level]. *) level : Raw_level.t; inputs : Sc_rollup.input list; (** List of all inputs for the level, to be read by a PVM. *) @@ -329,7 +328,7 @@ let pp_message fmt {input; message} = Format.asprintf "Info_per_level (%s, %a)" (Timestamp.to_notation predecessor_timestamp) - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash | `Message msg -> msg | `EOL -> "EOL") @@ -372,8 +371,7 @@ let make_inputs predecessor_timestamp predecessor messages inbox_level = (** Wrap messages, predecessor_timestamp and predecessor of a level into a [payloads_per_level] .*) let wrap_messages ?(predecessor_timestamp = Timestamp.of_seconds 0L) - ?(predecessor = Tezos_crypto.Block_hash.zero) level messages : - payloads_per_level = + ?(predecessor = Block_hash.zero) level messages : payloads_per_level = let payloads = List.map make_external_inbox_message messages in let inputs = make_inputs predecessor_timestamp predecessor messages level in {payloads; predecessor_timestamp; predecessor; messages; level; inputs} @@ -596,7 +594,7 @@ let fill_inbox ~inbox history payloads_histories payloads_per_levels = let construct_inbox ?(inbox_creation_level = Raw_level.(root)) ?(with_histories = true) ?(predecessor_timestamp = Time.Protocol.epoch) - ?(predecessor = Tezos_crypto.Block_hash.zero) payloads_per_levels = + ?(predecessor = Block_hash.zero) payloads_per_levels = let inbox = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Environment.wrap_tzresult @@ -653,12 +651,12 @@ let dumb_init level = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Sc_rollup.Inbox.genesis ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero level let dumb_init_repr level = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Sc_rollup_inbox_repr.genesis ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero level diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_baking.ml index 5b5ce979ae4d..cd7b92e17e21 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -52,7 +52,7 @@ let block_fork ?policy (contract_a, contract_b) b = let order_block_hashes ~correct_order bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if correct_order then if c < 0 then (bh1, bh2) else (bh2, bh1) else if c < 0 then (bh2, bh1) else (bh1, bh2) @@ -95,7 +95,7 @@ let test_valid_double_baking_evidence () = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_endorsement.ml index 38d190702a43..8417f6911f0f 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -52,7 +52,7 @@ let block_fork b = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index 199f1d679b5a..81dbcd956388 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_preendorsement.ml @@ -177,7 +177,7 @@ end = struct let order_preendorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_sc_rollup.ml index a49b4cc6c66a..edb20463f550 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -303,7 +303,7 @@ let publish_op_and_dummy_commitment ~src ?compressed_state ?predecessor rollup Option.map (fun s -> Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string [s])) + (Context_hash.hash_string [s])) compressed_state in let* commitment = @@ -1976,7 +1976,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]); + (Context_hash.hash_string ["first"]); } in let commitment2 = @@ -1985,7 +1985,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]); + (Context_hash.hash_string ["second"]); } in @@ -2092,14 +2092,14 @@ let init_with_conflict () = let* block, rollup = sc_originate block account1 "unit" in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]) + (Context_hash.hash_string ["first"]) in let* commitment1 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]) + (Context_hash.hash_string ["second"]) in let* commitment2 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup @@ -2496,7 +2496,7 @@ let test_automatically_added_internal_messages () = let level_zero_info = ( Time.Protocol.epoch, - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" ) in @@ -2759,7 +2759,7 @@ let test_offline_staker_does_not_prevent_cementation () = let init_with_4_conflicts () = let dumb_compressed_state s = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string [s]) + (Context_hash.hash_string [s]) in let* block, players = context_init (Context.TList 4) in let pA, pB, pC, pD = @@ -2995,7 +2995,7 @@ let test_conflict_point_on_a_branch () = commitment with compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["foo"]); + (Context_hash.hash_string ["foo"]); } ) in let* block = publish_commitments block pB rollup [pB_commitment] in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml index 26f764d3196b..01f6b5a5b3a5 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -413,7 +413,7 @@ let make_deposit b tx_rollup l1_src addr = (** Create an incomplete (but valid) commitment for a given level. It is incomplete in the sense that the Merkle roots for each message are generated - with [Tezos_crypto.Context_hash.hash_string message_index]. In the meantime provides the + with [Context_hash.hash_string message_index]. In the meantime provides the list of withdraw in a association list of [batch_index -> withdraw_list]. Be careful not to provide a too-big withdraw_list as the construction is expensive *) @@ -424,8 +424,7 @@ let make_incomplete_commitment_for_batch context level tx_rollup withdraw_list = Data_encoding.Binary.to_string_exn Tx_rollup_inbox.encoding metadata in List.init ~when_negative_length:[] metadata.inbox_length (fun i -> - Tezos_crypto.Context_hash.hash_string - [str_for_context_hash ^ string_of_int i]) + Context_hash.hash_string [str_for_context_hash ^ string_of_int i]) >>?= fun batches_result -> let messages = List.mapi @@ -1606,7 +1605,7 @@ let test_commitment_duplication () = let batches2 : Tx_rollup_message_result_hash.t list = [Bytes.make 20 '1'; Bytes.make 20 '2'] |> List.map (fun hash -> - let context_hash = Tezos_crypto.Context_hash.hash_bytes [hash] in + let context_hash = Context_hash.hash_bytes [hash] in Tx_rollup_message_result_hash.hash_uncarbonated { context_hash; @@ -2274,7 +2273,7 @@ module Rejection = struct Tx_rollup_message_result_hash.hash_uncarbonated { context_hash = - Tezos_crypto.Context_hash.of_b58check_exn + Context_hash.of_b58check_exn "CoUiEnajKeukmYFUgWTJF2z3v24MycpTaomF8a9hRzVy7as9hvgy"; withdraw_list_hash = Tx_rollup_withdraw_list_hash.empty; }; @@ -2344,8 +2343,7 @@ module Rejection = struct let* store = init_l2_store () in let* hash_tree = hash_tree_from_store store in assert ( - Tezos_crypto.Context_hash.( - hash_tree = Tx_rollup_message_result.empty_l2_context_hash)) ; + Context_hash.(hash_tree = Tx_rollup_message_result.empty_l2_context_hash)) ; return_unit (** [make_proof store msg] applies [msg] on [store] and returns the @@ -2373,7 +2371,7 @@ module Rejection = struct { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } @@ -2751,7 +2749,7 @@ module Rejection = struct let level1 = tx_level 1l in make_invalid_commitment b level0 l2_context_hash >>=? fun (b, commitment0) -> - make_invalid_commitment b level1 Tezos_crypto.Context_hash.zero + make_invalid_commitment b level1 Context_hash.zero >>=? fun (b, commitment1) -> Context.get_constants (B b) >>=? fun constants -> let bond_cost = constants.parametric.tx_rollup.commitment_bond in @@ -2987,7 +2985,7 @@ module Rejection = struct let previous_message_result : Tx_rollup_message_result.t = { (* Expected is Tx_rollup_commitment.empty_l2_context_hash *) - context_hash = Tezos_crypto.Context_hash.zero; + context_hash = Context_hash.zero; withdraw_list_hash = Tx_rollup_withdraw_list_hash.empty; } in @@ -3532,7 +3530,7 @@ module Rejection = struct l2_accounts in let time = time () in - let* (_ : Tezos_crypto.Context_hash.t) = C.commit ~time store in + let* (_ : Context_hash.t) = C.commit ~time store in return store (** Regression test to ensure that we can reject a commitment where the @@ -4567,7 +4565,7 @@ module Withdraw = struct ~message_result_path:Tx_rollup_commitment.Merkle.dummy_path tx_rollup Tx_rollup_level.root - (Tezos_crypto.Context_hash.hash_bytes [Bytes.make 20 'c']) + (Context_hash.hash_bytes [Bytes.make 20 'c']) (* any context hash will fail *) [ticket_info] (* any non-empty list will fail *) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_voting.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_voting.ml index 951fa00e12d7..83a5ce913c84 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_voting.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_voting.ml @@ -74,10 +74,10 @@ let expected_qr_num participation_ema = *. (of_int qr_max_num -. of_int qr_min_num) /. of_int den) -(* Tezos_crypto.Protocol_hash.zero is "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i" *) +(* Protocol_hash.zero is "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i" *) let protos = Array.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [| "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; @@ -230,9 +230,9 @@ let equal_delegate_info a b = Option.equal Int64.equal a.Vote.voting_power b.Vote.voting_power && Option.equal Vote.equal_ballot a.current_ballot b.current_ballot && List.equal - Tezos_crypto.Protocol_hash.equal - (List.sort Tezos_crypto.Protocol_hash.compare a.current_proposals) - (List.sort Tezos_crypto.Protocol_hash.compare b.current_proposals) + Protocol_hash.equal + (List.sort Protocol_hash.compare a.current_proposals) + (List.sort Protocol_hash.compare b.current_proposals) && Int.equal a.remaining_proposals b.remaining_proposals let assert_equal_info ~loc a b = @@ -470,9 +470,8 @@ let test_successful_vote num_delegates () = let props = List.map (fun i -> protos.(i)) (2 -- Constants.max_proposals_per_delegate) in - Op.proposals (B b) del1 (Tezos_crypto.Protocol_hash.zero :: props) - >>=? fun ops1 -> - Op.proposals (B b) del2 [Tezos_crypto.Protocol_hash.zero] >>=? fun ops2 -> + Op.proposals (B b) del1 (Protocol_hash.zero :: props) >>=? fun ops1 -> + Op.proposals (B b) del2 [Protocol_hash.zero] >>=? fun ops2 -> Block.bake ~operations:[ops1; ops2] b >>=? fun b -> Context.Delegate.voting_info (B b) pkh1 >>=? fun info1 -> Context.Delegate.voting_info (B b) pkh2 >>=? fun info2 -> @@ -482,7 +481,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow1; current_ballot = None; - current_proposals = Tezos_crypto.Protocol_hash.zero :: props; + current_proposals = Protocol_hash.zero :: props; remaining_proposals = 0; } >>=? fun () -> @@ -492,7 +491,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow2; current_ballot = None; - current_proposals = [Tezos_crypto.Protocol_hash.zero]; + current_proposals = [Protocol_hash.zero]; remaining_proposals = Constants.max_proposals_per_delegate - 1; } >>=? fun () -> @@ -514,7 +513,7 @@ let test_successful_vote num_delegates () = assert_validate_proposals_fails ~expected_error:too_many_proposals ~proposer:del1 - ~proposals:(Tezos_crypto.Protocol_hash.zero :: props) + ~proposals:(Protocol_hash.zero :: props) b __LOC__ >>=? fun () -> @@ -545,13 +544,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during exploration period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p2 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p2 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -572,7 +571,7 @@ let test_successful_vote num_delegates () = assert_validate_ballot_fails ~expected_error:already_submitted_a_ballot ~voter:del1 - ~proposal:Tezos_crypto.Protocol_hash.zero + ~proposal:Protocol_hash.zero ~ballot:Vote.Nay b __LOC__ @@ -623,13 +622,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during promotion period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p4 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p4 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -664,11 +663,11 @@ let test_successful_vote num_delegates () = Context.Vote.get_protocol b >>= fun p -> Assert.equal ~loc:__LOC__ - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Unexpected proposal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p - Tezos_crypto.Protocol_hash.zero + Protocol_hash.zero >>=? fun () -> return_unit (* given a list of active delegates, @@ -720,8 +719,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -743,7 +741,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -775,8 +773,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -792,7 +789,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -823,7 +820,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -947,7 +944,7 @@ let test_supermajority_in_exploration supermajority () = (* assert our proposal won *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal proposal v) then return_unit + if Protocol_hash.(equal proposal v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> @@ -1010,7 +1007,7 @@ let test_quorum_capped_maximum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1050,7 +1047,7 @@ let test_quorum_capped_minimum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1281,7 +1278,7 @@ let test_proposals_wrong_voting_period_index () = assert_validate_proposals_fails ~expected_error:(wrong_voting_period_index ~current_index ~op_index) ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] ~period:op_index block __LOC__ @@ -1341,14 +1338,14 @@ let test_proposals_source_not_in_vote_listings () = assert_validate_proposals_fails ~expected_error:proposals_from_unregistered_delegate ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in let assert_fails_with_source_not_in_vote_listings block = assert_validate_proposals_fails ~expected_error:source_not_in_vote_listings ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in (* Fail when the source has no contract in the storage. *) @@ -1919,7 +1916,7 @@ let observe_ballot pre_state post_state op caller_loc = let* current_proposal = Assert.get_some ~loc:(make_loc __LOC__) current_proposal in - assert (Tezos_crypto.Protocol_hash.equal proposal current_proposal) ; + assert (Protocol_hash.equal proposal current_proposal) ; (* Observations *) let* post_voting_infos = Context.Delegate.voting_info (B post_state) source in let* recorded_ballot = diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_frozen_bonds.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_frozen_bonds.ml index 789422bbbfa1..15f1f092c59e 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_frozen_bonds.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_frozen_bonds.ml @@ -54,7 +54,7 @@ let very_small_random_amount () = | Some x -> x let nonce_zero = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero + Origination_nonce.Internal_for_tests.initial Operation_hash.zero let mk_tx_rollup ?(nonce = nonce_zero) () = ( Tx_rollup.Internal_for_tests.originated_tx_rollup nonce, diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_sc_rollup_wasm.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_sc_rollup_wasm.ml index b971b3a70cd9..320df83e7801 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_sc_rollup_wasm.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_sc_rollup_wasm.ml @@ -85,7 +85,7 @@ module WASM_P : let produce_proof context tree step = let open Lwt_syntax in let* context = Context_binary.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context_binary.commit ~time:Time.Protocol.epoch context in let index = Context_binary.index context in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_token.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_token.ml index 7b5a33155ed2..b2b5f7ae8261 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/test_token.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/test_token.ml @@ -50,8 +50,7 @@ let random_amount () = | None -> assert false | Some x -> x -let nonce = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero +let nonce = Origination_nonce.Internal_for_tests.initial Operation_hash.zero let mk_rollup () = Tx_rollup.Internal_for_tests.originated_tx_rollup nonce diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.ml index 170f0435c8da..39c29f6d42b6 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.ml @@ -42,7 +42,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; @@ -129,10 +129,7 @@ let ballot_exploration_prelude state = let* props = List.map_es (fun voter -> - Op.proposals - (B state.block) - voter - [Tezos_crypto.Protocol_hash.zero]) + Op.proposals (B state.block) voter [Protocol_hash.zero]) voters in return (prop :: props, state) @@ -183,11 +180,7 @@ let ballot_exploration_descriptor = in assert (voting_period_info.voting_period.kind = Exploration) ; let ballot = pick_one ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -208,10 +201,7 @@ let proposal_descriptor = Context.Vote.get_current_period (B state.block) in assert (voting_period_info.voting_period.kind = Proposal) ; - Op.proposals - (B state.block) - contract - [Tezos_crypto.Protocol_hash.zero] + Op.proposals (B state.block) contract [Protocol_hash.zero] in List.map_es gen state.voters); } @@ -256,11 +246,7 @@ let ballot_promotion_descriptor = let* ops = List.map_es (fun voter -> - Op.ballot - (B state.block) - voter - Tezos_crypto.Protocol_hash.zero - Vote.Yay) + Op.ballot (B state.block) voter Protocol_hash.zero Vote.Yay) state.voters in return (ops, state) @@ -274,11 +260,7 @@ let ballot_promotion_descriptor = in assert (voting_period_info.voting_period.kind = Promotion) ; let ballot = Stdlib.List.hd ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -366,9 +348,7 @@ let dbl_endorsement_prelude state = let* op2 = Op.raw_preendorsement ~delegate:delegate1 b2 in let op1, op2 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op1) - (Operation.hash op2) + Operation_hash.compare (Operation.hash op1) (Operation.hash op2) in assert (comp <> 0) ; if comp < 0 then (op1, op2) else (op2, op1) @@ -380,9 +360,7 @@ let dbl_endorsement_prelude state = let* op4 = Op.raw_endorsement ~delegate:delegate2 b2 in let op3, op4 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op3) - (Operation.hash op4) + Operation_hash.compare (Operation.hash op3) (Operation.hash op4) in assert (comp <> 0) ; if comp < 0 then (op3, op4) else (op4, op3) @@ -430,7 +408,7 @@ let double_baking_descriptor = let order_block_header bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if c < 0 then (bh1, bh2) else (bh2, bh1) in let* ctxt = Context.to_alpha_ctxt (B state.block) in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.mli b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.mli index b0870b34a5be..515df860cfa4 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.mli +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/generator_descriptors.mli @@ -57,7 +57,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/manager_operation_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/manager_operation_helpers.ml index d0b1d04397f7..c3110e25dcc5 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/manager_operation_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/manager_operation_helpers.ml @@ -908,7 +908,7 @@ let mk_tx_rollup_reject (oinfos : operation_req) (infos : infos) = { version = 1; before = `Value Tx_rollup_message_result.empty_l2_context_hash; - after = `Value Tezos_crypto.Context_hash.zero; + after = `Value Context_hash.zero; state = Seq.empty; } in @@ -993,7 +993,7 @@ let mk_tx_rollup_dispacth_ticket (oinfos : operation_req) (infos : infos) = ~message_result_path:Tx_rollup_commitment.Merkle.dummy_path tx_rollup Tx_rollup_level.root - Tezos_crypto.Context_hash.zero + Context_hash.zero [reveal] let mk_sc_rollup_origination (oinfos : operation_req) (infos : infos) = diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml index 4547bed9fa28..7a6ce4bc8b21 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml @@ -84,16 +84,14 @@ let assert_operation_present_in_mempool ~__LOC__ mempool ophl = let resulting_mempool_operations = Environment.Operation_hash.Map.bindings operations |> List.map fst - |> List.sort Tezos_crypto.Operation_hash.compare - in - let expected_operations = - List.sort Tezos_crypto.Operation_hash.compare ophl + |> List.sort Operation_hash.compare in + let expected_operations = List.sort Operation_hash.compare ophl in Assert.assert_equal_list ~loc:__LOC__ - Tezos_crypto.Operation_hash.equal + Operation_hash.equal "operations present in mempool" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp resulting_mempool_operations expected_operations diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml index 715b19a4d705..cb5e7d8b18ea 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml @@ -61,7 +61,7 @@ let ballots = Vote.[Yay; Nay; Pass] let protos = List.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [ "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; diff --git a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_refutation_game.ml index 96d237dbe44d..17467ee33b83 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_refutation_game.ml @@ -1195,7 +1195,7 @@ module Player_client = struct | Info_hater -> let* corrupt_at_l = 0 -- List.length payloads_per_levels in let dumb_timestamp = Timestamp.of_seconds 42L in - let dumb_predecessor = Tezos_crypto.Block_hash.zero in + let dumb_predecessor = Block_hash.zero in let new_payloads_per_levels = List.mapi diff --git a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_sc_rollup_encoding.ml b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_sc_rollup_encoding.ml index 6bf0c0d5008a..869db23667e2 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_sc_rollup_encoding.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_sc_rollup_encoding.ml @@ -100,7 +100,7 @@ let gen_inbox level = let* witness = Sc_rollup_inbox_repr.add_info_per_level_no_history ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero witness in let* input_messages = diff --git a/src/proto_016_PtMumbai/lib_protocol/test/regression/test_logging.ml b/src/proto_016_PtMumbai/lib_protocol/test/regression/test_logging.ml index 5fb8465c249c..a123f6d311ba 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/regression/test_logging.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/regression/test_logging.ml @@ -225,9 +225,7 @@ let run_script transaction () = let* inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in let ctxt = - Alpha_context.Origination_nonce.init - ctxt - Tezos_crypto.Operation_hash.zero + Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in return (parameter, ctxt) in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_contract_repr.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_contract_repr.ml index 9a758c030b67..a372d293904e 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_contract_repr.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_contract_repr.ml @@ -47,7 +47,7 @@ module Test_contract_repr = struct open Contract_repr let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_destination_repr.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_destination_repr.ml index 1fafdba8ce99..f4cb1a04fcf6 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_destination_repr.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_destination_repr.ml @@ -36,7 +36,7 @@ open Protocol open Tztest let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_local_contexts.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_local_contexts.ml index 40eabf7d344b..d620a1618398 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_local_contexts.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_local_contexts.ml @@ -96,9 +96,9 @@ let eq_context ctxt1 ctxt2 = hash ctxt2 >>=? fun y -> Assert.equal ~loc:__LOC__ - Tezos_crypto.Context_hash.equal + Context_hash.equal "check context" - Tezos_crypto.Context_hash.pp + Context_hash.pp x y diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml index 419f430090de..19a806b1e138 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml @@ -94,7 +94,7 @@ module Test_operation_repr = struct let zero_bls = match - Tezos_crypto.Signature.(split_signature (Bls Tezos_crypto.Bls.zero)) + Tezos_crypto.Signature.split_signature (Bls Tezos_crypto.Bls.zero) with | {prefix = None; _} -> assert false | {prefix = Some prefix; suffix} -> diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_receipt.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_receipt.ml index 245ae17b0a54..866259712837 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_receipt.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_receipt.ml @@ -89,8 +89,7 @@ let test_encodings () = test_encodings Initial_commitments >>=? fun () -> test_encodings Minted >>=? fun () -> let nonce = - Origination_nonce.Internal_for_tests.initial - Tezos_crypto.Operation_hash.zero + Origination_nonce.Internal_for_tests.initial Operation_hash.zero in let tx_rollup = Tx_rollup.Internal_for_tests.originated_tx_rollup nonce in let bond_id = Bond_id.Tx_rollup_bond_id tx_rollup in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_arith.ml index b4b99941bd2e..85ad7450d318 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -81,7 +81,7 @@ module Arith_Context = struct (* FIXME: With on-disk context, we cannot commit the empty context. Is it also true in our case? *) let* context = Context_binary.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context_binary.commit ~time:Time.Protocol.epoch context in let index = Context_binary.index context in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_game.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_game.ml index 7559f0fb68a3..e3e292de954a 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_game.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_game.ml @@ -53,7 +53,7 @@ let assert_fails_with_f ~__LOC__ k f = let tick_of_int_exn n = match Tick.of_int n with None -> assert false | Some t -> t -let context_hash_of_string s = Tezos_crypto.Context_hash.hash_string [s] +let context_hash_of_string s = Context_hash.hash_string [s] let hash_string s = Sc_rollup_repr.State_hash.context_hash_to_state_hash diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox.ml index 81396aa1bffb..78441046d058 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox.ml @@ -135,7 +135,7 @@ let gen_payloads_for_level ?(inbox_creation_level = 0) () = let+ seconds = 0 -- 1_000_000 in Time.Protocol.of_seconds (Int64.of_int seconds) in - let predecessor = Tezos_crypto.Block_hash.zero in + let predecessor = Block_hash.zero in Sc_rollup_helpers.wrap_messages ~predecessor_timestamp ~predecessor diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml index 0b5ad6934674..8c02831d36f1 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml @@ -81,7 +81,7 @@ let populate_inboxes level history inbox inboxes list_of_messages = Environment.wrap_tzresult @@ add_all_messages ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero history inbox messages @@ -152,7 +152,7 @@ let setup_node_inbox_with_messages list_of_messages f = Environment.wrap_tzresult @@ add_all_messages ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero history inbox messages diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_storage.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_storage.ml index 31a5e619c997..c5e59ffed172 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_storage.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_storage.ml @@ -45,9 +45,7 @@ let new_context_n nb_stakers = let+ inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in (* Necessary to originate rollups. *) - let ctxt = - Alpha_context.Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in let ctxt = Alpha_context.Internal_for_tests.to_raw ctxt in let accounts = List.map @@ -765,7 +763,7 @@ module Stake_storage_tests = struct commitment with compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]); + (Context_hash.hash_string ["honest"]); } in let* () = @@ -1136,7 +1134,7 @@ module Stake_storage_tests = struct let honest_commitment, honest_commitment_hash = let compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]) + (Context_hash.hash_string ["honest"]) in commitment ~predecessor:genesis_hash @@ -1151,7 +1149,7 @@ module Stake_storage_tests = struct let dishonest_commitment, dishonest_commitment_hash = let compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["dishonest"]) + (Context_hash.hash_string ["dishonest"]) in commitment ~predecessor:genesis_hash @@ -1319,7 +1317,7 @@ module Stake_storage_tests = struct commitment with compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]); + (Context_hash.hash_string ["honest"]); } in let* ctxt = lift @@ publish_commitment ctxt rollup staker new_commitment in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_wasm.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_wasm.ml index 06a74827a158..544e03dd212c 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_wasm.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_sc_rollup_wasm.ml @@ -66,7 +66,7 @@ module Wasm_context = struct let produce_proof context tree step = let open Lwt_syntax in let* context = Context.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context.commit ~time:Time.Protocol.epoch context in let index = Context.index context in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_zk_rollup_storage.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_zk_rollup_storage.ml index 894f361439b0..cd548d976991 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_zk_rollup_storage.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_zk_rollup_storage.ml @@ -103,7 +103,7 @@ module Raw_context_tests = struct ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp in - let nonce = Tezos_crypto.Operation_hash.hash_string ["nonce_hash"] in + let nonce = Operation_hash.hash_string ["nonce_hash"] in return (Raw_context.init_origination_nonce ctx nonce, contract) (* Context with an originated ZKRU *) diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/l2_message.mli b/src/proto_016_PtMumbai/lib_sc_rollup/l2_message.mli index 456950222651..5f8f8ee52a90 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/l2_message.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup/l2_message.mli @@ -34,7 +34,7 @@ val make : string -> t val content : t -> string (** Hash with b58check encoding scmsg(55), for hashes of L2 messages. *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for message hash *) type hash = Hash.t diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.ml b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.ml index 4715b8408387..4f832b00e6fb 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.ml @@ -27,9 +27,9 @@ open Protocol open Alpha_context type header = { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; level : Raw_level.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; commitment_hash : Sc_rollup.Commitment.Hash.t option; previous_commitment_hash : Sc_rollup.Commitment.Hash.t; context : Sc_rollup_context_hash.t; @@ -105,10 +105,7 @@ let header_encoding = inbox_hash; }) @@ obj8 - (req - "block_hash" - Tezos_crypto.Block_hash.encoding - ~description:"Tezos block hash.") + (req "block_hash" Block_hash.encoding ~description:"Tezos block hash.") (req "level" Raw_level.encoding @@ -116,7 +113,7 @@ let header_encoding = "Level of the block, corresponds to the level of the tezos block.") (req "predecessor" - Tezos_crypto.Block_hash.encoding + Block_hash.encoding ~description:"Predecessor hash of the Tezos block.") (req "commitment_hash" diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.mli b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.mli index 7d79a246d3e6..1f0f8c7b4bbd 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_block.mli @@ -32,11 +32,10 @@ open Alpha_context with respect to a layer 1 block, but without the inbox content of messages. *) type header = { - block_hash : Tezos_crypto.Block_hash.t; (** Tezos block hash. *) + block_hash : Block_hash.t; (** Tezos block hash. *) level : Raw_level.t; (** Level of the block, corresponds to the level of the tezos block. *) - predecessor : Tezos_crypto.Block_hash.t; - (** Predecessor hash of the Tezos block. *) + predecessor : Block_hash.t; (** Predecessor hash of the Tezos block. *) commitment_hash : Sc_rollup.Commitment.Hash.t option; (** Hash of this block's commitment if any was computed for it. *) previous_commitment_hash : Sc_rollup.Commitment.Hash.t; diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.ml b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.ml index 000536a07aa5..4538fec721c6 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.ml @@ -23,11 +23,9 @@ (* *) (*****************************************************************************) -open Tezos_crypto - include - Blake2B.Make - (Base58) + Tezos_crypto.Blake2B.Make + (Tezos_crypto.Base58) (struct let name = "Smart_rollup_context_hash" @@ -38,4 +36,4 @@ include let size = None end) -let () = Base58.check_encoded_prefix b58check_encoding "SRCo" 54 +let () = Tezos_crypto.Base58.check_encoded_prefix b58check_encoding "SRCo" 54 diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.mli b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.mli index b8abde35922a..d7acec7ff0ea 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.mli +++ b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_context_hash.mli @@ -23,4 +23,4 @@ (* *) (*****************************************************************************) -include Tezos_crypto.S.HASH +include Tezos_crypto.Intfs.HASH diff --git a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_services.ml b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_services.ml index fd89e0903529..b96c04e1f558 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup/sc_rollup_services.ml @@ -223,15 +223,11 @@ end module Arg = struct type block_id = - [ `Head - | `Hash of Tezos_crypto.Block_hash.t - | `Level of Int32.t - | `Finalized - | `Cemented ] + [`Head | `Hash of Block_hash.t | `Level of Int32.t | `Finalized | `Cemented] let construct_block_id = function | `Head -> "head" - | `Hash h -> Tezos_crypto.Block_hash.to_b58check h + | `Hash h -> Block_hash.to_b58check h | `Level l -> Int32.to_string l | `Finalized -> "finalized" | `Cemented -> "cemented" @@ -245,7 +241,7 @@ module Arg = struct match Int32.of_string_opt h with | Some l -> Ok (`Level l) | None -> ( - match Tezos_crypto.Block_hash.of_b58check_opt h with + match Block_hash.of_b58check_opt h with | Some b -> Ok (`Hash b) | None -> Error "Cannot parse block id")) @@ -317,7 +313,7 @@ module Global = struct Tezos_rpc.Service.get_service ~description:"Tezos head known to the smart rollup node" ~query:Tezos_rpc.Query.empty - ~output:(Data_encoding.option Tezos_crypto.Block_hash.encoding) + ~output:(Data_encoding.option Block_hash.encoding) (path / "tezos_head") let current_tezos_level = @@ -415,7 +411,7 @@ module Global = struct Tezos_rpc.Service.get_service ~description:"Tezos block hash of block known to the smart rollup node" ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Block_hash.encoding + ~output:Block_hash.encoding (path / "hash") let level = diff --git a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml index 4fe448e05fb5..ca55fb24a41b 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -184,7 +184,7 @@ end) module Block_directory = Make_directory (struct include Sc_rollup_services.Global.Block - type context = Node_context.ro * Tezos_crypto.Block_hash.t + type context = Node_context.ro * Block_hash.t let context_of_prefix node_ctxt (((), block) : prefix) = let open Lwt_result_syntax in @@ -202,8 +202,7 @@ end) module Outbox_directory = Make_directory (struct include Sc_rollup_services.Global.Block.Outbox - type context = - Node_context.ro * Tezos_crypto.Block_hash.t * Alpha_context.Raw_level.t + type context = Node_context.ro * Block_hash.t * Alpha_context.Raw_level.t let context_of_prefix node_ctxt (((), block), level) = let open Lwt_result_syntax in diff --git a/src/proto_alpha/bin_sc_rollup_node/batcher_worker_types.ml b/src/proto_alpha/bin_sc_rollup_node/batcher_worker_types.ml index ac2201e49d44..63afd1221a6d 100644 --- a/src/proto_alpha/bin_sc_rollup_node/batcher_worker_types.ml +++ b/src/proto_alpha/bin_sc_rollup_node/batcher_worker_types.ml @@ -70,7 +70,7 @@ module Request = struct Format.fprintf ppf "switching to new L1 head %a at level %ld" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash level | Batch -> Format.pp_print_string ppf "batch" diff --git a/src/proto_alpha/bin_sc_rollup_node/commitment.ml b/src/proto_alpha/bin_sc_rollup_node/commitment.ml index 0c9c6fa82291..b1a5c83952f2 100644 --- a/src/proto_alpha/bin_sc_rollup_node/commitment.ml +++ b/src/proto_alpha/bin_sc_rollup_node/commitment.ml @@ -148,8 +148,7 @@ module Make (PVM : Pvm.S) : Commitment_sig.S with module PVM = PVM = struct let* last_commitment_hash = let*! pred = Store.L2_blocks.find node_ctxt.store predecessor in match pred with - | None -> - failwith "Missing block %a" Tezos_crypto.Block_hash.pp predecessor + | None -> failwith "Missing block %a" Block_hash.pp predecessor | Some pred -> return (Sc_rollup_block.most_recent_commitment pred.header) in diff --git a/src/proto_alpha/bin_sc_rollup_node/commitment_sig.ml b/src/proto_alpha/bin_sc_rollup_node/commitment_sig.ml index 0b5faa4c6cf2..b8527a283391 100644 --- a/src/proto_alpha/bin_sc_rollup_node/commitment_sig.ml +++ b/src/proto_alpha/bin_sc_rollup_node/commitment_sig.ml @@ -49,7 +49,7 @@ module type S = sig the hash of to be included in the commitment. *) val process_head : Node_context.rw -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> Layer1.head -> Context.rw -> Protocol.Alpha_context.Sc_rollup.Commitment.Hash.t option tzresult Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/configuration.ml b/src/proto_alpha/bin_sc_rollup_node/configuration.ml index 8444a987b87c..92e338776b9c 100644 --- a/src/proto_alpha/bin_sc_rollup_node/configuration.ml +++ b/src/proto_alpha/bin_sc_rollup_node/configuration.ml @@ -185,7 +185,7 @@ let protocol_max_batch_size = let open Alpha_context in let open Operation in { - shell = {branch = Tezos_crypto.Block_hash.zero}; + shell = {branch = Block_hash.zero}; protocol_data = { signature = Some Tezos_crypto.Signature.zero; diff --git a/src/proto_alpha/bin_sc_rollup_node/context.ml b/src/proto_alpha/bin_sc_rollup_node/context.ml index 0df91a965c46..f3d0059b22e4 100644 --- a/src/proto_alpha/bin_sc_rollup_node/context.ml +++ b/src/proto_alpha/bin_sc_rollup_node/context.ml @@ -112,7 +112,7 @@ let index context = context.index module Proof (Hash : sig type t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end) (Proof_encoding : sig val proof_encoding : Environment.Context.Proof.tree Environment.Context.Proof.t Data_encoding.t diff --git a/src/proto_alpha/bin_sc_rollup_node/context.mli b/src/proto_alpha/bin_sc_rollup_node/context.mli index 76a0f70c2924..ce4cfc1769bb 100644 --- a/src/proto_alpha/bin_sc_rollup_node/context.mli +++ b/src/proto_alpha/bin_sc_rollup_node/context.mli @@ -91,7 +91,7 @@ val is_empty : _ t -> bool module Proof (Hash : sig type t - val of_context_hash : Tezos_crypto.Context_hash.t -> t + val of_context_hash : Context_hash.t -> t end) (Proof_encoding : sig val proof_encoding : Environment.Context.Proof.tree Environment.Context.Proof.t Data_encoding.t diff --git a/src/proto_alpha/bin_sc_rollup_node/daemon.ml b/src/proto_alpha/bin_sc_rollup_node/daemon.ml index 034b3d0f5081..0d8efa5b13ad 100644 --- a/src/proto_alpha/bin_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/bin_sc_rollup_node/daemon.ml @@ -230,7 +230,7 @@ module Make (PVM : Pvm.S) = struct | None -> failwith "Missing L2 predecessor %a for previous commitment" - Tezos_crypto.Block_hash.pp + Block_hash.pp predecessor | Some pred -> return (Sc_rollup_block.most_recent_commitment pred.header) diff --git a/src/proto_alpha/bin_sc_rollup_node/daemon_event.ml b/src/proto_alpha/bin_sc_rollup_node/daemon_event.ml index 8b99312a3dce..61958297e722 100644 --- a/src/proto_alpha/bin_sc_rollup_node/daemon_event.ml +++ b/src/proto_alpha/bin_sc_rollup_node/daemon_event.ml @@ -37,7 +37,7 @@ module Simple = struct ~name:"sc_rollup_daemon_process_head" ~msg:"Processing {finalized} head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) ("finalized", Data_encoding.bool) ~pp3:(fun fmt finalized -> @@ -49,7 +49,7 @@ module Simple = struct ~name:"sc_rollup_node_layer_1_new_head_processed" ~msg:"Finished processing layer 1 head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) let processing_heads_iteration = diff --git a/src/proto_alpha/bin_sc_rollup_node/daemon_event.mli b/src/proto_alpha/bin_sc_rollup_node/daemon_event.mli index 6f6004363c7a..67e85d657b02 100644 --- a/src/proto_alpha/bin_sc_rollup_node/daemon_event.mli +++ b/src/proto_alpha/bin_sc_rollup_node/daemon_event.mli @@ -32,12 +32,11 @@ open Alpha_context (** [head_processing hash level ~finalized] emits the event that the block of the given [hash] and at the given [level] is being processed, and whether it is [finalized]. *) -val head_processing : - Tezos_crypto.Block_hash.t -> int32 -> finalized:bool -> unit Lwt.t +val head_processing : Block_hash.t -> int32 -> finalized:bool -> unit Lwt.t (** [new_head_processed hash level] emits the event that the daemon has finished processing the head of the given [hash] and at the given [level]. *) -val new_head_processed : Tezos_crypto.Block_hash.t -> int32 -> unit Lwt.t +val new_head_processed : Block_hash.t -> int32 -> unit Lwt.t (** [processing_heads_iteration heads] emits the event that the [heads] are going to be processed. *) diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml index fdf50dc71a16..db274826cb33 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.ml @@ -47,7 +47,7 @@ let ancestor_hash ~number_of_levels {Node_context.genesis_info; l1_ctxt; _} head the slot has been confirmed after the attestation_lag has passed. *) type confirmations_info = { (* The hash of the block in which the slots have been published. *) - published_block_hash : Tezos_crypto.Block_hash.t; + published_block_hash : Block_hash.t; (* The indexes of slots that have beenp published in block with hash `published_block_hash`, and have later been confirmed. *) confirmed_slots_indexes : Bitset.t; @@ -308,7 +308,7 @@ module Confirmed_slots_history = struct "The confirmed DAL %S for block hash %a (level = %a) is not expected \ to be found in the store, but is exists." entry_kind - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Raw_level.pp block_level @@ -317,7 +317,7 @@ module Confirmed_slots_history = struct "The confirmed DAL %S for block hash %a (level = %a) is expected to \ be found in the store, but is missing." entry_kind - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Raw_level.pp block_level diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli index 0e77b548a601..458d3735649f 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker.mli @@ -42,14 +42,14 @@ val is_slot_confirmed : that [slot_index] is unconfirmed in the block with hash in [node_ctxt.store]. *) val save_unconfirmed_slot : - Node_context.rw -> Tezos_crypto.Block_hash.t -> Dal.Slot_index.t -> unit Lwt.t + Node_context.rw -> Block_hash.t -> Dal.Slot_index.t -> unit Lwt.t (** [save_confirmed_slot node_ctxt hash slot_index] saves in [node_ctxt.store] that [slot_index] is confirmed in the block with hashin [node_ctxt.store]. The contents of the slot are set to [pages] in [node_ctxt.store]. *) val save_confirmed_slot : Node_context.rw -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Dal.Slot_index.t -> Dal.Page.content list -> unit Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker_event.ml b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker_event.ml index c66573018673..84ed4506c47f 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker_event.ml +++ b/src/proto_alpha/bin_sc_rollup_node/dal_slots_tracker_event.ml @@ -41,8 +41,8 @@ module Simple = struct {confirmed_hash}. The slot contents will be downloaded." ~level:Notice ("slot_index", Dal.Slot_index.encoding) - ("published_hash", Tezos_crypto.Block_hash.encoding) - ("confirmed_hash", Tezos_crypto.Block_hash.encoding) + ("published_hash", Block_hash.encoding) + ("confirmed_hash", Block_hash.encoding) end let slot_has_been_confirmed slot published_hash confirmed_hash = diff --git a/src/proto_alpha/bin_sc_rollup_node/inbox.ml b/src/proto_alpha/bin_sc_rollup_node/inbox.ml index 07aa6a1facb4..8080b46c2a94 100644 --- a/src/proto_alpha/bin_sc_rollup_node/inbox.ml +++ b/src/proto_alpha/bin_sc_rollup_node/inbox.ml @@ -72,7 +72,7 @@ module State = struct (* Invariant broken, the inbox for this level should exist. *) failwith "The inbox for block hash %a (level = %ld) is missing." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash block_level else diff --git a/src/proto_alpha/bin_sc_rollup_node/inbox.mli b/src/proto_alpha/bin_sc_rollup_node/inbox.mli index 4765aceb02d1..7323c3b51976 100644 --- a/src/proto_alpha/bin_sc_rollup_node/inbox.mli +++ b/src/proto_alpha/bin_sc_rollup_node/inbox.mli @@ -53,8 +53,7 @@ val process_head : (** [inbox_of_hash node_ctxt block_hash] returns the rollup inbox at the end of the given validation of [block_hash]. NOTE: It requires the L2 block for [block_hash] to have been saved. *) -val inbox_of_hash : - _ Node_context.t -> Tezos_crypto.Block_hash.t -> Inbox.t tzresult Lwt.t +val inbox_of_hash : _ Node_context.t -> Block_hash.t -> Inbox.t tzresult Lwt.t (** [inbox_of_head node_ctxt block_head] returns the rollup inbox at the end of the given validation of [block_head]. NOTE: It requires the L2 block for @@ -68,7 +67,7 @@ val start : unit -> unit Lwt.t [messages] to the [inbox] using {!Inbox.add_all_messages}. *) val add_messages : predecessor_timestamp:Timestamp.time -> - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> Inbox.t -> Inbox_message.t list -> (Inbox_merkelized_payload_hashes.History.t @@ -84,7 +83,7 @@ val add_messages : store payloads histories (which contain merkelized skip lists) but simply messages. *) val payloads_history_of_messages : - predecessor:Tezos_crypto.Block_hash.t -> + predecessor:Block_hash.t -> predecessor_timestamp:Timestamp.time -> Sc_rollup.Inbox_message.t list -> Sc_rollup.Inbox_merkelized_payload_hashes.History.t tzresult diff --git a/src/proto_alpha/bin_sc_rollup_node/inbox_event.ml b/src/proto_alpha/bin_sc_rollup_node/inbox_event.ml index b3e57760ef6b..18d83fc56dcd 100644 --- a/src/proto_alpha/bin_sc_rollup_node/inbox_event.ml +++ b/src/proto_alpha/bin_sc_rollup_node/inbox_event.ml @@ -52,7 +52,7 @@ module Simple = struct "Fetching {number_of_messages} messages from block {hash} at level \ {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) ("number_of_messages", Data_encoding.int32) end diff --git a/src/proto_alpha/bin_sc_rollup_node/inbox_event.mli b/src/proto_alpha/bin_sc_rollup_node/inbox_event.mli index c56ea8ad6ae7..72a3b8200880 100644 --- a/src/proto_alpha/bin_sc_rollup_node/inbox_event.mli +++ b/src/proto_alpha/bin_sc_rollup_node/inbox_event.mli @@ -32,4 +32,4 @@ val stopping : unit -> unit Lwt.t (** [get_messages hash level n] emits the event that [n] messages are being fetched from the block of the given [hash] at the given [level]. *) -val get_messages : Tezos_crypto.Block_hash.t -> int32 -> int -> unit Lwt.t +val get_messages : Block_hash.t -> int32 -> int -> unit Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml index e3952b6503d4..6b51421e1286 100644 --- a/src/proto_alpha/bin_sc_rollup_node/interpreter.ml +++ b/src/proto_alpha/bin_sc_rollup_node/interpreter.ml @@ -73,7 +73,7 @@ module Make (PVM : Pvm.S) : S with module PVM = PVM = struct let missing_boot_sector () = failwith "Boot sector not found in Tezos block %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash in Lwt.catch diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1.ml b/src/proto_alpha/bin_sc_rollup_node/layer1.ml index 95fc601d3ee6..b47052ff448d 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1.ml +++ b/src/proto_alpha/bin_sc_rollup_node/layer1.ml @@ -35,7 +35,7 @@ open Injector_common *) -type error += Cannot_find_block of Tezos_crypto.Block_hash.t +type error += Cannot_find_block of Block_hash.t let () = register_error_kind @@ -46,14 +46,14 @@ let () = Format.fprintf ppf "Block with hash %a was not found on the L1 node." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_find_block hash -> Some hash | _ -> None) (fun hash -> Cannot_find_block hash) -type error += Cannot_find_predecessor of Tezos_crypto.Block_hash.t +type error += Cannot_find_predecessor of Block_hash.t let () = register_error_kind @@ -64,10 +64,10 @@ let () = Format.fprintf ppf "Block with hash %a has no predecessor on the L1 node." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_find_predecessor hash -> Some hash | _ -> None) (fun hash -> Cannot_find_predecessor hash) @@ -78,20 +78,18 @@ let () = *) -type head = {hash : Tezos_crypto.Block_hash.t; level : int32} +type head = {hash : Block_hash.t; level : int32} let head_encoding = Data_encoding.( conv (fun {hash; level} -> (hash, level)) (fun (hash, level) -> {hash; level}) - (obj2 - (req "hash" Tezos_crypto.Block_hash.encoding) - (req "level" Data_encoding.int32))) + (obj2 (req "hash" Block_hash.encoding) (req "level" Data_encoding.int32))) module Blocks_cache = Aches_lwt.Lache.Make_option - (Aches.Rache.Transfer (Aches.Rache.LRU) (Tezos_crypto.Block_hash)) + (Aches.Rache.Transfer (Aches.Rache.LRU) (Block_hash)) type blocks_cache = Protocol_client_context.Alpha_block_services.block_info Blocks_cache.t @@ -125,8 +123,7 @@ let predecessors_of_blocks hashes = let get_predecessor = let max_cached = 1023 and max_read = 8 in let module HM = - Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.FIFO_Precise) (Aches.Vache.Strong) (Block_hash) in let cache = HM.create max_cached in fun cctxt (chain : Tezos_shell_services.Chain_services.chain) ancestor -> @@ -280,7 +277,7 @@ let get_tezos_reorg_for_new_head l1_state old_head new_head = let open Lwt_result_syntax in (* old_head and new_head must have the same level when calling aux *) let rec aux reorg old_head new_head = - if Tezos_crypto.Block_hash.(old_head.hash = new_head.hash) then return reorg + if Block_hash.(old_head.hash = new_head.hash) then return reorg else let* old_head_pred = get_predecessor l1_state old_head in let* new_head_pred = get_predecessor l1_state new_head in diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1.mli b/src/proto_alpha/bin_sc_rollup_node/layer1.mli index 94457c0091f0..ab5c194a6212 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1.mli +++ b/src/proto_alpha/bin_sc_rollup_node/layer1.mli @@ -29,7 +29,7 @@ subscribing to the head monitoring RPC offered by the Tezos node. *) -type head = {hash : Tezos_crypto.Block_hash.t; level : int32} +type head = {hash : Block_hash.t; level : int32} val head_encoding : head Data_encoding.t @@ -76,14 +76,14 @@ val shutdown : t -> unit Lwt.t [hash]. Looks for the block in the blocks cache first, and fetches it from the L1 node otherwise. *) val fetch_tezos_shell_header : - t -> Tezos_crypto.Block_hash.t -> Block_header.shell_header tzresult Lwt.t + t -> Block_hash.t -> Block_header.shell_header tzresult Lwt.t (** [fetch_tezos_block l1_ctxt hash] returns a block info given a block hash. Looks for the block in the blocks cache first, and fetches it from the L1 node otherwise. *) val fetch_tezos_block : t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Protocol_client_context.Alpha_block_services.block_info tzresult Lwt.t (** [nth_predecessor l1_ctxt n head] return [block, history] where [block] is diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1_event.ml b/src/proto_alpha/bin_sc_rollup_node/layer1_event.ml index 31aae66ddb52..6e9773d48ec2 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1_event.ml +++ b/src/proto_alpha/bin_sc_rollup_node/layer1_event.ml @@ -50,7 +50,7 @@ module Simple = struct ~name:"sc_rollup_node_layer_1_new_head" ~msg:"Layer 1 node has switched to head {hash} at level {level}" ~level:Notice - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("level", Data_encoding.int32) end diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1_event.mli b/src/proto_alpha/bin_sc_rollup_node/layer1_event.mli index 467da2e23f72..5b8ff83a660c 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1_event.mli +++ b/src/proto_alpha/bin_sc_rollup_node/layer1_event.mli @@ -32,4 +32,4 @@ val stopping : unit -> unit Lwt.t (** [switched_new_head hash level] emits the event that the layer 1 has notified a new head with [hash] at some given [level]. *) -val switched_new_head : Tezos_crypto.Block_hash.t -> int32 -> unit Lwt.t +val switched_new_head : Block_hash.t -> int32 -> unit Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/node_context.mli b/src/proto_alpha/bin_sc_rollup_node/node_context.mli index 3611b0e41cca..fc1769ceff9d 100644 --- a/src/proto_alpha/bin_sc_rollup_node/node_context.mli +++ b/src/proto_alpha/bin_sc_rollup_node/node_context.mli @@ -111,8 +111,7 @@ val init : (** [checkout_context node_ctxt block_hash] returns the context at block [block_hash]. *) -val checkout_context : - 'a t -> Tezos_crypto.Block_hash.t -> 'a Context.t tzresult Lwt.t +val checkout_context : 'a t -> Block_hash.t -> 'a Context.t tzresult Lwt.t (** [metadata node_ctxt] creates a {Sc_rollup.Metadata.t} using the information stored in [node_ctxt]. *) @@ -131,5 +130,4 @@ type 'a delayed_write = ('a, rw) Delayed_write_monad.t (** [get_full_l2_block node_ctxt hash] returns the full L2 block for L1 block hash [hash]. The result contains the L2 block and its content (inbox, messages, commitment). *) -val get_full_l2_block : - _ t -> Tezos_crypto.Block_hash.t -> Sc_rollup_block.full Lwt.t +val get_full_l2_block : _ t -> Block_hash.t -> Sc_rollup_block.full Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml b/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml index ceabd9516501..e4fec530e84d 100644 --- a/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml +++ b/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml @@ -37,9 +37,8 @@ type error += layer1_inbox : Sc_rollup.Inbox.t; inbox : Sc_rollup.Inbox.t; } - | Missing_PVM_state of Tezos_crypto.Block_hash.t * Int32.t - | Cannot_checkout_context of - Tezos_crypto.Block_hash.t * Sc_rollup_context_hash.t option + | Missing_PVM_state of Block_hash.t * Int32.t + | Cannot_checkout_context of Block_hash.t * Sc_rollup_context_hash.t option | No_batcher type error += @@ -170,11 +169,10 @@ let () = Format.fprintf ppf "Cannot retrieve PVM state for block %a at level %ld" - Tezos_crypto.Block_hash.pp + Block_hash.pp block level) - Data_encoding.( - obj2 (req "block" Tezos_crypto.Block_hash.encoding) (req "level" int32)) + Data_encoding.(obj2 (req "block" Block_hash.encoding) (req "level" int32)) (function | Missing_PVM_state (block, level) -> Some (block, level) | _ -> None) (fun (block, level) -> Missing_PVM_state (block, level)) ; @@ -193,11 +191,11 @@ let () = ~none:"" ~some:Sc_rollup_context_hash.to_b58check context_hash) - Tezos_crypto.Block_hash.pp + Block_hash.pp block) Data_encoding.( obj2 - (req "block" Tezos_crypto.Block_hash.encoding) + (req "block" Block_hash.encoding) (opt "context" Sc_rollup_context_hash.encoding)) (function | Cannot_checkout_context (block, context) -> Some (block, context) diff --git a/src/proto_alpha/bin_sc_rollup_node/simulation.ml b/src/proto_alpha/bin_sc_rollup_node/simulation.ml index 25d2ec2c3923..9072a8814725 100644 --- a/src/proto_alpha/bin_sc_rollup_node/simulation.ml +++ b/src/proto_alpha/bin_sc_rollup_node/simulation.ml @@ -36,7 +36,7 @@ module type S = sig type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } type t = { @@ -74,7 +74,7 @@ module Make (Interpreter : Interpreter.S) : type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } type t = { diff --git a/src/proto_alpha/bin_sc_rollup_node/simulation.mli b/src/proto_alpha/bin_sc_rollup_node/simulation.mli index 49e0da506df7..ad4faaedfd0e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/simulation.mli +++ b/src/proto_alpha/bin_sc_rollup_node/simulation.mli @@ -36,7 +36,7 @@ module type S = sig type info_per_level = { predecessor_timestamp : Timestamp.time; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; } (** Type of the state for a simulation. *) diff --git a/src/proto_alpha/bin_sc_rollup_node/state.ml b/src/proto_alpha/bin_sc_rollup_node/state.ml index 7c189136e987..9c71b60c5017 100644 --- a/src/proto_alpha/bin_sc_rollup_node/state.ml +++ b/src/proto_alpha/bin_sc_rollup_node/state.ml @@ -69,11 +69,11 @@ module Store = struct let to_path_representation = Int32.to_string end) (struct - type value = Tezos_crypto.Block_hash.t + type value = Block_hash.t let name = "block_hash" - let encoding = Tezos_crypto.Block_hash.encoding + let encoding = Block_hash.encoding end) end @@ -136,8 +136,7 @@ let block_before store tick = let rec search block_hash = let*! block = Raw_store.L2_blocks.find store block_hash in match block with - | None -> - failwith "Missing block %a" Tezos_crypto.Block_hash.pp block_hash + | None -> failwith "Missing block %a" Block_hash.pp block_hash | Some block -> if Sc_rollup.Tick.(block.initial_tick <= tick) then return_some block diff --git a/src/proto_alpha/bin_sc_rollup_node/state.mli b/src/proto_alpha/bin_sc_rollup_node/state.mli index 3481f831c419..a5c7335a19bd 100644 --- a/src/proto_alpha/bin_sc_rollup_node/state.mli +++ b/src/proto_alpha/bin_sc_rollup_node/state.mli @@ -27,7 +27,7 @@ open Protocol.Alpha_context (** [is_processed store hash] returns [true] if the block with [hash] has already been processed by the daemon. *) -val is_processed : _ Store.t -> Tezos_crypto.Block_hash.t -> bool Lwt.t +val is_processed : _ Store.t -> Block_hash.t -> bool Lwt.t (** [mark_processed_head store head] remembers that the [head] is processed. The system should not have to come back to it. *) @@ -47,13 +47,11 @@ val get_finalized_head_opt : _ Store.t -> Layer1.head option Lwt.t (** [hash_of_level node_ctxt level] returns the current block hash for a given [level]. *) -val hash_of_level : - _ Node_context.t -> int32 -> Tezos_crypto.Block_hash.t tzresult Lwt.t +val hash_of_level : _ Node_context.t -> int32 -> Block_hash.t tzresult Lwt.t (** [hash_of_level_opt] is like {!hash_of_level} but returns [None] if the [level] is not known. *) -val hash_of_level_opt : - _ Node_context.t -> int32 -> Tezos_crypto.Block_hash.t option Lwt.t +val hash_of_level_opt : _ Node_context.t -> int32 -> Block_hash.t option Lwt.t (** [save_level store head] registers the correspondences [head.level |-> head.hash] in the store. *) @@ -61,8 +59,7 @@ val save_level : Store.rw -> Layer1.head -> unit Lwt.t (** [level_of_hash node_ctxt hash] returns the level for Tezos block hash [hash] if it is known by the Tezos Layer 1 node. *) -val level_of_hash : - _ Node_context.t -> Tezos_crypto.Block_hash.t -> int32 tzresult Lwt.t +val level_of_hash : _ Node_context.t -> Block_hash.t -> int32 tzresult Lwt.t (** [block_before store tick] returns the last layer 2 block whose initial tick is before [tick]. *) diff --git a/src/proto_alpha/bin_sc_rollup_node/store.ml b/src/proto_alpha/bin_sc_rollup_node/store.ml index 3889830f6dd2..2c7b9924c0fb 100644 --- a/src/proto_alpha/bin_sc_rollup_node/store.ml +++ b/src/proto_alpha/bin_sc_rollup_node/store.ml @@ -57,9 +57,9 @@ module L2_blocks = let path = ["state_info"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Sc_rollup_block.t @@ -72,7 +72,7 @@ module L2_blocks = (** Unaggregated messages per block *) module Messages = struct type info = { - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; predecessor_timestamp : Timestamp.t; messages : Sc_rollup.Inbox_message.t list; } @@ -85,7 +85,7 @@ module Messages = struct (fun (predecessor, predecessor_timestamp, messages) -> {predecessor; predecessor_timestamp; messages}) @@ obj3 - (req "predecessor" Tezos_crypto.Block_hash.encoding) + (req "predecessor" Block_hash.encoding) (req "predecessor_timestamp" Timestamp.encoding) (req "messages" @@ -191,9 +191,9 @@ module Dal_slot_pages = let path = ["dal"; "slot_pages"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t * Dal.Page.Index.t @@ -223,9 +223,9 @@ module Dal_processed_slots = let path = ["dal"; "processed_slots"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t @@ -265,9 +265,9 @@ module Dal_slots_headers = let path = ["dal"; "slot_headers"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type key = Dal.Slot_index.t @@ -301,9 +301,9 @@ module Dal_confirmed_slots_history = let path = ["dal"; "confirmed_slots_history"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Dal.Slots_history.t @@ -323,9 +323,9 @@ module Dal_confirmed_slots_histories = let path = ["dal"; "confirmed_slots_histories_cache"] end) (struct - type key = Tezos_crypto.Block_hash.t + type key = Block_hash.t - let to_path_representation = Tezos_crypto.Block_hash.to_b58check + let to_path_representation = Block_hash.to_b58check end) (struct type value = Dal.Slots_history.History_cache.t diff --git a/src/proto_alpha/bin_sc_rollup_node/store.mli b/src/proto_alpha/bin_sc_rollup_node/store.mli index c30861a40e78..05766389c95a 100644 --- a/src/proto_alpha/bin_sc_rollup_node/store.mli +++ b/src/proto_alpha/bin_sc_rollup_node/store.mli @@ -58,14 +58,14 @@ val readonly : _ t -> ro module L2_blocks : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Sc_rollup_block.t and type 'a store := 'a store (** Storage for persisting messages downloaded from the L1 node. *) module Messages : sig type info = { - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; predecessor_timestamp : Timestamp.t; messages : Sc_rollup.Inbox_message.t list; } @@ -114,14 +114,14 @@ module Commitments_published_at_level : list into a [Dal.Slot_index.t]-indexed map. *) module Dal_slots_headers : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t and type value := Dal.Slot.Header.t and type 'a store := 'a store module Dal_confirmed_slots_history : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Dal.Slots_history.t and type 'a store := 'a store @@ -129,7 +129,7 @@ module Dal_confirmed_slots_history : {Dal_slot_repr.Slots_history} for more details. *) module Dal_confirmed_slots_histories : Store_sigs.Append_only_map - with type key := Tezos_crypto.Block_hash.t + with type key := Block_hash.t and type value := Dal.Slots_history.History_cache.t and type 'a store := 'a store @@ -141,7 +141,7 @@ module Dal_confirmed_slots_histories : *) module Dal_slot_pages : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t * Dal.Page.Index.t and type value := Dal.Page.content and type 'a store := 'a store @@ -155,7 +155,7 @@ module Dal_slot_pages : *) module Dal_processed_slots : Store_sigs.Nested_map - with type primary_key := Tezos_crypto.Block_hash.t + with type primary_key := Block_hash.t and type secondary_key := Dal.Slot_index.t and type value := [`Confirmed | `Unconfirmed] and type 'a store := 'a store diff --git a/src/proto_alpha/lib_benchmark/execution_context.ml b/src/proto_alpha/lib_benchmark/execution_context.ml index 2003cedff97d..c6c80fa3bf4e 100644 --- a/src/proto_alpha/lib_benchmark/execution_context.ml +++ b/src/proto_alpha/lib_benchmark/execution_context.ml @@ -90,6 +90,6 @@ let make ~rng_state = (* Required for eg Create_contract *) Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in return (ctxt, step_constants) diff --git a/src/proto_alpha/lib_benchmark/test/test_helpers.ml b/src/proto_alpha/lib_benchmark/test/test_helpers.ml index 5677355b0bb9..8d5db86cc9ed 100644 --- a/src/proto_alpha/lib_benchmark/test/test_helpers.ml +++ b/src/proto_alpha/lib_benchmark/test/test_helpers.ml @@ -71,7 +71,7 @@ let typecheck_by_tezos = return @@ Protocol.Alpha_context.Origination_nonce.init ctxt - Tezos_crypto.Operation_hash.zero + Tezos_crypto.Hashed.Operation_hash.zero in fun bef node -> Stdlib.Result.get_ok diff --git a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml index cffa19ba6874..37f91ab77e95 100644 --- a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml @@ -72,7 +72,7 @@ let default_raw_context () = context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero ~typecheck in Lwt.return @@ Environment.wrap_tzresult e diff --git a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml index 1e05cabccde1..237da10839e0 100644 --- a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml @@ -154,7 +154,7 @@ module Compare_key_contract_benchmark : Benchmark.S = struct let benchmark rng_state _conf () = let bytes = Base_samplers.bytes rng_state ~size:{min = 32; max = 64} in - let branch = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let branch = Block_hash.hash_bytes [bytes] in let op_hash = Operation.hash_raw {shell = {branch}; proto = bytes} in let nonce = Origination_nonce.Internal_for_tests.initial op_hash in let contract = Contract.Internal_for_tests.originated_contract nonce in diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index d8e7524e5d8a..85d4515fb160 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -808,7 +808,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -916,7 +916,7 @@ let get_operation_from_block (cctxt : #full) ~chain predecessors operation_hash | Some (block, i, j) -> cctxt#message "Operation found in block: %a (pass: %d, offset: %d)" - Tezos_crypto.Block_hash.pp + Block_hash.pp block i j diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index f29f5c2404f5..ad10258a9691 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -470,7 +470,7 @@ type period_info = { current_period_kind : Voting_period.kind; position : Int32.t; remaining : Int32.t; - current_proposal : Tezos_crypto.Protocol_hash.t option; + current_proposal : Protocol_hash.t option; } type ballots_info = { @@ -523,7 +523,7 @@ val submit_proposals : ?confirmations:int -> src_sk:Client_keys.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals Injection.result_list tzresult Lwt.t (** Calls {!Injection.inject_operation} @@ -538,7 +538,7 @@ val submit_ballot : ?confirmations:int -> src_sk:Client_keys.sk_uri -> public_key_hash -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot Injection.result_list tzresult Lwt.t @@ -548,7 +548,7 @@ val display_receipt_for_operation : #Protocol_client_context.full -> chain:Block_services.chain -> ?predecessors:int -> - Tezos_crypto.Operation_list_hash.elt -> + Operation_list_hash.elt -> unit tzresult Lwt.t (** Calls {!Tezos_protocol_alpha.Protocol.Alpha_services.Cache.cached_contracts} *) @@ -603,7 +603,7 @@ val transfer_ticket : destination:Contract.t -> entrypoint:Entrypoint.t -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.transfer_ticket Kind.manager contents * Kind.transfer_ticket Kind.manager Apply_results.contents_result) tzresult @@ -638,7 +638,7 @@ val sc_rollup_originate : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_originate Kind.manager contents * Kind.sc_rollup_originate Kind.manager Apply_results.contents_result) tzresult @@ -668,7 +668,7 @@ val sc_rollup_add_messages : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_add_messages Kind.manager contents * Kind.sc_rollup_add_messages Kind.manager Apply_results.contents_result) tzresult @@ -700,7 +700,7 @@ val sc_rollup_cement : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_cement Kind.manager contents * Kind.sc_rollup_cement Kind.manager Apply_results.contents_result) tzresult @@ -733,7 +733,7 @@ val sc_rollup_publish : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_publish Kind.manager contents * Kind.sc_rollup_publish Kind.manager Apply_results.contents_result) tzresult @@ -765,7 +765,7 @@ val sc_rollup_execute_outbox_message : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_execute_outbox_message Kind.manager contents * Kind.sc_rollup_execute_outbox_message Kind.manager Apply_results.contents_result) @@ -797,7 +797,7 @@ val sc_rollup_recover_bond : sc_rollup:Sc_rollup.t -> staker:public_key_hash -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_recover_bond Kind.manager contents * Kind.sc_rollup_recover_bond Kind.manager Apply_results.contents_result) tzresult @@ -829,7 +829,7 @@ val sc_rollup_refute : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_refute Kind.manager contents * Kind.sc_rollup_refute Kind.manager Apply_results.contents_result) tzresult @@ -861,7 +861,7 @@ val sc_rollup_timeout : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * Kind.sc_rollup_timeout Kind.manager contents * Kind.sc_rollup_timeout Kind.manager Apply_results.contents_result) tzresult @@ -888,7 +888,7 @@ val zk_rollup_originate : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_origination Kind.manager contents * Kind.zk_rollup_origination Kind.manager Apply_results.contents_result, tztrace ) @@ -914,7 +914,7 @@ val zk_rollup_publish : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_publish Kind.manager contents * Kind.zk_rollup_publish Kind.manager Apply_results.contents_result, tztrace ) @@ -940,7 +940,7 @@ val zk_rollup_update : src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> unit -> - ( Tezos_crypto.Operation_hash.t + ( Operation_hash.t * Kind.zk_rollup_update Kind.manager contents * Kind.zk_rollup_update Kind.manager Apply_results.contents_result, tztrace ) diff --git a/src/proto_alpha/lib_client/client_proto_utils.mli b/src/proto_alpha/lib_client/client_proto_utils.mli index e222f1745aff..3c06f0108ea8 100644 --- a/src/proto_alpha/lib_client/client_proto_utils.mli +++ b/src/proto_alpha/lib_client/client_proto_utils.mli @@ -26,13 +26,13 @@ val sign_message : #Protocol_client_context.full -> src_sk:Client_keys.sk_uri -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> message:string -> Tezos_crypto.Signature.t tzresult Lwt.t val check_message : #Protocol_client_context.full -> - block:Tezos_crypto.Block_hash.t -> + block:Block_hash.t -> key_locator:Client_keys.pk_uri -> quiet:bool -> message:string -> diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index 307aea3af98e..291a17304bee 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -57,15 +57,12 @@ let get_branch (rpc_config : #Protocol_client_context.full) ~chain return (chain_id, hash) type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result let get_manager_operation_gas_and_fee (contents : packed_contents_list) = let l = Operation.to_list contents in @@ -187,7 +184,7 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = in item (fun ppf () -> pp_print_text ppf "Branch: " ; - Tezos_crypto.Block_hash.pp ppf branch) ; + Block_hash.pp ppf branch) ; item (fun ppf () -> fprintf ppf @@ -1068,12 +1065,12 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations Data_encoding.Binary.to_bytes_exn Operation.encoding (Operation.pack op) in if dry_run || simulation then - let oph = Tezos_crypto.Operation_hash.hash_bytes [bytes] in + let oph = Operation_hash.hash_bytes [bytes] in cctxt#message "@[<v 0>Operation: 0x%a@,Operation hash is '%a'@]" Hex.pp (Hex.of_bytes bytes) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph >>= fun () -> cctxt#message @@ -1084,8 +1081,7 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations else Shell_services.Injection.operation cctxt ~chain bytes >>=? fun oph -> cctxt#message "Operation successfully injected in the node." >>= fun () -> - cctxt#message "Operation hash is '%a'" Tezos_crypto.Operation_hash.pp oph - >>= fun () -> + cctxt#message "Operation hash is '%a'" Operation_hash.pp oph >>= fun () -> (* Adjust user-provided confirmations with respect to Alpha protocol finality properties *) tenderbake_adjust_confirmations cctxt confirmations >>= fun confirmations -> (match confirmations with @@ -1097,10 +1093,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer to make sure that it has been \ included.@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch >>= fun () -> return result | Some confirmations -> ( @@ -1161,10 +1157,10 @@ let inject_operation_internal (type kind) cctxt ~chain ~block ?confirmations --branch %a@,\ and/or an external block explorer.@]" number - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph tenderbake_finality_confirmations - Tezos_crypto.Block_hash.pp + Block_hash.pp op.shell.branch) >>= fun () -> return (oph, op, result.contents) @@ -1385,7 +1381,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch ~(src_pk : public_key) ~src_sk ~fee ~gas_limit ~storage_limit ?counter ?(replace_by_fees = false) ~fee_parameter (type kind) (operations : kind Annotated_manager_operation.annotated_list) : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * kind Kind.manager contents_list * kind Kind.manager contents_result_list) diff --git a/src/proto_alpha/lib_client/injection.mli b/src/proto_alpha/lib_client/injection.mli index c9d649eeb41b..18d87a3c0ba7 100644 --- a/src/proto_alpha/lib_client/injection.mli +++ b/src/proto_alpha/lib_client/injection.mli @@ -28,7 +28,7 @@ open Alpha_context open Apply_results type 'kind preapply_result = - Tezos_crypto.Operation_hash.t * 'kind operation * 'kind operation_metadata + Operation_hash.t * 'kind operation * 'kind operation_metadata type fee_parameter = { minimal_fees : Tez.t; @@ -63,9 +63,7 @@ val simulate : 'kind preapply_result tzresult Lwt.t type 'kind result_list = - Tezos_crypto.Operation_hash.t - * 'kind contents_list - * 'kind contents_result_list + Operation_hash.t * 'kind contents_list * 'kind contents_result_list (** /!\ [inject_operation] does not perform automatic patching of gas, storage and fees; use [inject_manager_operation] to inject @@ -85,8 +83,7 @@ val inject_operation : 'kind contents_list -> 'kind result_list tzresult Lwt.t -type 'kind result = - Tezos_crypto.Operation_hash.t * 'kind contents * 'kind contents_result +type 'kind result = Operation_hash.t * 'kind contents * 'kind contents_result val prepare_manager_operation : fee:Tez.t Limit.t -> @@ -116,7 +113,7 @@ val inject_manager_operation : ?replace_by_fees:bool -> fee_parameter:fee_parameter -> 'kind Annotated_manager_operation.annotated_list -> - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * 'kind Kind.manager contents_list * 'kind Kind.manager contents_result_list) diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index ad1b10ea3158..09e517f76749 100644 --- a/src/proto_alpha/lib_client/mockup.ml +++ b/src/proto_alpha/lib_client/mockup.ml @@ -239,7 +239,7 @@ let lib_parameters_json_encoding = (* Blocks *) type block = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Environment.Context.t; @@ -259,14 +259,14 @@ module Forge = struct operations_hash; proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } end (* ------------------------------------------------------------------------- *) (* RPC context *) let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" let endorsement_branch_data_encoding = @@ -275,7 +275,7 @@ let endorsement_branch_data_encoding = (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (fun (block_hash, block_payload_hash) -> (block_hash, block_payload_hash)) (obj2 - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "block_payload_hash" Protocol.Block_payload_hash.encoding)) let initial_context chain_id (header : Block_header.shell_header) @@ -451,7 +451,7 @@ let mem_init : ~predecessor:hash ~timestamp ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in (match bootstrap_accounts_json with | None -> return None @@ -495,10 +495,7 @@ let mem_init : let protocol_data = let payload_hash = Protocol.Block_payload_hash.hash_bytes - [ - Tezos_crypto.Block_hash.to_bytes hash; - Tezos_crypto.Operation_list_hash.(to_bytes @@ compute []); - ] + [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in let _, _, sk = Tezos_crypto.Signature.generate_key () in diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 7d564fc94f6f..8ce9ee0df0b0 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -1029,9 +1029,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh1) - Tezos_crypto.Block_hash.pp + Block_hash.pp (Block_header.hash bh2) pp_balance_updates bus @@ -1084,9 +1084,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1099,9 +1099,9 @@ let pp_contents_and_result : Exhibit B: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op1) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash op2) pp_balance_updates bus @@ -1123,7 +1123,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.Public_key_hash.pp source period - (Format.pp_print_list Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_result -> Format.fprintf @@ -1132,7 +1132,7 @@ let pp_contents_and_result : Tezos_crypto.Signature.Public_key_hash.pp source period - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) diff --git a/src/proto_alpha/lib_client/proxy.ml b/src/proto_alpha/lib_client/proxy.ml index 26a2ebb2204d..ba6d01b6a7c5 100644 --- a/src/proto_alpha/lib_client/proxy.ml +++ b/src/proto_alpha/lib_client/proxy.ml @@ -95,7 +95,7 @@ module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC = struct end let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) : + (hash : Context_hash.t) : Tezos_protocol_environment.Context.t tzresult Lwt.t = let open Lwt_result_syntax in let*! () = diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index 774636b393a9..96c198bbb388 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -78,7 +78,7 @@ let report_michelson_errors ?(no_print_source = false) ~msg let block_hash_param = Tezos_clic.parameter (fun (cctxt : #Client_context.full) s -> - try Lwt_result_syntax.return (Tezos_crypto.Block_hash.of_b58check_exn s) + try Lwt_result_syntax.return (Block_hash.of_b58check_exn s) with _ -> cctxt#error "Parameter '%s' is an invalid block hash" s) let group = @@ -607,7 +607,7 @@ let commands_ro () = ~name:"operation" ~desc:"Operation to be looked up" (parameter (fun (cctxt : #Client_context.full) x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> cctxt#error "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ stop) @@ -651,10 +651,7 @@ let commands_ro () = also on the last block of the exploration and promotion periods when the proposal is not approved *) | Some proposal -> - cctxt#message - "Current proposal: %a" - Tezos_crypto.Protocol_hash.pp - proposal + cctxt#message "Current proposal: %a" Protocol_hash.pp proposal in match info.current_period_kind with | Proposal -> @@ -673,16 +670,13 @@ let commands_ro () = fprintf ppf "* %a %a %s (%sknown by the node)@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p Tez.pp (Tez.of_mutez_exn w) Operation_result.tez_sym (if - List.mem - ~equal:Tezos_crypto.Protocol_hash.equal - p - known_protos + List.mem ~equal:Protocol_hash.equal p known_protos then "" else "not ")) ranks ; @@ -1114,7 +1108,7 @@ let commands_rw () = (Some delegate) in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * _ contents * _ Apply_results.contents_result) option) = @@ -1427,7 +1421,7 @@ let commands_rw () = contents in let*! (_ : - (Tezos_crypto.Operation_hash.t + (Operation_hash.t * packed_operation * _ contents_list * _ Apply_results.contents_result_list) @@ -2099,7 +2093,7 @@ let commands_rw () = ~name:"operation" ~desc:"Operation to be included" (parameter (fun (cctxt : #Client_context.full) x -> - match Tezos_crypto.Operation_hash.of_b58check_opt x with + match Operation_hash.of_b58check_opt x with | None -> cctxt#error "Invalid operation hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ prefixes ["to"; "be"; "included"] @@ -2108,7 +2102,7 @@ let commands_rw () = operation_hash (ctxt : Protocol_client_context.full) -> let open Lwt_result_syntax in - let* (_ : Tezos_crypto.Block_hash.t * int * int) = + let* (_ : Block_hash.t * int * int) = Client_confirmations.wait_for_operation_inclusion ctxt ~chain:ctxt#chain @@ -2139,7 +2133,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to be submitted" (parameter (fun (cctxt : #Client_context.full) x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> cctxt#error "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)))) (fun (dry_run, verbose_signing, force) @@ -2202,9 +2196,7 @@ let commands_rw () = (List.length proposals) Constants.max_proposals_per_delegate ; (match - Base.List.find_all_dups - ~compare:Tezos_crypto.Protocol_hash.compare - proposals + Base.List.find_all_dups ~compare:Protocol_hash.compare proposals with | [] -> () | dups -> @@ -2216,19 +2208,16 @@ let commands_rw () = Format.( pp_print_list ~pp_sep:(fun ppf () -> pp_print_string ppf ", ") - Tezos_crypto.Protocol_hash.pp) + Protocol_hash.pp) dups) ; List.iter - (fun (p : Tezos_crypto.Protocol_hash.t) -> + (fun (p : Protocol_hash.t) -> if - List.mem ~equal:Tezos_crypto.Protocol_hash.equal p known_protos + List.mem ~equal:Protocol_hash.equal p known_protos || Environment.Protocol_hash.Map.mem p known_proposals then () else - error - "Protocol %a is not a known proposal." - Tezos_crypto.Protocol_hash.pp - p) + error "Protocol %a is not a known proposal." Protocol_hash.pp p) proposals ; if not has_voting_power then error @@ -2318,7 +2307,7 @@ let commands_rw () = ~name:"proposal" ~desc:"the protocol hash proposal to vote for" (parameter (fun (cctxt : #Client_context.full) x -> - match Tezos_crypto.Protocol_hash.of_b58check_opt x with + match Protocol_hash.of_b58check_opt x with | None -> cctxt#error "Invalid proposal hash: '%s'" x | Some hash -> Lwt_result_syntax.return hash)) @@ param @@ -2358,13 +2347,12 @@ let commands_rw () = let* () = match (info.current_period_kind, current_proposal) with | (Exploration | Promotion), Some current_proposal -> - if Tezos_crypto.Protocol_hash.equal proposal current_proposal then - return_unit + if Protocol_hash.equal proposal current_proposal then return_unit else let*! () = (if force then cctxt#warning else cctxt#error) "Unexpected proposal, expected: %a" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp current_proposal in return_unit 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 d1920589f114..22e4ed088ee8 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 @@ -100,18 +100,17 @@ type transfer = { type state = { rng_state : Random.State.t; - current_head_on_start : Tezos_crypto.Block_hash.t; + current_head_on_start : Block_hash.t; 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 last_block : Tezos_crypto.Block_hash.t; + mutable last_block : Block_hash.t; mutable last_level : int; - mutable target_block : Tezos_crypto.Block_hash.t; + mutable target_block : Block_hash.t; (** The block on top of which we are injecting transactions (HEAD~2). *) new_block_condition : unit Lwt_condition.t; - injected_operations : - Tezos_crypto.Operation_hash.t list Tezos_crypto.Block_hash.Table.t; + injected_operations : Operation_hash.t list Block_hash.Table.t; } (** Cost estimations for every kind of transaction used in the stress test. @@ -185,8 +184,8 @@ let injected_operations_encoding = let open Data_encoding in list (obj2 - (req "block_hash_when_injected" Tezos_crypto.Block_hash.encoding) - (req "operation_hashes" (list Tezos_crypto.Operation_hash.encoding))) + (req "block_hash_when_injected" Block_hash.encoding) + (req "operation_hashes" (list Operation_hash.encoding))) let transaction_costs_encoding = let open Data_encoding in @@ -345,7 +344,7 @@ let rec get_source_from_shuffled_pool state cctxt#message "sample_transfer: %d unused sources for the block next to %a" (List.length l) - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block) in Lwt.return source @@ -353,7 +352,7 @@ let rec get_source_from_shuffled_pool state let* () = cctxt#message "all available sources have been used for block next to %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp state.last_block in let* () = Lwt_condition.wait state.new_block_condition in @@ -375,9 +374,7 @@ let generate_fresh_source state = [promise] resolved when the stream is closed. [stopper ()] closes the stream. *) let heads_iter (cctxt : Protocol_client_context.full) - (f : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t) : + (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in @@ -392,7 +389,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "heads_iter: new block received %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp new_block_hash) in let* protocols = @@ -401,10 +398,7 @@ let heads_iter (cctxt : Protocol_client_context.full) ~block:(`Hash (new_block_hash, 0)) () in - if - Tezos_crypto.Protocol_hash.( - protocols.current_protocol = Protocol.hash) - then + if Protocol_hash.(protocols.current_protocol = Protocol.hash) then let* () = f block_hash_and_header in loop () else @@ -413,7 +407,7 @@ let heads_iter (cctxt : Protocol_client_context.full) cctxt#message "heads_iter: new block on protocol %a. Stopping \ iteration.@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp protocols.current_protocol) in return_unit) @@ -427,7 +421,7 @@ let heads_iter (cctxt : Protocol_client_context.full) log Debug (fun () -> cctxt#message "head iteration for proto %a stopped@." - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp Protocol.hash) in return (promise, stopper) @@ -651,18 +645,15 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state log Debug (fun () -> cctxt#message "inject_transfer: op injected %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash) in let ops = Option.value ~default:[] - (Tezos_crypto.Block_hash.Table.find state.injected_operations branch) + (Block_hash.Table.find state.injected_operations branch) in - Tezos_crypto.Block_hash.Table.replace - state.injected_operations - branch - (op_hash :: ops) ; + Block_hash.Table.replace state.injected_operations branch (op_hash :: ops) ; return_unit | Error e -> let*! () = @@ -679,7 +670,7 @@ let save_injected_operations (cctxt : Protocol_client_context.full) state = let json = Data_encoding.Json.construct injected_operations_encoding - (Tezos_crypto.Block_hash.Table.fold + (Block_hash.Table.fold (fun k v acc -> (k, v) :: acc) state.injected_operations []) @@ -702,10 +693,10 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = let ratio_injected_included_op () = let* current_head_on_exit = Shell_services.Blocks.hash cctxt () in let inter_cardinal s1 s2 = - Tezos_crypto.Operation_hash.Set.cardinal - (Tezos_crypto.Operation_hash.Set.inter - (Tezos_crypto.Operation_hash.Set.of_list s1) - (Tezos_crypto.Operation_hash.Set.of_list s2)) + Operation_hash.Set.cardinal + (Operation_hash.Set.inter + (Operation_hash.Set.of_list s1) + (Operation_hash.Set.of_list s2)) in let get_included_ops older_block = let rec get_included_ops block acc_included_ops = @@ -737,7 +728,7 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = get_included_ops current_head_on_exit [] in let injected_ops = - Tezos_crypto.Block_hash.Table.fold + Block_hash.Table.fold (fun k l acc -> (* The operations injected during the last block are ignored because they should not be currently included. *) @@ -751,9 +742,9 @@ let stat_on_exit (cctxt : Protocol_client_context.full) state = log Debug (fun () -> cctxt#message "injected : [%a]@.included: [%a]" - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) injected_ops - (Format.pp_print_list ~pp_sep Tezos_crypto.Operation_hash.pp) + (Format.pp_print_list ~pp_sep Operation_hash.pp) included_ops) in let injected_ops_count = List.length injected_ops in @@ -847,8 +838,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) loop () in let on_new_head : - Tezos_crypto.Block_hash.t * Tezos_base.Block_header.t -> - unit tzresult Lwt.t = + Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t = (* Because of how Tenderbake works the target block should stay 2 blocks in the past because this guarantees that we are targeting a block that is decided. *) @@ -862,8 +852,7 @@ let launch (cctxt : Protocol_client_context.full) (parameters : parameters) in fun (new_block_hash, new_block_header) -> let* () = update_target_block () in - if not (Tezos_crypto.Block_hash.equal new_block_hash state.last_block) - then ( + if not (Block_hash.equal new_block_hash state.last_block) then ( state.last_block <- new_block_hash ; state.last_level <- Int32.to_int new_block_header.shell.level ; state.shuffled_pool <- @@ -1185,7 +1174,7 @@ let generate_random_transactions = cctxt#error "The level of the head (%a) needs to be greater than 2 and is \ actually %ld." - Tezos_crypto.Block_hash.pp + Block_hash.pp current_head_on_start header_on_start.level else return_unit @@ -1208,7 +1197,7 @@ let generate_random_transactions = last_level = Int32.to_int header_on_start.level; target_block = current_target_block; new_block_condition = Lwt_condition.create (); - injected_operations = Tezos_crypto.Block_hash.Table.create 1023; + injected_operations = Block_hash.Table.create 1023; } in let exit_callback_id = diff --git a/src/proto_alpha/lib_delegate/abstract_context_index.ml b/src/proto_alpha/lib_delegate/abstract_context_index.ml index 54b73da7c42f..2e54f32fdc13 100644 --- a/src/proto_alpha/lib_delegate/abstract_context_index.ml +++ b/src/proto_alpha/lib_delegate/abstract_context_index.ml @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_alpha/lib_delegate/abstract_context_index.mli b/src/proto_alpha/lib_delegate/abstract_context_index.mli index 9a825a143620..5a280d04ac57 100644 --- a/src/proto_alpha/lib_delegate/abstract_context_index.mli +++ b/src/proto_alpha/lib_delegate/abstract_context_index.mli @@ -26,8 +26,7 @@ type t = { sync_fun : unit -> unit Lwt.t; checkout_fun : - Tezos_crypto.Context_hash.t -> - Tezos_protocol_environment.Context.t option Lwt.t; + Context_hash.t -> Tezos_protocol_environment.Context.t option Lwt.t; finalize_fun : unit -> unit Lwt.t; } diff --git a/src/proto_alpha/lib_delegate/baking_cache.ml b/src/proto_alpha/lib_delegate/baking_cache.ml index 1d5ffa81cdd2..2af2842c7777 100644 --- a/src/proto_alpha/lib_delegate/baking_cache.ml +++ b/src/proto_alpha/lib_delegate/baking_cache.ml @@ -30,8 +30,7 @@ open Protocol.Alpha_context type round = Round.t module Block_cache = - Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) - (Tezos_crypto.Block_hash) + Aches.Vache.Map (Aches.Vache.LRU_Precise) (Aches.Vache.Strong) (Block_hash) (** The [Timestamp_of_round_tbl] module allows to create memoization tables to store function calls of [Round.timestamp_of_round]. *) diff --git a/src/proto_alpha/lib_delegate/baking_configuration.ml b/src/proto_alpha/lib_delegate/baking_configuration.ml index db13c684bf3c..2b8dca57b0f6 100644 --- a/src/proto_alpha/lib_delegate/baking_configuration.ml +++ b/src/proto_alpha/lib_delegate/baking_configuration.ml @@ -81,7 +81,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -221,7 +221,7 @@ let retries_on_failure_config_encoding = Data_encoding.int31 let user_activate_upgrades_config_encoding = let open Data_encoding in - list (tup2 int32 Tezos_crypto.Protocol_hash.encoding) + list (tup2 int32 Protocol_hash.encoding) let liquidity_baking_toggle_vote_config_encoding = Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote_encoding diff --git a/src/proto_alpha/lib_delegate/baking_configuration.mli b/src/proto_alpha/lib_delegate/baking_configuration.mli index cd5b5a445f41..a1908d29dd22 100644 --- a/src/proto_alpha/lib_delegate/baking_configuration.mli +++ b/src/proto_alpha/lib_delegate/baking_configuration.mli @@ -56,7 +56,7 @@ type t = { nonce : nonce_config; validation : validation_config; retries_on_failure : int; - user_activated_upgrades : (int32 * Tezos_crypto.Protocol_hash.t) list; + user_activated_upgrades : (int32 * Protocol_hash.t) list; liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote; per_block_vote_file : string option; @@ -73,8 +73,7 @@ val default_nonce_config : nonce_config val default_retries_on_failure_config : int -val default_user_activated_upgrades : - (int32 * Tezos_crypto.Protocol_hash.t) list +val default_user_activated_upgrades : (int32 * Protocol_hash.t) list val default_liquidity_baking_toggle_vote : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote @@ -96,7 +95,7 @@ val make : ?nonce:nonce_config -> ?context_path:string -> ?retries_on_failure:int -> - ?user_activated_upgrades:(int32 * Tezos_crypto.Protocol_hash.t) list -> + ?user_activated_upgrades:(int32 * Protocol_hash.t) list -> ?liquidity_baking_toggle_vote: Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote -> ?per_block_vote_file:string -> @@ -115,7 +114,7 @@ val nonce_config_encoding : nonce_config Data_encoding.t val retries_on_failure_config_encoding : int Data_encoding.t val user_activate_upgrades_config_encoding : - (int32 * Tezos_crypto.Protocol_hash.t) list Data_encoding.t + (int32 * Protocol_hash.t) list Data_encoding.t val liquidity_baking_toggle_vote_config_encoding : Protocol.Alpha_context.Liquidity_baking.liquidity_baking_toggle_vote diff --git a/src/proto_alpha/lib_delegate/baking_events.ml b/src/proto_alpha/lib_delegate/baking_events.ml index 30ff8ba7911d..110ce3854366 100644 --- a/src/proto_alpha/lib_delegate/baking_events.ml +++ b/src/proto_alpha/lib_delegate/baking_events.ml @@ -43,8 +43,8 @@ module State_transitions = struct ~name:"new_head" ~level:Notice ~msg:"received new head {block} at level {level}, round {round}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) ~pp3:Round.pp @@ -119,12 +119,12 @@ module State_transitions = struct ~msg: "proposal {new_proposal} for current round ({current_round}) has \ already been seen {previous_proposal}" - ~pp1:Tezos_crypto.Block_hash.pp - ("new_proposal", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("new_proposal", Block_hash.encoding) ~pp2:Round.pp ("current_round", Round.encoding) - ~pp3:Tezos_crypto.Block_hash.pp - ("previous_proposal", Tezos_crypto.Block_hash.encoding) + ~pp3:Block_hash.pp + ("previous_proposal", Block_hash.encoding) let updating_latest_proposal = declare_1 @@ -132,8 +132,8 @@ module State_transitions = struct ~name:"updating_latest_proposal" ~msg:"updating latest proposal to {block_hash}" ~level:Info - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let baker_is_ahead_of_node = declare_2 @@ -156,10 +156,10 @@ module State_transitions = struct ~msg: "received a proposal on another branch - current: current \ pred{current_branch}, new pred {new_branch}" - ~pp1:Tezos_crypto.Block_hash.pp - ("current_branch", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("new_branch", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("current_branch", Block_hash.encoding) + ~pp2:Block_hash.pp + ("new_branch", Block_hash.encoding) let switching_branch = declare_0 @@ -215,8 +215,8 @@ module State_transitions = struct ~name:"attempting_preendorsing_proposal" ~level:Info ~msg:"attempting to preendorse proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let skipping_invalid_proposal = declare_0 @@ -232,8 +232,8 @@ module State_transitions = struct ~name:"outdated_proposal" ~level:Debug ~msg:"outdated proposal {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let proposing_fresh_block = declare_2 @@ -271,10 +271,10 @@ module State_transitions = struct ~msg: "unexpected prequorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let unexpected_quorum_received = declare_2 @@ -284,10 +284,10 @@ module State_transitions = struct ~msg: "unexpected quorum received for {received_hash} instead of \ {expected_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("received_hash", Tezos_crypto.Block_hash.encoding) - ~pp2:Tezos_crypto.Block_hash.pp - ("expected_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("received_hash", Block_hash.encoding) + ~pp2:Block_hash.pp + ("expected_hash", Block_hash.encoding) let step_current_phase = declare_2 @@ -321,8 +321,8 @@ module Node_rpc = struct ~name:"raw_info" ~level:Debug ~msg:"raw info for {block_hash} at level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) end @@ -451,8 +451,8 @@ module Scheduling = struct ~name:"proposal_in_the_future" ~level:Debug ~msg:"received proposal in the future {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) let process_proposal_in_the_future = declare_1 @@ -460,8 +460,8 @@ module Scheduling = struct ~name:"process_proposal_in_the_future" ~level:Debug ~msg:"process proposal received in the future with hash {block_hash}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block_hash", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block_hash", Block_hash.encoding) end module Lib = struct @@ -543,8 +543,8 @@ module Actions = struct ~name:"preendorsement_injected" ~level:Notice ~msg:"injected preendorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -554,8 +554,8 @@ module Actions = struct ~name:"endorsement_injected" ~level:Notice ~msg:"injected endorsement {ophash} for {delegate}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -565,8 +565,8 @@ module Actions = struct ~name:"synchronizing_round" ~level:Info ~msg:"synchronizing round after block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let prepare_forging_block = declare_3 @@ -615,11 +615,11 @@ module Actions = struct ~level:Notice ~msg: "block {block} at level {level}, round {round} injected for {delegate}" - ~pp1:Tezos_crypto.Block_hash.pp + ~pp1:Block_hash.pp ~pp2:pp_int32 ~pp3:Round.pp ~pp4:Baking_state.pp_consensus_key_and_delegate - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("round", Round.encoding) ("delegate", Baking_state.consensus_key_and_delegate_encoding) @@ -694,8 +694,8 @@ module VDF = struct ("cycle", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let vdf_daemon_start = declare_1 @@ -743,8 +743,8 @@ module Nonces = struct ~name:"found_nonce_to_reveal" ~level:Notice ~msg:"found nonce to reveal for block {block}, level {level}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) ~pp2:pp_int32 ("level", Data_encoding.int32) @@ -760,8 +760,8 @@ module Nonces = struct ("level", Data_encoding.int32) ~pp2:Format.pp_print_string ("chain", Data_encoding.string) - ~pp3:Tezos_crypto.Operation_hash.pp - ("ophash", Tezos_crypto.Operation_hash.encoding) + ~pp3:Operation_hash.pp + ("ophash", Operation_hash.encoding) let cannot_fetch_chain_head_level = declare_0 @@ -835,8 +835,8 @@ module Nonces = struct ~name:"registering_nonce" ~level:Info ~msg:"registering nonce for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let nothing_to_reveal = declare_1 @@ -844,8 +844,8 @@ module Nonces = struct ~name:"nothing_to_reveal" ~level:Info ~msg:"nothing to reveal for block {block}" - ~pp1:Tezos_crypto.Block_hash.pp - ("block", Tezos_crypto.Block_hash.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) let revelation_worker_started = declare_0 @@ -930,8 +930,8 @@ module Selection = struct ~name:"invalid_operation_filtered" ~level:Warning ~msg:"filtered invalid operation {op}: {errors}" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.(TzTrace.encoding error_encoding)) @@ -941,6 +941,6 @@ module Selection = struct ~name:"cannot_serialize_operation_metadata" ~level:Warning ~msg:"cannot serialize operation {op} metadata" - ~pp1:Tezos_crypto.Operation_hash.pp - ("op", Tezos_crypto.Operation_hash.encoding) + ~pp1:Operation_hash.pp + ("op", Operation_hash.encoding) end diff --git a/src/proto_alpha/lib_delegate/baking_lib.ml b/src/proto_alpha/lib_delegate/baking_lib.ml index 1f86ff2c9bac..bb2cb7b3f4ec 100644 --- a/src/proto_alpha/lib_delegate/baking_lib.ml +++ b/src/proto_alpha/lib_delegate/baking_lib.ml @@ -251,7 +251,7 @@ let propose_at_next_level ~minimal_timestamp state = "Proposed block at round %a on top of %a " Round.pp block_to_bake.round - Tezos_crypto.Block_hash.pp + Block_hash.pp block_to_bake.predecessor.hash in return state @@ -394,7 +394,7 @@ let bake_using_automaton config state block_stream = let*! () = cctxt#message "Block %a (%ld) injected" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash proposal.block.shell.level in diff --git a/src/proto_alpha/lib_delegate/baking_nonces.ml b/src/proto_alpha/lib_delegate/baking_nonces.ml index 3acc87f16377..5af73f61735e 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.ml +++ b/src/proto_alpha/lib_delegate/baking_nonces.ml @@ -33,34 +33,27 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -let empty = Tezos_crypto.Block_hash.Map.empty +let empty = Block_hash.Map.empty let encoding = let open Data_encoding in def "seed_nonce" @@ conv (fun m -> - Tezos_crypto.Block_hash.Map.fold - (fun hash nonce acc -> (hash, nonce) :: acc) - m - []) + Block_hash.Map.fold (fun hash nonce acc -> (hash, nonce) :: acc) m []) (fun l -> List.fold_left - (fun map (hash, nonce) -> - Tezos_crypto.Block_hash.Map.add hash nonce map) - Tezos_crypto.Block_hash.Map.empty + (fun map (hash, nonce) -> Block_hash.Map.add hash nonce map) + Block_hash.Map.empty l) - @@ list - (obj2 - (req "block" Tezos_crypto.Block_hash.encoding) - (req "nonce" Nonce.encoding)) + @@ list (obj2 (req "block" Block_hash.encoding) (req "nonce" Nonce.encoding)) let may_migrate (wallet : Protocol_client_context.full) location = let base_dir = wallet#get_base_dir in @@ -85,16 +78,16 @@ let load (wallet : #Client_context.wallet) location = let save (wallet : #Client_context.wallet) location nonces = wallet#write (Baking_files.filename location) nonces encoding -let mem nonces hash = Tezos_crypto.Block_hash.Map.mem hash nonces +let mem nonces hash = Block_hash.Map.mem hash nonces -let find_opt nonces hash = Tezos_crypto.Block_hash.Map.find hash nonces +let find_opt nonces hash = Block_hash.Map.find hash nonces -let add nonces hash nonce = Tezos_crypto.Block_hash.Map.add hash nonce nonces +let add nonces hash nonce = Block_hash.Map.add hash nonce nonces -let remove nonces hash = Tezos_crypto.Block_hash.Map.remove hash nonces +let remove nonces hash = Block_hash.Map.remove hash nonces let remove_all nonces nonces_to_remove = - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash _ acc -> remove acc hash) nonces_to_remove nonces @@ -123,7 +116,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let block_cycle = Int32.(div block_level blocks_per_cycle) in Int32.sub current_cycle block_cycle > Int32.of_int preserved_cycles in - Tezos_crypto.Block_hash.Map.fold + Block_hash.Map.fold (fun hash nonce acc -> acc >>=? fun (orphans, outdated) -> get_block_level_opt cctxt ~chain ~block:(`Hash (hash, 0)) >>= function @@ -138,7 +131,7 @@ let get_outdated_nonces {cctxt; constants; chain; _} nonces = let filter_outdated_nonces state nonces = get_outdated_nonces state nonces >>=? fun (orphans, outdated_nonces) -> when_ - (Tezos_crypto.Block_hash.Map.cardinal orphans >= 50) + (Block_hash.Map.cardinal orphans >= 50) (fun () -> Events.( emit too_many_nonces (Baking_files.filename state.nonces_location ^ "s")) @@ -263,9 +256,8 @@ let reveal_potential_nonces state new_proposal = let {cctxt; chain; nonces_location; last_predecessor; _} = state in let new_predecessor_hash = new_proposal.Baking_state.predecessor.hash in if - Tezos_crypto.Block_hash.(last_predecessor <> new_predecessor_hash) - && Tezos_crypto.Protocol_hash.( - new_proposal.predecessor.protocol = Protocol.hash) + Block_hash.(last_predecessor <> new_predecessor_hash) + && Protocol_hash.(new_proposal.predecessor.protocol = Protocol.hash) then ( (* only try revealing nonces when the proposal's predecessor is a new one *) state.last_predecessor <- new_predecessor_hash ; @@ -316,7 +308,7 @@ let start_revelation_worker cctxt config chain_id constants block_stream = constants; config; nonces_location; - last_predecessor = Tezos_crypto.Block_hash.zero; + last_predecessor = Block_hash.zero; } in let rec worker_loop () = diff --git a/src/proto_alpha/lib_delegate/baking_nonces.mli b/src/proto_alpha/lib_delegate/baking_nonces.mli index df34657eb901..8809adad843e 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.mli +++ b/src/proto_alpha/lib_delegate/baking_nonces.mli @@ -32,35 +32,31 @@ type state = { constants : Constants.t; config : Baking_configuration.nonce_config; nonces_location : [`Nonce] Baking_files.location; - mutable last_predecessor : Tezos_crypto.Block_hash.t; + mutable last_predecessor : Block_hash.t; } type t = state -type nonces = Nonce.t Tezos_crypto.Block_hash.Map.t +type nonces = Nonce.t Block_hash.Map.t -val empty : Nonce.t Tezos_crypto.Block_hash.Map.t +val empty : Nonce.t Block_hash.Map.t -val encoding : Nonce.t Tezos_crypto.Block_hash.Map.t Data_encoding.t +val encoding : Nonce.t Block_hash.Map.t Data_encoding.t val load : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + Nonce.t Block_hash.Map.t tzresult Lwt.t val save : #Client_context.wallet -> [< `Highwatermarks | `Nonce | `State] Baking_files.location -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> + Nonce.t Block_hash.Map.t -> unit tzresult Lwt.t -val mem : - Nonce.t Tezos_crypto.Block_hash.Map.t -> Tezos_crypto.Block_hash.t -> bool +val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool -val find_opt : - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Tezos_crypto.Block_hash.t -> - Nonce.t option +val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : #Tezos_rpc.Context.simple -> @@ -70,28 +66,21 @@ val get_block_level_opt : val get_outdated_nonces : t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Nonce.t Tezos_crypto.Block_hash.Map.t - * Nonce.t Tezos_crypto.Block_hash.Map.t) - tzresult - Lwt.t + Nonce.t Block_hash.Map.t -> + (Nonce.t Block_hash.Map.t * Nonce.t Block_hash.Map.t) tzresult Lwt.t val filter_outdated_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - Nonce.t Tezos_crypto.Block_hash.Map.t tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> Nonce.t Block_hash.Map.t tzresult Lwt.t val blocks_from_current_cycle : t -> Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t val get_unrevealed_nonces : - t -> - Nonce.t Tezos_crypto.Block_hash.Map.t -> - (Raw_level.t * Nonce.t) list tzresult Lwt.t + t -> Nonce.t Block_hash.Map.t -> (Raw_level.t * Nonce.t) list tzresult Lwt.t val generate_seed_nonce : Baking_configuration.nonce_config -> @@ -102,7 +91,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -110,7 +99,7 @@ val inject_seed_nonce_revelation : #Protocol_client_context.full -> chain:Chain_services.chain -> block:Block_services.block -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> (Raw_level.t * Nonce.t) list -> unit tzresult Lwt.t diff --git a/src/proto_alpha/lib_delegate/baking_scheduling.ml b/src/proto_alpha/lib_delegate/baking_scheduling.ml index bca851f697d8..38d42a06cc3d 100644 --- a/src/proto_alpha/lib_delegate/baking_scheduling.ml +++ b/src/proto_alpha/lib_delegate/baking_scheduling.ml @@ -211,10 +211,8 @@ let compute_next_round_time state = | None -> state.level_state.latest_proposal | Some {proposal; _} -> proposal in - if - Tezos_crypto.Protocol_hash.( - proposal.predecessor.next_protocol <> Protocol.hash) - then None + if Protocol_hash.(proposal.predecessor.next_protocol <> Protocol.hash) then + None else match state.level_state.next_level_proposed_round with | Some _proposed_round -> @@ -632,7 +630,7 @@ let create_initial_state cctxt ?(synchronize = true) ~chain config >>=? fun next_level_delegate_slots -> let elected_block = if - Tezos_crypto.Protocol_hash.( + Protocol_hash.( current_proposal.block.protocol <> Protocol.hash && current_proposal.block.next_protocol = Protocol.hash) then diff --git a/src/proto_alpha/lib_delegate/baking_simulator.ml b/src/proto_alpha/lib_delegate/baking_simulator.ml index c4bcd1aa80dc..2d09542279ad 100644 --- a/src/proto_alpha/lib_delegate/baking_simulator.ml +++ b/src/proto_alpha/lib_delegate/baking_simulator.ml @@ -99,9 +99,9 @@ let begin_construction ~timestamp ~protocol_data fitness = pred_shell.fitness; timestamp; level = pred_shell.level; - context = Tezos_crypto.Context_hash.zero (* fake context hash *); + context = Context_hash.zero (* fake context hash *); operations_hash = - Tezos_crypto.Operation_list_list_hash.zero (* fake op hash *); + Operation_list_list_hash.zero (* fake op hash *); } in let mode = diff --git a/src/proto_alpha/lib_delegate/baking_simulator.mli b/src/proto_alpha/lib_delegate/baking_simulator.mli index d6d45255028e..1643296eb489 100644 --- a/src/proto_alpha/lib_delegate/baking_simulator.mli +++ b/src/proto_alpha/lib_delegate/baking_simulator.mli @@ -39,7 +39,7 @@ val load_context : (** Make sure that the given context is consistent by trying to read in it *) val check_context_consistency : - Abstract_context_index.t -> Tezos_crypto.Context_hash.t -> unit tzresult Lwt.t + Abstract_context_index.t -> Context_hash.t -> unit tzresult Lwt.t val begin_construction : timestamp:Time.Protocol.t -> diff --git a/src/proto_alpha/lib_delegate/baking_state.ml b/src/proto_alpha/lib_delegate/baking_state.ml index 78e113a2ebd5..b2dc19ae851a 100644 --- a/src/proto_alpha/lib_delegate/baking_state.ml +++ b/src/proto_alpha/lib_delegate/baking_state.ml @@ -110,18 +110,18 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; } type cache = { @@ -225,19 +225,19 @@ let block_info_encoding = }) (merge_objs (obj10 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "shell" Block_header.shell_header_encoding) - (req "resulting_context_hash" Tezos_crypto.Context_hash.encoding) + (req "resulting_context_hash" Context_hash.encoding) (req "payload_hash" Block_payload_hash.encoding) (req "payload_round" Round.encoding) (req "round" Round.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding) (req "prequorum" (option prequorum_encoding)) (req "quorum" (list (dynamic_size Operation.encoding)))) (obj2 (req "payload" Operation_pool.payload_encoding) - (req "live_blocks" Tezos_crypto.Block_hash.Set.encoding))) + (req "live_blocks" Block_hash.Set.encoding))) let round_of_shell_header shell_header = Environment.wrap_tzresult @@ -450,17 +450,17 @@ let event_encoding = happen once. *) type legacy_block_info = { - legacy_hash : Tezos_crypto.Block_hash.t; + legacy_hash : Block_hash.t; legacy_shell : Block_header.shell_header; legacy_payload_hash : Block_payload_hash.t; legacy_payload_round : Round.t; legacy_round : Round.t; - legacy_protocol : Tezos_crypto.Protocol_hash.t; - legacy_next_protocol : Tezos_crypto.Protocol_hash.t; + legacy_protocol : Protocol_hash.t; + legacy_next_protocol : Protocol_hash.t; legacy_prequorum : prequorum option; legacy_quorum : Kind.endorsement operation list; legacy_payload : Operation_pool.payload; - legacy_live_blocks : Tezos_crypto.Block_hash.Set.t; + legacy_live_blocks : Block_hash.Set.t; } let legacy_block_info_encoding : legacy_block_info Data_encoding.t = @@ -518,17 +518,17 @@ let legacy_block_info_encoding : legacy_block_info Data_encoding.t = }) (merge_objs (obj10 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "shell" Block_header.shell_header_encoding) (req "payload_hash" Block_payload_hash.encoding) (req "payload_round" Round.encoding) (req "round" Round.encoding) - (req "protocol" Tezos_crypto.Protocol_hash.encoding) - (req "next_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "protocol" Protocol_hash.encoding) + (req "next_protocol" Protocol_hash.encoding) (req "prequorum" (option prequorum_encoding)) (req "quorum" (list (dynamic_size Operation.encoding))) (req "payload" Operation_pool.payload_encoding)) - (obj1 (req "live_blocks" Tezos_crypto.Block_hash.Set.encoding))) + (obj1 (req "live_blocks" Block_hash.Set.encoding))) type legacy_proposal = { legacy_block : legacy_block_info; @@ -880,16 +880,16 @@ let pp_block_info fmt "@[<v 2>Block:@ hash: %a@ payload_hash: %a@ level: %ld@ round: %a@ \ protocol: %a@ next protocol: %a@ prequorum: %a@ quorum: %d endorsements@ \ payload: %a@]" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash Block_payload_hash.pp_short payload_hash shell.level Round.pp round - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short protocol - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short next_protocol (pp_option pp_prequorum) prequorum @@ -912,7 +912,7 @@ let pp_endorsable_payload fmt {proposal; prequorum} = Format.fprintf fmt "proposal: %a, prequorum: %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp proposal.block.hash pp_prequorum prequorum @@ -1029,7 +1029,7 @@ let pp_event fmt = function round %a" (List.length preendos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched @@ -1039,7 +1039,7 @@ let pp_event fmt = function "quorum reached with %d endorsements (power: %d) for %a at round %a" (List.length endos) voting_power - Tezos_crypto.Block_hash.pp + Block_hash.pp candidate.Operation_worker.hash Round.pp candidate.round_watched diff --git a/src/proto_alpha/lib_delegate/baking_state.mli b/src/proto_alpha/lib_delegate/baking_state.mli index b1ea6622eb77..14296c3823a9 100644 --- a/src/proto_alpha/lib_delegate/baking_state.mli +++ b/src/proto_alpha/lib_delegate/baking_state.mli @@ -56,18 +56,18 @@ type prequorum = { } type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; shell : Block_header.shell_header; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; payload_hash : Block_payload_hash.t; payload_round : Round.t; round : Round.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; prequorum : prequorum option; quorum : Kind.endorsement operation list; payload : Operation_pool.payload; - live_blocks : Tezos_crypto.Block_hash.Set.t; + live_blocks : Block_hash.Set.t; (** Set of live blocks for this block that is used to filter old or too recent operations. *) } diff --git a/src/proto_alpha/lib_delegate/baking_vdf.ml b/src/proto_alpha/lib_delegate/baking_vdf.ml index 6dc6d5e9abb1..8d2caefb709b 100644 --- a/src/proto_alpha/lib_delegate/baking_vdf.ml +++ b/src/proto_alpha/lib_delegate/baking_vdf.ml @@ -182,7 +182,7 @@ let process_new_block (cctxt : #Protocol_client_context.full) state let* level_info = get_level_info cctxt level in let level_str = Int32.to_string (Raw_level.to_int32 level) in let* () = check_new_cycle state level_info in - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then let*! () = D_Events.(emit protocol_change_detected) () in return_unit else diff --git a/src/proto_alpha/lib_delegate/block_forge.ml b/src/proto_alpha/lib_delegate/block_forge.ml index 0df28bfea484..917133e0e553 100644 --- a/src/proto_alpha/lib_delegate/block_forge.ml +++ b/src/proto_alpha/lib_delegate/block_forge.ml @@ -117,7 +117,7 @@ let finalize_block_header shell_header timestamp validation_result let retain_live_operations_only ~live_blocks operation_pool = Operation_pool.Prioritized.filter (fun ({shell; _} : packed_operation) -> - Tezos_crypto.Block_hash.Set.mem shell.branch live_blocks) + Block_hash.Set.mem shell.branch live_blocks) operation_pool let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info @@ -141,7 +141,7 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info | None -> next_protocol | Some hash -> hash in - return Tezos_crypto.Protocol_hash.(Protocol.hash <> next_protocol) + return Protocol_hash.(Protocol.hash <> next_protocol) in let filter_via_node ~operation_pool = let filtered_operations = @@ -301,11 +301,10 @@ let forge (cctxt : #Protocol_client_context.full) ~chain_id ~pred_info >>=? fun (incremental, ordered_pool) -> let operations = Operation_pool.ordered_to_list_list ordered_pool in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in (* We need to compute the final [operations_hash] before diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.ml b/src/proto_alpha/lib_delegate/client_baking_blocks.ml index e192aa649a72..9be4d3735d52 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.ml +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.ml @@ -28,16 +28,16 @@ open Alpha_context open Protocol_client_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } let raw_info cctxt ?(chain = `Main) hash shell_header = @@ -80,7 +80,7 @@ let info cctxt ?(chain = `Main) block = module Block_seen_event = struct type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Tezos_base.Block_header.t; occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; } @@ -101,7 +101,7 @@ module Block_seen_event = struct (function {hash; header; occurrence} -> (hash, occurrence, header)) (fun (hash, occurrence, header) -> make hash header occurrence) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (* Occurrence has to come before header, because: (Invalid_argument "Cannot merge two objects when the left element is of @@ -133,7 +133,7 @@ module Block_seen_event = struct With_version.(encoding ~name (first_version v0_encoding)) let pp ~short:_ ppf {hash; _} = - Format.fprintf ppf "Saw block %a" Tezos_crypto.Block_hash.pp_short hash + Format.fprintf ppf "Saw block %a" Block_hash.pp_short hash let doc = "Block observed while monitoring a blockchain." @@ -173,7 +173,7 @@ let monitor_heads cctxt ~next_protocols chain = type error += | Unexpected_empty_block_list of { chain : string; - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; length : int; } @@ -190,13 +190,13 @@ let () = "Unexpected empty block list retrieved from chain %s at block %a, \ length %d" chain - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash length) Data_encoding.( obj3 (req "chain" string) - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "length" int31)) (function | Unexpected_empty_block_list {chain; block_hash; length} -> diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.mli b/src/proto_alpha/lib_delegate/client_baking_blocks.mli index 07d582b6ed9b..e3b8a7621d56 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.mli +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.mli @@ -27,16 +27,16 @@ open Protocol open Alpha_context type block_info = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; - protocol : Tezos_crypto.Protocol_hash.t; - next_protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; + next_protocol : Protocol_hash.t; proto_level : int; level : Raw_level.t; - context : Tezos_crypto.Context_hash.t; + context : Context_hash.t; } val info : @@ -48,14 +48,14 @@ val info : val monitor_valid_blocks : #Protocol_client_context.rpc_context -> ?chains:Chain_services.chain list -> - ?protocols:Tezos_crypto.Protocol_hash.t list -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + ?protocols:Protocol_hash.t list -> + next_protocols:Protocol_hash.t list option -> unit -> (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> - next_protocols:Tezos_crypto.Protocol_hash.t list option -> + next_protocols:Protocol_hash.t list option -> Chain_services.chain -> block_info tzresult Lwt_stream.t tzresult Lwt.t @@ -65,4 +65,4 @@ val blocks_from_current_cycle : Block_services.block -> ?offset:int32 -> unit -> - Tezos_crypto.Block_hash.t list tzresult Lwt.t + Block_hash.t list tzresult Lwt.t diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index 21b58428d339..19a7712b1698 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -49,8 +49,7 @@ module Slot_Map = Slot.Map (* type of operations stream, as returned by monitor_operations RPC *) type ops_stream = - ((Tezos_crypto.Operation_hash.t * packed_operation) * error trace option) list - Lwt_stream.t + ((Operation_hash.t * packed_operation) * error trace option) list Lwt_stream.t type 'a state = { (* Endorsements seen so far *) @@ -58,7 +57,7 @@ type 'a state = { (* Preendorsements seen so far *) preendorsements_table : Kind.preendorsement operation Slot_Map.t HLevel.t; (* Blocks received so far *) - blocks_table : Tezos_crypto.Block_hash.t Delegate_Map.t HLevel.t; + blocks_table : Block_hash.t Delegate_Map.t HLevel.t; (* Maximum delta of level to register *) preserved_levels : int; (* Highest level seen in a block *) @@ -127,7 +126,7 @@ let double_consensus_op_evidence (type kind) : kind consensus_operation_type -> #Protocol_client_context.full -> 'a -> - branch:Tezos_crypto.Block_hash.t -> + branch:Block_hash.t -> op1:kind Alpha_context.operation -> op2:kind Alpha_context.operation -> unit -> @@ -160,7 +159,7 @@ let process_consensus_op (type kind) cctxt (Operation.hash new_op, Operation.hash existing_op) in let op1, op2 = - if Tezos_crypto.Operation_hash.(new_op_hash < existing_op_hash) then + if Operation_hash.(new_op_hash < existing_op_hash) then (new_op, existing_op) else (existing_op, new_op) in @@ -274,8 +273,7 @@ let process_block (cctxt : #Protocol_client_context.full) state state.blocks_table (chain_id, level, round) (Delegate_Map.add baker.delegate new_hash map) - | Some existing_hash - when Tezos_crypto.Block_hash.(existing_hash = new_hash) -> + | Some existing_hash when Block_hash.(existing_hash = new_hash) -> (* This case should never happen *) Events.(emit double_baking_but_not) () >>= fun () -> return @@ -291,8 +289,7 @@ let process_block (cctxt : #Protocol_client_context.full) state let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in let bh1, bh2 = - if Tezos_crypto.Block_hash.(hash1 < hash2) then (bh1, bh2) - else (bh2, bh1) + if Block_hash.(hash1 < hash2) then (bh1, bh2) else (bh2, bh1) in (* If the blocks are on different chains then skip it *) get_block_offset level >>= fun block -> @@ -353,7 +350,7 @@ let cleanup_old_operations state = *) let process_new_block (cctxt : #Protocol_client_context.full) state {hash; chain_id; level; protocol; next_protocol; _} = - if Tezos_crypto.Protocol_hash.(protocol <> next_protocol) then + if Protocol_hash.(protocol <> next_protocol) then Events.(emit protocol_change_detected) () >>= fun () -> return_unit else Events.(emit accuser_saw_block) (level, hash) >>= fun () -> diff --git a/src/proto_alpha/lib_delegate/client_daemon.ml b/src/proto_alpha/lib_delegate/client_daemon.ml index 836c95f1ad9a..ba2cfdac03b3 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.ml +++ b/src/proto_alpha/lib_delegate/client_daemon.ml @@ -91,7 +91,7 @@ module Baker = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> let canceler = Lwt_canceler.create () in @@ -121,7 +121,7 @@ module Accuser = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash >>= fun () -> Client_baking_blocks.monitor_valid_blocks @@ -159,7 +159,7 @@ module VDF = struct Tezos_version.Version.pp Tezos_version.Current_git_info.version Tezos_version.Current_git_info.abbreviated_commit_hash - Tezos_crypto.Protocol_hash.pp_short + Protocol_hash.pp_short Protocol.hash in let* chain_id = Shell_services.Chain.chain_id cctxt ~chain () in diff --git a/src/proto_alpha/lib_delegate/delegate_events.ml b/src/proto_alpha/lib_delegate/delegate_events.ml index ca4361b2dc96..20f5d091dd9c 100644 --- a/src/proto_alpha/lib_delegate/delegate_events.ml +++ b/src/proto_alpha/lib_delegate/delegate_events.ml @@ -50,8 +50,8 @@ module Denunciator = struct ~level ~name:"double_endorsement_detected" ~msg:"double endorsement detected" - ("existing_endorsement", Tezos_crypto.Operation_hash.encoding) - ("new_endorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_endorsement", Operation_hash.encoding) + ("new_endorsement", Operation_hash.encoding) let double_endorsement_denounced = declare_2 @@ -59,7 +59,7 @@ module Denunciator = struct ~level ~name:"double_endorsement_denounced" ~msg:"double endorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -69,8 +69,8 @@ module Denunciator = struct ~level ~name:"double_preendorsement_detected" ~msg:"double preendorsement detected" - ("existing_preendorsement", Tezos_crypto.Operation_hash.encoding) - ("new_preendorsement", Tezos_crypto.Operation_hash.encoding) + ("existing_preendorsement", Operation_hash.encoding) + ("new_preendorsement", Operation_hash.encoding) let double_preendorsement_denounced = declare_2 @@ -78,7 +78,7 @@ module Denunciator = struct ~level ~name:"double_preendorsement_denounced" ~msg:"double preendorsement evidence injected: {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -88,7 +88,7 @@ module Denunciator = struct ~level:Error ~name:"inconsistent_endorsement" ~msg:"inconsistent endorsement found {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) let unexpected_pruned_block = declare_1 @@ -96,7 +96,7 @@ module Denunciator = struct ~level:Error ~name:"unexpected_pruned_block" ~msg:"unexpected pruned block: {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let double_baking_but_not = declare_0 @@ -120,7 +120,7 @@ module Denunciator = struct ~level ~name:"double_baking_denounced" ~msg:"double baking evidence injected {hash}" - ("hash", Tezos_crypto.Operation_hash.encoding) + ("hash", Operation_hash.encoding) ~pp2:pp_ignore ("bytes", Data_encoding.bytes) @@ -139,7 +139,7 @@ module Denunciator = struct ~name:"accuser_saw_block" ~msg:"block level: {level}" ("level", Alpha_context.Raw_level.encoding) - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let fetch_operations_error = declare_1 @@ -147,8 +147,8 @@ module Denunciator = struct ~level:Error ~name:"fetch_operations_error" ~msg:"error while fetching operations of block {hash}" - ("hash", Tezos_crypto.Block_hash.encoding) - ~pp1:Tezos_crypto.Block_hash.pp + ("hash", Block_hash.encoding) + ~pp1:Block_hash.pp let accuser_processed_block = declare_1 @@ -156,7 +156,7 @@ module Denunciator = struct ~level ~name:"accuser_processed_block" ~msg:"block {hash} registered" - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) let accuser_block_error = declare_2 @@ -165,7 +165,7 @@ module Denunciator = struct ~name:"accuser_block_error" ~msg:"error while processing block {hash} {errors}" ~pp2:pp_print_top_error_of_trace - ("hash", Tezos_crypto.Block_hash.encoding) + ("hash", Block_hash.encoding) ("errors", Error_monad.(TzTrace.encoding error_encoding)) end diff --git a/src/proto_alpha/lib_delegate/logging.ml b/src/proto_alpha/lib_delegate/logging.ml index 6756e73e07e6..ed9cb18c9db3 100644 --- a/src/proto_alpha/lib_delegate/logging.ml +++ b/src/proto_alpha/lib_delegate/logging.ml @@ -147,9 +147,9 @@ let conflicting_endorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) let conflicting_preendorsements_tag = @@ -161,7 +161,7 @@ let conflicting_preendorsements_tag = fprintf ppf "%a / %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash a) - Tezos_crypto.Operation_hash.pp + Operation_hash.pp (Operation.hash b)) diff --git a/src/proto_alpha/lib_delegate/node_rpc.ml b/src/proto_alpha/lib_delegate/node_rpc.ml index 94be468c039b..a6d3d71cc15e 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.ml +++ b/src/proto_alpha/lib_delegate/node_rpc.ml @@ -70,9 +70,7 @@ let raw_info cctxt ~chain ~block_hash shell resulting_context_hash payload_hash >>= fun () -> let open Protocol_client_context in let block = `Hash (block_hash, 0) in - let is_in_protocol = - Tezos_crypto.Protocol_hash.(current_protocol = Protocol.hash) - in + let is_in_protocol = Protocol_hash.(current_protocol = Protocol.hash) in (if is_in_protocol then Alpha_block_services.Operations.operations cctxt ~chain ~block () >>=? fun operations -> @@ -126,7 +124,7 @@ let info cctxt ~chain ~block () = >>=? fun {current_protocol; next_protocol} -> Shell_services.Blocks.resulting_context_hash cctxt ~chain ~block () >>=? fun resulting_context_hash -> - (if Tezos_crypto.Protocol_hash.(current_protocol <> Protocol.hash) then + (if Protocol_hash.(current_protocol <> Protocol.hash) then Block_services.Header.shell_header cctxt ~chain ~block () >>=? fun shell -> Chain_services.Blocks.Header.raw_protocol_data cctxt ~chain ~block () >>=? fun protocol_data -> @@ -161,7 +159,7 @@ let info cctxt ~chain ~block () = (Chain_services.Blocks.live_blocks cctxt ~chain ~block () >>= function | Error _ -> (* The RPC might fail when a block's metadata is not available *) - Lwt.return Tezos_crypto.Block_hash.Set.empty + Lwt.return Block_hash.Set.empty | Ok live_blocks -> Lwt.return live_blocks) >>= fun live_blocks -> raw_info diff --git a/src/proto_alpha/lib_delegate/node_rpc.mli b/src/proto_alpha/lib_delegate/node_rpc.mli index 55694e129b55..2dd0468ef6f1 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.mli +++ b/src/proto_alpha/lib_delegate/node_rpc.mli @@ -37,13 +37,13 @@ val inject_block : chain:Shell_services.chain -> Block_header.t -> Tezos_base.Operation.t list list -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t (** Preapply a block using the node validation mechanism.*) val preapply_block : #Protocol_client_context.full -> chain:Shell_services.chain -> - head:Tezos_crypto.Block_hash.t -> + head:Block_hash.t -> timestamp:Time.Protocol.t -> protocol_data:Protocol.block_header_data -> packed_operation list list -> @@ -58,7 +58,7 @@ val proposal : #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Baking_state.proposal tzresult Lwt.t (** Monitor proposals from the node.*) diff --git a/src/proto_alpha/lib_delegate/operation_pool.ml b/src/proto_alpha/lib_delegate/operation_pool.ml index 16ec9eda7cdb..7e0a7612054e 100644 --- a/src/proto_alpha/lib_delegate/operation_pool.ml +++ b/src/proto_alpha/lib_delegate/operation_pool.ml @@ -41,7 +41,7 @@ let compare_op op1 op2 = (* FIXME some operations (e.g. tx_rollup_rejection) pack functional values which could raise an exception. In this specific case, we default to comparing their hashes. *) - Tezos_crypto.Operation_hash.compare + Operation_hash.compare (Alpha_context.Operation.hash_packed op1) (Alpha_context.Operation.hash_packed op2) diff --git a/src/proto_alpha/lib_delegate/operation_selection.ml b/src/proto_alpha/lib_delegate/operation_selection.ml index 83543149b056..089f4b439a93 100644 --- a/src/proto_alpha/lib_delegate/operation_selection.ml +++ b/src/proto_alpha/lib_delegate/operation_selection.ml @@ -165,7 +165,7 @@ type simulation_result = { validation_result : Tezos_protocol_environment.validation_result; block_header_metadata : block_header_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } let validate_operation inc op = @@ -250,11 +250,10 @@ let filter_operations_with_simulation initial_inc fees_config >>= fun (inc, managers) -> let operations = [consensus; votes; anonymous; managers] in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute + Operation_list_list_hash.compute (List.map (fun sl -> - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed sl)) + Operation_list_hash.compute (List.map Operation.hash_packed sl)) operations) in let inc = {inc with header = {inc.header with operations_hash}} in diff --git a/src/proto_alpha/lib_delegate/operation_selection.mli b/src/proto_alpha/lib_delegate/operation_selection.mli index 3ab72a91347c..78caab5c158c 100644 --- a/src/proto_alpha/lib_delegate/operation_selection.mli +++ b/src/proto_alpha/lib_delegate/operation_selection.mli @@ -31,7 +31,7 @@ type simulation_result = { validation_result : validation_result; block_header_metadata : Apply_results.block_metadata; operations : packed_operation list list; - operations_hash : Tezos_crypto.Operation_list_list_hash.t; + operations_hash : Operation_list_list_hash.t; } val filter_operations_with_simulation : diff --git a/src/proto_alpha/lib_delegate/operation_worker.ml b/src/proto_alpha/lib_delegate/operation_worker.ml index 5589f585649f..66cec5723476 100644 --- a/src/proto_alpha/lib_delegate/operation_worker.ml +++ b/src/proto_alpha/lib_delegate/operation_worker.ml @@ -145,7 +145,7 @@ module Events = struct end type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } @@ -158,7 +158,7 @@ let candidate_encoding = (fun (hash, round_watched, payload_hash_watched) -> {hash; round_watched; payload_hash_watched}) (obj3 - (req "hash" Tezos_crypto.Block_hash.encoding) + (req "hash" Block_hash.encoding) (req "round_watched" Round.encoding) (req "payload_hash_watched" Block_payload_hash.encoding)) @@ -539,8 +539,7 @@ let retrieve_pending_operations cctxt state = state.operation_pool (List.rev_map (fun (_, (op, _)) -> op) - (Tezos_crypto.Operation_hash.Map.bindings - pending_mempool.branch_delayed)) ; + (Operation_hash.Map.bindings pending_mempool.branch_delayed)) ; return_unit let get_current_operations state = state.operation_pool diff --git a/src/proto_alpha/lib_delegate/operation_worker.mli b/src/proto_alpha/lib_delegate/operation_worker.mli index ab66270bfd91..eecbc990f2d1 100644 --- a/src/proto_alpha/lib_delegate/operation_worker.mli +++ b/src/proto_alpha/lib_delegate/operation_worker.mli @@ -34,7 +34,7 @@ open Alpha_context type t type candidate = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; round_watched : Round.t; payload_hash_watched : Block_payload_hash.t; } diff --git a/src/proto_alpha/lib_delegate/state_transitions.ml b/src/proto_alpha/lib_delegate/state_transitions.ml index dfe009f4387a..196d248f553e 100644 --- a/src/proto_alpha/lib_delegate/state_transitions.ml +++ b/src/proto_alpha/lib_delegate/state_transitions.ml @@ -47,9 +47,8 @@ let is_acceptable_proposal_for_current_level state let previous_proposal = state.level_state.latest_proposal in if Round.(proposal.block.round = previous_proposal.block.round) - && Tezos_crypto.Block_hash.( - proposal.block.hash <> previous_proposal.block.hash) - && Tezos_crypto.Block_hash.( + && Block_hash.(proposal.block.hash <> previous_proposal.block.hash) + && Block_hash.( proposal.predecessor.hash = previous_proposal.predecessor.hash) then (* An existing proposal was found at the same round: the @@ -112,9 +111,7 @@ let may_update_proposal state (proposal : proposal) = else Lwt.return state let preendorse state proposal = - if - Tezos_crypto.Protocol_hash.( - proposal.block.protocol <> proposal.block.next_protocol) + if Protocol_hash.(proposal.block.protocol <> proposal.block.next_protocol) then (* We do not preendorse the first transition block *) let new_state = update_current_phase state Idle in @@ -198,7 +195,7 @@ let rec handle_new_proposal state (new_proposal : proposal) = let's check if it's a valid one for us. *) let current_proposal = state.level_state.latest_proposal in if - Tezos_crypto.Block_hash.( + Block_hash.( current_proposal.predecessor.hash <> new_proposal.predecessor.hash) then Events.( @@ -531,8 +528,7 @@ let end_of_round state current_round = do_nothing new_state | Some (delegate, _) -> let last_proposal = state.level_state.latest_proposal.block in - if Tezos_crypto.Protocol_hash.(last_proposal.protocol <> Protocol.hash) - then + if Protocol_hash.(last_proposal.protocol <> Protocol.hash) then (* Do not inject a block for the previous protocol! (Let the baker of the previous protocol do it.) *) do_nothing new_state @@ -594,9 +590,7 @@ let make_endorse_action state proposal = let prequorum_reached_when_awaiting_preendorsements state candidate preendorsements = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit @@ -643,9 +637,7 @@ let prequorum_reached_when_awaiting_preendorsements state candidate let quorum_reached_when_waiting_endorsements state candidate endorsement_qc = let latest_proposal = state.level_state.latest_proposal in - if - Tezos_crypto.Block_hash.( - candidate.Operation_worker.hash <> latest_proposal.block.hash) + if Block_hash.(candidate.Operation_worker.hash <> latest_proposal.block.hash) then Events.( emit diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml index ff2b7871d752..624565b40889 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml @@ -10,7 +10,7 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) val monitor_heads : - unit -> (Tezos_crypto.Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -23,7 +23,7 @@ module type Mocked_services_hooks = sig (** [resulting_context_hash] returns the context resulting hash of the given block. *) val resulting_context_hash : - Block_services.block -> Tezos_crypto.Context_hash.t tzresult Lwt.t + Block_services.block -> Context_hash.t tzresult Lwt.t (** [operations] returns all operations included in the block. *) val operations : @@ -34,15 +34,14 @@ module type Mocked_services_hooks = sig [Tezos_shell_services.Injection_services.S.block], after checking that the block header can be deserialized. *) val inject_block : - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t (** [inject_operation] is used by the endorser (or the client) to inject operations, including endorsements. *) - val inject_operation : - Operation.t -> Tezos_crypto.Operation_hash.t tzresult Lwt.t + val inject_operation : Operation.t -> Operation_hash.t tzresult Lwt.t (** [pending_operations] returns the current contents of the mempool. It is used by the baker to fetch operations to potentially include in the @@ -59,9 +58,7 @@ module type Mocked_services_hooks = sig branch_delayed:bool -> branch_refused:bool -> refused:bool -> - ((Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) - * error trace option) - list + ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted @@ -69,16 +66,15 @@ module type Mocked_services_hooks = sig chain. Optional arguments allow to return the list of predecessors of a given block or of a set of blocks. *) val list_blocks : - heads:Tezos_crypto.Block_hash.t list -> + heads:Block_hash.t list -> length:int option -> min_date:Time.Protocol.t option -> - Tezos_crypto.Block_hash.t list list tzresult Lwt.t + Block_hash.t list list tzresult Lwt.t (** List the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block. *) - val live_blocks : - Block_services.block -> Tezos_crypto.Block_hash.Set.t tzresult Lwt.t + val live_blocks : Block_services.block -> Block_hash.Set.t tzresult Lwt.t (** [rpc_context_callback] is used in the implementations of several RPCs (see local_services.ml). It should correspond to the @@ -95,7 +91,7 @@ module type Mocked_services_hooks = sig to all nodes. *) val broadcast_block : ?dests:int list -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> Block_header.t -> Operation.t trace trace -> unit tzresult Lwt.t @@ -110,8 +106,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> - (Tezos_crypto.Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -200,7 +195,7 @@ module Make (Hooks : Mocked_services_hooks) = struct match Block_header.of_bytes bytes with | None -> failwith "faked_services.inject_block: can't deserialize" | Some block_header -> - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in Hooks.inject_block block_hash block_header operations >>=? fun () -> return block_hash) @@ -219,7 +214,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Broadcast_services.S.block (fun () dests (block_header, operations) -> let bytes = Block_header.to_bytes block_header in - let block_hash = Tezos_crypto.Block_hash.hash_bytes [bytes] in + let block_hash = Block_hash.hash_bytes [bytes] in let dests = match dests#dests with [] -> None | dests -> Some dests in Hooks.broadcast_block ?dests block_hash block_header operations) diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index b97417ed1807..b391b3b272bd 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -28,7 +28,7 @@ type block = { protocol_data : Protocol.Alpha_context.Block_header.protocol_data; raw_protocol_data : Bytes.t; operations : Mockup.M.Block_services.operation list list; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } type chain = block list @@ -36,10 +36,8 @@ type chain = block list (** As new blocks and operations are received they are pushed to an Lwt_pipe wrapped into this type. *) type broadcast = - | Broadcast_block of - Tezos_crypto.Block_hash.t * Block_header.t * Operation.t list list - | Broadcast_op of - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation + | Broadcast_block of Block_hash.t * Block_header.t * Operation.t list list + | Broadcast_op of Operation_hash.t * Alpha_context.packed_operation (** The state of a mockup node. *) type state = { @@ -49,33 +47,29 @@ type state = { live_depth : int; (** How many blocks (counting from the head into the past) are considered live? *) mutable chain : chain; (** The chain as seen by this fake "node". *) - mutable mempool : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list; + mutable mempool : (Operation_hash.t * Mockup.M.Protocol.operation) list; (** Mempool of this fake "node". *) - chain_table : chain Tezos_crypto.Block_hash.Table.t; + chain_table : chain Block_hash.Table.t; (** The chain table of this fake "node". It maps from block hashes to blocks. *) - global_chain_table : block Tezos_crypto.Block_hash.Table.t; + global_chain_table : block Block_hash.Table.t; (** The global chain table that allows us to look up blocks that may be missing in [chain_table], i.e. not known to this particular node. This is used to find unknown predecessors. The real node can ask about an unknown block and receive it on request, this is supposed to emulate that functionality. *) - ctxt_table : - Tezos_protocol_environment.rpc_context Tezos_crypto.Context_hash.Table.t; + ctxt_table : Tezos_protocol_environment.rpc_context Context_hash.Table.t; (** The context table allows us to look up rpc_context by its hash. *) - heads_pipe : - (Tezos_crypto.Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; + heads_pipe : (Block_hash.t * Block_header.t) Lwt_pipe.Unbounded.t; (** [heads_pipe] is used to implement the [monitor_heads] RPC. *) operations_pipe : - (Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) option - Lwt_pipe.Unbounded.t; + (Operation_hash.t * Mockup.M.Protocol.operation) option Lwt_pipe.Unbounded.t; (** [operations_pipe] is used to implement the [operations_pipe] RPC. *) mutable streaming_operations : bool; (** A helper flag used to implement the monitor operations RPC. *) broadcast_pipes : broadcast Lwt_pipe.Unbounded.t list; (** Broadcast pipes per node. *) - genesis_block_true_hash : Tezos_crypto.Block_hash.t; + genesis_block_true_hash : Block_hash.t; (** True hash of the genesis block as calculated by the [Block_header.hash] function. *) @@ -86,10 +80,10 @@ let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" let genesis_block_hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" -let genesis_predecessor_block_hash = Tezos_crypto.Block_hash.zero +let genesis_predecessor_block_hash = Block_hash.zero type propagation = Block | Pass | Delay of float @@ -99,40 +93,34 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -141,7 +129,7 @@ module type Hooks = sig level:int32 -> round:int32 -> chain:chain -> unit tzresult Lwt.t val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t val stop_on_event : Baking_state.event -> bool @@ -162,12 +150,9 @@ let locate_blocks (state : state) block list tzresult Lwt.t = match block with | `Hash (hash, rel) -> ( - match Tezos_crypto.Block_hash.Table.find state.chain_table hash with + match Block_hash.Table.find state.chain_table hash with | None -> - failwith - "locate_blocks: can't find the block %a" - Tezos_crypto.Block_hash.pp - hash + failwith "locate_blocks: can't find the block %a" Block_hash.pp hash | Some chain0 -> let _, chain = List.split_n rel chain0 in return chain) @@ -193,8 +178,8 @@ let live_blocks (state : state) block = (List.fold_left (fun set ({rpc_context; _} : block) -> let hash = rpc_context.Tezos_protocol_environment.block_hash in - Tezos_crypto.Block_hash.Set.add hash set) - (Tezos_crypto.Block_hash.Set.singleton state.genesis_block_true_hash) + Block_hash.Set.add hash set) + (Block_hash.Set.singleton state.genesis_block_true_hash) segment) (** Extract the round number from raw fitness. *) @@ -288,27 +273,25 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : match block with | `Hash (requested_hash, rel) -> Int.equal rel 0 - && Tezos_crypto.Block_hash.equal - requested_hash - genesis_predecessor_block_hash + && Block_hash.equal requested_hash genesis_predecessor_block_hash | _ -> false in (* It is important to tell the baker that the genesis block is not in - the alpha protocol (we use Tezos_crypto.Protocol_hash.zero). This will make the + the alpha protocol (we use Protocol_hash.zero). This will make the baker not try to propose alternatives to that block and just accept - it as final in that Tezos_crypto.Protocol_hash.zero protocol. The same for - predecessor of genesis, it should be in Tezos_crypto.Protocol_hash.zero. *) + it as final in that Protocol_hash.zero protocol. The same for + predecessor of genesis, it should be in Protocol_hash.zero. *) return Tezos_shell_services.Block_services. { current_protocol = (if - Tezos_crypto.Block_hash.equal hash genesis_block_hash + Block_hash.equal hash genesis_block_hash || is_predecessor_of_genesis - then Tezos_crypto.Protocol_hash.zero + then Protocol_hash.zero else Protocol.hash); next_protocol = - (if is_predecessor_of_genesis then Tezos_crypto.Protocol_hash.zero + (if is_predecessor_of_genesis then Protocol_hash.zero else Protocol.hash); } @@ -325,7 +308,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : let resulting_context_hash (block : Tezos_shell_services.Block_services.block) : - Tezos_crypto.Context_hash.t tzresult Lwt.t = + Context_hash.t tzresult Lwt.t = locate_block state block >>=? fun x -> return x.resulting_context_hash let operations block = @@ -410,11 +393,11 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : Mockup.M.Block_services.Mempool. { applied = ops; - refused = Tezos_crypto.Operation_hash.Map.empty; - outdated = Tezos_crypto.Operation_hash.Map.empty; - branch_refused = Tezos_crypto.Operation_hash.Map.empty; - branch_delayed = Tezos_crypto.Operation_hash.Map.empty; - unprocessed = Tezos_crypto.Operation_hash.Map.empty; + refused = Operation_hash.Map.empty; + outdated = Operation_hash.Map.empty; + branch_refused = Operation_hash.Map.empty; + branch_delayed = Operation_hash.Map.empty; + unprocessed = Operation_hash.Map.empty; } let monitor_operations ~applied ~branch_delayed ~branch_refused ~refused = @@ -494,12 +477,11 @@ let clear_mempool state = (fun (_oph, (op : Mockup.M.Protocol.operation)) -> let included_in_head = List.mem - ~equal:Tezos_crypto.Operation_hash.equal + ~equal:Operation_hash.equal (Alpha_context.Operation.hash_packed op) included_ops_hashes in - Tezos_crypto.Block_hash.Set.mem op.shell.branch live_set - && not included_in_head) + Block_hash.Set.mem op.shell.branch live_set && not included_in_head) state.mempool in state.mempool <- mempool ; @@ -573,17 +555,13 @@ let rec process_block state block_hash (block_header : Block_header.t) let get_predecessor () = let predecessor_hash = block_header.Block_header.shell.predecessor in head state >>=? fun head -> - match - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash - with + match Block_hash.Table.find state.chain_table predecessor_hash with | None | Some [] -> ( (* Even if the predecessor is not known locally, it might be known by some node in the network. The code below "requests" information about the block by its hash. *) match - Tezos_crypto.Block_hash.Table.find - state.global_chain_table - predecessor_hash + Block_hash.Table.find state.global_chain_table predecessor_hash with | None -> failwith "get_predecessor: unknown predecessor block" | Some predecessor -> @@ -626,7 +604,7 @@ let rec process_block state block_hash (block_header : Block_header.t) then return predecessor else failwith "get_predecessor: the predecessor block is too old" in - match Tezos_crypto.Block_hash.Table.find state.chain_table block_hash with + match Block_hash.Table.find state.chain_table block_hash with | Some _ -> (* The block is already known. *) return_unit @@ -650,7 +628,7 @@ let rec process_block state block_hash (block_header : Block_header.t) (fun pass -> List.map (fun (Operation.{shell; proto} as op) -> - let hash : Tezos_crypto.Operation_hash.t = Operation.hash op in + let hash : Operation_hash.t = Operation.hash op in let protocol_data : Alpha_context.packed_protocol_data = Data_encoding.Binary.of_bytes_exn Protocol.operation_data_encoding @@ -678,19 +656,13 @@ let rec process_block state block_hash (block_header : Block_header.t) in let predecessor_hash = block_header.Block_header.shell.predecessor in let tail = - Tezos_crypto.Block_hash.Table.find state.chain_table predecessor_hash + Block_hash.Table.find state.chain_table predecessor_hash |> WithExceptions.Option.get ~loc:__LOC__ in let new_chain = new_block :: tail in - Tezos_crypto.Block_hash.Table.replace - state.chain_table - block_hash - new_chain ; - Tezos_crypto.Block_hash.Table.replace - state.global_chain_table - block_hash - new_block ; - Tezos_crypto.Context_hash.Table.replace + Block_hash.Table.replace state.chain_table block_hash new_chain ; + Block_hash.Table.replace state.global_chain_table block_hash new_block ; + Context_hash.Table.replace state.ctxt_table resulting_context_hash rpc_context ; @@ -780,7 +752,7 @@ let create_fake_node_state ~i ~live_depth mempool = []; chain = chain0; chain_table = - Tezos_crypto.Block_hash.Table.of_seq + Block_hash.Table.of_seq (List.to_seq [ (rpc_context0.block_hash, chain0); @@ -789,7 +761,7 @@ let create_fake_node_state ~i ~live_depth ]); global_chain_table; ctxt_table = - Tezos_crypto.Context_hash.Table.of_seq + Context_hash.Table.of_seq (List.to_seq [ ( rpc_context0.Tezos_protocol_environment.block_header @@ -850,7 +822,7 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir sync_fun = Lwt.return; checkout_fun = (fun hash -> - Tezos_crypto.Context_hash.Table.find state.ctxt_table hash + Context_hash.Table.find state.ctxt_table hash |> Option.map (fun Tezos_protocol_environment.{context; _} -> context) |> Lwt.return); finalize_fun = Lwt.return; @@ -871,8 +843,8 @@ let baker_process ~(delegates : Baking_state.consensus_key list) ~base_dir User_hooks.check_chain_on_success ~chain:state.chain let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) - (predecessor_hash : Tezos_crypto.Block_hash.t) - (block_header : Block_header.shell_header) : Bytes.t = + (predecessor_hash : Block_hash.t) (block_header : Block_header.shell_header) + : Bytes.t = let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -1168,7 +1140,7 @@ let run ?(config = default_config) bakers_spec = | Error () -> failwith "impossible: negative length of the baker spec" | Ok xs -> return xs) >>=? fun broadcast_pipes -> - let global_chain_table = Tezos_crypto.Block_hash.Table.create 10 in + let global_chain_table = Block_hash.Table.create 10 in Tezos_mockup_commands.Mockup_wallet.default_bootstrap_accounts >>=? fun bootstrap_secrets -> let accounts_with_secrets = @@ -1253,15 +1225,13 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) else failwith "unexpected signature for %a; tried with %a@." - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash Tezos_crypto.Signature.Public_key.pp public_key type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t let mempool_count_ops ~mempool ~predicate = List.map_es (fun (op_hash, op) -> predicate op_hash op) mempool @@ -1280,7 +1250,7 @@ let mempool_has_op_ref ~mempool ~predicate ~var = if result then var := true ; return_unit -let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_signed_by ~public_key (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1293,17 +1263,13 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) | _ -> Tezos_crypto.Signature.Generic_operation) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) >>=? fun watermark -> match d.signature with | None -> failwith "did not find a signature for op %a@." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp op_hash | Some signature -> let unsigned_operation_bytes = @@ -1318,7 +1284,7 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) signature unsigned_operation_bytes)) -let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_preendorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1344,13 +1310,9 @@ let op_is_preendorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) -let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) +let op_is_endorsement ?level ?round (op_hash : Operation_hash.t) (op : Alpha_context.packed_operation) = match op.protocol_data with | Operation_data d -> ( @@ -1376,11 +1338,7 @@ let op_is_endorsement ?level ?round (op_hash : Tezos_crypto.Operation_hash.t) in return (right_level && right_round) | _ -> return false) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) let op_is_both f g op_hash op = f op_hash op >>=? fun f_result -> diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli index ef4db4d8b7cb..2fc5f544597a 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli @@ -29,7 +29,7 @@ type block = { protocol_data : Protocol.Alpha_context.Block_header.protocol_data; raw_protocol_data : Bytes.t; operations : Mockup.M.Block_services.operation list list; - resulting_context_hash : Tezos_crypto.Context_hash.t; + resulting_context_hash : Context_hash.t; } (** Chain is a list of blocks. *) @@ -57,25 +57,20 @@ module type Hooks = sig val on_inject_block : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> operations:Operation.t list list -> protocol_data:Alpha_context.Block_header.protocol_data -> - (Tezos_crypto.Block_hash.t - * Block_header.t - * Operation.t list list - * propagation_vector) + (Block_hash.t * Block_header.t * Operation.t list list * propagation_vector) tzresult Lwt.t (** This function is called on injection of an operation. It is similar to [on_inject_block], which see. *) val on_inject_operation : - op_hash:Tezos_crypto.Operation_hash.t -> + op_hash:Operation_hash.t -> op:Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t - * Alpha_context.packed_operation - * propagation_vector) + (Operation_hash.t * Alpha_context.packed_operation * propagation_vector) tzresult Lwt.t @@ -83,23 +78,22 @@ module type Hooks = sig a "monitor heads" RPC call. Returning [None] here terminates the process for the baker. *) val on_new_head : - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> - (Tezos_crypto.Block_hash.t * Block_header.t) option Lwt.t + (Block_hash.t * Block_header.t) option Lwt.t (** This is called when a new operation is going to be sent as the response to a "monitor operations" RPC call. Returning [None] here indicates that the node has advanced to the next level. *) val on_new_operation : - Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation -> - (Tezos_crypto.Operation_hash.t * Alpha_context.packed_operation) option - Lwt.t + Operation_hash.t * Alpha_context.packed_operation -> + (Operation_hash.t * Alpha_context.packed_operation) option Lwt.t (** Check a block before processing it in the mockup. *) val check_block_before_processing : level:int32 -> round:int32 -> - block_hash:Tezos_crypto.Block_hash.t -> + block_hash:Block_hash.t -> block_header:Block_header.t -> protocol_data:Alpha_context.Block_header.protocol_data -> unit tzresult Lwt.t @@ -110,7 +104,7 @@ module type Hooks = sig (** Check operations in the mempool after injecting an operation. *) val check_mempool_after_processing : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> unit tzresult Lwt.t (** This hook is used to decide when the baker is supposed to shut down. @@ -190,35 +184,33 @@ val bootstrap5 : Tezos_crypto.Signature.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_hash:Block_hash.t -> block_header:Block_header.t -> public_key:Tezos_crypto.Signature.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) type op_predicate = - Tezos_crypto.Operation_hash.t -> - Alpha_context.packed_operation -> - bool tzresult Lwt.t + Operation_hash.t -> Alpha_context.packed_operation -> bool tzresult Lwt.t (** Count the number of operations in the mempool that satisfy the given predicate. *) val mempool_count_ops : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> int tzresult Lwt.t (** Check if the mempool has at least one operation that satisfies the given predicate. *) val mempool_has_op : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> bool tzresult Lwt.t (** Similar to [mempool_has_op] but instead of returning a [bool] it sets the given [bool ref]. *) val mempool_has_op_ref : - mempool:(Tezos_crypto.Operation_hash.t * Mockup.M.Protocol.operation) list -> + mempool:(Operation_hash.t * Mockup.M.Protocol.operation) list -> predicate:op_predicate -> var:bool ref -> unit tzresult Lwt.t diff --git a/src/proto_alpha/lib_injector/disk_persistence.ml b/src/proto_alpha/lib_injector/disk_persistence.ml index f8585e929ff4..e31f9ca0b66d 100644 --- a/src/proto_alpha/lib_injector/disk_persistence.ml +++ b/src/proto_alpha/lib_injector/disk_persistence.ml @@ -276,7 +276,7 @@ end module Make_queue (N : sig val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_alpha/lib_injector/disk_persistence.mli b/src/proto_alpha/lib_injector/disk_persistence.mli index 048ec2a1309f..b79cc251fb93 100644 --- a/src/proto_alpha/lib_injector/disk_persistence.mli +++ b/src/proto_alpha/lib_injector/disk_persistence.mli @@ -106,7 +106,7 @@ module Make_queue (N : sig to store the persistent information for this queue. *) val name : string end) -(K : Tezos_crypto.S.HASH) (V : sig +(K : Tezos_crypto.Intfs.HASH) (V : sig type t val encoding : t Data_encoding.t diff --git a/src/proto_alpha/lib_injector/injector_common.ml b/src/proto_alpha/lib_injector/injector_common.ml index e6db79b79345..ad6336e2a24c 100644 --- a/src/proto_alpha/lib_injector/injector_common.ml +++ b/src/proto_alpha/lib_injector/injector_common.ml @@ -75,7 +75,7 @@ let fetch_tezos_shell_header ~find_in_cache (cctxt : #full) hash : i.e. calls {!fetch} for cache misses. *) error_with "Fetching Tezos block %a failed unexpectedly" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash | None, Some errs -> Error errs | Some shell_header, _ -> Ok shell_header @@ -106,7 +106,7 @@ let fetch_tezos_block ~find_in_cache (cctxt : #full) hash : i.e. calls {!fetch} for cache misses. *) error_with "Fetching Tezos block %a failed unexpectedly" - Tezos_crypto.Block_hash.pp + Block_hash.pp hash | None, Some errs -> Error errs | Some block, _ -> Ok block @@ -117,7 +117,7 @@ let tezos_reorg fetch_tezos_block ~old_head_hash ~new_head_hash = let open Alpha_block_services in let open Lwt_result_syntax in let rec loop old_chain new_chain old_head_hash new_head_hash = - if Tezos_crypto.Block_hash.(old_head_hash = new_head_hash) then + if Block_hash.(old_head_hash = new_head_hash) then return {old_chain = List.rev old_chain; new_chain = List.rev new_chain} else let* new_head = fetch_tezos_block new_head_hash in diff --git a/src/proto_alpha/lib_injector/injector_common.mli b/src/proto_alpha/lib_injector/injector_common.mli index 7d4dd86089ee..c5bfb943322f 100644 --- a/src/proto_alpha/lib_injector/injector_common.mli +++ b/src/proto_alpha/lib_injector/injector_common.mli @@ -63,11 +63,11 @@ type shell_header := Block_header.shell_header {!Aches_lwt.Lache.MAP_RESULT}. *) val fetch_tezos_shell_header : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> shell_header option Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> shell_header option Lwt.t) -> shell_header option Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> shell_header tzresult Lwt.t (** [fetch_tezos_block ~find_in_cache cctxt hash] returns [Some block_info] @@ -77,18 +77,18 @@ val fetch_tezos_shell_header : {!Aches_lwt.Lache.MAP_RESULT}. *) val fetch_tezos_block : find_in_cache: - (Tezos_crypto.Block_hash.t -> - (Tezos_crypto.Block_hash.t -> block_info option Lwt.t) -> + (Block_hash.t -> + (Block_hash.t -> block_info option Lwt.t) -> block_info option Lwt.t) -> #full -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> block_info tzresult Lwt.t (** [tezos_reorg fetch ~old_head_hash ~new_head_hash] computes the reorganization of L1 blocks from the chain whose head is [old_head_hash] and the chain whose head [new_head_hash]. *) val tezos_reorg : - (Tezos_crypto.Block_hash.t -> block_info tzresult Lwt.t) -> - old_head_hash:Tezos_crypto.Block_hash.t -> - new_head_hash:Tezos_crypto.Block_hash.t -> + (Block_hash.t -> block_info tzresult Lwt.t) -> + old_head_hash:Block_hash.t -> + new_head_hash:Block_hash.t -> block_info reorg tzresult Lwt.t diff --git a/src/proto_alpha/lib_injector/injector_events.ml b/src/proto_alpha/lib_injector/injector_events.ml index 256903f6a5e9..b1a4cedb3371 100644 --- a/src/proto_alpha/lib_injector/injector_events.ml +++ b/src/proto_alpha/lib_injector/injector_events.ml @@ -113,7 +113,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"new_tezos_head" ~msg:"processing new Tezos head {head}" ~level:Debug - ("head", Tezos_crypto.Block_hash.encoding) + ("head", Block_hash.encoding) let injecting_pending = declare_1 @@ -169,7 +169,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~msg:"Injected {nb} operations in {oph}" ~level:Notice ("nb", Data_encoding.int31) - ("oph", Tezos_crypto.Operation_hash.encoding) + ("oph", Operation_hash.encoding) let add_pending = declare_1 @@ -192,7 +192,7 @@ module Make (Rollup : Injector_sigs.PARAMETERS) = struct ~name:"included" ~msg:"Included operations of {block} at level {level}: {operations}" ~level:Notice - ("block", Tezos_crypto.Block_hash.encoding) + ("block", Block_hash.encoding) ("level", Data_encoding.int32) ("operations", Data_encoding.list L1_operation.Hash.encoding) ~pp3:pp_operations_hash_list diff --git a/src/proto_alpha/lib_injector/injector_functor.ml b/src/proto_alpha/lib_injector/injector_functor.ml index 1af48370900a..898aeb1f96e1 100644 --- a/src/proto_alpha/lib_injector/injector_functor.ml +++ b/src/proto_alpha/lib_injector/injector_functor.ml @@ -84,15 +84,15 @@ module Make (Rollup : PARAMETERS) = struct end) module Injected_ophs = Disk_persistence.Make_table (struct - include Tezos_crypto.Operation_hash.Table + include Operation_hash.Table type value = L1_operation.Hash.t list let name = "injected_ophs" - let string_of_key = Tezos_crypto.Operation_hash.to_b58check + let string_of_key = Operation_hash.to_b58check - let key_of_string = Tezos_crypto.Operation_hash.of_b58check_opt + let key_of_string = Operation_hash.of_b58check_opt let value_encoding = Data_encoding.list L1_operation.Hash.encoding end) @@ -123,15 +123,15 @@ module Make (Rollup : PARAMETERS) = struct end) module Included_in_blocks = Disk_persistence.Make_table (struct - include Tezos_crypto.Block_hash.Table + include Block_hash.Table type value = int32 * L1_operation.Hash.t list let name = "included_in_blocks" - let string_of_key = Tezos_crypto.Block_hash.to_b58check + let string_of_key = Block_hash.to_b58check - let key_of_string = Tezos_crypto.Block_hash.of_b58check_opt + let key_of_string = Block_hash.of_b58check_opt let value_encoding = let open Data_encoding in @@ -635,7 +635,7 @@ module Make (Rollup : PARAMETERS) = struct | Ok packed_contents_list -> packed_contents_list in let signature = Tezos_crypto.Signature.zero in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; diff --git a/src/proto_alpha/lib_injector/injector_sigs.ml b/src/proto_alpha/lib_injector/injector_sigs.ml index 1f19298c3703..3b77944a9825 100644 --- a/src/proto_alpha/lib_injector/injector_sigs.ml +++ b/src/proto_alpha/lib_injector/injector_sigs.ml @@ -68,7 +68,7 @@ type retry_action = node. *) type injected_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) } @@ -77,10 +77,10 @@ type injected_info = { block. *) type included_info = { op : L1_operation.t; (** The L1 manager operation. *) - oph : Tezos_crypto.Operation_hash.t; + oph : Operation_hash.t; (** The hash of the operation which contains [op] (this can be an L1 batch of several manager operations). *) - l1_block : Tezos_crypto.Block_hash.t; + l1_block : Block_hash.t; (** The hash of the L1 block in which the operation was included. *) l1_level : int32; (** The level of [l1_block]. *) } @@ -101,9 +101,7 @@ let injected_info_encoding = @@ merge_objs L1_operation.encoding (obj1 - (req - "layer1" - (obj1 (req "operation_hash" Tezos_crypto.Operation_hash.encoding)))) + (req "layer1" (obj1 (req "operation_hash" Operation_hash.encoding)))) let included_info_encoding = let open Data_encoding in @@ -116,8 +114,8 @@ let included_info_encoding = (req "layer1" (obj3 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) - (req "block_hash" Tezos_crypto.Block_hash.encoding) + (req "operation_hash" Operation_hash.encoding) + (req "block_hash" Block_hash.encoding) (req "level" int32)))) (** Signature for tags used in injector *) diff --git a/src/proto_alpha/lib_injector/injector_worker_types.ml b/src/proto_alpha/lib_injector/injector_worker_types.ml index 7f86e158a775..8ea98a4b4871 100644 --- a/src/proto_alpha/lib_injector/injector_worker_types.ml +++ b/src/proto_alpha/lib_injector/injector_worker_types.ml @@ -84,7 +84,7 @@ module Request = struct Format.fprintf ppf "switching to new Tezos head %a" - Tezos_crypto.Block_hash.pp + Block_hash.pp b.Alpha_block_services.hash ; if r.old_chain <> [] || r.new_chain <> [] then Format.fprintf diff --git a/src/proto_alpha/lib_injector/l1_operation.mli b/src/proto_alpha/lib_injector/l1_operation.mli index 21b13fbf32ff..6dc5bdeb9cd8 100644 --- a/src/proto_alpha/lib_injector/l1_operation.mli +++ b/src/proto_alpha/lib_injector/l1_operation.mli @@ -26,7 +26,7 @@ open Protocol.Alpha_context (** Hash with b58check encoding mop(53), for hashes of L1 manager operations *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for L1 operations hashes *) type hash = Hash.t diff --git a/src/proto_alpha/lib_layer2_utils/layer1_services.ml b/src/proto_alpha/lib_layer2_utils/layer1_services.ml index 7f8742082e1c..64f23841d330 100644 --- a/src/proto_alpha/lib_layer2_utils/layer1_services.ml +++ b/src/proto_alpha/lib_layer2_utils/layer1_services.ml @@ -29,7 +29,7 @@ open Apply_results open Protocol_client_context open Alpha_block_services -type error += Cannot_read_block_metadata of Tezos_crypto.Block_hash.t +type error += Cannot_read_block_metadata of Block_hash.t let () = register_error_kind @@ -40,10 +40,10 @@ let () = Format.fprintf ppf "Could not read block receipt for block with hash %a." - Tezos_crypto.Block_hash.pp + Block_hash.pp hash) `Temporary - Data_encoding.(obj1 (req "hash" Tezos_crypto.Block_hash.encoding)) + Data_encoding.(obj1 (req "hash" Block_hash.encoding)) (function Cannot_read_block_metadata hash -> Some hash | _ -> None) (fun hash -> Cannot_read_block_metadata hash) diff --git a/src/proto_alpha/lib_layer2_utils/layer1_services.mli b/src/proto_alpha/lib_layer2_utils/layer1_services.mli index 1255d70b764e..4cb30e48b0a5 100644 --- a/src/proto_alpha/lib_layer2_utils/layer1_services.mli +++ b/src/proto_alpha/lib_layer2_utils/layer1_services.mli @@ -27,7 +27,7 @@ open Protocol open Alpha_context open Protocol_client_context.Alpha_block_services -type error += Cannot_read_block_metadata of Tezos_crypto.Block_hash.t +type error += Cannot_read_block_metadata of Block_hash.t type 'accu successful_operation_processor = { apply : diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 9c45e8d33cff..7b24e94e442f 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -949,7 +949,7 @@ module Scripts = struct let register () = let originate_dummy_contract ctxt script balance = - let ctxt = Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero in + let ctxt = Origination_nonce.init ctxt Operation_hash.zero in Contract.fresh_contract_from_current_nonce ctxt >>?= fun (ctxt, dummy_contract_hash) -> let dummy_contract = Contract.Originated dummy_contract_hash in diff --git a/src/proto_alpha/lib_plugin/mempool.ml b/src/proto_alpha/lib_plugin/mempool.ml index c4131028861d..bdec72bfb938 100644 --- a/src/proto_alpha/lib_plugin/mempool.ml +++ b/src/proto_alpha/lib_plugin/mempool.ml @@ -187,10 +187,7 @@ type manager_op_info = { in [state] when appropriate. *) } -type manager_op_weight = { - operation_hash : Tezos_crypto.Operation_hash.t; - weight : Q.t; -} +type manager_op_weight = {operation_hash : Operation_hash.t; weight : Q.t} (** Build a {!manager_op_weight} from operation hash and {!manager_op_info}. *) let mk_op_weight oph (info : manager_op_info) = @@ -199,7 +196,7 @@ let mk_op_weight oph (info : manager_op_info) = let compare_manager_op_weight op1 op2 = let c = Q.compare op1.weight op2.weight in if c <> 0 then c - else Tezos_crypto.Operation_hash.compare op1.operation_hash op2.operation_hash + else Operation_hash.compare op1.operation_hash op2.operation_hash module ManagerOpWeightSet = Set.Make (struct type t = manager_op_weight @@ -224,10 +221,10 @@ type ops_state = { (** Number of prechecked manager operations. Invariants: - [prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal prechecked_manager_ops + = Operation_hash.Map.cardinal prechecked_manager_ops = ManagerOpWeightSet.cardinal prechecked_op_weights] - [prechecked_manager_op_count <= max_prechecked_manager_operations] *) - prechecked_manager_ops : manager_op_info Tezos_crypto.Operation_hash.Map.t; + prechecked_manager_ops : manager_op_info Operation_hash.Map.t; (** All prechecked manager operations. See {!manager_op_info}. *) prechecked_op_weights : ManagerOpWeightSet.t; (** The {!manager_op_weight} of all prechecked manager operations. *) @@ -243,7 +240,7 @@ type state = {state_info : state_info; ops_state : ops_state} let empty_ops_state = { prechecked_manager_op_count = 0; - prechecked_manager_ops = Tezos_crypto.Operation_hash.Map.empty; + prechecked_manager_ops = Operation_hash.Map.empty; prechecked_op_weights = ManagerOpWeightSet.empty; min_prechecked_op_weight = None; } @@ -352,7 +349,7 @@ let () = (fun () -> Fees_too_low) type Environment.Error_monad.error += - | Manager_restriction of {oph : Tezos_crypto.Operation_hash.t; fee : Tez.t} + | Manager_restriction of {oph : Operation_hash.t; fee : Tez.t} let () = Environment.Error_monad.register_error_kind @@ -366,21 +363,21 @@ let () = "Only one manager operation per manager per block allowed (found %a \ with %atez fee. You may want to use --replace to provide adequate fee \ and replace it)." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Tez.pp fee) Data_encoding.( obj2 - (req "operation_hash" Tezos_crypto.Operation_hash.encoding) + (req "operation_hash" Operation_hash.encoding) (req "operation_fee" Tez.encoding)) (function Manager_restriction {oph; fee} -> Some (oph, fee) | _ -> None) (fun (oph, fee) -> Manager_restriction {oph; fee}) type Environment.Error_monad.error += | Manager_operation_replaced of { - old_hash : Tezos_crypto.Operation_hash.t; - new_hash : Tezos_crypto.Operation_hash.t; + old_hash : Operation_hash.t; + new_hash : Operation_hash.t; } let () = @@ -393,13 +390,13 @@ let () = Format.fprintf ppf "The manager operation %a has been replaced with %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp old_hash - Tezos_crypto.Operation_hash.pp + Operation_hash.pp new_hash) (Data_encoding.obj2 - (Data_encoding.req "old_hash" Tezos_crypto.Operation_hash.encoding) - (Data_encoding.req "new_hash" Tezos_crypto.Operation_hash.encoding)) + (Data_encoding.req "old_hash" Operation_hash.encoding) + (Data_encoding.req "new_hash" Operation_hash.encoding)) (function | Manager_operation_replaced {old_hash; new_hash} -> Some (old_hash, new_hash) @@ -827,17 +824,13 @@ let pre_filter config ~filter_state (** Remove a manager operation hash from the ops_state. Do nothing if the operation was not in the state. *) let remove_operation ops_state oph = - match - Tezos_crypto.Operation_hash.Map.find oph ops_state.prechecked_manager_ops - with + match Operation_hash.Map.find oph ops_state.prechecked_manager_ops with | None -> (* Not present in the ops_state: nothing to do. *) ops_state | Some info -> let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.remove - oph - ops_state.prechecked_manager_ops + Operation_hash.Map.remove oph ops_state.prechecked_manager_ops in let prechecked_manager_op_count = ops_state.prechecked_manager_op_count - 1 @@ -851,9 +844,8 @@ let remove_operation ops_state oph = match ops_state.min_prechecked_op_weight with | None -> None | Some min_op_weight -> - if - Tezos_crypto.Operation_hash.equal min_op_weight.operation_hash oph - then ManagerOpWeightSet.min_elt prechecked_op_weights + if Operation_hash.equal min_op_weight.operation_hash oph then + ManagerOpWeightSet.min_elt prechecked_op_weights else Some min_op_weight in { @@ -876,18 +868,15 @@ let add_manager_op ops_state oph info replacement = | `No_replace -> ops_state | `Replace (oph, _classification) -> remove_operation ops_state oph in - if Tezos_crypto.Operation_hash.Map.mem oph ops_state.prechecked_manager_ops - then (* Already present in the ops_state: nothing to do. *) + if Operation_hash.Map.mem oph ops_state.prechecked_manager_ops then + (* Already present in the ops_state: nothing to do. *) ops_state else let prechecked_manager_op_count = ops_state.prechecked_manager_op_count + 1 in let prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - ops_state.prechecked_manager_ops + Operation_hash.Map.add oph info ops_state.prechecked_manager_ops in let op_weight = mk_op_weight oph info in let prechecked_op_weights = @@ -1011,8 +1000,8 @@ let is_manager_operation op = of the call to {!Operation.compare}). *) let conflict_handler config : Mempool.conflict_handler = fun ~existing_operation ~new_operation -> - let (_ : Tezos_crypto.Operation_hash.t), old_op = existing_operation in - let (_ : Tezos_crypto.Operation_hash.t), new_op = new_operation in + let (_ : Operation_hash.t), old_op = existing_operation in + let (_ : Operation_hash.t), new_op = new_operation in if is_manager_operation old_op && is_manager_operation new_op then let new_op_is_better = let open Result_syntax in diff --git a/src/proto_alpha/lib_plugin/test/generators.ml b/src/proto_alpha/lib_plugin/test/generators.ml index 426dadd70939..affc95dd5a77 100644 --- a/src/proto_alpha/lib_plugin/test/generators.ml +++ b/src/proto_alpha/lib_plugin/test/generators.ml @@ -39,10 +39,10 @@ let public_key_hash_gen : (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) -let operation_hash_gen : Tezos_crypto.Operation_hash.t QCheck2.Gen.t = +let operation_hash_gen : Operation_hash.t QCheck2.Gen.t = let open QCheck2.Gen in let+ s = QCheck2.Gen.string_size (return 32) in - Tezos_crypto.Operation_hash.of_string_exn s + Operation_hash.of_string_exn s let dummy_manager_op_info = let fee = Alpha_context.Tez.zero in @@ -61,7 +61,7 @@ let dummy_manager_op_info = let protocol_data = {contents; signature = Some Tezos_crypto.Signature.zero} in - let branch = Tezos_crypto.Block_hash.zero in + let branch = Block_hash.zero in Mempool.Manager_op {shell = {branch}; protocol_data} in Mempool.{manager_op; fee; gas_limit; weight = Q.zero} @@ -77,8 +77,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = let+ ops = small_list oph_and_info_gen in List.fold_left (fun state (oph, info) -> - if Tezos_crypto.Operation_hash.Map.mem oph state.prechecked_manager_ops - then state + if Operation_hash.Map.mem oph state.prechecked_manager_ops then state else let prechecked_manager_op_count = state.prechecked_manager_op_count + 1 @@ -94,10 +93,7 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = { prechecked_manager_op_count; prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.add - oph - info - state.prechecked_manager_ops; + Operation_hash.Map.add oph info state.prechecked_manager_ops; prechecked_op_weights = ManagerOpWeightSet.add op_weight state.prechecked_op_weights; min_prechecked_op_weight; @@ -109,25 +105,20 @@ let filter_state_gen : Plugin.Mempool.ops_state QCheck2.Gen.t = even odds of belonging to the given filter_state or being fresh. *) let with_filter_state_operation_gen : Plugin.Mempool.ops_state -> - (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - QCheck2.Gen.t = + (Operation_hash.t * Plugin.Mempool.manager_op_info) QCheck2.Gen.t = fun state -> let open QCheck2.Gen in let* use_fresh = bool in - if - use_fresh - || Tezos_crypto.Operation_hash.Map.is_empty state.prechecked_manager_ops - then oph_and_info_gen - else - oneofl - (Tezos_crypto.Operation_hash.Map.bindings state.prechecked_manager_ops) + if use_fresh || Operation_hash.Map.is_empty state.prechecked_manager_ops then + oph_and_info_gen + else oneofl (Operation_hash.Map.bindings state.prechecked_manager_ops) (** Generate both a filter_state, and a pair of operation hash and manager_op_info. The pair has even odds of belonging to the filter_state or being fresh. *) let filter_state_with_operation_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in filter_state_gen >>= fun state -> @@ -138,8 +129,8 @@ let filter_state_with_operation_gen : to the filter_state or being fresh. *) let filter_state_with_two_operations_gen : (Plugin.Mempool.ops_state - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info) - * (Tezos_crypto.Operation_hash.t * Plugin.Mempool.manager_op_info)) + * (Operation_hash.t * Plugin.Mempool.manager_op_info) + * (Operation_hash.t * Plugin.Mempool.manager_op_info)) QCheck2.Gen.t = let open QCheck2.Gen in let* filter_state = filter_state_gen in diff --git a/src/proto_alpha/lib_plugin/test/test_conflict_handler.ml b/src/proto_alpha/lib_plugin/test/test_conflict_handler.ml index d84714a3b984..1b5d344cd38b 100644 --- a/src/proto_alpha/lib_plugin/test/test_conflict_handler.ml +++ b/src/proto_alpha/lib_plugin/test/test_conflict_handler.ml @@ -38,7 +38,7 @@ let check_answer ?__LOC__ expected actual = assert (Qcheck2_helpers.qcheck_eq ~pp:pp_answer ?__LOC__ expected actual : bool) -let is_manager_op ((_ : Tezos_crypto.Operation_hash.t), op) = +let is_manager_op ((_ : Operation_hash.t), op) = (* This is implemented differently from [Plugin.Mempool.is_manager_operation] (which relies on [Alpha_context.Operation.acceptable_pass]), used in diff --git a/src/proto_alpha/lib_plugin/test/test_filter_state.ml b/src/proto_alpha/lib_plugin/test/test_filter_state.ml index 82868acd43f2..bb48f3b41809 100644 --- a/src/proto_alpha/lib_plugin/test/test_filter_state.ml +++ b/src/proto_alpha/lib_plugin/test/test_filter_state.ml @@ -46,14 +46,13 @@ let check_filter_state_invariants filter_state = filter_state) ~cond:(fun filter_state -> filter_state.prechecked_manager_op_count - = Tezos_crypto.Operation_hash.Map.cardinal - filter_state.prechecked_manager_ops + = Operation_hash.Map.cardinal filter_state.prechecked_manager_ops && filter_state.prechecked_manager_op_count = ManagerOpWeightSet.cardinal filter_state.prechecked_op_weights && ManagerOpWeightSet.for_all (fun {operation_hash; weight} -> match - Tezos_crypto.Operation_hash.Map.find + Operation_hash.Map.find operation_hash filter_state.prechecked_manager_ops with @@ -80,7 +79,7 @@ let test_add_manager_op = already present in [filter_state] or fresh. *) let replacement = if should_replace then ( - assume (not (Tezos_crypto.Operation_hash.equal oph_to_replace oph)) ; + assume (not (Operation_hash.equal oph_to_replace oph)) ; `Replace (oph_to_replace, ())) else `No_replace in @@ -91,11 +90,11 @@ let test_add_manager_op = Format.fprintf fmt "%a was not found in prechecked_manager_ops: %a" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph pp_prechecked_manager_ops set) - ~cond:(Tezos_crypto.Operation_hash.Map.mem oph) + ~cond:(Operation_hash.Map.mem oph) filter_state.prechecked_manager_ops () && @@ -105,11 +104,11 @@ let test_add_manager_op = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph_to_replace) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph_to_replace filter_state.prechecked_manager_ops)) () @@ -132,10 +131,7 @@ let test_remove_present = -> (* Add a fresh operation [oph] to the state. *) assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let replacement = if should_replace then `Replace (oph_to_replace, ()) else `No_replace in @@ -151,11 +147,11 @@ let test_remove_present = Format.fprintf fmt "%a should have been removed from prechecked_manager_ops." - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph) ~cond:(fun () -> not - (Tezos_crypto.Operation_hash.Map.mem + (Operation_hash.Map.mem oph filter_state.prechecked_manager_ops)) () @@ -183,10 +179,7 @@ let test_remove_unknown = (Gen.pair Generators.filter_state_gen Generators.operation_hash_gen) (fun (initial_state, oph) -> assume - (not - (Tezos_crypto.Operation_hash.Map.mem - oph - initial_state.prechecked_manager_ops)) ; + (not (Operation_hash.Map.mem oph initial_state.prechecked_manager_ops)) ; let filter_state = remove_operation initial_state oph in qcheck_eq ~pp:pp_state ~eq:eq_state initial_state filter_state) diff --git a/src/proto_alpha/lib_plugin/test/test_utils.ml b/src/proto_alpha/lib_plugin/test/test_utils.ml index 0b92f1f4ca4c..57402233a49e 100644 --- a/src/proto_alpha/lib_plugin/test/test_utils.ml +++ b/src/proto_alpha/lib_plugin/test/test_utils.ml @@ -44,7 +44,7 @@ let pp_prechecked_manager_ops fmt set = Format.fprintf ppf "(%a -> {fee: %a; gas: %a; weight: %a})" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp oph Alpha_context.Tez.pp op_info.fee @@ -52,13 +52,13 @@ let pp_prechecked_manager_ops fmt set = op_info.gas_limit Q.pp_print op_info.weight)) - (Tezos_crypto.Operation_hash.Map.bindings set) + (Operation_hash.Map.bindings set) let pp_manager_op_weight fmt weight = Format.fprintf fmt "{oph: %a; weight: %a}" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp weight.operation_hash Q.pp_print weight.weight @@ -95,7 +95,7 @@ let pp_state fmt state = state.min_prechecked_op_weight let eq_prechecked_manager_ops = - Tezos_crypto.Operation_hash.Map.equal + Operation_hash.Map.equal (fun {manager_op = _; fee = fee1; gas_limit = gas1; weight = w1} {manager_op = _; fee = fee2; gas_limit = gas2; weight = w2} @@ -103,9 +103,7 @@ let eq_prechecked_manager_ops = let eq_op_weight_opt = Option.equal (fun op_weight1 op_weight2 -> - Tezos_crypto.Operation_hash.equal - op_weight1.operation_hash - op_weight2.operation_hash + Operation_hash.equal op_weight1.operation_hash op_weight2.operation_hash && Q.equal op_weight1.weight op_weight2.weight) (* This function needs to be updated if the filter state is extended *) diff --git a/src/proto_alpha/lib_protocol/dune b/src/proto_alpha/lib_protocol/dune index 3bb05e69e6d1..e157f146f8b5 100644 --- a/src/proto_alpha/lib_protocol/dune +++ b/src/proto_alpha/lib_protocol/dune @@ -301,7 +301,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK\"\nlet name = Tezos_protocol_environment_alpha.Name.name\ninclude Tezos_raw_protocol_alpha\ninclude Tezos_raw_protocol_alpha.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK\"\nlet name = Tezos_protocol_environment_alpha.Name.name\ninclude Tezos_raw_protocol_alpha\ninclude Tezos_raw_protocol_alpha.Main\n"))) (rule (targets tezos_protocol_alpha.ml) diff --git a/src/proto_alpha/lib_protocol/test/helpers/assert.ml b/src/proto_alpha/lib_protocol/test/helpers/assert.ml index 24d1953a35e3..983cc13fc8e9 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/assert.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/assert.ml @@ -174,23 +174,21 @@ let not_equal_pkh ~loc (a : Tezos_crypto.Signature.Public_key_hash.t) not_equal ~loc PKH.equal "Public key hashes are equal" PKH.pp a b (* protocol hash *) -let equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes aren't equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b -let not_equal_protocol_hash ~loc (a : Tezos_crypto.Protocol_hash.t) - (b : Tezos_crypto.Protocol_hash.t) = +let not_equal_protocol_hash ~loc (a : Protocol_hash.t) (b : Protocol_hash.t) = not_equal ~loc - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Protocol hashes are equal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp a b diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 446ccb5cd0eb..e88f7ad7e438 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -31,7 +31,7 @@ open Alpha_context (* This type collects a block and the context that results from its application *) type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; @@ -185,7 +185,7 @@ module Forge = struct (* We don't care of the following values, only the shell validates them. *) proto_level = 0; validation_passes = 0; - context = Tezos_crypto.Context_hash.zero; + context = Context_hash.zero; } let set_seed_nonce_hash seed_nonce_hash @@ -247,8 +247,7 @@ module Forge = struct >|=? fun seed_nonce_hash -> let hashes = List.map Operation.hash_packed operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [Tezos_crypto.Operation_list_hash.compute hashes] + Operation_list_list_hash.compute [Operation_list_hash.compute hashes] in let shell = make_shell @@ -405,7 +404,7 @@ let initial_alpha_context ?(commitments = []) constants let genesis_with_parameters parameters = let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let fitness = @@ -421,7 +420,7 @@ let genesis_with_parameters parameters = ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in let contents = Forge.make_contents @@ -571,7 +570,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum in check_constants_consistency constants >>=? fun () -> let hash = - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" in let level = Option.value ~default:0l level in @@ -588,7 +587,7 @@ let prepare_initial_context_params ?consensus_threshold ?min_proposal_quorum ~predecessor:hash ~timestamp:Time.Protocol.epoch ~fitness - ~operations_hash:Tezos_crypto.Operation_list_list_hash.zero + ~operations_hash:Operation_list_list_hash.zero in return (constants, shell, hash) diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.mli b/src/proto_alpha/lib_protocol/test/helpers/block.mli index 4c23ea45be94..77498b11df15 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/block.mli @@ -29,7 +29,7 @@ open Protocol open Alpha_context type t = { - hash : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; header : Block_header.t; operations : Operation.packed list; context : Tezos_protocol_environment.Context.t; (** Resulting context *) @@ -298,9 +298,7 @@ val prepare_initial_context_params : ?hard_gas_limit_per_block:Gas.Arith.integral -> ?nonce_revelation_threshold:int32 -> unit -> - ( Constants.Parametric.t - * Block_header.shell_header - * Tezos_crypto.Block_hash.t, + ( Constants.Parametric.t * Block_header.shell_header * Block_hash.t, tztrace ) result Lwt.t diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 1e0b1e4ee30d..5aa436ff163b 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -276,7 +276,7 @@ module Vote = struct type delegate_info = Alpha_context.Vote.delegate_info = { voting_power : Int64.t option; current_ballot : Alpha_context.Vote.ballot option; - current_proposals : Tezos_crypto.Protocol_hash.t list; + current_proposals : Protocol_hash.t list; remaining_proposals : int; } @@ -589,6 +589,6 @@ let default_raw_context () = context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero ~typecheck >>= fun e -> Lwt.return @@ Environment.wrap_tzresult e diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 8681d9c66e4c..639c6a1297d7 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -30,9 +30,9 @@ open Environment type t = B of Block.t | I of Incremental.t -val branch : t -> Tezos_crypto.Block_hash.t +val branch : t -> Block_hash.t -val pred_branch : t -> Tezos_crypto.Block_hash.t +val pred_branch : t -> Block_hash.t val get_level : t -> Raw_level.t tzresult @@ -130,17 +130,16 @@ module Vote : sig val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t - val get_current_proposal : - t -> Tezos_crypto.Protocol_hash.t option tzresult Lwt.t + val get_current_proposal : t -> Protocol_hash.t option tzresult Lwt.t - val get_protocol : Block.t -> Tezos_crypto.Protocol_hash.t Lwt.t + val get_protocol : Block.t -> Protocol_hash.t Lwt.t val set_participation_ema : Block.t -> int32 -> Block.t Lwt.t type delegate_info = Alpha_context.Vote.delegate_info = { voting_power : Int64.t option; current_ballot : Alpha_context.Vote.ballot option; - current_proposals : Tezos_crypto.Protocol_hash.t list; + current_proposals : Protocol_hash.t list; remaining_proposals : int; } diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index 1cf523719e41..c1c382ffbe86 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -54,7 +54,7 @@ let rpc_context st = let fitness = (header st).shell.fitness in let result = Alpha_context.finalize (alpha_ctxt st) fitness in { - Environment.Updater.block_hash = Tezos_crypto.Block_hash.zero; + Environment.Updater.block_hash = Block_hash.zero; block_header = {st.header.shell with fitness = result.fitness}; context = result.context; } @@ -115,8 +115,8 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) fitness = predecessor.header.shell.fitness; timestamp; level = predecessor.header.shell.level; - context = Tezos_crypto.Context_hash.zero; - operations_hash = Tezos_crypto.Operation_list_list_hash.zero; + context = Context_hash.zero; + operations_hash = Operation_list_list_hash.zero; }; protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; } @@ -244,11 +244,8 @@ let finalize_block st = let open Lwt_result_syntax in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let shell_header = { @@ -263,11 +260,8 @@ let finalize_block st = let*? validation_result, _ = Environment.wrap_tzresult res in let operations = List.rev st.rev_operations in let operations_hash = - Tezos_crypto.Operation_list_list_hash.compute - [ - Tezos_crypto.Operation_list_hash.compute - (List.map Operation.hash_packed operations); - ] + Operation_list_list_hash.compute + [Operation_list_hash.compute (List.map Operation.hash_packed operations)] in let header = { diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index be7100071831..6fc57ee26f8d 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -241,7 +241,7 @@ let combine_operations ?public_key ?counter ?spurious_operation ~source ctxt assert ( List.for_all (fun {shell = {Tezos_base.Operation.branch = b; _}; _} -> - Tezos_crypto.Block_hash.(branch = b)) + Block_hash.(branch = b)) packed_operations) ; (* TODO? : check signatures consistency *) let unpacked_operations = diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.mli b/src/proto_alpha/lib_protocol/test/helpers/op.mli index 10581d765da3..c6cc27152b8d 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/op.mli @@ -47,7 +47,7 @@ val pack_operation : val sign : ?watermark:Tezos_crypto.Signature.watermark -> Tezos_crypto.Signature.secret_key -> - Tezos_crypto.Block_hash.t -> + Block_hash.t -> packed_contents_list -> packed_operation @@ -66,7 +66,7 @@ val raw_endorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Kind.endorsement Operation.t tzresult Lwt.t @@ -80,7 +80,7 @@ val raw_preendorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Kind.preendorsement Operation.t tzresult Lwt.t @@ -92,7 +92,7 @@ val endorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Operation.packed tzresult Lwt.t @@ -104,7 +104,7 @@ val preendorsement : ?level:Raw_level.t -> ?round:Round.t -> ?block_payload_hash:Block_payload_hash.t -> - ?pred_branch:Tezos_crypto.Block_hash.t -> + ?pred_branch:Block_hash.t -> Block.t -> Operation.packed tzresult Lwt.t @@ -343,7 +343,7 @@ val proposals_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Kind.proposals contents_list tzresult Lwt.t (** Craft a Proposals operation. @@ -356,7 +356,7 @@ val proposals : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t list -> + Protocol_hash.t list -> Operation.packed tzresult Lwt.t (** Craft the [contents_list] for a Ballot operation. @@ -369,7 +369,7 @@ val ballot_contents : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Kind.ballot contents_list tzresult Lwt.t @@ -383,7 +383,7 @@ val ballot : Context.t -> Contract.t -> ?period:int32 -> - Tezos_crypto.Protocol_hash.t -> + Protocol_hash.t -> Vote.ballot -> Operation.packed tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml index 16e6222c5332..60f21f28d291 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -126,7 +126,7 @@ end (** {3 Selection in hashes list} *) let gen_block_hash = - let module G = Gen_hash (Tezos_crypto.Block_hash) in + let module G = Gen_hash (Block_hash) in G.gen let random_payload_hash = @@ -248,7 +248,7 @@ let random_sc_rollup = G.gen let random_proto = - let module G = Gen_hash (Tezos_crypto.Protocol_hash) in + let module G = Gen_hash (Protocol_hash) in G.gen let random_code = diff --git a/src/proto_alpha/lib_protocol/test/helpers/sc_rollup_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/sc_rollup_helpers.ml index eadb4e700224..9831d1fafba0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/sc_rollup_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/sc_rollup_helpers.ml @@ -39,8 +39,8 @@ module Make_in_memory_context (Context : sig Tezos_context_sigs.Context.TEZOS_CONTEXT with type memory_context_tree := tree and type tree := tree - and type value_key = Tezos_crypto.Context_hash.t - and type node_key = Tezos_crypto.Context_hash.t + and type value_key = Context_hash.t + and type node_key = Context_hash.t end) = struct module Tree = struct @@ -280,7 +280,7 @@ type message = { input : Sc_rollup.input; message : [ `SOL - | `Info_per_level of Timestamp.t * Tezos_crypto.Block_hash.t + | `Info_per_level of Timestamp.t * Block_hash.t | `Message of string | `EOL ]; } @@ -299,8 +299,7 @@ type payloads_per_level = { (** List of external serialized messages. *) predecessor_timestamp : Time.Protocol.t; (** predecessor timestamp of the [Info_per_level]. *) - predecessor : Tezos_crypto.Block_hash.t; - (** Predecessor of the [Info_per_level]. *) + predecessor : Block_hash.t; (** Predecessor of the [Info_per_level]. *) level : Raw_level.t; inputs : Sc_rollup.input list; (** List of all inputs for the level, to be read by a PVM. *) @@ -329,7 +328,7 @@ let pp_message fmt {input; message} = Format.asprintf "Info_per_level (%s, %a)" (Timestamp.to_notation predecessor_timestamp) - Tezos_crypto.Block_hash.pp + Block_hash.pp block_hash | `Message msg -> msg | `EOL -> "EOL") @@ -372,8 +371,7 @@ let make_inputs predecessor_timestamp predecessor messages inbox_level = (** Wrap messages, predecessor_timestamp and predecessor of a level into a [payloads_per_level] .*) let wrap_messages ?(predecessor_timestamp = Timestamp.of_seconds 0L) - ?(predecessor = Tezos_crypto.Block_hash.zero) level messages : - payloads_per_level = + ?(predecessor = Block_hash.zero) level messages : payloads_per_level = let payloads = List.map make_external_inbox_message messages in let inputs = make_inputs predecessor_timestamp predecessor messages level in {payloads; predecessor_timestamp; predecessor; messages; level; inputs} @@ -596,7 +594,7 @@ let fill_inbox ~inbox history payloads_histories payloads_per_levels = let construct_inbox ?(inbox_creation_level = Raw_level.(root)) ?(with_histories = true) ?(predecessor_timestamp = Time.Protocol.epoch) - ?(predecessor = Tezos_crypto.Block_hash.zero) payloads_per_levels = + ?(predecessor = Block_hash.zero) payloads_per_levels = let inbox = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Environment.wrap_tzresult @@ -653,12 +651,12 @@ let dumb_init level = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Sc_rollup.Inbox.genesis ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero level let dumb_init_repr level = WithExceptions.Result.get_ok ~loc:__LOC__ @@ Sc_rollup_inbox_repr.genesis ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero level diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml index 5b5ce979ae4d..cd7b92e17e21 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -52,7 +52,7 @@ let block_fork ?policy (contract_a, contract_b) b = let order_block_hashes ~correct_order bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if correct_order then if c < 0 then (bh1, bh2) else (bh2, bh1) else if c < 0 then (bh2, bh1) else (bh1, bh2) @@ -95,7 +95,7 @@ let test_valid_double_baking_evidence () = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml index 38d190702a43..8417f6911f0f 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -52,7 +52,7 @@ let block_fork b = let order_endorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index 199f1d679b5a..81dbcd956388 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml @@ -177,7 +177,7 @@ end = struct let order_preendorsements ~correct_order op1 op2 = let oph1 = Operation.hash op1 in let oph2 = Operation.hash op2 in - let c = Tezos_crypto.Operation_hash.compare oph1 oph2 in + let c = Operation_hash.compare oph1 oph2 in if correct_order then if c < 0 then (op1, op2) else (op2, op1) else if c < 0 then (op2, op1) else (op1, op2) diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml index 832eabdeacb2..0182455432a8 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -310,7 +310,7 @@ let publish_op_and_dummy_commitment ~src ?compressed_state ?predecessor rollup Option.map (fun s -> Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string [s])) + (Context_hash.hash_string [s])) compressed_state in let* commitment = @@ -1989,7 +1989,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]); + (Context_hash.hash_string ["first"]); } in let commitment2 = @@ -1998,7 +1998,7 @@ let test_timeout () = number_of_ticks = number_of_ticks_exn 4L; compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]); + (Context_hash.hash_string ["second"]); } in @@ -2105,14 +2105,14 @@ let init_with_conflict () = let* block, rollup = sc_originate block account1 "unit" in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["first"]) + (Context_hash.hash_string ["first"]) in let* commitment1 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup in let compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["second"]) + (Context_hash.hash_string ["second"]) in let* commitment2 = dummy_commitment ~compressed_state ~number_of_ticks:1L (B block) rollup @@ -2607,7 +2607,7 @@ let test_automatically_added_internal_messages () = let level_zero_info = ( Time.Protocol.epoch, - Tezos_crypto.Block_hash.of_b58check_exn + Block_hash.of_b58check_exn "BLockGenesisGenesisGenesisGenesisGenesisCCCCCeZiLHU" ) in @@ -2870,7 +2870,7 @@ let test_offline_staker_does_not_prevent_cementation () = let init_with_4_conflicts () = let dumb_compressed_state s = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string [s]) + (Context_hash.hash_string [s]) in let* block, players = context_init (Context.TList 4) in let pA, pB, pC, pD = @@ -3106,7 +3106,7 @@ let test_conflict_point_on_a_branch () = commitment with compressed_state = Sc_rollup.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["foo"]); + (Context_hash.hash_string ["foo"]); } ) in let* block = publish_commitments block pB rollup [pB_commitment] in diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml index 951fa00e12d7..83a5ce913c84 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml @@ -74,10 +74,10 @@ let expected_qr_num participation_ema = *. (of_int qr_max_num -. of_int qr_min_num) /. of_int den) -(* Tezos_crypto.Protocol_hash.zero is "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i" *) +(* Protocol_hash.zero is "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i" *) let protos = Array.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [| "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; @@ -230,9 +230,9 @@ let equal_delegate_info a b = Option.equal Int64.equal a.Vote.voting_power b.Vote.voting_power && Option.equal Vote.equal_ballot a.current_ballot b.current_ballot && List.equal - Tezos_crypto.Protocol_hash.equal - (List.sort Tezos_crypto.Protocol_hash.compare a.current_proposals) - (List.sort Tezos_crypto.Protocol_hash.compare b.current_proposals) + Protocol_hash.equal + (List.sort Protocol_hash.compare a.current_proposals) + (List.sort Protocol_hash.compare b.current_proposals) && Int.equal a.remaining_proposals b.remaining_proposals let assert_equal_info ~loc a b = @@ -470,9 +470,8 @@ let test_successful_vote num_delegates () = let props = List.map (fun i -> protos.(i)) (2 -- Constants.max_proposals_per_delegate) in - Op.proposals (B b) del1 (Tezos_crypto.Protocol_hash.zero :: props) - >>=? fun ops1 -> - Op.proposals (B b) del2 [Tezos_crypto.Protocol_hash.zero] >>=? fun ops2 -> + Op.proposals (B b) del1 (Protocol_hash.zero :: props) >>=? fun ops1 -> + Op.proposals (B b) del2 [Protocol_hash.zero] >>=? fun ops2 -> Block.bake ~operations:[ops1; ops2] b >>=? fun b -> Context.Delegate.voting_info (B b) pkh1 >>=? fun info1 -> Context.Delegate.voting_info (B b) pkh2 >>=? fun info2 -> @@ -482,7 +481,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow1; current_ballot = None; - current_proposals = Tezos_crypto.Protocol_hash.zero :: props; + current_proposals = Protocol_hash.zero :: props; remaining_proposals = 0; } >>=? fun () -> @@ -492,7 +491,7 @@ let test_successful_vote num_delegates () = { voting_power = Some pow2; current_ballot = None; - current_proposals = [Tezos_crypto.Protocol_hash.zero]; + current_proposals = [Protocol_hash.zero]; remaining_proposals = Constants.max_proposals_per_delegate - 1; } >>=? fun () -> @@ -514,7 +513,7 @@ let test_successful_vote num_delegates () = assert_validate_proposals_fails ~expected_error:too_many_proposals ~proposer:del1 - ~proposals:(Tezos_crypto.Protocol_hash.zero :: props) + ~proposals:(Protocol_hash.zero :: props) b __LOC__ >>=? fun () -> @@ -545,13 +544,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during exploration period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p2 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p2 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -572,7 +571,7 @@ let test_successful_vote num_delegates () = assert_validate_ballot_fails ~expected_error:already_submitted_a_ballot ~voter:del1 - ~proposal:Tezos_crypto.Protocol_hash.zero + ~proposal:Protocol_hash.zero ~ballot:Vote.Nay b __LOC__ @@ -623,13 +622,13 @@ let test_successful_vote num_delegates () = (* current proposal must be set during promotion period *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal zero v) then return_unit + if Protocol_hash.(equal zero v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> (* unanimous vote: all delegates --active when p4 started-- vote *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) delegates_p4 >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -664,11 +663,11 @@ let test_successful_vote num_delegates () = Context.Vote.get_protocol b >>= fun p -> Assert.equal ~loc:__LOC__ - Tezos_crypto.Protocol_hash.equal + Protocol_hash.equal "Unexpected proposal" - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp p - Tezos_crypto.Protocol_hash.zero + Protocol_hash.zero >>=? fun () -> return_unit (* given a list of active delegates, @@ -720,8 +719,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -743,7 +741,7 @@ let test_not_enough_quorum_in_exploration num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -775,8 +773,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in - Op.proposals (B b) proposer [Tezos_crypto.Protocol_hash.zero] - >>=? fun operation -> + Op.proposals (B b) proposer [Protocol_hash.zero] >>=? fun operation -> Block.bake ~operation b >>=? fun b -> (* skip to exploration period *) bake_until_first_block_of_next_period b >>=? fun b -> @@ -792,7 +789,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -823,7 +820,7 @@ let test_not_enough_quorum_in_promotion num_delegates () = (* all voters_without_quorum vote, for yays; no nays, so supermajority is satisfied *) List.map_es - (fun del -> Op.ballot (B b) del Tezos_crypto.Protocol_hash.zero Vote.Yay) + (fun del -> Op.ballot (B b) del Protocol_hash.zero Vote.Yay) voters_without_quorum >>=? fun operations -> Block.bake ~operations b >>=? fun b -> @@ -947,7 +944,7 @@ let test_supermajority_in_exploration supermajority () = (* assert our proposal won *) (Context.Vote.get_current_proposal (B b) >>=? function | Some v -> - if Tezos_crypto.Protocol_hash.(equal proposal v) then return_unit + if Protocol_hash.(equal proposal v) then return_unit else failwith "%s - Wrong proposal" __LOC__ | None -> failwith "%s - Missing proposal" __LOC__) >>=? fun () -> @@ -1010,7 +1007,7 @@ let test_quorum_capped_maximum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1050,7 +1047,7 @@ let test_quorum_capped_minimum num_delegates () = let open Alpha_context in assert_period ~expected_kind:Proposal b __LOC__ >>=? fun () -> (* propose a new protocol *) - let protocol = Tezos_crypto.Protocol_hash.zero in + let protocol = Protocol_hash.zero in let proposer = WithExceptions.Option.get ~loc:__LOC__ @@ List.nth delegates 0 in @@ -1281,7 +1278,7 @@ let test_proposals_wrong_voting_period_index () = assert_validate_proposals_fails ~expected_error:(wrong_voting_period_index ~current_index ~op_index) ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] ~period:op_index block __LOC__ @@ -1341,14 +1338,14 @@ let test_proposals_source_not_in_vote_listings () = assert_validate_proposals_fails ~expected_error:proposals_from_unregistered_delegate ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in let assert_fails_with_source_not_in_vote_listings block = assert_validate_proposals_fails ~expected_error:source_not_in_vote_listings ~proposer - ~proposals:[Tezos_crypto.Protocol_hash.zero] + ~proposals:[Protocol_hash.zero] block in (* Fail when the source has no contract in the storage. *) @@ -1919,7 +1916,7 @@ let observe_ballot pre_state post_state op caller_loc = let* current_proposal = Assert.get_some ~loc:(make_loc __LOC__) current_proposal in - assert (Tezos_crypto.Protocol_hash.equal proposal current_proposal) ; + assert (Protocol_hash.equal proposal current_proposal) ; (* Observations *) let* post_voting_infos = Context.Delegate.voting_info (B post_state) source in let* recorded_ballot = diff --git a/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml b/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml index b808cdf3a3cc..74590d73cea9 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml @@ -54,7 +54,7 @@ let very_small_random_amount () = | Some x -> x let nonce_zero = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero + Origination_nonce.Internal_for_tests.initial Operation_hash.zero let mk_sc_rollup ?(nonce = nonce_zero) () = ( Sc_rollup.Internal_for_tests.originated_sc_rollup nonce, diff --git a/src/proto_alpha/lib_protocol/test/integration/test_sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/test/integration/test_sc_rollup_wasm.ml index b971b3a70cd9..320df83e7801 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_sc_rollup_wasm.ml @@ -85,7 +85,7 @@ module WASM_P : let produce_proof context tree step = let open Lwt_syntax in let* context = Context_binary.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context_binary.commit ~time:Time.Protocol.epoch context in let index = Context_binary.index context in diff --git a/src/proto_alpha/lib_protocol/test/integration/test_token.ml b/src/proto_alpha/lib_protocol/test/integration/test_token.ml index f8650e2e9d1c..69eea30ce50c 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_token.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_token.ml @@ -48,8 +48,7 @@ let random_amount () = | None -> assert false | Some x -> x -let nonce = - Origination_nonce.Internal_for_tests.initial Tezos_crypto.Operation_hash.zero +let nonce = Origination_nonce.Internal_for_tests.initial Operation_hash.zero let sc_rollup () = Sc_rollup.Internal_for_tests.originated_sc_rollup nonce diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml index 9dd33155cee4..a57507ee8c97 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml @@ -42,7 +42,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; @@ -128,10 +128,7 @@ let ballot_exploration_prelude state = let* props = List.map_es (fun voter -> - Op.proposals - (B state.block) - voter - [Tezos_crypto.Protocol_hash.zero]) + Op.proposals (B state.block) voter [Protocol_hash.zero]) voters in return (prop :: props, state) @@ -182,11 +179,7 @@ let ballot_exploration_descriptor = in assert (voting_period_info.voting_period.kind = Exploration) ; let ballot = pick_one ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -207,10 +200,7 @@ let proposal_descriptor = Context.Vote.get_current_period (B state.block) in assert (voting_period_info.voting_period.kind = Proposal) ; - Op.proposals - (B state.block) - contract - [Tezos_crypto.Protocol_hash.zero] + Op.proposals (B state.block) contract [Protocol_hash.zero] in List.map_es gen state.voters); } @@ -255,11 +245,7 @@ let ballot_promotion_descriptor = let* ops = List.map_es (fun voter -> - Op.ballot - (B state.block) - voter - Tezos_crypto.Protocol_hash.zero - Vote.Yay) + Op.ballot (B state.block) voter Protocol_hash.zero Vote.Yay) state.voters in return (ops, state) @@ -273,11 +259,7 @@ let ballot_promotion_descriptor = in assert (voting_period_info.voting_period.kind = Promotion) ; let ballot = Stdlib.List.hd ballots in - Op.ballot - (B state.block) - contract - Tezos_crypto.Protocol_hash.zero - ballot + Op.ballot (B state.block) contract Protocol_hash.zero ballot in List.map_es gen state.voters); } @@ -365,9 +347,7 @@ let dbl_endorsement_prelude state = let* op2 = Op.raw_preendorsement ~delegate:delegate1 b2 in let op1, op2 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op1) - (Operation.hash op2) + Operation_hash.compare (Operation.hash op1) (Operation.hash op2) in assert (comp <> 0) ; if comp < 0 then (op1, op2) else (op2, op1) @@ -379,9 +359,7 @@ let dbl_endorsement_prelude state = let* op4 = Op.raw_endorsement ~delegate:delegate2 b2 in let op3, op4 = let comp = - Tezos_crypto.Operation_hash.compare - (Operation.hash op3) - (Operation.hash op4) + Operation_hash.compare (Operation.hash op3) (Operation.hash op4) in assert (comp <> 0) ; if comp < 0 then (op3, op4) else (op4, op3) @@ -429,7 +407,7 @@ let double_baking_descriptor = let order_block_header bh1 bh2 = let hash1 = Block_header.hash bh1 in let hash2 = Block_header.hash bh2 in - let c = Tezos_crypto.Block_hash.compare hash1 hash2 in + let c = Block_hash.compare hash1 hash2 in if c < 0 then (bh1, bh2) else (bh2, bh1) in let* ctxt = Context.to_alpha_ctxt (B state.block) in diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli index b0870b34a5be..515df860cfa4 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli +++ b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.mli @@ -57,7 +57,7 @@ type state = { voters : Contract.t list; seed_nonce_to_reveal : (Raw_level.t * Nonce_hash.t) list; commitments : secret_account list; - protocol_hashes : Tezos_crypto.Protocol_hash.t list; + protocol_hashes : Protocol_hash.t list; slashable_bakes : (block_header * block_header) list; vdf : bool; dbl_endorsement : dbl_endorsement_state; diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml index 4547bed9fa28..7a6ce4bc8b21 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml @@ -84,16 +84,14 @@ let assert_operation_present_in_mempool ~__LOC__ mempool ophl = let resulting_mempool_operations = Environment.Operation_hash.Map.bindings operations |> List.map fst - |> List.sort Tezos_crypto.Operation_hash.compare - in - let expected_operations = - List.sort Tezos_crypto.Operation_hash.compare ophl + |> List.sort Operation_hash.compare in + let expected_operations = List.sort Operation_hash.compare ophl in Assert.assert_equal_list ~loc:__LOC__ - Tezos_crypto.Operation_hash.equal + Operation_hash.equal "operations present in mempool" - Tezos_crypto.Operation_hash.pp + Operation_hash.pp resulting_mempool_operations expected_operations diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml index ebf3c18cdd72..2ab9c5d5a866 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml @@ -61,7 +61,7 @@ let ballots = Vote.[Yay; Nay; Pass] let protos = List.map - (fun s -> Tezos_crypto.Protocol_hash.of_b58check_exn s) + (fun s -> Protocol_hash.of_b58check_exn s) [ "ProtoALphaALphaALphaALphaALphaALphaALpha61322gcLUGH"; "ProtoALphaALphaALphaALphaALphaALphaALphabc2a7ebx6WB"; diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml index 2033061546f6..f537dd58abd8 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml @@ -1194,7 +1194,7 @@ module Player_client = struct | Info_hater -> let* corrupt_at_l = 0 -- List.length payloads_per_levels in let dumb_timestamp = Timestamp.of_seconds 42L in - let dumb_predecessor = Tezos_crypto.Block_hash.zero in + let dumb_predecessor = Block_hash.zero in let new_payloads_per_levels = List.mapi diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml index 53afa3890ec3..bb742d2cc88e 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml @@ -98,7 +98,7 @@ let gen_inbox level = let* witness = Sc_rollup_inbox_repr.add_info_per_level_no_history ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero witness in let* input_messages = diff --git a/src/proto_alpha/lib_protocol/test/regression/test_logging.ml b/src/proto_alpha/lib_protocol/test/regression/test_logging.ml index 5fb8465c249c..a123f6d311ba 100644 --- a/src/proto_alpha/lib_protocol/test/regression/test_logging.ml +++ b/src/proto_alpha/lib_protocol/test/regression/test_logging.ml @@ -225,9 +225,7 @@ let run_script transaction () = let* inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in let ctxt = - Alpha_context.Origination_nonce.init - ctxt - Tezos_crypto.Operation_hash.zero + Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in return (parameter, ctxt) in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml index 9a758c030b67..a372d293904e 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml @@ -47,7 +47,7 @@ module Test_contract_repr = struct open Contract_repr let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash diff --git a/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml index 1fafdba8ce99..f4cb1a04fcf6 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml @@ -36,7 +36,7 @@ open Protocol open Tztest let dummy_operation_hash = - Tezos_crypto.Operation_hash.of_bytes_exn + Operation_hash.of_bytes_exn (Bytes.of_string "test-operation-hash-of-length-32") let dummy_origination_nonce = Origination_nonce.initial dummy_operation_hash diff --git a/src/proto_alpha/lib_protocol/test/unit/test_local_contexts.ml b/src/proto_alpha/lib_protocol/test/unit/test_local_contexts.ml index 40eabf7d344b..d620a1618398 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_local_contexts.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_local_contexts.ml @@ -96,9 +96,9 @@ let eq_context ctxt1 ctxt2 = hash ctxt2 >>=? fun y -> Assert.equal ~loc:__LOC__ - Tezos_crypto.Context_hash.equal + Context_hash.equal "check context" - Tezos_crypto.Context_hash.pp + Context_hash.pp x y diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index b4b99941bd2e..85ad7450d318 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -81,7 +81,7 @@ module Arith_Context = struct (* FIXME: With on-disk context, we cannot commit the empty context. Is it also true in our case? *) let* context = Context_binary.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context_binary.commit ~time:Time.Protocol.epoch context in let index = Context_binary.index context in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml index c2894eabaacc..621dd364b6a5 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml @@ -53,7 +53,7 @@ let assert_fails_with_f ~__LOC__ k f = let tick_of_int_exn n = match Tick.of_int n with None -> assert false | Some t -> t -let context_hash_of_string s = Tezos_crypto.Context_hash.hash_string [s] +let context_hash_of_string s = Context_hash.hash_string [s] let hash_string s = Sc_rollup_repr.State_hash.context_hash_to_state_hash diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox.ml index aabb38b8495c..a50278fb92c8 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox.ml @@ -131,7 +131,7 @@ let gen_payloads_for_level ?(inbox_creation_level = 0) () = let+ seconds = 0 -- 1_000_000 in Time.Protocol.of_seconds (Int64.of_int seconds) in - let predecessor = Tezos_crypto.Block_hash.zero in + let predecessor = Block_hash.zero in Sc_rollup_helpers.wrap_messages ~predecessor_timestamp ~predecessor diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml index ee352577340b..1ecd4abbbd42 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_inbox_legacy.ml @@ -79,7 +79,7 @@ let populate_inboxes level history inbox inboxes list_of_messages = Environment.wrap_tzresult @@ add_all_messages ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero history inbox messages @@ -150,7 +150,7 @@ let setup_node_inbox_with_messages list_of_messages f = Environment.wrap_tzresult @@ add_all_messages ~predecessor_timestamp:Time.Protocol.epoch - ~predecessor:Tezos_crypto.Block_hash.zero + ~predecessor:Block_hash.zero history inbox messages diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_storage.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_storage.ml index 2ca875b7103f..1cc17e39b053 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_storage.ml @@ -42,9 +42,7 @@ let new_context_n nb_stakers = let+ inc = Incremental.begin_construction b in let ctxt = Incremental.alpha_ctxt inc in (* Necessary to originate rollups. *) - let ctxt = - Alpha_context.Origination_nonce.init ctxt Tezos_crypto.Operation_hash.zero - in + let ctxt = Alpha_context.Origination_nonce.init ctxt Operation_hash.zero in let ctxt = Alpha_context.Internal_for_tests.to_raw ctxt in let accounts = List.map @@ -776,7 +774,7 @@ module Stake_storage_tests = struct commitment with compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]); + (Context_hash.hash_string ["honest"]); } in let* () = @@ -1158,7 +1156,7 @@ module Stake_storage_tests = struct let honest_commitment, honest_commitment_hash = let compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]) + (Context_hash.hash_string ["honest"]) in commitment ~predecessor:genesis_hash @@ -1173,7 +1171,7 @@ module Stake_storage_tests = struct let dishonest_commitment, dishonest_commitment_hash = let compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["dishonest"]) + (Context_hash.hash_string ["dishonest"]) in commitment ~predecessor:genesis_hash @@ -1346,7 +1344,7 @@ module Stake_storage_tests = struct commitment with compressed_state = Sc_rollup_repr.State_hash.context_hash_to_state_hash - (Tezos_crypto.Context_hash.hash_string ["honest"]); + (Context_hash.hash_string ["honest"]); } in let* ctxt = wrap @@ publish_commitment ctxt rollup staker new_commitment in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_wasm.ml index 06a74827a158..544e03dd212c 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_wasm.ml @@ -66,7 +66,7 @@ module Wasm_context = struct let produce_proof context tree step = let open Lwt_syntax in let* context = Context.add_tree context [] tree in - let* (_hash : Tezos_crypto.Context_hash.t) = + let* (_hash : Context_hash.t) = Context.commit ~time:Time.Protocol.epoch context in let index = Context.index context in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml b/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml index 894f361439b0..cd548d976991 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml @@ -103,7 +103,7 @@ module Raw_context_tests = struct ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp in - let nonce = Tezos_crypto.Operation_hash.hash_string ["nonce_hash"] in + let nonce = Operation_hash.hash_string ["nonce_hash"] in return (Raw_context.init_origination_nonce ctx nonce, contract) (* Context with an originated ZKRU *) diff --git a/src/proto_alpha/lib_sc_rollup/l2_message.mli b/src/proto_alpha/lib_sc_rollup/l2_message.mli index 456950222651..5f8f8ee52a90 100644 --- a/src/proto_alpha/lib_sc_rollup/l2_message.mli +++ b/src/proto_alpha/lib_sc_rollup/l2_message.mli @@ -34,7 +34,7 @@ val make : string -> t val content : t -> string (** Hash with b58check encoding scmsg(55), for hashes of L2 messages. *) -module Hash : Tezos_crypto.S.HASH +module Hash : Tezos_crypto.Intfs.HASH (** Alias for message hash *) type hash = Hash.t diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_block.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_block.ml index 4715b8408387..4f832b00e6fb 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_block.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_block.ml @@ -27,9 +27,9 @@ open Protocol open Alpha_context type header = { - block_hash : Tezos_crypto.Block_hash.t; + block_hash : Block_hash.t; level : Raw_level.t; - predecessor : Tezos_crypto.Block_hash.t; + predecessor : Block_hash.t; commitment_hash : Sc_rollup.Commitment.Hash.t option; previous_commitment_hash : Sc_rollup.Commitment.Hash.t; context : Sc_rollup_context_hash.t; @@ -105,10 +105,7 @@ let header_encoding = inbox_hash; }) @@ obj8 - (req - "block_hash" - Tezos_crypto.Block_hash.encoding - ~description:"Tezos block hash.") + (req "block_hash" Block_hash.encoding ~description:"Tezos block hash.") (req "level" Raw_level.encoding @@ -116,7 +113,7 @@ let header_encoding = "Level of the block, corresponds to the level of the tezos block.") (req "predecessor" - Tezos_crypto.Block_hash.encoding + Block_hash.encoding ~description:"Predecessor hash of the Tezos block.") (req "commitment_hash" diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_block.mli b/src/proto_alpha/lib_sc_rollup/sc_rollup_block.mli index 7d79a246d3e6..1f0f8c7b4bbd 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_block.mli +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_block.mli @@ -32,11 +32,10 @@ open Alpha_context with respect to a layer 1 block, but without the inbox content of messages. *) type header = { - block_hash : Tezos_crypto.Block_hash.t; (** Tezos block hash. *) + block_hash : Block_hash.t; (** Tezos block hash. *) level : Raw_level.t; (** Level of the block, corresponds to the level of the tezos block. *) - predecessor : Tezos_crypto.Block_hash.t; - (** Predecessor hash of the Tezos block. *) + predecessor : Block_hash.t; (** Predecessor hash of the Tezos block. *) commitment_hash : Sc_rollup.Commitment.Hash.t option; (** Hash of this block's commitment if any was computed for it. *) previous_commitment_hash : Sc_rollup.Commitment.Hash.t; diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_context_hash.mli b/src/proto_alpha/lib_sc_rollup/sc_rollup_context_hash.mli index b8abde35922a..d7acec7ff0ea 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_context_hash.mli +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_context_hash.mli @@ -23,4 +23,4 @@ (* *) (*****************************************************************************) -include Tezos_crypto.S.HASH +include Tezos_crypto.Intfs.HASH diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml index e9d32952a1d5..fccaf23df7c6 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml @@ -223,15 +223,11 @@ end module Arg = struct type block_id = - [ `Head - | `Hash of Tezos_crypto.Block_hash.t - | `Level of Int32.t - | `Finalized - | `Cemented ] + [`Head | `Hash of Block_hash.t | `Level of Int32.t | `Finalized | `Cemented] let construct_block_id = function | `Head -> "head" - | `Hash h -> Tezos_crypto.Block_hash.to_b58check h + | `Hash h -> Block_hash.to_b58check h | `Level l -> Int32.to_string l | `Finalized -> "finalized" | `Cemented -> "cemented" @@ -245,7 +241,7 @@ module Arg = struct match Int32.of_string_opt h with | Some l -> Ok (`Level l) | None -> ( - match Tezos_crypto.Block_hash.of_b58check_opt h with + match Block_hash.of_b58check_opt h with | Some b -> Ok (`Hash b) | None -> Error "Cannot parse block id")) @@ -317,7 +313,7 @@ module Global = struct Tezos_rpc.Service.get_service ~description:"Tezos head known to the smart rollup node" ~query:Tezos_rpc.Query.empty - ~output:(Data_encoding.option Tezos_crypto.Block_hash.encoding) + ~output:(Data_encoding.option Block_hash.encoding) (path / "tezos_head") let current_tezos_level = @@ -415,7 +411,7 @@ module Global = struct Tezos_rpc.Service.get_service ~description:"Tezos block hash of block known to the smart rollup node" ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Block_hash.encoding + ~output:Block_hash.encoding (path / "hash") let level = diff --git a/src/proto_demo_counter/lib_client/client_proto_commands.ml b/src/proto_demo_counter/lib_client/client_proto_commands.ml index 162b65edaa13..1ddfebc381ab 100644 --- a/src/proto_demo_counter/lib_client/client_proto_commands.ml +++ b/src/proto_demo_counter/lib_client/client_proto_commands.ml @@ -51,8 +51,8 @@ let bake (cctxt : Protocol_client_context.full) message : unit tzresult Lwt.t = let operations = [List.map snd preapply_result.applied] in Shell_services.Injection.block cctxt header_encoded operations >>=? fun block_hash -> - cctxt#message "Injected block %a" Tezos_crypto.Block_hash.pp_short block_hash - >>= fun () -> return_unit + cctxt#message "Injected block %a" Block_hash.pp_short block_hash >>= fun () -> + return_unit let operation_encoding = let open Data_encoding in @@ -63,8 +63,7 @@ let operation_encoding = let forge_op = Data_encoding.Binary.to_bytes_exn operation_encoding let inject_op (cctxt : Protocol_client_context.full) (pop : Proto_operation.t) = - Demo_block_services.hash cctxt () - >>=? fun (block_hash : Tezos_crypto.Block_hash.t) -> + Demo_block_services.hash cctxt () >>=? fun (block_hash : Block_hash.t) -> let shell_header : Operation.shell_header = Operation.{branch = block_hash} in let op : operation = {shell = shell_header; protocol_data = pop} in Demo_block_services.Helpers.Preapply.operations cctxt [op] >>=? function @@ -73,7 +72,7 @@ let inject_op (cctxt : Protocol_client_context.full) (pop : Proto_operation.t) = cctxt#message "Operation receipt: %s" receipt_str >>= fun () -> let mbytes = forge_op (shell_header, pop) in Shell_services.Injection.operation cctxt mbytes >>=? fun op_hash -> - let injected = Tezos_crypto.Operation_hash.to_short_b58check op_hash in + let injected = Operation_hash.to_short_b58check op_hash in cctxt#message "Injected: %s" injected >>= fun () -> return_unit | _ -> assert false diff --git a/src/proto_demo_counter/lib_protocol/dune b/src/proto_demo_counter/lib_protocol/dune index 932fb2491968..669686885a3c 100644 --- a/src/proto_demo_counter/lib_protocol/dune +++ b/src/proto_demo_counter/lib_protocol/dune @@ -65,7 +65,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"ProtoDemoCounterDemoCounterDemoCounterDemoCou4LSpdT\"\nlet name = Tezos_protocol_environment_demo_counter.Name.name\ninclude Tezos_raw_protocol_demo_counter\ninclude Tezos_raw_protocol_demo_counter.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"ProtoDemoCounterDemoCounterDemoCounterDemoCou4LSpdT\"\nlet name = Tezos_protocol_environment_demo_counter.Name.name\ninclude Tezos_raw_protocol_demo_counter\ninclude Tezos_raw_protocol_demo_counter.Main\n"))) (rule (targets tezos_protocol_demo_counter.ml) diff --git a/src/proto_demo_noops/lib_protocol/dune b/src/proto_demo_noops/lib_protocol/dune index 2aae2dcdf794..d3469e983b58 100644 --- a/src/proto_demo_noops/lib_protocol/dune +++ b/src/proto_demo_noops/lib_protocol/dune @@ -56,7 +56,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp\"\nlet name = Tezos_protocol_environment_demo_noops.Name.name\ninclude Tezos_raw_protocol_demo_noops\ninclude Tezos_raw_protocol_demo_noops.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp\"\nlet name = Tezos_protocol_environment_demo_noops.Name.name\ninclude Tezos_raw_protocol_demo_noops\ninclude Tezos_raw_protocol_demo_noops.Main\n"))) (rule (targets tezos_protocol_demo_noops.ml) diff --git a/src/proto_genesis/lib_client/client_proto_main.ml b/src/proto_genesis/lib_client/client_proto_main.ml index ac9a4a21d33f..3468ec081822 100644 --- a/src/proto_genesis/lib_client/client_proto_main.ml +++ b/src/proto_genesis/lib_client/client_proto_main.ml @@ -119,7 +119,7 @@ let proto_param ~name ~desc t = ~name ~desc (Tezos_clic.parameter (fun _ str -> - Lwt.return (Tezos_crypto.Protocol_hash.of_b58check str))) + Lwt.return (Protocol_hash.of_b58check str))) t let commands () = @@ -176,8 +176,8 @@ let commands () = (Activate {protocol = hash; fitness; protocol_parameters}) sk >>=? fun hash -> - cctxt#answer "Injected %a" Tezos_crypto.Block_hash.pp_short hash - >>= fun () -> return_unit); + cctxt#answer "Injected %a" Block_hash.pp_short hash >>= fun () -> + return_unit); command ~desc:"Fork a test protocol" (args2 timestamp_arg test_delay_arg) @@ -215,8 +215,8 @@ let commands () = {protocol = hash; fitness; protocol_parameters; delay}) sk >>=? fun hash -> - cctxt#answer "Injected %a" Tezos_crypto.Block_hash.pp_short hash - >>= fun () -> return_unit); + cctxt#answer "Injected %a" Block_hash.pp_short hash >>= fun () -> + return_unit); ] let () = Client_commands.register Protocol.hash @@ fun _network -> commands () diff --git a/src/proto_genesis/lib_client/client_proto_main.mli b/src/proto_genesis/lib_client/client_proto_main.mli index d2a08cabec07..21b0b3ce6a67 100644 --- a/src/proto_genesis/lib_client/client_proto_main.mli +++ b/src/proto_genesis/lib_client/client_proto_main.mli @@ -31,4 +31,4 @@ val bake : Shell_services.block -> Data.Command.t -> Client_keys_v0.sk_uri -> - Tezos_crypto.Block_hash.t tzresult Lwt.t + Block_hash.t tzresult Lwt.t diff --git a/src/proto_genesis/lib_client/proxy.ml b/src/proto_genesis/lib_client/proxy.ml index 1a7f6779feed..2649b7df9593 100644 --- a/src/proto_genesis/lib_client/proxy.ml +++ b/src/proto_genesis/lib_client/proxy.ml @@ -65,7 +65,7 @@ let () = let directory = Tezos_rpc.Directory.empty let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) - (hash : Tezos_crypto.Context_hash.t) = + (hash : Context_hash.t) = let open Lwt_result_syntax in let p_rpc = (module ProtoRpc : Tezos_proxy.Proxy_proto.PROTO_RPC) in let* (module ProxyDelegation) = diff --git a/src/proto_genesis/lib_protocol/dune b/src/proto_genesis/lib_protocol/dune index fb4e27fa1f83..7c79a4039fd2 100644 --- a/src/proto_genesis/lib_protocol/dune +++ b/src/proto_genesis/lib_protocol/dune @@ -56,7 +56,7 @@ (action (write-file %{targets} - "\nlet hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im\"\nlet name = Tezos_protocol_environment_genesis.Name.name\ninclude Tezos_raw_protocol_genesis\ninclude Tezos_raw_protocol_genesis.Main\n"))) + "\nlet hash = Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn \"ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im\"\nlet name = Tezos_protocol_environment_genesis.Name.name\ninclude Tezos_raw_protocol_genesis\ninclude Tezos_raw_protocol_genesis.Main\n"))) (rule (targets tezos_protocol_genesis.ml) diff --git a/tezt/lib_tezos/operation_core.ml b/tezt/lib_tezos/operation_core.ml index 4530b8e583ec..1266d352b88a 100644 --- a/tezt/lib_tezos/operation_core.ml +++ b/tezt/lib_tezos/operation_core.ml @@ -99,14 +99,14 @@ module Tezos_operation = Tezos_base.TzPervasives.Operation let to_raw_operation t client : Tezos_operation.t Lwt.t = let open Tezos_base.TzPervasives in - let branch = Tezos_crypto.Block_hash.of_b58check_exn t.branch in + let branch = Block_hash.of_b58check_exn t.branch in let* raw = hex t client in return Tezos_operation.{shell = {branch}; proto = Hex.to_bytes_exn raw} let hash t client : [`OpHash of string] Lwt.t = let* op = to_raw_operation t client in let hash = Tezos_operation.hash op in - return (`OpHash (Tezos_crypto.Operation_hash.to_string hash)) + return (`OpHash (Tezos_crypto.Hashed.Operation_hash.to_string hash)) let inject ?(request = `Inject) ?(force = false) ?protocol ?signature ?error t client : [`OpHash of string] Lwt.t = diff --git a/tezt/long_tests/qcheck_rpc.ml b/tezt/long_tests/qcheck_rpc.ml index 6f47742127e7..742c076d7b33 100644 --- a/tezt/long_tests/qcheck_rpc.ml +++ b/tezt/long_tests/qcheck_rpc.ml @@ -314,7 +314,7 @@ module Gen = struct let block_hash_gen : string t = let open QCheck2.Gen in - let open Tezos_crypto in + let open Tezos_crypto.Hashed in let non_alias = list string >|= Block_hash.hash_string >|= Block_hash.to_string in @@ -322,7 +322,7 @@ module Gen = struct let protocol_hash_gen : string t = let open QCheck2.Gen in - let open Tezos_crypto in + let open Tezos_crypto.Hashed in list string >|= Protocol_hash.hash_string >|= Protocol_hash.to_string let path_int_gen : string t = QCheck2.Gen.(map Int.to_string small_nat) diff --git a/tezt/tests/baking.ml b/tezt/tests/baking.ml index ac5cc2d0df38..7d099b7af055 100644 --- a/tezt/tests/baking.ml +++ b/tezt/tests/baking.ml @@ -34,6 +34,7 @@ (* Typedefs *) open Tezos_crypto +open Tezos_crypto.Hashed type operation = {shell_header : branch; protocol_data : protocol_data} @@ -57,12 +58,12 @@ and operation_content = { type mempool_operation = | Mempool_operation of { - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; shell_header : branch; protocol_data : protocol_data; } -type mempool = (Tezos_crypto.Operation_hash.t * mempool_operation) list +type mempool = (Operation_hash.t * mempool_operation) list (* ------------------------------------------------------------------------- *) (* Operation-related encodings *) @@ -161,7 +162,7 @@ let unsigned_operation_to_json op = (* ------------------------------------------------------------------------- *) type state = { - protocol : Tezos_crypto.Protocol_hash.t; + protocol : Protocol_hash.t; sandbox_client : Tezt_tezos.Client.t; sandbox_node : Tezt_tezos.Node.t; counters : (Account.key, int) Hashtbl.t; @@ -216,7 +217,7 @@ let mempool_operation_from_op client protocol signer op : (mempool_operation * bytes) Lwt.t = let* bin = encode_unsigned_operation_to_binary client op in let signature = Operation.sign_manager_op_bytes ~signer bin in - let signature = Tezos_crypto.Signature.to_b58check signature in + let signature = Signature.to_b58check signature in return ( Mempool_operation { diff --git a/tezt/tests/tenderbake.ml b/tezt/tests/tenderbake.ml index 3e7d0eeb2da0..bce5f67abe9f 100644 --- a/tezt/tests/tenderbake.ml +++ b/tezt/tests/tenderbake.ml @@ -55,7 +55,7 @@ let init ?(overrides = default_overrides) protocol = in Log.info "Activated protocol." ; return - @@ ( Tezos_crypto.Protocol_hash.of_b58check_exn (Protocol.hash protocol), + @@ ( Tezos_crypto.Hashed.Protocol_hash.of_b58check_exn (Protocol.hash protocol), sandbox_endpoint, sandbox_client, sandbox_node ) -- GitLab From 8a3ccd35668feb12fe97367000b1075e650a0c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= <code@bnwr.net> Date: Tue, 22 Nov 2022 14:20:14 +0100 Subject: [PATCH 4/6] Crypto: group signature scheme modules under a module --- src/bin_dal_node/main_dal.ml | 4 +- .../client_keys_commands.ml | 4 +- .../test/test_deterministic_nonce.ml | 6 +-- src/lib_crypto/test/test_prop_signature.ml | 2 +- src/lib_crypto/test/test_signature.ml | 7 +-- .../test/test_signature_encodings.ml | 8 +-- src/lib_crypto/tezos_crypto.ml | 13 +++-- .../environment_V0.ml | 21 ++++---- .../environment_V0.mli | 21 ++++---- .../environment_V1.ml | 21 ++++---- .../environment_V1.mli | 21 ++++---- .../environment_V2.ml | 21 ++++---- .../environment_V2.mli | 21 ++++---- .../environment_V3.ml | 27 +++++----- .../environment_V3.mli | 21 ++++---- .../environment_V4.ml | 27 +++++----- .../environment_V4.mli | 21 ++++---- .../environment_V5.ml | 27 +++++----- .../environment_V5.mli | 21 ++++---- .../environment_V6.ml | 27 +++++----- .../environment_V6.mli | 21 ++++---- .../environment_V7.ml | 36 +++++++------ .../environment_V7.mli | 28 +++++----- .../environment_V8.ml | 36 +++++++------ .../environment_V8.mli | 28 +++++----- .../environment_V9.ml | 36 +++++++------ .../environment_V9.mli | 28 +++++----- .../structs/v0_ed25519.ml | 23 +++++--- .../structs/v0_p256.ml | 23 +++++--- .../structs/v0_secp256k1.ml | 21 +++++--- src/lib_signer_backends/encrypted.ml | 16 +++--- .../unix/ledger.available.ml | 8 +-- .../lib_client/operation_result.ml | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../bin_tx_rollup_client/commands.ml | 25 +++++---- .../lib_benchmark/michelson_samplers.ml | 2 +- .../lib_benchmark/michelson_samplers_base.ml | 6 +-- .../interpreter_workload.ml | 6 +-- .../tx_rollup_benchmarks.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 2 +- .../test/helpers/tx_rollup_l2_helpers.ml | 8 +-- .../integration/operations/test_activation.ml | 2 +- .../integration/operations/test_tx_rollup.ml | 7 ++- .../integration/validate/validate_helpers.ml | 8 +-- .../test/pbt/test_tx_rollup_l2_encoding.ml | 2 +- .../test/unit/test_tx_rollup_l2_apply.ml | 8 +-- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml | 7 +-- .../lib_tx_rollup/batcher.ml | 2 +- .../lib_tx_rollup/fancy_l2block.ml | 6 +-- .../lib_tx_rollup/l2_transaction.ml | 4 +- .../lib_benchmark/michelson_samplers_base.ml | 10 ++-- .../interpreter_workload.ml | 24 ++++++--- .../tx_rollup_benchmarks.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/injection.ml | 8 +-- .../lib_client/operation_result.ml | 2 +- .../test/helpers/operation_generator.ml | 54 ++++++++++++------- .../test/helpers/tx_rollup_l2_helpers.ml | 8 +-- .../consensus/test_consensus_key.ml | 2 +- .../integration/consensus/test_delegation.ml | 2 +- .../integration/operations/test_activation.ml | 2 +- .../integration/operations/test_tx_rollup.ml | 7 ++- .../integration/validate/validate_helpers.ml | 8 +-- .../test/pbt/test_tx_rollup_l2_encoding.ml | 2 +- .../test/unit/test_operation_repr.ml | 3 +- .../test/unit/test_tx_rollup_l2_apply.ml | 8 +-- .../lib_benchmark/michelson_samplers_base.ml | 10 ++-- .../interpreter_workload.ml | 24 ++++++--- .../tx_rollup_benchmarks.ml | 2 +- .../lib_client/client_proto_context.ml | 14 ++--- .../lib_client/client_proto_context.mli | 2 +- src/proto_alpha/lib_client/injection.ml | 8 +-- .../lib_client/operation_result.ml | 2 +- .../test/helpers/operation_generator.ml | 54 ++++++++++++------- .../consensus/test_consensus_key.ml | 2 +- .../integration/consensus/test_delegation.ml | 2 +- .../integration/operations/test_activation.ml | 2 +- .../integration/validate/validate_helpers.ml | 8 +-- .../test/unit/test_operation_repr.ml | 3 +- 110 files changed, 695 insertions(+), 510 deletions(-) diff --git a/src/bin_dal_node/main_dal.ml b/src/bin_dal_node/main_dal.ml index 243984d32469..76128dd4471e 100644 --- a/src/bin_dal_node/main_dal.ml +++ b/src/bin_dal_node/main_dal.ml @@ -128,7 +128,9 @@ module Dac_client = struct let tz4_address_parameter () = Tezos_clic.parameter (fun _cctxt s -> let open Lwt_result_syntax in - let*? bls_pkh = Tezos_crypto.Bls.Public_key_hash.of_b58check s in + let*? bls_pkh = + Tezos_crypto.Signature.Bls.Public_key_hash.of_b58check s + in let pkh : Tezos_crypto.Aggregate_signature.public_key_hash = Tezos_crypto.Aggregate_signature.Bls12_381 bls_pkh in diff --git a/src/lib_client_commands/client_keys_commands.ml b/src/lib_client_commands/client_keys_commands.ml index 653d7ebcc2b8..12e171b03629 100644 --- a/src/lib_client_commands/client_keys_commands.ml +++ b/src/lib_client_commands/client_keys_commands.ml @@ -228,7 +228,7 @@ let rec input_fundraiser_params (cctxt : #Client_context.io_wallet) = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in @@ -937,7 +937,7 @@ let commands network : Client_context.full Tezos_clic.command list = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let*? unencrypted_sk_uri = diff --git a/src/lib_crypto/test/test_deterministic_nonce.ml b/src/lib_crypto/test/test_deterministic_nonce.ml index 946d9fe63705..b71c9fac59ee 100644 --- a/src/lib_crypto/test/test_deterministic_nonce.ml +++ b/src/lib_crypto/test/test_deterministic_nonce.ml @@ -42,11 +42,11 @@ let test_hash_matches (module X : Intfs.SIGNATURE) () = Alcotest.failf "the hash of deterministic_nonce is NOT deterministic_nonce_hash" -let ed25519 = (module Ed25519 : Intfs.SIGNATURE) +let ed25519 = (module Signature.Ed25519 : Intfs.SIGNATURE) -let p256 = (module P256 : Intfs.SIGNATURE) +let p256 = (module Signature.P256 : Intfs.SIGNATURE) -let secp256k1 = (module Secp256k1 : Intfs.SIGNATURE) +let secp256k1 = (module Signature.Secp256k1 : Intfs.SIGNATURE) let tests = [ diff --git a/src/lib_crypto/test/test_prop_signature.ml b/src/lib_crypto/test/test_prop_signature.ml index 80e067c8df7d..09285cbdad59 100644 --- a/src/lib_crypto/test/test_prop_signature.ml +++ b/src/lib_crypto/test/test_prop_signature.ml @@ -159,7 +159,7 @@ let () = let name = "Bls12_381" end) (struct - include Bls + include Signature.Bls let watermark_of_bytes b = b end) diff --git a/src/lib_crypto/test/test_signature.ml b/src/lib_crypto/test/test_signature.ml index 934a0bb3716d..4616df06ecca 100644 --- a/src/lib_crypto/test/test_signature.ml +++ b/src/lib_crypto/test/test_signature.ml @@ -32,7 +32,7 @@ let test_size () = let expected = (* add 1 for the tag of union encoding *) (WithExceptions.Option.get ~loc:__LOC__ - @@ Data_encoding.Binary.fixed_length Ed25519.Public_key.encoding) + @@ Data_encoding.Binary.fixed_length Signature.Ed25519.Public_key.encoding) + 1 in assert (Compare.Int.(expected = length)) ; @@ -43,7 +43,7 @@ let test_size () = let expected = (* add 1 for the tag of union encoding *) (WithExceptions.Option.get ~loc:__LOC__ - @@ Data_encoding.Binary.fixed_length P256.Public_key.encoding) + @@ Data_encoding.Binary.fixed_length Signature.P256.Public_key.encoding) + 1 in assert (Compare.Int.(expected = length)) ; @@ -54,7 +54,8 @@ let test_size () = let expected = (* add 1 for the tag of union encoding *) (WithExceptions.Option.get ~loc:__LOC__ - @@ Data_encoding.Binary.fixed_length Secp256k1.Public_key.encoding) + @@ Data_encoding.Binary.fixed_length Signature.Secp256k1.Public_key.encoding + ) + 1 in assert (Compare.Int.(expected = length)) ; diff --git a/src/lib_crypto/test/test_signature_encodings.ml b/src/lib_crypto/test/test_signature_encodings.ml index 6e0c17bcf6d6..d9a531ac05f4 100644 --- a/src/lib_crypto/test/test_signature_encodings.ml +++ b/src/lib_crypto/test/test_signature_encodings.ml @@ -139,7 +139,7 @@ end module Test_Ed25519 = Make_tests - (Ed25519) + (Signature.Ed25519) (struct let name = "ed25519" @@ -150,7 +150,7 @@ module Test_Ed25519 = module Test_Secp256k1 = Make_tests - (Secp256k1) + (Signature.Secp256k1) (struct let name = "secp256k1" @@ -161,7 +161,7 @@ module Test_Secp256k1 = module Test_P256 = Make_tests - (P256) + (Signature.P256) (struct let name = "p256" @@ -172,7 +172,7 @@ module Test_P256 = module Test_Bls = Make_tests - (Bls) + (Signature.Bls) (struct let name = "bls12_381" diff --git a/src/lib_crypto/tezos_crypto.ml b/src/lib_crypto/tezos_crypto.ml index 022bed87d4fd..36affe5c6959 100644 --- a/src/lib_crypto/tezos_crypto.ml +++ b/src/lib_crypto/tezos_crypto.ml @@ -38,17 +38,20 @@ module Hashed = struct module Protocol_hash = Protocol_hash end +module Signature = struct + module Bls = Bls + module Ed25519 = Ed25519 + module P256 = P256 + module Secp256k1 = Secp256k1 + include Signature +end + module Aggregate_signature = Aggregate_signature module Base58 = Base58 module Blake2B = Blake2B -module Bls = Bls module Chain_id = Chain_id module Crypto_box = Crypto_box -module Ed25519 = Ed25519 module Hacl = Hacl module Helpers = Helpers -module P256 = P256 module Rand = Rand -module Secp256k1 = Secp256k1 -module Signature = Signature module Timelock = Timelock diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index bf58842618d9..913a66c4b523 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -53,16 +53,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index f30fbde15323..c3f1ccf30655 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -53,16 +53,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index c2b3b6754ced..0a0d6e94bd55 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -53,16 +53,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index 305e0f0b9670..677c4e97c28f 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -52,16 +52,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index 998d6543fe06..d8e08198da3a 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -53,16 +53,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index b7706975d94f..34de31230d70 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -52,16 +52,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index ebbebc6c0eb6..b6fbc2abc388 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -57,16 +57,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key @@ -273,9 +276,9 @@ struct module Time = Time.Protocol module Bls12_381 = Bls12_381 - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index 43af86b16d0f..da8665b1ae01 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -56,16 +56,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index 503005c31964..9b839e68bafa 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -61,16 +61,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key @@ -307,9 +310,9 @@ struct (List.map Bls12_381_signature.MinPk.unsafe_signature_of_bytes sigs) end - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index 9ebad90f478f..d70c827c0e4b 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -56,16 +56,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index 7874c0561a0d..65cfb34c0839 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -66,16 +66,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key @@ -272,9 +275,9 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 module Signature = Tezos_crypto.Signature.V0 module Timelock = Tezos_crypto.Timelock diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index 9d05a9a0c5b0..5ba5bf28a558 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -67,16 +67,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index 73be2c671d0b..3f92098481b0 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -66,16 +66,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key @@ -273,9 +276,9 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 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 d115e3a6e9d6..7cf7ef20f913 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -67,16 +67,19 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 4449b0d8f458..944dbcaeb220 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -66,19 +66,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key @@ -272,10 +276,10 @@ struct end module Time = Time.Protocol - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 - module Bls = Tezos_crypto.Bls + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 + module Bls = Tezos_crypto.Signature.Bls 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 0cf4fa6cc7b7..a45ec842d627 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -66,19 +66,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V0.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V0.public_key diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index 1307c38dc5d3..cf5efca44aea 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -66,19 +66,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V1.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V1.public_key @@ -301,10 +305,10 @@ struct end module Time = Time.Protocol - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 - module Bls = Tezos_crypto.Bls + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 + module Bls = Tezos_crypto.Signature.Bls 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 092661d9544d..e9bdf23351da 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -66,19 +66,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V1.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V1.public_key diff --git a/src/lib_protocol_environment/environment_V9.ml b/src/lib_protocol_environment/environment_V9.ml index b42232904df8..e0ab699b1eac 100644 --- a/src/lib_protocol_environment/environment_V9.ml +++ b/src/lib_protocol_environment/environment_V9.ml @@ -63,19 +63,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V1.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V1.public_key @@ -298,10 +302,10 @@ struct end module Time = Time.Protocol - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.P256 - module Bls = Tezos_crypto.Bls + module Ed25519 = Tezos_crypto.Signature.Ed25519 + module Secp256k1 = Tezos_crypto.Signature.Secp256k1 + module P256 = Tezos_crypto.Signature.P256 + module Bls = Tezos_crypto.Signature.Bls 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_V9.mli b/src/lib_protocol_environment/environment_V9.mli index 7b10ba049a43..8cd927b3fe81 100644 --- a/src/lib_protocol_environment/environment_V9.mli +++ b/src/lib_protocol_environment/environment_V9.mli @@ -63,19 +63,23 @@ module type T = sig and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = - Tezos_crypto.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = Tezos_crypto.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Ed25519.t + Tezos_crypto.Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = + Tezos_crypto.Signature.Ed25519.Public_key.t + and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = Tezos_crypto.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Secp256k1.t - and type P256.Public_key_hash.t = Tezos_crypto.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.P256.Public_key.t - and type P256.t = Tezos_crypto.P256.t - and type Bls.Public_key_hash.t = Tezos_crypto.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Bls.t + Tezos_crypto.Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = + Tezos_crypto.Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t + and type P256.Public_key_hash.t = + Tezos_crypto.Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t + and type P256.t = Tezos_crypto.Signature.P256.t + and type Bls.Public_key_hash.t = + Tezos_crypto.Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t + and type Bls.t = Tezos_crypto.Signature.Bls.t and type Signature.public_key_hash = Tezos_crypto.Signature.V1.public_key_hash and type Signature.public_key = Tezos_crypto.Signature.V1.public_key diff --git a/src/lib_protocol_environment/structs/v0_ed25519.ml b/src/lib_protocol_environment/structs/v0_ed25519.ml index 96e5dfef2906..1cd685b87cf9 100644 --- a/src/lib_protocol_environment/structs/v0_ed25519.ml +++ b/src/lib_protocol_environment/structs/v0_ed25519.ml @@ -23,35 +23,39 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Ed25519 +include Tezos_crypto.Signature.Ed25519 module Public_key_hash = struct - include Tezos_crypto.Ed25519.Public_key_hash + include Tezos_crypto.Signature.Ed25519.Public_key_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Ed25519.Public_key_hash) + include Stdlib.Set.Make (Tezos_crypto.Signature.Ed25519.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.Ed25519.Public_key_hash.encoding) + Data_encoding.( + list Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Ed25519.Public_key_hash) + include Stdlib.Map.Make (Tezos_crypto.Signature.Ed25519.Public_key_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.Ed25519.Public_key_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding + arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Ed25519.Public_key_hash + include Tezos_crypto.Signature.Ed25519.Public_key_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -71,6 +75,9 @@ module Public_key_hash = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.Ed25519.Public_key_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding + arg_encoding)) end end diff --git a/src/lib_protocol_environment/structs/v0_p256.ml b/src/lib_protocol_environment/structs/v0_p256.ml index 4a2b7551ceb8..980657d613b2 100644 --- a/src/lib_protocol_environment/structs/v0_p256.ml +++ b/src/lib_protocol_environment/structs/v0_p256.ml @@ -23,35 +23,39 @@ (* *) (*****************************************************************************) -include Tezos_crypto.P256 +include Tezos_crypto.Signature.P256 module Public_key_hash = struct - include Tezos_crypto.P256.Public_key_hash + include Tezos_crypto.Signature.P256.Public_key_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.P256.Public_key_hash) + include Stdlib.Set.Make (Tezos_crypto.Signature.P256.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.P256.Public_key_hash.encoding) + Data_encoding.( + list Tezos_crypto.Signature.P256.Public_key_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.P256.Public_key_hash) + include Stdlib.Map.Make (Tezos_crypto.Signature.P256.Public_key_hash) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) Data_encoding.( - list (tup2 Tezos_crypto.P256.Public_key_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Signature.P256.Public_key_hash.encoding + arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.P256.Public_key_hash + include Tezos_crypto.Signature.P256.Public_key_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -71,6 +75,9 @@ module Public_key_hash = struct List.iter (fun (k, v) -> add h k v) l ; h) Data_encoding.( - list (tup2 Tezos_crypto.P256.Public_key_hash.encoding arg_encoding)) + list + (tup2 + Tezos_crypto.Signature.P256.Public_key_hash.encoding + arg_encoding)) end end diff --git a/src/lib_protocol_environment/structs/v0_secp256k1.ml b/src/lib_protocol_environment/structs/v0_secp256k1.ml index 93427a3b5f06..86cc861334e9 100644 --- a/src/lib_protocol_environment/structs/v0_secp256k1.ml +++ b/src/lib_protocol_environment/structs/v0_secp256k1.ml @@ -23,23 +23,24 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Secp256k1 +include Tezos_crypto.Signature.Secp256k1 module Public_key_hash = struct - include Tezos_crypto.Secp256k1.Public_key_hash + include Tezos_crypto.Signature.Secp256k1.Public_key_hash module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Secp256k1.Public_key_hash) + include Stdlib.Set.Make (Tezos_crypto.Signature.Secp256k1.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.Secp256k1.Public_key_hash.encoding) + Data_encoding.( + list Tezos_crypto.Signature.Secp256k1.Public_key_hash.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Secp256k1.Public_key_hash) + include Stdlib.Map.Make (Tezos_crypto.Signature.Secp256k1.Public_key_hash) let encoding arg_encoding = Data_encoding.conv @@ -47,12 +48,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.Secp256k1.Public_key_hash.encoding arg_encoding)) + (tup2 + Tezos_crypto.Signature.Secp256k1.Public_key_hash.encoding + arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Secp256k1.Public_key_hash + include Tezos_crypto.Signature.Secp256k1.Public_key_hash (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -73,6 +76,8 @@ module Public_key_hash = struct h) Data_encoding.( list - (tup2 Tezos_crypto.Secp256k1.Public_key_hash.encoding arg_encoding)) + (tup2 + Tezos_crypto.Signature.Secp256k1.Public_key_hash.encoding + arg_encoding)) end end diff --git a/src/lib_signer_backends/encrypted.ml b/src/lib_signer_backends/encrypted.ml index efbcd0e7f6f0..dca443fd2dbe 100644 --- a/src/lib_signer_backends/encrypted.ml +++ b/src/lib_signer_backends/encrypted.ml @@ -71,19 +71,19 @@ module Raw = struct match (sk : decrypted_sk) with | Decrypted_sk (Ed25519 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk | Decrypted_sk (Secp256k1 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Secp256k1.Secret_key.encoding + Tezos_crypto.Signature.Secp256k1.Secret_key.encoding sk | Decrypted_sk (P256 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.P256.Secret_key.encoding + Tezos_crypto.Signature.P256.Secret_key.encoding sk | Decrypted_sk (Bls sk) | Decrypted_aggregate_sk (Bls12_381 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Bls.Secret_key.encoding + Tezos_crypto.Signature.Bls.Secret_key.encoding sk in Bytes.cat salt (Tezos_crypto.Crypto_box.Secretbox.secretbox key msg nonce) @@ -103,7 +103,7 @@ module Raw = struct | Some bytes, Encrypted_sk Tezos_crypto.Signature.Ed25519 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding bytes with | Some sk -> @@ -116,7 +116,7 @@ module Raw = struct | Some bytes, Encrypted_sk Tezos_crypto.Signature.Secp256k1 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Secp256k1.Secret_key.encoding + Tezos_crypto.Signature.Secp256k1.Secret_key.encoding bytes with | Some sk -> @@ -129,7 +129,7 @@ module Raw = struct | Some bytes, Encrypted_sk Tezos_crypto.Signature.P256 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.P256.Secret_key.encoding + Tezos_crypto.Signature.P256.Secret_key.encoding bytes with | Some sk -> @@ -144,7 +144,7 @@ module Raw = struct -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Bls.Secret_key.encoding + Tezos_crypto.Signature.Bls.Secret_key.encoding bytes with | Some sk -> diff --git a/src/lib_signer_backends/unix/ledger.available.ml b/src/lib_signer_backends/unix/ledger.available.ml index dde868147fbd..4c135d39ea4e 100644 --- a/src/lib_signer_backends/unix/ledger.available.ml +++ b/src/lib_signer_backends/unix/ledger.available.ml @@ -333,7 +333,8 @@ module Ledger_commands = struct match curve with | Ed25519 | Bip32_ed25519 -> let signature = - Tezos_crypto.Ed25519.of_bytes_exn (Cstruct.to_bytes signature) + Tezos_crypto.Signature.Ed25519.of_bytes_exn + (Cstruct.to_bytes signature) in return (Tezos_crypto.Signature.of_ed25519 signature) | Secp256k1 -> @@ -344,7 +345,8 @@ module Ledger_commands = struct let signature = Sign.read_der_exn secp256k1_ctx signature in let bytes = Sign.to_bytes secp256k1_ctx signature in let signature = - Tezos_crypto.Secp256k1.of_bytes_exn (Bigstring.to_bytes bytes) + Tezos_crypto.Signature.Secp256k1.of_bytes_exn + (Bigstring.to_bytes bytes) in return (Tezos_crypto.Signature.of_secp256k1 signature) | Secp256r1 -> @@ -356,7 +358,7 @@ module Ledger_commands = struct let signature = Sign.read_der_exn secp256k1_ctx signature in let buf = Sign.to_bytes secp256k1_ctx signature in let signature = - Tezos_crypto.P256.of_bytes_exn (Bigstring.to_bytes buf) + Tezos_crypto.Signature.P256.of_bytes_exn (Bigstring.to_bytes buf) in return (Tezos_crypto.Signature.of_p256 signature) diff --git a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml index 66e535e6d8b2..2b326f10df90 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml @@ -416,7 +416,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml index 1e7b81791c1a..cc58ebb6449c 100644 --- a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml +++ b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml @@ -420,7 +420,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_003_PsddFKi3/lib_client/operation_result.ml b/src/proto_003_PsddFKi3/lib_client/operation_result.ml index e5f61fa29063..6ab00114a84a 100644 --- a/src/proto_003_PsddFKi3/lib_client/operation_result.ml +++ b/src/proto_003_PsddFKi3/lib_client/operation_result.ml @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml index e5f61fa29063..6ab00114a84a 100644 --- a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml +++ b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_005_PsBabyM1/lib_client/operation_result.ml b/src/proto_005_PsBabyM1/lib_client/operation_result.ml index 72e04fdc0022..d551f655cc59 100644 --- a/src/proto_005_PsBabyM1/lib_client/operation_result.ml +++ b/src/proto_005_PsBabyM1/lib_client/operation_result.ml @@ -436,7 +436,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 295fa69b8bd5..e761d6d1ca5f 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.ml @@ -260,7 +260,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -271,7 +271,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -301,7 +301,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -326,7 +328,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -356,7 +358,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -377,7 +379,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 f40826febc60..b4623325720f 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli @@ -167,7 +167,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_006_PsCARTHA/lib_client/operation_result.ml b/src/proto_006_PsCARTHA/lib_client/operation_result.ml index 137e03133a5a..6fa1447fe31f 100644 --- a/src/proto_006_PsCARTHA/lib_client/operation_result.ml +++ b/src/proto_006_PsCARTHA/lib_client/operation_result.ml @@ -432,7 +432,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_007_PsDELPH1/lib_client/operation_result.ml b/src/proto_007_PsDELPH1/lib_client/operation_result.ml index a488a1a4b53b..ac634cc2ba1b 100644 --- a/src/proto_007_PsDELPH1/lib_client/operation_result.ml +++ b/src/proto_007_PsDELPH1/lib_client/operation_result.ml @@ -428,7 +428,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 ea96ff391ad8..72a72102fc06 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.ml @@ -309,7 +309,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -320,7 +320,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -350,7 +350,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -401,7 +403,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -431,7 +433,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -452,7 +454,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 81d210140a76..0ac2316b003c 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli @@ -196,7 +196,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml index 2033d79822a5..d96042de70c3 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml @@ -435,7 +435,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 5975fb3b757e..eb7b4394bde2 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.ml +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.ml @@ -319,7 +319,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -330,7 +330,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -360,7 +360,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -411,7 +413,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -441,7 +443,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -462,7 +464,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 cf64cb78e949..628d22b66b57 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli @@ -196,7 +196,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_009_PsFLoren/lib_client/operation_result.ml b/src/proto_009_PsFLoren/lib_client/operation_result.ml index 943c221c0e2d..e2d1f7aa6554 100644 --- a/src/proto_009_PsFLoren/lib_client/operation_result.ml +++ b/src/proto_009_PsFLoren/lib_client/operation_result.ml @@ -440,7 +440,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 b5457b4d7996..1cecba8b1d76 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.ml @@ -346,7 +346,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -357,7 +357,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -387,7 +387,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -438,7 +440,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -468,7 +470,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -489,7 +491,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 12f545798111..950b10922ecc 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli @@ -205,7 +205,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_010_PtGRANAD/lib_client/operation_result.ml b/src/proto_010_PtGRANAD/lib_client/operation_result.ml index 03edb82199ba..04862527c1ed 100644 --- a/src/proto_010_PtGRANAD/lib_client/operation_result.ml +++ b/src/proto_010_PtGRANAD/lib_client/operation_result.ml @@ -441,7 +441,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 71ea5125cf43..e791517f5ebd 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.ml @@ -390,7 +390,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -401,7 +401,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -431,7 +431,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -482,7 +484,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -512,7 +514,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -533,7 +535,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 2fd43b1073bf..0277fd9ba994 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_context.mli +++ b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli @@ -227,7 +227,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_011_PtHangz2/lib_client/operation_result.ml b/src/proto_011_PtHangz2/lib_client/operation_result.ml index edacbd8b765e..3fc2db86c97a 100644 --- a/src/proto_011_PtHangz2/lib_client/operation_result.ml +++ b/src/proto_011_PtHangz2/lib_client/operation_result.ml @@ -483,7 +483,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 95a86015f5b7..1749004e3dfd 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.ml @@ -426,7 +426,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -437,7 +437,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -467,7 +467,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -518,7 +520,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -548,7 +550,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -569,7 +571,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 92f08c5e2db5..67cac9a92464 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_context.mli +++ b/src/proto_012_Psithaca/lib_client/client_proto_context.mli @@ -250,7 +250,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_012_Psithaca/lib_client/operation_result.ml b/src/proto_012_Psithaca/lib_client/operation_result.ml index 76fd9e110fdb..9e66e3366b2d 100644 --- a/src/proto_012_Psithaca/lib_client/operation_result.ml +++ b/src/proto_012_Psithaca/lib_client/operation_result.ml @@ -609,7 +609,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 dc16867fdbfe..c0350a0b184e 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.ml @@ -473,7 +473,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -484,7 +484,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -514,7 +514,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -565,7 +567,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -595,7 +597,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -616,7 +618,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 6e72ec2dca00..4a379b57e23b 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_context.mli +++ b/src/proto_013_PtJakart/lib_client/client_proto_context.mli @@ -284,7 +284,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_013_PtJakart/lib_client/operation_result.ml b/src/proto_013_PtJakart/lib_client/operation_result.ml index eae377304340..5e257454adec 100644 --- a/src/proto_013_PtJakart/lib_client/operation_result.ml +++ b/src/proto_013_PtJakart/lib_client/operation_result.ml @@ -1035,7 +1035,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 05415aac8bf1..cfbcdf95ac57 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.ml @@ -507,7 +507,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -518,7 +518,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -548,7 +548,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -599,7 +601,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -628,7 +630,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -649,7 +651,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 6ef593bd6d04..4d46ef846db0 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_context.mli +++ b/src/proto_014_PtKathma/lib_client/client_proto_context.mli @@ -308,7 +308,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_014_PtKathma/lib_client/operation_result.ml b/src/proto_014_PtKathma/lib_client/operation_result.ml index 748133f34e07..a22c4071415c 100644 --- a/src/proto_014_PtKathma/lib_client/operation_result.ml +++ b/src/proto_014_PtKathma/lib_client/operation_result.ml @@ -1008,7 +1008,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 1456382e394b..9fe2c90e2606 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml @@ -66,8 +66,8 @@ let alias_or_literal ~from_alias ~from_key = type wallet_entry = { alias : string; - public_key_hash : Tezos_crypto.Bls.Public_key_hash.t; - public_key : Tezos_crypto.Bls.Public_key.t option; + public_key_hash : Tezos_crypto.Signature.Bls.Public_key_hash.t; + public_key : Tezos_crypto.Signature.Bls.Public_key.t option; secret_key_uri : Client_keys_v0.aggregate_sk_uri option; } @@ -107,12 +107,12 @@ let bls_pkh_parameter () = return pkh in let from_key s = - Tezos_crypto.Bls.Public_key_hash.of_b58check s |> Lwt.return + Tezos_crypto.Signature.Bls.Public_key_hash.of_b58check s |> Lwt.return in alias_or_literal ~from_alias ~from_key s) let conv_bls_pkh_to_l2_addr pkh = - Tezos_crypto.Bls.Public_key_hash.to_b58check pkh + Tezos_crypto.Signature.Bls.Public_key_hash.to_b58check pkh |> Tx_rollup_l2_address.of_b58check_exn let bls_pkh_param ?(name = "public key hash") @@ -146,7 +146,7 @@ let bls_sk_uri_param ?(name = "secret key") ?(desc = "Bls secret key to use.") = let signature_parameter () = Tezos_clic.parameter (fun _cctxt s -> - Tezos_crypto.Bls.of_b58check s |> Lwt.return) + Tezos_crypto.Signature.Bls.of_b58check s |> Lwt.return) let signature_arg = Tezos_clic.arg @@ -342,7 +342,7 @@ let craft_withdraw ~counter ~signer ~destination ~ticket_hash ~qty = let aggregate_signature signatures = let open Result_syntax in - match Tezos_crypto.Bls.aggregate_signature_opt signatures with + match Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures with | Some res -> return res | None -> error_with "aggregate_signature" @@ -369,7 +369,7 @@ let conv_counter = let signer_to_address : Tx_rollup_l2_batch.signer -> Tx_rollup_l2_address.t = function - | Bls_pk pk -> Tezos_crypto.Bls.Public_key.hash pk + | Bls_pk pk -> Tezos_crypto.Signature.Bls.Public_key.hash pk | L2_addr addr -> addr let wait_for_synchronized ?(quiet = false) @@ -443,7 +443,7 @@ let signer_parameter = match Tx_rollup_l2_address.of_b58check_opt s with | Some pkh -> return @@ Tx_rollup_l2_batch.L2_addr pkh | None -> ( - match Tezos_crypto.Bls.Public_key.of_b58check_opt s with + match Tezos_crypto.Signature.Bls.Public_key.of_b58check_opt s with | Some pk -> return @@ Tx_rollup_l2_batch.Bls_pk pk | None -> failwith "cannot parse %s to get a valid signer" s)) @@ -687,7 +687,7 @@ let prepare_operation_parameters cctxt signer counter = | Some pk -> ok pk | None -> error_with "missing signer public key in the wallet" in - let signer_addr = Tezos_crypto.Bls.Public_key.hash signer_pk in + let signer_addr = Tezos_crypto.Signature.Bls.Public_key.hash signer_pk in let* () = wait_for_synchronized cctxt in let* counter = match counter with @@ -825,7 +825,10 @@ let sign_transaction () = let*? aggregated_signature = aggregate_signature signatures in let*! () = - cctxt#message "@[%a@]" Tezos_crypto.Bls.pp aggregated_signature + cctxt#message + "@[%a@]" + Tezos_crypto.Signature.Bls.pp + aggregated_signature in return_unit else @@ -834,7 +837,7 @@ let sign_transaction () = "@[%a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.pp_print_string ppf ";") - Tezos_crypto.Bls.pp) + Tezos_crypto.Signature.Bls.pp) signatures in return_unit) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml index ed701eca32ce..ab56005225f5 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml @@ -608,7 +608,7 @@ end) let seed = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255) in - let pkh, _pk, _sk = Tezos_crypto.Bls.generate_key ~seed () in + let pkh, _pk, _sk = Tezos_crypto.Signature.Bls.generate_key ~seed () in Tx_rollup_l2_address.Indexable.value pkh let chain_id rng_state = 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 847b8406a4a3..0cdffc62d93c 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers_base.ml @@ -81,19 +81,19 @@ end) : S = struct let i = Random.State.int rng_state 4 in match i with | 0 -> ( - let open Tezos_crypto.Ed25519 in + let open Tezos_crypto.Signature.Ed25519 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.V0.of_ed25519 s) | 1 -> ( - let open Tezos_crypto.Secp256k1 in + let open Tezos_crypto.Signature.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.V0.of_secp256k1 s) | 2 -> ( - let open Tezos_crypto.P256 in + let open Tezos_crypto.Signature.P256 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false 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 032f8fb857bc..c663605ad08c 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml @@ -1342,17 +1342,17 @@ let extract_ir_sized_step : | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with | Tezos_crypto.Signature.V0.Ed25519 _pk -> - let pk = Size.of_int Tezos_crypto.Ed25519.size in + let pk = Size.of_int Tezos_crypto.Signature.Ed25519.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.V0.Secp256k1 _pk -> - let pk = Size.of_int Tezos_crypto.Secp256k1.size in + let pk = Size.of_int Tezos_crypto.Signature.Secp256k1.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.V0.P256 _pk -> - let pk = Size.of_int Tezos_crypto.P256.size in + let pk = Size.of_int Tezos_crypto.Signature.P256.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) diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 079352eb2f91..2dcbcd6c3eb8 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -254,7 +254,7 @@ let unique_ticket_id = let gen_l2_account rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in - Tezos_crypto.Bls.generate_key ~seed () + Tezos_crypto.Signature.Bls.generate_key ~seed () let hash_key_exn ctxt ~ticketer ~typ ~contents ~owner = let ticketer = Micheline.root @@ Expr.from_string ticketer in 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 0f982e7b7376..7c7d29a04b4c 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.ml @@ -614,7 +614,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -625,7 +625,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -655,7 +655,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -706,7 +708,7 @@ let read_key key = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -735,7 +737,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -756,7 +758,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V0.public_key pk in 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 3e8868c59be4..627b2d80098b 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli @@ -398,7 +398,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_015_PtLimaPt/lib_client/operation_result.ml b/src/proto_015_PtLimaPt/lib_client/operation_result.ml index dd163ff417a4..f331139a9bab 100644 --- a/src/proto_015_PtLimaPt/lib_client/operation_result.ml +++ b/src/proto_015_PtLimaPt/lib_client/operation_result.ml @@ -1140,7 +1140,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus 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 b8b174bbfe49..5ba47d702767 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 @@ -100,7 +100,9 @@ let gen_l1_address ?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 + let pkh, public_key, secret_key = + Tezos_crypto.Signature.Bls.generate_key () + in (secret_key, public_key, pkh) (** [make_unit_ticket_key ctxt ticketer l2_address] computes the key hash of @@ -154,7 +156,7 @@ let gen_n_ticket_hash n = | Error _ -> raise (Invalid_argument "Failed to forge tickets") let sign_transaction : - Tezos_crypto.Bls.Secret_key.t list -> + Tezos_crypto.Signature.Bls.Secret_key.t list -> ('signer, 'content) Tx_rollup_l2_batch.V1.transaction -> Tx_rollup_l2_batch.V1.signature list = fun sks transaction -> @@ -166,7 +168,7 @@ let sign_transaction : Tx_rollup_l2_batch.V1.transaction_encoding transaction in - List.map (fun sk -> Tezos_crypto.Bls.sign sk buf) sks + List.map (fun sk -> Tezos_crypto.Signature.Bls.sign sk buf) sks type Environment.Error_monad.error += Test_error of string 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 e3e1c1de743a..c2452be7cfa7 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 @@ -88,7 +88,7 @@ let secrets () = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk 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 19b4451e1730..f63ecad4834d 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 @@ -327,7 +327,9 @@ let gen_l2_account ?rng_state () = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255)) rng_state in - let pkh, public_key, secret_key = Tezos_crypto.Bls.generate_key ?seed () in + let pkh, public_key, secret_key = + Tezos_crypto.Signature.Bls.generate_key ?seed () + in (secret_key, public_key, pkh) (** [make_ticket_key ty contents ticketer tx_rollup] computes the ticket hash @@ -2501,7 +2503,8 @@ module Rejection = struct Tx_rollup_l2_helpers.sign_transaction signers transaction in let signature = - assert_some @@ Tezos_crypto.Bls.aggregate_signature_opt signatures + assert_some + @@ Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures in let batch = Tx_rollup_l2_batch.V1. 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 a2f198ea176a..944803d64b63 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 @@ -88,7 +88,7 @@ let protos = type secret_account = { blinded_public_key_hash : Blinded_public_key_hash.t; - account : Tezos_crypto.Ed25519.Public_key_hash.t; + account : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -106,7 +106,7 @@ let secrets = let sk : Tezos_crypto.Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.V0.Secret_key.to_public_key sk in @@ -116,7 +116,9 @@ let secrets = 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 + let pkh = + Tezos_crypto.Signature.Ed25519.Public_key_hash.of_b58check_exn pkh + in assert (Tezos_crypto.Signature.V0.Public_key_hash.equal (Ed25519 pkh) pkh') ; let activation_code = Stdlib.Option.get 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 a2db3fb5b46b..7bb71f335b23 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 @@ -48,7 +48,7 @@ let l2_address, bls_pk = |> Hex.to_bytes_exn in let pkh, public_key, _secret_key = - Tezos_crypto.Bls.generate_key ~seed:ikm () + Tezos_crypto.Signature.Bls.generate_key ~seed:ikm () in (pkh, public_key) 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 c5c000e6de9b..b1d627104c6d 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 @@ -84,7 +84,7 @@ let expect_error_status ~msg error status cont = let aggregate_signature_exn : signature list -> signature = fun signatures -> - match Tezos_crypto.Bls.aggregate_signature_opt signatures with + match Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures with | Some res -> res | None -> raise (Invalid_argument "aggregate_signature_exn") @@ -127,7 +127,7 @@ let pp_metadata fmt Tx_rollup_l2_context_sig.{counter; public_key} = fmt "{counter=%d; public_key=%a}" counter - Tezos_crypto.Bls.Public_key.pp + Tezos_crypto.Signature.Bls.Public_key.pp public_key let eq_metadata = Alcotest.of_pp pp_metadata @@ -280,7 +280,9 @@ let batch_from_transfers inputs = (fun all_sks input -> List.fold_left (fun acc (sk, _, _, _, _, _) -> - if List.mem ~equal:Tezos_crypto.Bls.Secret_key.equal sk acc then acc + if + List.mem ~equal:Tezos_crypto.Signature.Bls.Secret_key.equal sk acc + then acc else sk :: acc) [] input diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml index 88b2ebaafcf9..4cc52ecfdacc 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml @@ -413,7 +413,7 @@ module Context_RPC = struct type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; counter : int64; - public_key : Tezos_crypto.Bls.Public_key.t; + public_key : Tezos_crypto.Signature.Bls.Public_key.t; } let address_metadata_encoding = @@ -424,7 +424,7 @@ module Context_RPC = struct @@ obj3 (req "index" Tx_rollup_l2_address.Indexable.index_encoding) (req "counter" int64) - (req "public_key" Tezos_crypto.Bls.Public_key.encoding)) + (req "public_key" Tezos_crypto.Signature.Bls.Public_key.encoding)) let balance = Tezos_rpc.Service.get_service @@ -496,7 +496,8 @@ module Context_RPC = struct "Get the BLS public key associated to the given address, or null if \ the address has not performed any transfer or withdraw on the rollup." ~query:Tezos_rpc.Query.empty - ~output:(Data_encoding.option Tezos_crypto.Bls.Public_key.encoding) + ~output: + (Data_encoding.option Tezos_crypto.Signature.Bls.Public_key.encoding) Tezos_rpc.Path.( path / "addresses" /: Arg.address_indexable / "public_key") diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml index 35f152099d46..8549eb933e10 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml @@ -158,7 +158,7 @@ let on_register state ~apply (tr : L2_transaction.t) = let open Lwt_result_syntax in Lwt_mutex.with_lock state.lock @@ fun () -> let*? aggregated_signature = - match Tezos_crypto.Bls.aggregate_signature_opt tr.signatures with + match Tezos_crypto.Signature.Bls.aggregate_signature_opt tr.signatures with | Some s -> ok s | None -> error_with "could not aggregate signatures of transaction" in diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml index 196a618b57d6..776edf8b43f1 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml @@ -102,7 +102,7 @@ let signer_value ctxt signer = | Left _ -> assert false) | Right Tx_rollup_l2_batch.(L2_addr _) -> return signer | Right Tx_rollup_l2_batch.(Bls_pk pk) -> - let addr = Tezos_crypto.Bls.Public_key.hash pk in + let addr = Tezos_crypto.Signature.Bls.Public_key.hash pk in return (value (Tx_rollup_l2_batch.L2_addr addr) |> forget) let transaction_replace_indexes ctxt transaction = @@ -280,7 +280,7 @@ let l2_message_encoding = (req "result" transaction_result_encoding)))) (req "withdrawals" (list Tx_rollup_withdraw.encoding)) (req "indexes" indexes_encoding) - (req "aggregated_signature" Tezos_crypto.Bls.encoding)) + (req "aggregated_signature" Tezos_crypto.Signature.Bls.encoding)) (function | Ok_batch { @@ -314,7 +314,7 @@ let l2_message_encoding = "transactions" (list Tx_rollup_l2_batch.V1.transaction_encoding)) (req "errors" Error_monad.trace_encoding) - (req "aggregated_signature" Tezos_crypto.Bls.encoding)) + (req "aggregated_signature" Tezos_crypto.Signature.Bls.encoding)) (function | Failing_batch {transactions; reasons; aggregated_signature} -> Some (transactions, reasons, aggregated_signature) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml index 15aa8a7e9041..e4c2f6781956 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml @@ -38,13 +38,13 @@ let encoding = (fun (transaction, signatures) -> {transaction; signatures}) @@ obj2 (req "transaction" Tx_rollup_l2_batch.V1.transaction_encoding) - (req "signatures" (list Tezos_crypto.Bls.encoding)) + (req "signatures" (list Tezos_crypto.Signature.Bls.encoding)) let batch l = let contents = List.map (fun {transaction; _} -> transaction) l in let aggregated_signature = List.concat_map (fun {signatures; _} -> signatures) l - |> Tezos_crypto.Bls.aggregate_signature_opt + |> Tezos_crypto.Signature.Bls.aggregate_signature_opt in match aggregated_signature with | None -> error_with "Cannot aggregate signatures" diff --git a/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml b/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml index 5162851c02af..acb279a10a40 100644 --- a/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_016_PtMumbai/lib_benchmark/michelson_samplers_base.ml @@ -81,19 +81,19 @@ end) : S = struct let i = Random.State.int rng_state 5 in match i with | 0 -> ( - let open Tezos_crypto.Ed25519 in + let open Tezos_crypto.Signature.Ed25519 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_ed25519 s) | 1 -> ( - let open Tezos_crypto.Secp256k1 in + let open Tezos_crypto.Signature.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) | 2 -> ( - let open Tezos_crypto.P256 in + let open Tezos_crypto.Signature.P256 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false @@ -101,7 +101,7 @@ end) : S = struct | 3 -> (* BLS checks that signatures are on the curve so we need to generate real ones by signing a message. *) - let open Tezos_crypto.Bls in + let open Tezos_crypto.Signature.Bls in let msg = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let _, _, sk = generate_key ~seed () in @@ -109,7 +109,7 @@ end) : S = struct | _ -> let bytes = Base_samplers.uniform_bytes - ~nbytes:Tezos_crypto.Ed25519.size + ~nbytes:Tezos_crypto.Signature.Ed25519.size rng_state in Unknown bytes diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_workload.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_workload.ml index 90b96546a052..efab9da028b3 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_workload.ml @@ -1408,23 +1408,31 @@ let extract_ir_sized_step : | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with | Tezos_crypto.Signature.Ed25519 pk -> - let pk = Size.of_int (Tezos_crypto.Ed25519.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Ed25519.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Ed25519.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Ed25519.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message | Tezos_crypto.Signature.Secp256k1 pk -> - let pk = Size.of_int (Tezos_crypto.Secp256k1.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Secp256k1.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Secp256k1.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Secp256k1.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message | Tezos_crypto.Signature.P256 pk -> - let pk = Size.of_int (Tezos_crypto.P256.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.P256.size in + let pk = + Size.of_int (Tezos_crypto.Signature.P256.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.P256.size in let message = Size.bytes message in Instructions.check_signature_p256 pk signature message | Tezos_crypto.Signature.Bls pk -> - let pk = Size.of_int (Tezos_crypto.Bls.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Bls.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Bls.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Bls.size in let message = Size.bytes message in Instructions.check_signature_bls pk signature message) | IHash_key (_, _), _ -> Instructions.hash_key diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 093ace757eff..a3034da86548 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -250,7 +250,7 @@ let unique_ticket_id = let gen_l2_account rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in - Tezos_crypto.Bls.generate_key ~seed () + Tezos_crypto.Signature.Bls.generate_key ~seed () let hash_key_exn ctxt ~ticketer ~typ ~contents ~owner = let ticketer = Micheline.root @@ Expr.from_string ticketer in diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_context.ml b/src/proto_016_PtMumbai/lib_client/client_proto_context.ml index d6b0426b818c..2db3f6c84b83 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_context.ml +++ b/src/proto_016_PtMumbai/lib_client/client_proto_context.ml @@ -624,7 +624,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -635,7 +635,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -665,7 +665,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -716,7 +718,7 @@ let read_key key = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in @@ -745,7 +747,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -766,7 +768,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V1.public_key pk in diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_context.mli b/src/proto_016_PtMumbai/lib_client/client_proto_context.mli index 12b34df096b1..5bdaa5d75cf9 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_context.mli +++ b/src/proto_016_PtMumbai/lib_client/client_proto_context.mli @@ -418,7 +418,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_016_PtMumbai/lib_client/injection.ml b/src/proto_016_PtMumbai/lib_client/injection.ml index 291a17304bee..1ae1dbcef8e9 100644 --- a/src/proto_016_PtMumbai/lib_client/injection.ml +++ b/src/proto_016_PtMumbai/lib_client/injection.ml @@ -632,13 +632,13 @@ let detect_script_failure : type kind. kind operation_metadata -> _ = fun {contents} -> detect_script_failure contents let signature_size_of_algo : Tezos_crypto.Signature.algo -> int = function - | Ed25519 -> Tezos_crypto.Ed25519.size - | Secp256k1 -> Tezos_crypto.Secp256k1.size - | P256 -> Tezos_crypto.P256.size + | Ed25519 -> Tezos_crypto.Signature.Ed25519.size + | Secp256k1 -> Tezos_crypto.Signature.Secp256k1.size + | P256 -> Tezos_crypto.Signature.P256.size | Bls -> (* BLS signatures in operations are encoded with 2 extra bytes: a [ff] prefix and a tag [03]. *) - Tezos_crypto.Bls.size + 2 + Tezos_crypto.Signature.Bls.size + 2 (* This value is used as a safety guard for gas limit. *) let safety_guard = Gas.Arith.(integral_of_int_exn 100) diff --git a/src/proto_016_PtMumbai/lib_client/operation_result.ml b/src/proto_016_PtMumbai/lib_client/operation_result.ml index 4a18ff228b63..5d64fa545937 100644 --- a/src/proto_016_PtMumbai/lib_client/operation_result.ml +++ b/src/proto_016_PtMumbai/lib_client/operation_result.ml @@ -1108,7 +1108,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml index a9f28dc80300..06f477c7a18c 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/operation_generator.ml @@ -156,25 +156,36 @@ let random_keys = let random_tz1 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Ed25519.Public_key_hash.size) in - (Ed25519 (Tezos_crypto.Ed25519.Public_key_hash.of_string_exn str) + let+ str = + string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) + in + (Ed25519 (Tezos_crypto.Signature.Ed25519.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz2 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Secp256k1.Public_key_hash.size) in - (Secp256k1 (Tezos_crypto.Secp256k1.Public_key_hash.of_string_exn str) + let+ str = + string_size (pure Tezos_crypto.Signature.Secp256k1.Public_key_hash.size) + in + (Secp256k1 + (Tezos_crypto.Signature.Secp256k1.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz3 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.P256.Public_key_hash.size) in - (P256 (Tezos_crypto.P256.Public_key_hash.of_string_exn str) : public_key_hash) + let+ str = + string_size (pure Tezos_crypto.Signature.P256.Public_key_hash.size) + in + (P256 (Tezos_crypto.Signature.P256.Public_key_hash.of_string_exn str) + : public_key_hash) let random_tz4 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Bls.Public_key_hash.size) in - (Bls (Tezos_crypto.Bls.Public_key_hash.of_string_exn str) : public_key_hash) + let+ str = + string_size (pure Tezos_crypto.Signature.Bls.Public_key_hash.size) + in + (Bls (Tezos_crypto.Signature.Bls.Public_key_hash.of_string_exn str) + : public_key_hash) let random_pkh = let open QCheck2.Gen in @@ -195,19 +206,20 @@ let random_signature = let* algo = option ~ratio:0.8 gen_algo in match algo with | None -> - let+ str = string_size (pure Tezos_crypto.Ed25519.size) in + let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in (Unknown (Bytes.unsafe_of_string str) : Tezos_crypto.Signature.t) | Some Ed25519 -> - let+ str = string_size (pure Tezos_crypto.Ed25519.size) in - (Ed25519 (Tezos_crypto.Ed25519.of_string_exn str) + let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in + (Ed25519 (Tezos_crypto.Signature.Ed25519.of_string_exn str) : Tezos_crypto.Signature.t) | Some Secp256k1 -> - let+ str = string_size (pure Tezos_crypto.Secp256k1.size) in - (Secp256k1 (Tezos_crypto.Secp256k1.of_string_exn str) + let+ str = string_size (pure Tezos_crypto.Signature.Secp256k1.size) in + (Secp256k1 (Tezos_crypto.Signature.Secp256k1.of_string_exn str) : Tezos_crypto.Signature.t) | Some P256 -> - let+ str = string_size (pure Tezos_crypto.P256.size) in - (P256 (Tezos_crypto.P256.of_string_exn str) : Tezos_crypto.Signature.t) + let+ str = string_size (pure Tezos_crypto.Signature.P256.size) in + (P256 (Tezos_crypto.Signature.P256.of_string_exn str) + : Tezos_crypto.Signature.t) | Some Bls -> let+ seed = random_seed in let _, _, sk = Tezos_crypto.Signature.generate_key ~algo:Bls ~seed () in @@ -219,10 +231,10 @@ let random_signature = random_signature Tezos_crypto.Signature. [ - of_ed25519 Tezos_crypto.Ed25519.zero; - of_secp256k1 Tezos_crypto.Secp256k1.zero; - of_p256 Tezos_crypto.P256.zero; - of_bls Tezos_crypto.Bls.zero; + of_ed25519 Tezos_crypto.Signature.Ed25519.zero; + of_secp256k1 Tezos_crypto.Signature.Secp256k1.zero; + of_p256 Tezos_crypto.Signature.P256.zero; + of_bls Tezos_crypto.Signature.Bls.zero; Unknown (Bytes.make 64 '\000'); ] () @@ -268,7 +280,9 @@ let random_proto = let random_code = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Ed25519.Public_key_hash.size) in + let+ str = + string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) + in let (`Hex hex) = Hex.of_string str in Blinded_public_key_hash.activation_code_of_hex hex |> WithExceptions.Option.get ~loc:__LOC__ diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 22acc5dfcb67..bd1bea034cd7 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml @@ -100,7 +100,9 @@ let gen_l1_address ?seed () = Tezos_crypto.Signature.generate_key ~algo:Ed25519 ?seed () let gen_l2_address () = - let pkh, public_key, secret_key = Tezos_crypto.Bls.generate_key () in + let pkh, public_key, secret_key = + Tezos_crypto.Signature.Bls.generate_key () + in (secret_key, public_key, pkh) (** [make_unit_ticket_key ctxt ticketer l2_address] computes the key hash of @@ -154,7 +156,7 @@ let gen_n_ticket_hash n = | Error _ -> raise (Invalid_argument "Failed to forge tickets") let sign_transaction : - Tezos_crypto.Bls.Secret_key.t list -> + Tezos_crypto.Signature.Bls.Secret_key.t list -> ('signer, 'content) Tx_rollup_l2_batch.V1.transaction -> Tx_rollup_l2_batch.V1.signature list = fun sks transaction -> @@ -166,7 +168,7 @@ let sign_transaction : Tx_rollup_l2_batch.V1.transaction_encoding transaction in - List.map (fun sk -> Tezos_crypto.Bls.sign sk buf) sks + List.map (fun sk -> Tezos_crypto.Signature.Bls.sign sk buf) sks type Environment.Error_monad.error += Test_error of string diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_consensus_key.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_consensus_key.ml index 336097c14e35..227e19498598 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_consensus_key.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_consensus_key.ml @@ -193,7 +193,7 @@ let test_tz4_consensus_key () = Environment.Ecoproto_error (Delegate_consensus_key.Invalid_consensus_key_update_tz4 pk); ] - when Tezos_crypto.Bls.Public_key.(pk = tz4_pk) -> + when Tezos_crypto.Signature.Bls.Public_key.(pk = tz4_pk) -> return_unit | err -> failwith diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_delegation.ml index 2aa32630dd84..527ad98cd70d 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_delegation.ml @@ -1390,7 +1390,7 @@ let test_bls_account_cannot_self_delegate () = Environment.Ecoproto_error (Contract_delegate_storage.Forbidden_tz4_delegate pkh); ] - when Tezos_crypto.Bls.Public_key_hash.(pkh = tz4_pkh) -> + when Tezos_crypto.Signature.Bls.Public_key_hash.(pkh = tz4_pkh) -> return_unit | err -> failwith diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_activation.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_activation.ml index 778544462e33..0bbf9e283fb0 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_activation.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_activation.ml @@ -88,7 +88,7 @@ let secrets () = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml index 01f6b5a5b3a5..6b05f9fd4bc9 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -329,7 +329,9 @@ let gen_l2_account ?rng_state () = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255)) rng_state in - let pkh, public_key, secret_key = Tezos_crypto.Bls.generate_key ?seed () in + let pkh, public_key, secret_key = + Tezos_crypto.Signature.Bls.generate_key ?seed () + in (secret_key, public_key, pkh) (** [make_ticket_key ty contents ticketer tx_rollup] computes the ticket hash @@ -2506,7 +2508,8 @@ module Rejection = struct Tx_rollup_l2_helpers.sign_transaction signers transaction in let signature = - assert_some @@ Tezos_crypto.Bls.aggregate_signature_opt signatures + assert_some + @@ Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures in let batch = Tx_rollup_l2_batch.V1. diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml index cb5e7d8b18ea..2a752d8f0a52 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml @@ -88,7 +88,7 @@ let protos = type secret_account = { blinded_public_key_hash : Blinded_public_key_hash.t; - account : Tezos_crypto.Ed25519.Public_key_hash.t; + account : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -106,7 +106,7 @@ let secrets = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in @@ -116,7 +116,9 @@ let secrets = 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 + let pkh = + Tezos_crypto.Signature.Ed25519.Public_key_hash.of_b58check_exn pkh + in assert (Tezos_crypto.Signature.Public_key_hash.equal (Ed25519 pkh) pkh') ; let activation_code = Stdlib.Option.get diff --git a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index b43c3b31c430..408504364c5d 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml @@ -48,7 +48,7 @@ let l2_address, bls_pk = |> Hex.to_bytes_exn in let pkh, public_key, _secret_key = - Tezos_crypto.Bls.generate_key ~seed:ikm () + Tezos_crypto.Signature.Bls.generate_key ~seed:ikm () in (pkh, public_key) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml index 19a806b1e138..a34eb06d4e69 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_operation_repr.ml @@ -94,7 +94,8 @@ module Test_operation_repr = struct let zero_bls = match - Tezos_crypto.Signature.split_signature (Bls Tezos_crypto.Bls.zero) + Tezos_crypto.Signature.split_signature + (Bls Tezos_crypto.Signature.Bls.zero) with | {prefix = None; _} -> assert false | {prefix = Some prefix; suffix} -> diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index 767190f5ba0e..c29e711fbdac 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml @@ -84,7 +84,7 @@ let expect_error_status ~msg error status cont = let aggregate_signature_exn : signature list -> signature = fun signatures -> - match Tezos_crypto.Bls.aggregate_signature_opt signatures with + match Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures with | Some res -> res | None -> raise (Invalid_argument "aggregate_signature_exn") @@ -127,7 +127,7 @@ let pp_metadata fmt Tx_rollup_l2_context_sig.{counter; public_key} = fmt "{counter=%d; public_key=%a}" counter - Tezos_crypto.Bls.Public_key.pp + Tezos_crypto.Signature.Bls.Public_key.pp public_key let eq_metadata = Alcotest.of_pp pp_metadata @@ -280,7 +280,9 @@ let batch_from_transfers inputs = (fun all_sks input -> List.fold_left (fun acc (sk, _, _, _, _, _) -> - if List.mem ~equal:Tezos_crypto.Bls.Secret_key.equal sk acc then acc + if + List.mem ~equal:Tezos_crypto.Signature.Bls.Secret_key.equal sk acc + then acc else sk :: acc) [] input diff --git a/src/proto_alpha/lib_benchmark/michelson_samplers_base.ml b/src/proto_alpha/lib_benchmark/michelson_samplers_base.ml index c9a9d36e0612..837374f56709 100644 --- a/src/proto_alpha/lib_benchmark/michelson_samplers_base.ml +++ b/src/proto_alpha/lib_benchmark/michelson_samplers_base.ml @@ -81,19 +81,19 @@ end) : S = struct let i = Random.State.int rng_state 5 in match i with | 0 -> ( - let open Tezos_crypto.Ed25519 in + let open Tezos_crypto.Signature.Ed25519 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_ed25519 s) | 1 -> ( - let open Tezos_crypto.Secp256k1 in + let open Tezos_crypto.Signature.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) | 2 -> ( - let open Tezos_crypto.P256 in + let open Tezos_crypto.Signature.P256 in let bytes = Base_samplers.uniform_bytes ~nbytes:size rng_state in match of_bytes_opt bytes with | None -> assert false @@ -101,7 +101,7 @@ end) : S = struct | 3 -> (* BLS checks that signatures are on the curve so we need to generate real ones by signing a message. *) - let open Tezos_crypto.Bls in + let open Tezos_crypto.Signature.Bls in let msg = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in let _, _, sk = generate_key ~seed () in @@ -110,7 +110,7 @@ end) : S = struct let open Tezos_crypto.Signature in let bytes = Base_samplers.uniform_bytes - ~nbytes:Tezos_crypto.Ed25519.size + ~nbytes:Tezos_crypto.Signature.Ed25519.size rng_state in Unknown bytes diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml index 90b96546a052..efab9da028b3 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml @@ -1408,23 +1408,31 @@ let extract_ir_sized_step : | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with | Tezos_crypto.Signature.Ed25519 pk -> - let pk = Size.of_int (Tezos_crypto.Ed25519.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Ed25519.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Ed25519.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Ed25519.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message | Tezos_crypto.Signature.Secp256k1 pk -> - let pk = Size.of_int (Tezos_crypto.Secp256k1.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Secp256k1.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Secp256k1.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Secp256k1.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message | Tezos_crypto.Signature.P256 pk -> - let pk = Size.of_int (Tezos_crypto.P256.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.P256.size in + let pk = + Size.of_int (Tezos_crypto.Signature.P256.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.P256.size in let message = Size.bytes message in Instructions.check_signature_p256 pk signature message | Tezos_crypto.Signature.Bls pk -> - let pk = Size.of_int (Tezos_crypto.Bls.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.Bls.size in + let pk = + Size.of_int (Tezos_crypto.Signature.Bls.Public_key.size pk) + in + let signature = Size.of_int Tezos_crypto.Signature.Bls.size in let message = Size.bytes message in Instructions.check_signature_bls pk signature message) | IHash_key (_, _), _ -> Instructions.hash_key diff --git a/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 093ace757eff..a3034da86548 100644 --- a/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -250,7 +250,7 @@ let unique_ticket_id = let gen_l2_account rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in - Tezos_crypto.Bls.generate_key ~seed () + Tezos_crypto.Signature.Bls.generate_key ~seed () let hash_key_exn ctxt ~ticketer ~typ ~contents ~owner = let ticketer = Micheline.root @@ Expr.from_string ticketer in diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 85d4515fb160..1faaf46e9b9e 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -624,7 +624,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -635,7 +635,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -665,7 +665,9 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req + "pkh" + Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -716,7 +718,7 @@ let read_key key = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in @@ -745,7 +747,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -766,7 +768,7 @@ let activate_account (cctxt : #full) ~chain ~block ?confirmations ?dry_run %a @]" Tezos_crypto.Signature.Public_key_hash.pp pkh - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp key.pkh) >>=? fun () -> let pk = Tezos_crypto.Signature.Of_V1.public_key pk in diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index ad10258a9691..8745c2772806 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -418,7 +418,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Ed25519.Public_key_hash.t; + pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index 291a17304bee..1ae1dbcef8e9 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -632,13 +632,13 @@ let detect_script_failure : type kind. kind operation_metadata -> _ = fun {contents} -> detect_script_failure contents let signature_size_of_algo : Tezos_crypto.Signature.algo -> int = function - | Ed25519 -> Tezos_crypto.Ed25519.size - | Secp256k1 -> Tezos_crypto.Secp256k1.size - | P256 -> Tezos_crypto.P256.size + | Ed25519 -> Tezos_crypto.Signature.Ed25519.size + | Secp256k1 -> Tezos_crypto.Signature.Secp256k1.size + | P256 -> Tezos_crypto.Signature.P256.size | Bls -> (* BLS signatures in operations are encoded with 2 extra bytes: a [ff] prefix and a tag [03]. *) - Tezos_crypto.Bls.size + 2 + Tezos_crypto.Signature.Bls.size + 2 (* This value is used as a safety guard for gas limit. *) let safety_guard = Gas.Arith.(integral_of_int_exn 100) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 8ce9ee0df0b0..14a6658ed476 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -1112,7 +1112,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Tezos_crypto.Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus diff --git a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml index 60f21f28d291..ab1d4c38223b 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -148,25 +148,36 @@ let random_keys = let random_tz1 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Ed25519.Public_key_hash.size) in - (Ed25519 (Tezos_crypto.Ed25519.Public_key_hash.of_string_exn str) + let+ str = + string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) + in + (Ed25519 (Tezos_crypto.Signature.Ed25519.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz2 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Secp256k1.Public_key_hash.size) in - (Secp256k1 (Tezos_crypto.Secp256k1.Public_key_hash.of_string_exn str) + let+ str = + string_size (pure Tezos_crypto.Signature.Secp256k1.Public_key_hash.size) + in + (Secp256k1 + (Tezos_crypto.Signature.Secp256k1.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz3 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.P256.Public_key_hash.size) in - (P256 (Tezos_crypto.P256.Public_key_hash.of_string_exn str) : public_key_hash) + let+ str = + string_size (pure Tezos_crypto.Signature.P256.Public_key_hash.size) + in + (P256 (Tezos_crypto.Signature.P256.Public_key_hash.of_string_exn str) + : public_key_hash) let random_tz4 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Bls.Public_key_hash.size) in - (Bls (Tezos_crypto.Bls.Public_key_hash.of_string_exn str) : public_key_hash) + let+ str = + string_size (pure Tezos_crypto.Signature.Bls.Public_key_hash.size) + in + (Bls (Tezos_crypto.Signature.Bls.Public_key_hash.of_string_exn str) + : public_key_hash) let random_pkh = let open QCheck2.Gen in @@ -187,19 +198,20 @@ let random_signature = let* algo = option ~ratio:0.8 gen_algo in match algo with | None -> - let+ str = string_size (pure Tezos_crypto.Ed25519.size) in + let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in (Unknown (Bytes.unsafe_of_string str) : Tezos_crypto.Signature.t) | Some Ed25519 -> - let+ str = string_size (pure Tezos_crypto.Ed25519.size) in - (Ed25519 (Tezos_crypto.Ed25519.of_string_exn str) + let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in + (Ed25519 (Tezos_crypto.Signature.Ed25519.of_string_exn str) : Tezos_crypto.Signature.t) | Some Secp256k1 -> - let+ str = string_size (pure Tezos_crypto.Secp256k1.size) in - (Secp256k1 (Tezos_crypto.Secp256k1.of_string_exn str) + let+ str = string_size (pure Tezos_crypto.Signature.Secp256k1.size) in + (Secp256k1 (Tezos_crypto.Signature.Secp256k1.of_string_exn str) : Tezos_crypto.Signature.t) | Some P256 -> - let+ str = string_size (pure Tezos_crypto.P256.size) in - (P256 (Tezos_crypto.P256.of_string_exn str) : Tezos_crypto.Signature.t) + let+ str = string_size (pure Tezos_crypto.Signature.P256.size) in + (P256 (Tezos_crypto.Signature.P256.of_string_exn str) + : Tezos_crypto.Signature.t) | Some Bls -> let+ seed = random_seed in let _, _, sk = Tezos_crypto.Signature.generate_key ~algo:Bls ~seed () in @@ -211,10 +223,10 @@ let random_signature = random_signature Tezos_crypto.Signature. [ - of_ed25519 Tezos_crypto.Ed25519.zero; - of_secp256k1 Tezos_crypto.Secp256k1.zero; - of_p256 Tezos_crypto.P256.zero; - of_bls Tezos_crypto.Bls.zero; + of_ed25519 Tezos_crypto.Signature.Ed25519.zero; + of_secp256k1 Tezos_crypto.Signature.Secp256k1.zero; + of_p256 Tezos_crypto.Signature.P256.zero; + of_bls Tezos_crypto.Signature.Bls.zero; Unknown (Bytes.make 64 '\000'); ] () @@ -253,7 +265,9 @@ let random_proto = let random_code = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.Ed25519.Public_key_hash.size) in + let+ str = + string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) + in let (`Hex hex) = Hex.of_string str in Blinded_public_key_hash.activation_code_of_hex hex |> WithExceptions.Option.get ~loc:__LOC__ diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml index 336097c14e35..227e19498598 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml @@ -193,7 +193,7 @@ let test_tz4_consensus_key () = Environment.Ecoproto_error (Delegate_consensus_key.Invalid_consensus_key_update_tz4 pk); ] - when Tezos_crypto.Bls.Public_key.(pk = tz4_pk) -> + when Tezos_crypto.Signature.Bls.Public_key.(pk = tz4_pk) -> return_unit | err -> failwith diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml index 2aa32630dd84..527ad98cd70d 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml @@ -1390,7 +1390,7 @@ let test_bls_account_cannot_self_delegate () = Environment.Ecoproto_error (Contract_delegate_storage.Forbidden_tz4_delegate pkh); ] - when Tezos_crypto.Bls.Public_key_hash.(pkh = tz4_pkh) -> + when Tezos_crypto.Signature.Bls.Public_key_hash.(pkh = tz4_pkh) -> return_unit | err -> failwith diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml index 778544462e33..0bbf9e283fb0 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml @@ -88,7 +88,7 @@ let secrets () = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml index 2ab9c5d5a866..875b130154c4 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml @@ -88,7 +88,7 @@ let protos = type secret_account = { blinded_public_key_hash : Blinded_public_key_hash.t; - account : Tezos_crypto.Ed25519.Public_key_hash.t; + account : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -106,7 +106,7 @@ let secrets = let sk : Tezos_crypto.Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Ed25519.Secret_key.encoding + Tezos_crypto.Signature.Ed25519.Secret_key.encoding sk) in let pk = Tezos_crypto.Signature.Secret_key.to_public_key sk in @@ -116,7 +116,9 @@ let secrets = 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 + let pkh = + Tezos_crypto.Signature.Ed25519.Public_key_hash.of_b58check_exn pkh + in assert (Tezos_crypto.Signature.Public_key_hash.equal (Ed25519 pkh) pkh') ; let activation_code = Stdlib.Option.get diff --git a/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml index 419f430090de..7b4bb78595e9 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml @@ -94,7 +94,8 @@ module Test_operation_repr = struct let zero_bls = match - Tezos_crypto.Signature.(split_signature (Bls Tezos_crypto.Bls.zero)) + Tezos_crypto.Signature.( + split_signature (Bls Tezos_crypto.Signature.Bls.zero)) with | {prefix = None; _} -> assert false | {prefix = Some prefix; suffix} -> -- GitLab From e0ded6f1a1af2ebb9f8a4d3ff68932a5a7d7a362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= <code@bnwr.net> Date: Tue, 22 Nov 2022 14:20:49 +0100 Subject: [PATCH 5/6] Base: expose `Signature` in pervasives --- src/bin_dal_node/main_dal.ml | 4 +- src/lib_base/tzPervasives.ml | 1 + src/lib_base/tzPervasives.mli | 1 + .../client_keys_commands.ml | 67 ++++++-------- .../environment_V0.ml | 31 +++---- .../environment_V0.mli | 31 +++---- .../environment_V1.ml | 31 +++---- .../environment_V1.mli | 31 +++---- .../environment_V2.ml | 31 +++---- .../environment_V2.mli | 31 +++---- .../environment_V3.ml | 39 ++++---- .../environment_V3.mli | 31 +++---- .../environment_V4.ml | 39 ++++---- .../environment_V4.mli | 31 +++---- .../environment_V5.ml | 39 ++++---- .../environment_V5.mli | 31 +++---- .../environment_V6.ml | 39 ++++---- .../environment_V6.mli | 31 +++---- .../environment_V7.ml | 48 +++++----- .../environment_V7.mli | 38 ++++---- .../environment_V8.ml | 50 +++++------ .../environment_V8.mli | 40 ++++----- src/lib_signer_backends/encrypted.ml | 70 ++++++--------- .../unix/ledger.available.ml | 90 +++++++------------ .../lib_client/operation_result.ml | 22 ++--- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 2 +- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 6 +- .../lib_client/operation_result.ml | 22 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 8 +- .../lib_client/operation_result.ml | 24 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 44 ++++----- .../lib_client/operation_result.ml | 24 ++--- .../lib_client/client_proto_context.ml | 30 +++---- .../lib_client/client_proto_context.mli | 48 +++++----- .../lib_client/operation_result.ml | 36 +++----- .../bin_tx_rollup_client/commands.ml | 27 +++--- .../interpreter_workload.ml | 18 ++-- .../tx_rollup_benchmarks.ml | 2 +- .../lib_client/client_proto_context.ml | 32 ++++--- .../lib_client/client_proto_context.mli | 60 ++++++------- .../lib_client/operation_result.ml | 42 ++++----- .../lib_protocol/test/helpers/op.ml | 2 +- .../test/helpers/tx_rollup_l2_helpers.ml | 11 +-- .../integration/operations/test_activation.ml | 14 +-- .../integration/operations/test_tx_rollup.ml | 11 +-- .../integration/validate/validate_helpers.ml | 16 ++-- .../test/pbt/test_tx_rollup_l2_encoding.ml | 8 +- .../test/unit/test_tx_rollup_l2_apply.ml | 12 ++- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml | 7 +- .../lib_tx_rollup/batcher.ml | 6 +- .../lib_tx_rollup/fancy_l2block.ml | 6 +- .../lib_tx_rollup/l2_transaction.ml | 4 +- src/proto_alpha/bin_sc_rollup_node/batcher.ml | 4 +- .../bin_sc_rollup_node/configuration.ml | 9 +- .../bin_sc_rollup_node/configuration.mli | 2 +- src/proto_alpha/bin_sc_rollup_node/daemon.ml | 13 +-- .../main_sc_rollup_node_alpha.ml | 2 +- .../bin_sc_rollup_node/node_context.ml | 2 +- .../bin_sc_rollup_node/node_context.mli | 6 +- .../bin_sc_rollup_node/refutation_game.ml | 2 +- .../refutation_game_event.ml | 2 +- .../sc_rollup_node_errors.ml | 4 +- .../interpreter_benchmarks.ml | 30 +++---- .../interpreter_workload.ml | 32 +++---- .../lib_benchmarks_proto/ticket_benchmarks.ml | 7 +- .../tx_rollup_benchmarks.ml | 2 +- .../lib_client/client_proto_args.ml | 2 +- .../lib_client/client_proto_args.mli | 5 +- .../lib_client/client_proto_context.ml | 32 ++++--- .../lib_client/client_proto_context.mli | 30 +++---- .../lib_client/client_proto_fa12.mli | 2 +- .../lib_client/client_proto_multisig.ml | 39 +++----- .../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 | 8 +- .../lib_client/client_proto_utils.mli | 4 +- src/proto_alpha/lib_client/injection.ml | 29 +++--- src/proto_alpha/lib_client/injection.mli | 4 +- .../lib_client/managed_contract.ml | 18 ++-- src/proto_alpha/lib_client/mockup.ml | 16 ++-- .../lib_client/operation_result.ml | 45 ++++------ .../client_proto_context_commands.ml | 6 +- .../client_proto_fa12_commands.ml | 3 +- .../client_proto_multisig_commands.ml | 12 +-- .../client_proto_programs_commands.ml | 6 +- .../client_proto_stresstest_commands.ml | 69 ++++++-------- .../client_proto_utils_commands.ml | 8 +- .../client_sapling_commands.ml | 4 +- .../lib_dal/dal_plugin_registration.ml | 5 +- .../lib_delegate/baking_commands.ml | 2 +- .../lib_delegate/baking_highwatermarks.ml | 6 +- .../lib_delegate/baking_highwatermarks.mli | 12 +-- src/proto_alpha/lib_delegate/baking_nonces.ml | 4 +- src/proto_alpha/lib_delegate/baking_state.ml | 37 +++----- src/proto_alpha/lib_delegate/baking_state.mli | 7 +- src/proto_alpha/lib_delegate/baking_vdf.ml | 2 +- src/proto_alpha/lib_delegate/block_forge.ml | 4 +- .../client_baking_denunciation.ml | 10 +-- .../lib_delegate/operation_selection.ml | 4 +- .../test/mockup_simulator/mockup_simulator.ml | 20 ++--- .../mockup_simulator/mockup_simulator.mli | 18 ++-- .../test/tenderbrute/lib/tenderbrute.ml | 12 +-- .../test/tenderbrute/lib/tenderbrute.mli | 4 +- .../test/tenderbrute/tenderbrute_main.ml | 2 +- .../lib_delegate/test/test_scenario.ml | 10 +-- .../lib_injector/injector_common.ml | 4 +- .../lib_injector/injector_common.mli | 8 +- .../lib_injector/injector_errors.ml | 7 +- .../lib_injector/injector_errors.mli | 2 +- .../lib_injector/injector_events.ml | 12 +-- .../lib_injector/injector_functor.ml | 17 ++-- .../lib_injector/injector_worker_types.ml | 6 +- src/proto_alpha/lib_injector/l1_operation.ml | 2 +- .../lib_parameters/default_parameters.ml | 4 +- .../lib_parameters/default_parameters.mli | 8 +- src/proto_alpha/lib_plugin/RPC.ml | 63 ++++++------- src/proto_alpha/lib_plugin/test/generators.ml | 12 +-- .../lib_protocol/test/helpers/account.ml | 36 +++----- .../lib_protocol/test/helpers/account.mli | 24 ++--- .../lib_protocol/test/helpers/assert.ml | 12 +-- .../lib_protocol/test/helpers/block.ml | 22 ++--- .../lib_protocol/test/helpers/block.mli | 2 +- .../lib_protocol/test/helpers/context.ml | 13 ++- .../lib_protocol/test/helpers/context.mli | 20 ++--- .../test/helpers/contract_helpers.ml | 2 +- .../test/helpers/dummy_zk_rollup.ml | 6 +- .../lib_protocol/test/helpers/expr_common.ml | 2 +- .../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 | 22 +++-- .../lib_protocol/test/helpers/op.mli | 14 +-- .../test/helpers/operation_generator.ml | 74 ++++++--------- .../test/integration/consensus/test_baking.ml | 12 ++- .../consensus/test_consensus_key.ml | 2 +- .../consensus/test_deactivation.ml | 4 +- .../integration/consensus/test_delegation.ml | 2 +- .../consensus/test_double_baking.ml | 6 +- .../consensus/test_double_endorsement.ml | 20 ++--- .../consensus/test_double_preendorsement.ml | 5 +- .../consensus/test_participation.ml | 2 +- .../test/integration/gas/test_gas_costs.ml | 2 +- .../michelson/test_interpretation.ml | 4 +- .../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 | 14 +-- .../integration/operations/test_reveal.ml | 12 +-- .../integration/operations/test_sc_rollup.ml | 8 +- .../integration/operations/test_voting.ml | 8 +- .../test/integration/test_frozen_bonds.ml | 6 +- .../test/integration/test_token.ml | 40 ++++----- .../validate/manager_operation_helpers.ml | 4 +- .../integration/validate/validate_helpers.ml | 16 ++-- .../test/pbt/test_refutation_game.ml | 7 +- .../test/pbt/test_sc_rollup_encoding.ml | 2 +- .../test/pbt/test_script_comparison.ml | 5 +- .../test/pbt/test_zk_rollup_encoding.ml | 2 +- .../test/unit/test_consensus_key.ml | 8 +- .../test/unit/test_contract_repr.ml | 5 +- .../test/unit/test_operation_repr.ml | 9 +- .../lib_protocol/test/unit/test_receipt.ml | 2 +- .../test/unit/test_sc_rollup_arith.ml | 2 +- .../test_sc_rollup_management_protocol.ml | 2 +- .../test/unit/test_zk_rollup_storage.ml | 12 +-- 185 files changed, 1353 insertions(+), 1745 deletions(-) diff --git a/src/bin_dal_node/main_dal.ml b/src/bin_dal_node/main_dal.ml index 76128dd4471e..95988c36e2f3 100644 --- a/src/bin_dal_node/main_dal.ml +++ b/src/bin_dal_node/main_dal.ml @@ -128,9 +128,7 @@ module Dac_client = struct let tz4_address_parameter () = Tezos_clic.parameter (fun _cctxt s -> let open Lwt_result_syntax in - let*? bls_pkh = - Tezos_crypto.Signature.Bls.Public_key_hash.of_b58check s - in + let*? bls_pkh = Signature.Bls.Public_key_hash.of_b58check s in let pkh : Tezos_crypto.Aggregate_signature.public_key_hash = Tezos_crypto.Aggregate_signature.Bls12_381 bls_pkh in diff --git a/src/lib_base/tzPervasives.ml b/src/lib_base/tzPervasives.ml index 7c53afe62641..0f8194b6bcac 100644 --- a/src/lib_base/tzPervasives.ml +++ b/src/lib_base/tzPervasives.ml @@ -91,6 +91,7 @@ module P2p_rejection = P2p_rejection module Distributed_db_version = Distributed_db_version module Network_version = Network_version include Tezos_crypto.Hashed +module Signature = Tezos_crypto.Signature include Utils.Infix include Error_monad diff --git a/src/lib_base/tzPervasives.mli b/src/lib_base/tzPervasives.mli index e22aadf51a34..444ac18f6b58 100644 --- a/src/lib_base/tzPervasives.mli +++ b/src/lib_base/tzPervasives.mli @@ -104,6 +104,7 @@ module Operation_metadata_list_hash = module Operation_metadata_list_list_hash = Tezos_crypto.Hashed.Operation_metadata_list_list_hash module Protocol_hash = Tezos_crypto.Hashed.Protocol_hash +module Signature = Tezos_crypto.Signature include module type of Utils.Infix diff --git a/src/lib_client_commands/client_keys_commands.ml b/src/lib_client_commands/client_keys_commands.ml index 12e171b03629..d34da200c9bf 100644 --- a/src/lib_client_commands/client_keys_commands.ml +++ b/src/lib_client_commands/client_keys_commands.ml @@ -37,10 +37,10 @@ let algo_param () = ~autocomplete:(fun _ -> return ["ed25519"; "secp256k1"; "p256"; "bls"]) (fun _ name -> match name with - | "ed25519" -> return Tezos_crypto.Signature.Ed25519 - | "secp256k1" -> return Tezos_crypto.Signature.Secp256k1 - | "p256" -> return Tezos_crypto.Signature.P256 - | "bls" -> return Tezos_crypto.Signature.Bls + | "ed25519" -> return Signature.Ed25519 + | "secp256k1" -> return Signature.Secp256k1 + | "p256" -> return Signature.P256 + | "bls" -> return Signature.Bls | name -> failwith "Unknown signature algorithm (%s). Available: 'ed25519', \ @@ -148,11 +148,11 @@ let gen_keys_containing ?(encrypted = false) ?(prefix = false) in let rec loop attempts = let public_key_hash, public_key, secret_key = - Tezos_crypto.Signature.generate_key () + Signature.generate_key () in let hash = - Tezos_crypto.Signature.Public_key_hash.to_b58check - @@ Tezos_crypto.Signature.Public_key.hash public_key + Signature.Public_key_hash.to_b58check + @@ Signature.Public_key.hash public_key in if matches hash then let*? pk_uri = @@ -225,18 +225,18 @@ let rec input_fundraiser_params (cctxt : #Client_context.io_wallet) = let passphrase = Bytes.(cat (of_string email) password) 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 : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.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 = Signature.Secret_key.to_public_key sk in + let pkh = Signature.Public_key.hash pk in let msg = Format.asprintf "Your public Tezos address is %a is that correct?" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in let* b = get_boolean_answer cctxt ~msg ~default:true in @@ -270,9 +270,9 @@ let keys_count_param = (** The kind of info that the [generate_test_keys] command outputs. *) type source = { - pkh : Tezos_crypto.Signature.public_key_hash; - pk : Tezos_crypto.Signature.public_key; - sk : Tezos_crypto.Signature.secret_key; + pkh : Signature.public_key_hash; + pk : Signature.public_key; + sk : Signature.secret_key; } let source_encoding = @@ -281,9 +281,9 @@ let source_encoding = (fun {pkh; pk; sk} -> (pkh, pk, sk)) (fun (pkh, pk, sk) -> {pkh; pk; sk}) (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" Signature.Public_key_hash.encoding) + (req "pk" Signature.Public_key.encoding) + (req "sk" Signature.Secret_key.encoding)) let source_list_encoding = Data_encoding.list source_encoding @@ -344,9 +344,7 @@ let generate_test_keys = List.init_es ~when_negative_length:[] n (fun i -> let alias = alias_prefix i in let pkh, pk, sk = - Tezos_crypto.Signature.generate_key - ~algo:Tezos_crypto.Signature.Ed25519 - () + Signature.generate_key ~algo:Signature.Ed25519 () in let*? pk_uri = Tezos_signer_backends.Unencrypted.make_pk pk in let*? sk_uri = Tezos_signer_backends.Unencrypted.make_sk sk in @@ -555,7 +553,7 @@ let commands network : Client_context.full Tezos_clic.command list = (prefixes ["gen"; "keys"] @@ Secret_key.fresh_alias_param @@ stop) (fun (force, algo) name (cctxt : Client_context.full) -> let* name = Secret_key.of_fresh cctxt force name in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~algo () in + let pkh, pk, sk = Signature.generate_key ~algo () in let*? pk_uri = Tezos_signer_backends.Unencrypted.make_pk pk in let* sk_uri = Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk @@ -572,7 +570,7 @@ let commands network : Client_context.full Tezos_clic.command list = (prefixes ["gen"; "keys"] @@ Secret_key.fresh_alias_param @@ stop) (fun (force, algo, encrypted) name (cctxt : Client_context.full) -> let* name = Secret_key.of_fresh cctxt force name in - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~algo () in + let pkh, pk, sk = Signature.generate_key ~algo () in let*? pk_uri = Tezos_signer_backends.Unencrypted.make_pk pk in let* sk_uri = if encrypted then @@ -670,8 +668,7 @@ let commands network : Client_context.full Tezos_clic.command list = "This command can only be used with the \"unencrypted\" scheme" in let* sk = - Lwt.return - (Tezos_crypto.Signature.Secret_key.of_b58check (Uri.path sk_uri)) + Lwt.return (Signature.Secret_key.of_b58check (Uri.path sk_uri)) in let* sk_uri = Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk @@ -699,7 +696,7 @@ let commands network : Client_context.full Tezos_clic.command list = let*! () = cctxt#message "Tezos address added: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in register_key cctxt ~force (pkh, pk_uri, sk_uri) ?public_key name); @@ -740,7 +737,7 @@ let commands network : Client_context.full Tezos_clic.command list = let*! () = cctxt#message "Tezos address added: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in Public_key.add ~force cctxt name (pk_uri, public_key)); @@ -790,19 +787,13 @@ let commands network : Client_context.full Tezos_clic.command list = return_unit | Some (pkh, pk, skloc) -> ( let*! () = - cctxt#message - "Hash: %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh + cctxt#message "Hash: %a" Signature.Public_key_hash.pp pkh in match pk with | None -> return_unit | Some pk -> let*! () = - cctxt#message - "Public Key: %a" - Tezos_crypto.Signature.Public_key.pp - pk + cctxt#message "Public Key: %a" Signature.Public_key.pp pk in if show_private then match skloc with @@ -934,10 +925,10 @@ let commands network : Client_context.full Tezos_clic.command list = 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 : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) in let*? unencrypted_sk_uri = @@ -962,7 +953,7 @@ let commands network : Client_context.full Tezos_clic.command list = let*! () = cctxt#message "Tezos address added: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in return_unit); diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index 913a66c4b523..b398ccebc349 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -52,25 +52,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 c3f1ccf30655..b70e4f003823 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -52,25 +52,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 0a0d6e94bd55..c45638753b81 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -52,25 +52,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 677c4e97c28f..5ac0b5e377f1 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -51,25 +51,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 d8e08198da3a..9fb572b4805f 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -52,25 +52,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 34de31230d70..9a1e87e46ba0 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -51,25 +51,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 b6fbc2abc388..eed6de81bd0f 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -56,25 +56,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 @@ -276,10 +271,10 @@ struct module Time = Time.Protocol module Bls12_381 = Bls12_381 - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Signature = Tezos_crypto.Signature.V0 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Signature = 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 da8665b1ae01..acde51bfcb0d 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -55,25 +55,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 9b839e68bafa..9089678aae75 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -60,25 +60,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 @@ -310,10 +305,10 @@ struct (List.map Bls12_381_signature.MinPk.unsafe_signature_of_bytes sigs) end - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Signature = Tezos_crypto.Signature.V0 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Signature = 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 d70c827c0e4b..4fb64aefdbda 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -55,25 +55,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 65cfb34c0839..aa8789717ed8 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -65,25 +65,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 @@ -275,10 +270,10 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Signature = Tezos_crypto.Signature.V0 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Signature = 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 5ba5bf28a558..e88e0fa97b44 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -66,25 +66,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 3f92098481b0..ce9d1fbbd5ae 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -65,25 +65,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 @@ -276,10 +271,10 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Signature = Tezos_crypto.Signature.V0 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Signature = 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 7cf7ef20f913..342aa3bb7b56 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -66,25 +66,20 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 944dbcaeb220..35b2c2cd9e4f 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -65,29 +65,23 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Bls.Public_key_hash.t = - Tezos_crypto.Signature.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Signature.Bls.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Bls.Public_key_hash.t = Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Signature.Bls.Public_key.t + and type Bls.t = Signature.Bls.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = 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 @@ -276,11 +270,11 @@ struct end module Time = Time.Protocol - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Bls = Tezos_crypto.Signature.Bls - module Signature = Tezos_crypto.Signature.V0 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Bls = Signature.Bls + module Signature = 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 a45ec842d627..40d6d0810b67 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -65,29 +65,23 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Bls.Public_key_hash.t = - Tezos_crypto.Signature.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Signature.Bls.t - and type Signature.public_key_hash = - 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 + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Bls.Public_key_hash.t = Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Signature.Bls.Public_key.t + and type Bls.t = Signature.Bls.t + and type Signature.public_key_hash = Signature.V0.public_key_hash + and type Signature.public_key = Signature.V0.public_key + and type Signature.t = Signature.V0.t + and type Signature.watermark = Signature.V0.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index cf5efca44aea..e3b99c178149 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -65,30 +65,24 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Bls.Public_key_hash.t = - Tezos_crypto.Signature.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Signature.Bls.t - and type Signature.public_key_hash = - Tezos_crypto.Signature.V1.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.V1.public_key - and type Signature.signature = Tezos_crypto.Signature.V1.signature - and type Signature.t = Tezos_crypto.Signature.V1.t - and type Signature.watermark = Tezos_crypto.Signature.V1.watermark + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Bls.Public_key_hash.t = Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Signature.Bls.Public_key.t + and type Bls.t = Signature.Bls.t + and type Signature.public_key_hash = Signature.V1.public_key_hash + and type Signature.public_key = Signature.V1.public_key + and type Signature.signature = Signature.V1.signature + and type Signature.t = Signature.V1.t + and type Signature.watermark = 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 @@ -305,11 +299,11 @@ struct end module Time = Time.Protocol - module Ed25519 = Tezos_crypto.Signature.Ed25519 - module Secp256k1 = Tezos_crypto.Signature.Secp256k1 - module P256 = Tezos_crypto.Signature.P256 - module Bls = Tezos_crypto.Signature.Bls - module Signature = Tezos_crypto.Signature.V1 + module Ed25519 = Signature.Ed25519 + module Secp256k1 = Signature.Secp256k1 + module P256 = Signature.P256 + module Bls = Signature.Bls + module Signature = 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 e9bdf23351da..9a1b571fde7a 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -65,30 +65,24 @@ module type T = sig and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t - and type Ed25519.Public_key_hash.t = - Tezos_crypto.Signature.Ed25519.Public_key_hash.t - and type Ed25519.Public_key.t = - Tezos_crypto.Signature.Ed25519.Public_key.t - and type Ed25519.t = Tezos_crypto.Signature.Ed25519.t + and type Ed25519.Public_key_hash.t = Signature.Ed25519.Public_key_hash.t + and type Ed25519.Public_key.t = Signature.Ed25519.Public_key.t + and type Ed25519.t = Signature.Ed25519.t and type Secp256k1.Public_key_hash.t = - Tezos_crypto.Signature.Secp256k1.Public_key_hash.t - and type Secp256k1.Public_key.t = - Tezos_crypto.Signature.Secp256k1.Public_key.t - and type Secp256k1.t = Tezos_crypto.Signature.Secp256k1.t - and type P256.Public_key_hash.t = - Tezos_crypto.Signature.P256.Public_key_hash.t - and type P256.Public_key.t = Tezos_crypto.Signature.P256.Public_key.t - and type P256.t = Tezos_crypto.Signature.P256.t - and type Bls.Public_key_hash.t = - Tezos_crypto.Signature.Bls.Public_key_hash.t - and type Bls.Public_key.t = Tezos_crypto.Signature.Bls.Public_key.t - and type Bls.t = Tezos_crypto.Signature.Bls.t - and type Signature.public_key_hash = - Tezos_crypto.Signature.V1.public_key_hash - and type Signature.public_key = Tezos_crypto.Signature.V1.public_key - and type Signature.signature = Tezos_crypto.Signature.V1.signature - and type Signature.t = Tezos_crypto.Signature.V1.t - and type Signature.watermark = Tezos_crypto.Signature.V1.watermark + Signature.Secp256k1.Public_key_hash.t + and type Secp256k1.Public_key.t = Signature.Secp256k1.Public_key.t + and type Secp256k1.t = Signature.Secp256k1.t + and type P256.Public_key_hash.t = Signature.P256.Public_key_hash.t + and type P256.Public_key.t = Signature.P256.Public_key.t + and type P256.t = Signature.P256.t + and type Bls.Public_key_hash.t = Signature.Bls.Public_key_hash.t + and type Bls.Public_key.t = Signature.Bls.Public_key.t + and type Bls.t = Signature.Bls.t + and type Signature.public_key_hash = Signature.V1.public_key_hash + and type Signature.public_key = Signature.V1.public_key + and type Signature.signature = Signature.V1.signature + and type Signature.t = Signature.V1.t + and type Signature.watermark = Signature.V1.watermark and type Micheline.canonical_location = Micheline.canonical_location and type 'a Micheline.canonical = 'a Micheline.canonical and type Z.t = Z.t diff --git a/src/lib_signer_backends/encrypted.ml b/src/lib_signer_backends/encrypted.ml index dca443fd2dbe..45de1d2275b3 100644 --- a/src/lib_signer_backends/encrypted.ml +++ b/src/lib_signer_backends/encrypted.ml @@ -34,13 +34,11 @@ type Tezos_crypto.Base58.data += Encrypted_secp256k1_element of Bytes.t type Tezos_crypto.Base58.data += Encrypted_bls12_381 of Bytes.t -type encrypted_sk = - | Encrypted_aggregate_sk - | Encrypted_sk of Tezos_crypto.Signature.algo +type encrypted_sk = Encrypted_aggregate_sk | Encrypted_sk of Signature.algo type decrypted_sk = | Decrypted_aggregate_sk of Tezos_crypto.Aggregate_signature.Secret_key.t - | Decrypted_sk of Tezos_crypto.Signature.Secret_key.t + | Decrypted_sk of Signature.Secret_key.t open Client_keys @@ -71,20 +69,18 @@ module Raw = struct match (sk : decrypted_sk) with | Decrypted_sk (Ed25519 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk | Decrypted_sk (Secp256k1 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Secp256k1.Secret_key.encoding + Signature.Secp256k1.Secret_key.encoding sk | Decrypted_sk (P256 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.P256.Secret_key.encoding + Signature.P256.Secret_key.encoding sk | Decrypted_sk (Bls sk) | Decrypted_aggregate_sk (Bls12_381 sk) -> - Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Bls.Secret_key.encoding - sk + Data_encoding.Binary.to_bytes_exn Signature.Bls.Secret_key.encoding sk in Bytes.cat salt (Tezos_crypto.Crypto_box.Secretbox.secretbox key msg nonce) @@ -100,51 +96,45 @@ module Raw = struct algo ) with | None, _ -> return_none - | Some bytes, Encrypted_sk Tezos_crypto.Signature.Ed25519 -> ( + | Some bytes, Encrypted_sk Signature.Ed25519 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding bytes with | Some sk -> - return_some - (Decrypted_sk (Ed25519 sk : Tezos_crypto.Signature.Secret_key.t)) + return_some (Decrypted_sk (Ed25519 sk : Signature.Secret_key.t)) | None -> failwith - "Corrupted wallet, deciphered key is not a valid \ - Tezos_crypto.Ed25519 secret key") - | Some bytes, Encrypted_sk Tezos_crypto.Signature.Secp256k1 -> ( + "Corrupted wallet, deciphered key is not a valid Ed25519 secret \ + key") + | Some bytes, Encrypted_sk Signature.Secp256k1 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Secp256k1.Secret_key.encoding + Signature.Secp256k1.Secret_key.encoding bytes with | Some sk -> - return_some - (Decrypted_sk (Secp256k1 sk : Tezos_crypto.Signature.Secret_key.t)) + return_some (Decrypted_sk (Secp256k1 sk : Signature.Secret_key.t)) | None -> failwith - "Corrupted wallet, deciphered key is not a valid \ - Tezos_crypto.Secp256k1 secret key") - | Some bytes, Encrypted_sk Tezos_crypto.Signature.P256 -> ( + "Corrupted wallet, deciphered key is not a valid Secp256k1 \ + secret key") + | Some bytes, Encrypted_sk Signature.P256 -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.P256.Secret_key.encoding + Signature.P256.Secret_key.encoding bytes with | Some sk -> - return_some - (Decrypted_sk (P256 sk : Tezos_crypto.Signature.Secret_key.t)) + return_some (Decrypted_sk (P256 sk : Signature.Secret_key.t)) | None -> failwith - "Corrupted wallet, deciphered key is not a valid \ - Tezos_crypto.P256 secret key") - | ( Some bytes, - (Encrypted_aggregate_sk | Encrypted_sk Tezos_crypto.Signature.Bls) ) - -> ( + "Corrupted wallet, deciphered key is not a valid P256 secret key") + | Some bytes, (Encrypted_aggregate_sk | Encrypted_sk Signature.Bls) -> ( match Data_encoding.Binary.of_bytes_opt - Tezos_crypto.Signature.Bls.Secret_key.encoding + Signature.Bls.Secret_key.encoding bytes with | Some sk -> @@ -304,11 +294,11 @@ let decrypt_payload cctxt ?name encrypted_sk = let* algo, encrypted_sk = match Tezos_crypto.Base58.decode encrypted_sk with | Some (Encrypted_ed25519 encrypted_sk) -> - return (Encrypted_sk Tezos_crypto.Signature.Ed25519, encrypted_sk) + return (Encrypted_sk Signature.Ed25519, encrypted_sk) | Some (Encrypted_secp256k1 encrypted_sk) -> - return (Encrypted_sk Tezos_crypto.Signature.Secp256k1, encrypted_sk) + return (Encrypted_sk Signature.Secp256k1, encrypted_sk) | Some (Encrypted_p256 encrypted_sk) -> - return (Encrypted_sk Tezos_crypto.Signature.P256, encrypted_sk) + return (Encrypted_sk Signature.P256, encrypted_sk) | Some (Encrypted_bls12_381 encrypted_sk) -> return (Encrypted_aggregate_sk, encrypted_sk) | _ -> failwith "Not a Base58Check-encoded encrypted key" @@ -548,25 +538,23 @@ struct let neuterize sk_uri = let open Lwt_result_syntax in let* sk = decrypt C.cctxt sk_uri in - let*? v = - Unencrypted.make_pk (Tezos_crypto.Signature.Secret_key.to_public_key sk) - in + let*? v = Unencrypted.make_pk (Signature.Secret_key.to_public_key sk) in return v let sign ?watermark sk_uri buf = let open Lwt_result_syntax in let* sk = decrypt C.cctxt sk_uri in - return (Tezos_crypto.Signature.sign ?watermark sk buf) + return (Signature.sign ?watermark sk buf) let deterministic_nonce sk_uri buf = let open Lwt_result_syntax in let* sk = decrypt C.cctxt sk_uri in - return (Tezos_crypto.Signature.deterministic_nonce sk buf) + return (Signature.deterministic_nonce sk buf) let deterministic_nonce_hash sk_uri buf = let open Lwt_result_syntax in let* sk = decrypt C.cctxt sk_uri in - return (Tezos_crypto.Signature.deterministic_nonce_hash sk buf) + return (Signature.deterministic_nonce_hash sk buf) let supports_deterministic_nonces _ = Lwt_result_syntax.return_true end diff --git a/src/lib_signer_backends/unix/ledger.available.ml b/src/lib_signer_backends/unix/ledger.available.ml index 4c135d39ea4e..17c304861090 100644 --- a/src/lib_signer_backends/unix/ledger.available.ml +++ b/src/lib_signer_backends/unix/ledger.available.ml @@ -211,9 +211,7 @@ module Ledger_commands = struct let pk = Cstruct.to_bytes pk in TzEndian.set_int8 pk 0 0 ; (* hackish, but works. *) - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding - pk + Data_encoding.Binary.of_bytes_exn Signature.Public_key.encoding pk | Secp256k1 -> let open Libsecp256k1.External in let buf = Bigstring.create (Key.compressed_pk_bytes + 1) in @@ -221,7 +219,7 @@ module Ledger_commands = struct EndianBigstring.BigEndian.set_int8 buf 0 1 ; let _nb_written = Key.write secp256k1_ctx ~pos:1 buf pk in Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding + Signature.Public_key.encoding (Bigstring.to_bytes buf) | Secp256r1 -> ( let open Tezos_crypto.Hacl.P256 in @@ -232,13 +230,11 @@ module Ledger_commands = struct | Some pk -> TzEndian.set_int8 buf 0 2 ; blit_to_bytes pk ~pos:1 buf ; - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key.encoding - buf) + Data_encoding.Binary.of_bytes_exn Signature.Public_key.encoding buf) let get_public_key = public_key_returning_instruction `Get_public_key - let pkh_of_pk = Tezos_crypto.Signature.Public_key.hash + let pkh_of_pk = Signature.Public_key.hash let public_key ?(first_import : Client_context.io_wallet option) hid curve path = @@ -251,7 +247,7 @@ module Ledger_commands = struct cctxt#message "Please validate@ (and write down)@ the public key hash@ \ displayed@ on the Ledger,@ it should be equal@ to `%a`:" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in get_public_key ~prompt:true hid curve path @@ -290,9 +286,7 @@ module Ledger_commands = struct let open Lwt_result_syntax in let msg = Option.fold watermark ~none:base_msg ~some:(fun watermark -> - Bytes.cat - (Tezos_crypto.Signature.bytes_of_watermark watermark) - base_msg) + Bytes.cat (Signature.bytes_of_watermark watermark) base_msg) in let path = Bip32_path.tezos_root @ path in let* hash_opt, signature = @@ -333,10 +327,9 @@ module Ledger_commands = struct match curve with | Ed25519 | Bip32_ed25519 -> let signature = - Tezos_crypto.Signature.Ed25519.of_bytes_exn - (Cstruct.to_bytes signature) + Signature.Ed25519.of_bytes_exn (Cstruct.to_bytes signature) in - return (Tezos_crypto.Signature.of_ed25519 signature) + return (Signature.of_ed25519 signature) | Secp256k1 -> (* Remove parity info *) Cstruct.(set_uint8 signature 0 (get_uint8 signature 0 land 0xfe)) ; @@ -345,10 +338,9 @@ module Ledger_commands = struct let signature = Sign.read_der_exn secp256k1_ctx signature in let bytes = Sign.to_bytes secp256k1_ctx signature in let signature = - Tezos_crypto.Signature.Secp256k1.of_bytes_exn - (Bigstring.to_bytes bytes) + Signature.Secp256k1.of_bytes_exn (Bigstring.to_bytes bytes) in - return (Tezos_crypto.Signature.of_secp256k1 signature) + return (Signature.of_secp256k1 signature) | Secp256r1 -> (* Remove parity info *) Cstruct.(set_uint8 signature 0 (get_uint8 signature 0 land 0xfe)) ; @@ -357,10 +349,8 @@ module Ledger_commands = struct (* We use secp256r1 library to extract P256 DER signature. *) let signature = Sign.read_der_exn secp256k1_ctx signature in let buf = Sign.to_bytes secp256k1_ctx signature in - let signature = - Tezos_crypto.Signature.P256.of_bytes_exn (Bigstring.to_bytes buf) - in - return (Tezos_crypto.Signature.of_p256 signature) + let signature = Signature.P256.of_bytes_exn (Bigstring.to_bytes buf) in + return (Signature.of_p256 signature) let get_deterministic_nonce hid curve path msg = let open Lwt_result_syntax in @@ -384,26 +374,23 @@ module Ledger_id = struct The “ID” of the ledger is the animals (or pkh) corresponding to ["/ed25519/"] (first curve, no path). *) - type t = - | Animals of Ledger_names.t - | Pkh of Tezos_crypto.Signature.public_key_hash + type t = Animals of Ledger_names.t | Pkh of Signature.public_key_hash let animals_of_pkh pkh = - pkh |> Tezos_crypto.Signature.Public_key_hash.to_string - |> Ledger_names.crouching_tiger + pkh |> Signature.Public_key_hash.to_string |> Ledger_names.crouching_tiger let curve = Ledgerwallet_tezos.Ed25519 let get hidapi = let open Lwt_result_syntax in let* pk = Ledger_commands.get_public_key hidapi curve [] in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pkh = Signature.Public_key.hash pk in let animals = animals_of_pkh pkh in return (Animals animals) let pp ppf = function | Animals a -> Ledger_names.pp ppf a - | Pkh pkh -> Tezos_crypto.Signature.Public_key_hash.pp ppf pkh + | Pkh pkh -> Signature.Public_key_hash.pp ppf pkh let to_animals = function Animals a -> a | Pkh pkh -> animals_of_pkh pkh @@ -462,9 +449,7 @@ module Ledger_uri = struct let open Lwt_result_syntax in let host = Uri.host uri in let* ledger = - match - Option.bind host Tezos_crypto.Signature.Public_key_hash.of_b58check_opt - with + match Option.bind host Signature.Public_key_hash.of_b58check_opt with | Some pkh -> return (Ledger_id.Pkh pkh) | None -> ( match Option.bind host parse_animals with @@ -768,19 +753,12 @@ let use_ledger_or_fail ~ledger_uri ?(filter = `None) ?msg {!Signer_implementation.get_public_key} too often. *) module Global_cache : sig val record : - pk_uri -> - pk:Tezos_crypto.Signature.public_key -> - pkh:Tezos_crypto.Signature.public_key_hash -> - unit - - val get : - pk_uri -> - (Tezos_crypto.Signature.public_key_hash * Tezos_crypto.Signature.public_key) - option + pk_uri -> pk:Signature.public_key -> pkh:Signature.public_key_hash -> unit + + val get : pk_uri -> (Signature.public_key_hash * Signature.public_key) option end = struct let cache : - (Tezos_crypto.Signature.Public_key_hash.t - * Tezos_crypto.Signature.Public_key.t) + (Signature.Public_key_hash.t * Signature.Public_key.t) Client_keys.Pk_uri_hashtbl.t = Client_keys.Pk_uri_hashtbl.create 13 @@ -817,7 +795,7 @@ module Signer_implementation : Client_keys.SIGNER = struct let*? v = make_pk_uri (sk :> Uri.t) in return v - let pkh_of_pk = Tezos_crypto.Signature.Public_key.hash + let pkh_of_pk = Signature.Public_key.hash let public_key_maybe_prompt ?(first_import : Client_context.io_wallet option) (pk_uri : pk_uri) = @@ -1046,19 +1024,19 @@ let generic_commands group = let*! () = cctxt#message "* Public Key: %a" - Tezos_crypto.Signature.Public_key.pp + Signature.Public_key.pp pk in let*! () = cctxt#message "* Public Key Hash: %a@\n" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh in match (test_sign, version.app_class) with | true, Tezos -> ( let pkh_bytes = - Tezos_crypto.Signature.Public_key_hash.to_bytes pkh + Signature.Public_key_hash.to_bytes pkh in (* Signing requires validation on the device. *) let*! () = @@ -1078,7 +1056,7 @@ let generic_commands group = pkh_bytes in match - Tezos_crypto.Signature.check + Signature.check ~watermark:Generic_operation pk signature @@ -1087,13 +1065,13 @@ let generic_commands group = | false -> failwith "Fatal: Ledger cannot sign with %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh | true -> let*! () = cctxt#message "Tezos Wallet successfully signed:@ %a." - Tezos_crypto.Signature.pp + Signature.pp signature in return_unit) @@ -1226,14 +1204,14 @@ let baking_commands group = curve path in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pkh = Signature.Public_key.hash pk in let*! () = cctxt#message "@[<v 0>Authorized baking for address: %a@,\ Corresponding full public key: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh - Tezos_crypto.Signature.Public_key.pp + Signature.Public_key.pp pk in return_some ())); @@ -1365,14 +1343,14 @@ let baking_commands group = curve path in - let pkh = Tezos_crypto.Signature.Public_key.hash pk in + let pkh = Signature.Public_key.hash pk in let*! () = cctxt#message "@[<v 0>Authorized baking for address: %a@,\ Corresponding full public key: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh - Tezos_crypto.Signature.Public_key.pp + Signature.Public_key.pp pk in return_some ())); diff --git a/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml b/src/proto_001_PtCJ7pwo/lib_client/operation_result.ml index 2b326f10df90..f99e55d74c8b 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -416,7 +416,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -434,7 +434,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %s@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_002_PsYLVpVv/lib_client/operation_result.ml b/src/proto_002_PsYLVpVv/lib_client/operation_result.ml index cc58ebb6449c..1600023430f5 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -420,7 +420,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -438,7 +438,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %s@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_003_PsddFKi3/lib_client/operation_result.ml b/src/proto_003_PsddFKi3/lib_client/operation_result.ml index 6ab00114a84a..6db37dbdebc2 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -449,7 +449,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_004_Pt24m4xi/lib_client/operation_result.ml b/src/proto_004_Pt24m4xi/lib_client/operation_result.ml index 6ab00114a84a..6db37dbdebc2 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -449,7 +449,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_005_PsBabyM1/lib_client/operation_result.ml b/src/proto_005_PsBabyM1/lib_client/operation_result.ml index d551f655cc59..46c3d69989cb 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Fees (pkh, l) -> Format.asprintf "fees(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh Cycle.pp l | Deposits (pkh, l) -> Format.asprintf "deposits(%a,%a)" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -436,7 +436,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -454,7 +454,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period 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 e761d6d1ca5f..d83fe226c32a 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -260,7 +260,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -271,7 +271,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -301,9 +301,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -325,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -358,7 +356,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -373,17 +371,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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_006_PsCARTHA/lib_client/client_proto_context.mli b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli index b4623325720f..92adcff6c987 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_context.mli @@ -167,7 +167,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_006_PsCARTHA/lib_client/operation_result.ml b/src/proto_006_PsCARTHA/lib_client/operation_result.ml index 6fa1447fe31f..c9c85f2645f6 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -432,7 +432,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -450,7 +450,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period diff --git a/src/proto_007_PsDELPH1/lib_client/operation_result.ml b/src/proto_007_PsDELPH1/lib_client/operation_result.ml index ac634cc2ba1b..93b83f017b7b 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -428,7 +428,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -446,7 +446,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %a@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Ballot:@,From: %a@,Period: %a@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Voting_period.pp period 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 72a72102fc06..ac9266343c64 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -309,7 +309,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -320,7 +320,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -350,9 +350,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -400,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -433,7 +431,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -448,17 +446,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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.mli b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli index 0ac2316b003c..fc717f724f73 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli +++ b/src/proto_008_PtEdo2Zk/lib_client/client_proto_context.mli @@ -196,7 +196,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml b/src/proto_008_PtEdo2Zk/lib_client/operation_result.ml index d96042de70c3..d2d74bbde990 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -435,7 +435,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -453,7 +453,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -472,7 +472,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 eb7b4394bde2..61064f3c23e4 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -319,7 +319,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -330,7 +330,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -360,9 +360,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -410,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -443,7 +441,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -458,17 +456,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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.mli b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli index 628d22b66b57..215ff3b60060 100644 --- a/src/proto_009_PsFLoren/lib_client/client_proto_context.mli +++ b/src/proto_009_PsFLoren/lib_client/client_proto_context.mli @@ -196,7 +196,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_009_PsFLoren/lib_client/operation_result.ml b/src/proto_009_PsFLoren/lib_client/operation_result.ml index e2d1f7aa6554..b56c51b4b885 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -440,7 +440,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -467,7 +467,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -486,7 +486,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 1cecba8b1d76..5a683c4cf432 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -346,7 +346,7 @@ let originate_contract (cctxt : #full) ~chain ~block ?confirmations ?dry_run (List.length contracts) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -357,7 +357,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -387,9 +387,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -437,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -470,7 +468,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -485,17 +483,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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.mli b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli index 950b10922ecc..85cf93811f68 100644 --- a/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli +++ b/src/proto_010_PtGRANAD/lib_client/client_proto_context.mli @@ -205,7 +205,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_010_PtGRANAD/lib_client/operation_result.ml b/src/proto_010_PtGRANAD/lib_client/operation_result.ml index 04862527c1ed..813e4dc0801f 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -441,7 +441,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -468,7 +468,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -487,7 +487,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 e791517f5ebd..a8d917d02bdb 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -390,7 +390,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -401,7 +401,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -431,9 +431,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -481,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -514,7 +512,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -529,17 +527,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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.mli b/src/proto_011_PtHangz2/lib_client/client_proto_context.mli index 0277fd9ba994..19f564a0e5cc 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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -227,7 +227,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_011_PtHangz2/lib_client/operation_result.ml b/src/proto_011_PtHangz2/lib_client/operation_result.ml index 3fc2db86c97a..92dcf24f9f1f 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source Client_proto_args.tez_sym Tez.pp @@ -483,7 +483,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -510,7 +510,7 @@ let rec pp_contents_and_result_list : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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 "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -529,7 +529,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 1749004e3dfd..f1c29fc97739 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -426,7 +426,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -437,7 +437,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -467,9 +467,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -517,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -550,7 +548,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -565,17 +563,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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/client_proto_context.mli b/src/proto_012_Psithaca/lib_client/client_proto_context.mli index 67cac9a92464..3aed4fae5943 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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.Public_key_hash.t -> + Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -250,7 +250,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; diff --git a/src/proto_012_Psithaca/lib_client/operation_result.ml b/src/proto_012_Psithaca/lib_client/operation_result.ml index 9e66e3366b2d..f9d94f94ef58 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate endorsement_power | Single_and_result @@ -609,7 +609,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -618,7 +618,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -628,7 +628,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 c0350a0b184e..b0c48d592ae2 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -473,7 +473,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -484,7 +484,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -514,9 +514,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -564,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -597,7 +595,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -612,17 +610,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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/client_proto_context.mli b/src/proto_013_PtJakart/lib_client/client_proto_context.mli index 4a379b57e23b..76df19dc2eb6 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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.Public_key_hash.t -> + Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -284,7 +284,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -432,8 +432,8 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> diff --git a/src/proto_013_PtJakart/lib_client/operation_result.ml b/src/proto_013_PtJakart/lib_client/operation_result.ml index 5e257454adec..52aa931c23eb 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.V0.Public_key_hash.pp + 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.V0.Public_key.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.equal + Signature.V0.Public_key_hash.equal baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate endorsement_power | Single_and_result @@ -1035,7 +1035,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1044,7 +1044,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -1054,7 +1054,7 @@ let rec pp_contents_and_result_list : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 cfbcdf95ac57..be4359ebe511 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.V0.Public_key.hash src_pk in + let source = Signature.V0.Public_key.hash src_pk in delegate_contract cctxt ~chain @@ -507,7 +507,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -518,7 +518,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -548,9 +548,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -598,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -630,7 +628,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -645,17 +643,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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/client_proto_context.mli b/src/proto_014_PtKathma/lib_client/client_proto_context.mli index 4d46ef846db0..533b8b036810 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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.Public_key_hash.t -> + Signature.V0.Public_key_hash.t -> Tez.t option tzresult Lwt.t val build_delegate_operation : @@ -308,7 +308,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -456,8 +456,8 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> diff --git a/src/proto_014_PtKathma/lib_client/operation_result.ml b/src/proto_014_PtKathma/lib_client/operation_result.ml index a22c4071415c..515d02156fae 100644 --- a/src/proto_014_PtKathma/lib_client/operation_result.ml +++ b/src/proto_014_PtKathma/lib_client/operation_result.ml @@ -96,14 +96,13 @@ let pp_internal_operation ppf (Internal_contents {operation; source; _}) = Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp ppf delegate) + | Some delegate -> Signature.V0.Public_key_hash.pp ppf delegate) | Event {ty; tag; payload} -> Format.fprintf ppf @@ -170,7 +169,7 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate) | Reveal key -> Format.fprintf @@ -178,14 +177,13 @@ let pp_manager_operation_content (type kind) source ppf "Revelation of manager public key:@,Contract: %a@,Key: %a" Contract.pp source - Tezos_crypto.Signature.V0.Public_key.pp + 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.V0.Public_key_hash.pp ppf delegate) + | Some delegate -> Signature.V0.Public_key_hash.pp ppf delegate) | Register_global_constant {value} -> Format.fprintf ppf @@ -385,11 +383,9 @@ 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.V0.Public_key_hash.equal - baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.equal baker Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -871,11 +867,7 @@ let pp_manager_operation_result ppf Manager_operation_result {balance_updates; operation_result; internal_operation_results} ) = Format.fprintf ppf "@[<v 2>Manager signed operations:" ; - Format.fprintf - ppf - "@,From: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp - source ; + Format.fprintf ppf "@,From: %a" 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 ; Format.fprintf ppf "@,Gas limit: %a" Gas.Arith.pp_integral gas_limit ; @@ -946,7 +938,7 @@ let pp_contents_and_result : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate preendorsement_power | ( Endorsement {level; _}, @@ -962,14 +954,14 @@ let pp_contents_and_result : level pp_balance_updates balance_updates - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate endorsement_power | Dal_slot_availability _, Dal_slot_availability_result {delegate} -> Format.fprintf ppf "@[<v 2>Slot availability:@,Delegate: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> @@ -1008,7 +1000,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1016,7 +1008,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -1025,7 +1017,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp 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 9fe2c90e2606..387373af5c6a 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.V0.Public_key_hash.of_b58check_opt s with + match 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) @@ -66,8 +66,8 @@ let alias_or_literal ~from_alias ~from_key = type wallet_entry = { alias : string; - public_key_hash : Tezos_crypto.Signature.Bls.Public_key_hash.t; - public_key : Tezos_crypto.Signature.Bls.Public_key.t option; + public_key_hash : Signature.Bls.Public_key_hash.t; + public_key : Signature.Bls.Public_key.t option; secret_key_uri : Client_keys_v0.aggregate_sk_uri option; } @@ -107,12 +107,12 @@ let bls_pkh_parameter () = return pkh in let from_key s = - Tezos_crypto.Signature.Bls.Public_key_hash.of_b58check s |> Lwt.return + Signature.Bls.Public_key_hash.of_b58check s |> Lwt.return in alias_or_literal ~from_alias ~from_key s) let conv_bls_pkh_to_l2_addr pkh = - Tezos_crypto.Signature.Bls.Public_key_hash.to_b58check pkh + Signature.Bls.Public_key_hash.to_b58check pkh |> Tx_rollup_l2_address.of_b58check_exn let bls_pkh_param ?(name = "public key hash") @@ -146,7 +146,7 @@ let bls_sk_uri_param ?(name = "secret key") ?(desc = "Bls secret key to use.") = let signature_parameter () = Tezos_clic.parameter (fun _cctxt s -> - Tezos_crypto.Signature.Bls.of_b58check s |> Lwt.return) + Signature.Bls.of_b58check s |> Lwt.return) let signature_arg = Tezos_clic.arg @@ -342,7 +342,7 @@ let craft_withdraw ~counter ~signer ~destination ~ticket_hash ~qty = let aggregate_signature signatures = let open Result_syntax in - match Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures with + match Signature.Bls.aggregate_signature_opt signatures with | Some res -> return res | None -> error_with "aggregate_signature" @@ -369,7 +369,7 @@ let conv_counter = let signer_to_address : Tx_rollup_l2_batch.signer -> Tx_rollup_l2_address.t = function - | Bls_pk pk -> Tezos_crypto.Signature.Bls.Public_key.hash pk + | Bls_pk pk -> Signature.Bls.Public_key.hash pk | L2_addr addr -> addr let wait_for_synchronized ?(quiet = false) @@ -443,7 +443,7 @@ let signer_parameter = match Tx_rollup_l2_address.of_b58check_opt s with | Some pkh -> return @@ Tx_rollup_l2_batch.L2_addr pkh | None -> ( - match Tezos_crypto.Signature.Bls.Public_key.of_b58check_opt s with + match Signature.Bls.Public_key.of_b58check_opt s with | Some pk -> return @@ Tx_rollup_l2_batch.Bls_pk pk | None -> failwith "cannot parse %s to get a valid signer" s)) @@ -687,7 +687,7 @@ let prepare_operation_parameters cctxt signer counter = | Some pk -> ok pk | None -> error_with "missing signer public key in the wallet" in - let signer_addr = Tezos_crypto.Signature.Bls.Public_key.hash signer_pk in + let signer_addr = Signature.Bls.Public_key.hash signer_pk in let* () = wait_for_synchronized cctxt in let* counter = match counter with @@ -825,10 +825,7 @@ let sign_transaction () = let*? aggregated_signature = aggregate_signature signatures in let*! () = - cctxt#message - "@[%a@]" - Tezos_crypto.Signature.Bls.pp - aggregated_signature + cctxt#message "@[%a@]" Signature.Bls.pp aggregated_signature in return_unit else @@ -837,7 +834,7 @@ let sign_transaction () = "@[%a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.pp_print_string ppf ";") - Tezos_crypto.Signature.Bls.pp) + Signature.Bls.pp) signatures in return_unit) 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 c663605ad08c..41e2f1e35d78 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.V0.Ed25519 _pk -> - let pk = Size.of_int Tezos_crypto.Signature.Ed25519.size in - let signature = Size.of_int Tezos_crypto.Signature.V0.size in + | Signature.V0.Ed25519 _pk -> + let pk = Size.of_int Signature.Ed25519.size in + let signature = Size.of_int Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message - | Tezos_crypto.Signature.V0.Secp256k1 _pk -> - let pk = Size.of_int Tezos_crypto.Signature.Secp256k1.size in - let signature = Size.of_int Tezos_crypto.Signature.V0.size in + | Signature.V0.Secp256k1 _pk -> + let pk = Size.of_int Signature.Secp256k1.size in + let signature = Size.of_int Signature.V0.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message - | Tezos_crypto.Signature.V0.P256 _pk -> - let pk = Size.of_int Tezos_crypto.Signature.P256.size in - let signature = Size.of_int Tezos_crypto.Signature.V0.size in + | Signature.V0.P256 _pk -> + let pk = Size.of_int Signature.P256.size in + let signature = Size.of_int 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/tx_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 2dcbcd6c3eb8..d9823c555b37 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -254,7 +254,7 @@ let unique_ticket_id = let gen_l2_account rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in - Tezos_crypto.Signature.Bls.generate_key ~seed () + Signature.Bls.generate_key ~seed () let hash_key_exn ctxt ~ticketer ~typ ~contents ~owner = let ticketer = Micheline.root @@ Expr.from_string ticketer in 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 7c7d29a04b4c..d0af983ca345 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.V0.Public_key.hash src_pk in + let source = 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.V0.Public_key.hash src_pk in + let source = 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 @@ -614,7 +614,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -625,7 +625,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -655,9 +655,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -705,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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = Signature.V0.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -737,7 +735,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -752,17 +750,17 @@ 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.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) + (Signature.V0.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V0.public_key pk in + let sk = 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/client_proto_context.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_context.mli index 627b2d80098b..4d97f637c14a 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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.Public_key_hash.t -> + 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.V0.public_key -> + consensus_pk:Signature.V0.public_key -> manager_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> - Tezos_crypto.Signature.V0.public_key -> + 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_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 -> + consensus_pkh:Signature.V0.public_key_hash -> + ?destination:Signature.V0.public_key_hash -> + delegate: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.V0.Public_key.hash} [src_pk]. *) + is {!Signature.V0.Public_key.hash} [src_pk]. *) val register_as_delegate : #Protocol_client_context.full -> chain:Shell_services.chain -> @@ -398,7 +398,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -572,8 +572,8 @@ val originate_tx_rollup : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Z.t -> - source:Tezos_crypto.Signature.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.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.V0.public_key_hash -> - src_pk:Tezos_crypto.Signature.V0.public_key -> + source:Signature.V0.public_key_hash -> + src_pk:Signature.V0.public_key -> src_sk:Client_keys_v0.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> diff --git a/src/proto_015_PtLimaPt/lib_client/operation_result.ml b/src/proto_015_PtLimaPt/lib_client/operation_result.ml index f331139a9bab..052d4e863585 100644 --- a/src/proto_015_PtLimaPt/lib_client/operation_result.ml +++ b/src/proto_015_PtLimaPt/lib_client/operation_result.ml @@ -96,14 +96,13 @@ let pp_internal_operation ppf (Internal_operation {operation; source; _}) = Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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.V0.Public_key_hash.pp ppf delegate) + | Some delegate -> Signature.V0.Public_key_hash.pp ppf delegate) | Event {ty; tag; payload} -> Format.fprintf ppf @@ -170,7 +169,7 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate) | Reveal key -> Format.fprintf @@ -178,14 +177,13 @@ let pp_manager_operation_content (type kind) source ppf "Revelation of manager public key:@,Contract: %a@,Key: %a" Contract.pp source - Tezos_crypto.Signature.V0.Public_key.pp + 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.V0.Public_key_hash.pp ppf delegate) + | Some delegate -> Signature.V0.Public_key_hash.pp ppf delegate) | Register_global_constant {value} -> Format.fprintf ppf @@ -215,8 +213,8 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "Update_consensus_key:@,Public key hash: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp - (Tezos_crypto.Signature.V0.Public_key.hash pk) + Signature.V0.Public_key_hash.pp + (Signature.V0.Public_key.hash pk) | Tx_rollup_origination -> Format.fprintf ppf @@ -432,11 +430,9 @@ 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.V0.Public_key_hash.equal - baker - Tezos_crypto.Signature.V0.Public_key_hash.zero + Signature.V0.Public_key_hash.equal baker Signature.V0.Public_key_hash.zero then Format.fprintf ppf "the baker who will include this operation" - else Tezos_crypto.Signature.V0.Public_key_hash.pp ppf baker + else Signature.V0.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -1002,11 +998,7 @@ let pp_manager_operation_result ppf Manager_operation_result {balance_updates; operation_result; internal_operation_results} ) = Format.fprintf ppf "@[<v 2>Manager signed operations:" ; - Format.fprintf - ppf - "@,From: %a" - Tezos_crypto.Signature.V0.Public_key_hash.pp - source ; + Format.fprintf ppf "@,From: %a" 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 ; Format.fprintf ppf "@,Gas limit: %a" Gas.Arith.pp_integral gas_limit ; @@ -1101,7 +1093,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Slot availability:@,Delegate: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> @@ -1140,7 +1132,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1148,7 +1140,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -1157,7 +1149,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp source period Protocol_hash.pp @@ -1173,11 +1165,11 @@ let pp_contents_and_result : Consensus key hash: %a@,\ Delegate: %a@,\ Destination: %a%s%a@]" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp consensus_key - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp delegate - Tezos_crypto.Signature.V0.Public_key_hash.pp + 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_protocol/test/helpers/op.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml index db20e37d697e..20cc879d3ec7 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml @@ -517,7 +517,7 @@ let activation ctxt (pkh : Tezos_crypto.Signature.V0.Public_key_hash.t) | _ -> failwith "Wrong public key hash : %a - Commitments must be activated with an \ - Tezos_crypto.Ed25519 encrypted public key hash" + Ed25519 encrypted public key hash" Tezos_crypto.Signature.V0.Public_key_hash.pp pkh) >|=? fun id -> 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 5ba47d702767..fae2e10c21b1 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 @@ -96,13 +96,10 @@ let empty_context : Context_l2.t = empty_storage let rng_state = Random.State.make_self_init () -let gen_l1_address ?seed () = - Tezos_crypto.Signature.V0.generate_key ~algo:Ed25519 ?seed () +let gen_l1_address ?seed () = Signature.V0.generate_key ~algo:Ed25519 ?seed () let gen_l2_address () = - let pkh, public_key, secret_key = - Tezos_crypto.Signature.Bls.generate_key () - in + let pkh, public_key, secret_key = Signature.Bls.generate_key () in (secret_key, public_key, pkh) (** [make_unit_ticket_key ctxt ticketer l2_address] computes the key hash of @@ -156,7 +153,7 @@ let gen_n_ticket_hash n = | Error _ -> raise (Invalid_argument "Failed to forge tickets") let sign_transaction : - Tezos_crypto.Signature.Bls.Secret_key.t list -> + Signature.Bls.Secret_key.t list -> ('signer, 'content) Tx_rollup_l2_batch.V1.transaction -> Tx_rollup_l2_batch.V1.signature list = fun sks transaction -> @@ -168,7 +165,7 @@ let sign_transaction : Tx_rollup_l2_batch.V1.transaction_encoding transaction in - List.map (fun sk -> Tezos_crypto.Signature.Bls.sign sk buf) sks + List.map (fun sk -> Signature.Bls.sign sk buf) sks type Environment.Error_monad.error += Test_error of string 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 c2452be7cfa7..eb61f0dd7c42 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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = 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.V0.Public_key_hash.of_b58check_exn pkh in - assert (Tezos_crypto.Signature.V0.Public_key_hash.equal pkh pkh') ; + let pkh = Signature.V0.Public_key_hash.of_b58check_exn pkh in + assert (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.V0.Public_key_hash.of_b58check_exn + 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_tx_rollup.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_tx_rollup.ml index f63ecad4834d..f7ae246ea29a 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.V0.Public_key_hash.pp - Tezos_crypto.Signature.V0.Public_key_hash.( = ) + Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.( = ) let raw_level_testable = Alcotest.testable Raw_level.pp Raw_level.( = ) @@ -327,9 +327,7 @@ let gen_l2_account ?rng_state () = Bytes.init 32 (fun _ -> char_of_int @@ Random.State.int rng_state 255)) rng_state in - let pkh, public_key, secret_key = - Tezos_crypto.Signature.Bls.generate_key ?seed () - in + let pkh, public_key, secret_key = Signature.Bls.generate_key ?seed () in (secret_key, public_key, pkh) (** [make_ticket_key ty contents ticketer tx_rollup] computes the ticket hash @@ -2503,8 +2501,7 @@ module Rejection = struct Tx_rollup_l2_helpers.sign_transaction signers transaction in let signature = - assert_some - @@ Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures + assert_some @@ Signature.Bls.aggregate_signature_opt signatures in let batch = Tx_rollup_l2_batch.V1. 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 944803d64b63..cfbb750ccd66 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 @@ -88,7 +88,7 @@ let protos = type secret_account = { blinded_public_key_hash : Blinded_public_key_hash.t; - account : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + account : Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -103,23 +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.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk) 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 + let pk = Signature.V0.Secret_key.to_public_key sk in + let pkh = 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.Ed25519.Public_key_hash.of_b58check_exn pkh - in - assert (Tezos_crypto.Signature.V0.Public_key_hash.equal (Ed25519 pkh) pkh') ; + let pkh = Signature.Ed25519.Public_key_hash.of_b58check_exn pkh in + assert (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_tx_rollup_l2_encoding.ml b/src/proto_015_PtLimaPt/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index 7bb71f335b23..cef46fea7eeb 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 @@ -47,9 +47,7 @@ let l2_address, bls_pk = `Hex "8fee216367c463821f82c942a1cee3a01469b1da782736ca269a2accea6e0cc4" |> Hex.to_bytes_exn in - let pkh, public_key, _secret_key = - Tezos_crypto.Signature.Bls.generate_key ~seed:ikm () - in + let pkh, public_key, _secret_key = Signature.Bls.generate_key ~seed:ikm () in (pkh, public_key) let signer_gen : Signer_indexable.either QCheck2.Gen.t = @@ -76,7 +74,7 @@ let idx_l2_address_gen = oneof [idx_l2_address_idx_gen; return idx_l2_address_value] let public_key_hash = - Tezos_crypto.Signature.V0.Public_key_hash.of_b58check_exn + Signature.V0.Public_key_hash.of_b58check_exn "tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU" let public_key_hash_gen = @@ -90,7 +88,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.V0.Public_key_hash.of_b58check_exn ticketer_b58 + 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/unit/test_tx_rollup_l2_apply.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index b1d627104c6d..66b65558e3d0 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.V0.Public_key_hash.zero +let pkh = Signature.V0.Public_key_hash.zero let ((_, pk1, addr1) as l2_addr1) = gen_l2_address () @@ -84,7 +84,7 @@ let expect_error_status ~msg error status cont = let aggregate_signature_exn : signature list -> signature = fun signatures -> - match Tezos_crypto.Signature.Bls.aggregate_signature_opt signatures with + match Signature.Bls.aggregate_signature_opt signatures with | Some res -> res | None -> raise (Invalid_argument "aggregate_signature_exn") @@ -127,7 +127,7 @@ let pp_metadata fmt Tx_rollup_l2_context_sig.{counter; public_key} = fmt "{counter=%d; public_key=%a}" counter - Tezos_crypto.Signature.Bls.Public_key.pp + Signature.Bls.Public_key.pp public_key let eq_metadata = Alcotest.of_pp pp_metadata @@ -154,7 +154,7 @@ let pp_withdrawal fmt = function Format.fprintf fmt "{claimer=%a; ticket_hash=%a; amount=%a}" - Tezos_crypto.Signature.V0.Public_key_hash.pp + Signature.V0.Public_key_hash.pp claimer Ticket_hash.pp ticket_hash @@ -280,9 +280,7 @@ let batch_from_transfers inputs = (fun all_sks input -> List.fold_left (fun acc (sk, _, _, _, _, _) -> - if - List.mem ~equal:Tezos_crypto.Signature.Bls.Secret_key.equal sk acc - then acc + if List.mem ~equal:Signature.Bls.Secret_key.equal sk acc then acc else sk :: acc) [] input diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml index 4cc52ecfdacc..18cae2c014ea 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml @@ -413,7 +413,7 @@ module Context_RPC = struct type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; counter : int64; - public_key : Tezos_crypto.Signature.Bls.Public_key.t; + public_key : Signature.Bls.Public_key.t; } let address_metadata_encoding = @@ -424,7 +424,7 @@ module Context_RPC = struct @@ obj3 (req "index" Tx_rollup_l2_address.Indexable.index_encoding) (req "counter" int64) - (req "public_key" Tezos_crypto.Signature.Bls.Public_key.encoding)) + (req "public_key" Signature.Bls.Public_key.encoding)) let balance = Tezos_rpc.Service.get_service @@ -496,8 +496,7 @@ module Context_RPC = struct "Get the BLS public key associated to the given address, or null if \ the address has not performed any transfer or withdraw on the rollup." ~query:Tezos_rpc.Query.empty - ~output: - (Data_encoding.option Tezos_crypto.Signature.Bls.Public_key.encoding) + ~output:(Data_encoding.option Signature.Bls.Public_key.encoding) Tezos_rpc.Path.( path / "addresses" /: Arg.address_indexable / "public_key") diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml index 8549eb933e10..4241399ae2f0 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.V0.public_key_hash; + signer : Signature.V0.public_key_hash; transactions : Tx_queue.t; mutable incr_context : Context.t; lock : Lwt_mutex.t; @@ -158,7 +158,7 @@ let on_register state ~apply (tr : L2_transaction.t) = let open Lwt_result_syntax in Lwt_mutex.with_lock state.lock @@ fun () -> let*? aggregated_signature = - match Tezos_crypto.Signature.Bls.aggregate_signature_opt tr.signatures with + match Signature.Bls.aggregate_signature_opt tr.signatures with | Some s -> ok s | None -> error_with "could not aggregate signatures of transaction" in @@ -241,7 +241,7 @@ module Types = struct type nonrec state = state type parameters = { - signer : Tezos_crypto.Signature.V0.public_key_hash; + signer : 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/fancy_l2block.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml index 776edf8b43f1..d72cb447004e 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml @@ -102,7 +102,7 @@ let signer_value ctxt signer = | Left _ -> assert false) | Right Tx_rollup_l2_batch.(L2_addr _) -> return signer | Right Tx_rollup_l2_batch.(Bls_pk pk) -> - let addr = Tezos_crypto.Signature.Bls.Public_key.hash pk in + let addr = Signature.Bls.Public_key.hash pk in return (value (Tx_rollup_l2_batch.L2_addr addr) |> forget) let transaction_replace_indexes ctxt transaction = @@ -280,7 +280,7 @@ let l2_message_encoding = (req "result" transaction_result_encoding)))) (req "withdrawals" (list Tx_rollup_withdraw.encoding)) (req "indexes" indexes_encoding) - (req "aggregated_signature" Tezos_crypto.Signature.Bls.encoding)) + (req "aggregated_signature" Signature.Bls.encoding)) (function | Ok_batch { @@ -314,7 +314,7 @@ let l2_message_encoding = "transactions" (list Tx_rollup_l2_batch.V1.transaction_encoding)) (req "errors" Error_monad.trace_encoding) - (req "aggregated_signature" Tezos_crypto.Signature.Bls.encoding)) + (req "aggregated_signature" Signature.Bls.encoding)) (function | Failing_batch {transactions; reasons; aggregated_signature} -> Some (transactions, reasons, aggregated_signature) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml index e4c2f6781956..1f2b690b7dbb 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml @@ -38,13 +38,13 @@ let encoding = (fun (transaction, signatures) -> {transaction; signatures}) @@ obj2 (req "transaction" Tx_rollup_l2_batch.V1.transaction_encoding) - (req "signatures" (list Tezos_crypto.Signature.Bls.encoding)) + (req "signatures" (list Signature.Bls.encoding)) let batch l = let contents = List.map (fun {transaction; _} -> transaction) l in let aggregated_signature = List.concat_map (fun {signatures; _} -> signatures) l - |> Tezos_crypto.Signature.Bls.aggregate_signature_opt + |> Signature.Bls.aggregate_signature_opt in match aggregated_signature with | None -> error_with "Cannot aggregate signatures" diff --git a/src/proto_alpha/bin_sc_rollup_node/batcher.ml b/src/proto_alpha/bin_sc_rollup_node/batcher.ml index 71cbb62d919f..0460e4733c5e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/batcher.ml +++ b/src/proto_alpha/bin_sc_rollup_node/batcher.ml @@ -67,7 +67,7 @@ module Make (Simulation : Simulation.S) : S = struct type state = { node_ctxt : Node_context.ro; - signer : Tezos_crypto.Signature.public_key_hash; + signer : Signature.public_key_hash; conf : Configuration.batcher; messages : Message_queue.t; batched : Batched_messages.t; @@ -260,7 +260,7 @@ module Make (Simulation : Simulation.S) : S = struct type parameters = { node_ctxt : Node_context.ro; - signer : Tezos_crypto.Signature.public_key_hash; + signer : Signature.public_key_hash; conf : Configuration.batcher; } end diff --git a/src/proto_alpha/bin_sc_rollup_node/configuration.ml b/src/proto_alpha/bin_sc_rollup_node/configuration.ml index 92e338776b9c..a599a2cf6f92 100644 --- a/src/proto_alpha/bin_sc_rollup_node/configuration.ml +++ b/src/proto_alpha/bin_sc_rollup_node/configuration.ml @@ -38,7 +38,7 @@ module Operator_purpose_map = Map.Make (struct let compare = Stdlib.compare end) -type operators = Tezos_crypto.Signature.Public_key_hash.t Operator_purpose_map.t +type operators = Signature.Public_key_hash.t Operator_purpose_map.t type fee_parameters = Injection.fee_parameter Operator_purpose_map.t @@ -188,12 +188,12 @@ let protocol_max_batch_size = shell = {branch = Block_hash.zero}; protocol_data = { - signature = Some Tezos_crypto.Signature.zero; + signature = Some Signature.zero; contents = Single (Manager_operation { - source = Tezos_crypto.Signature.Public_key_hash.zero; + source = Signature.Public_key_hash.zero; fee = Tez.of_mutez_exn Int64.max_int; counter = Manager_counter.Internal_for_tests.of_int max_int; gas_limit = @@ -318,8 +318,7 @@ let operator_purpose_map_encoding encoding = Data_encoding.Json.encoding let operators_encoding = - operator_purpose_map_encoding (fun _ -> - Tezos_crypto.Signature.Public_key_hash.encoding) + operator_purpose_map_encoding (fun _ -> Signature.Public_key_hash.encoding) let fee_parameter_encoding purpose = let open Data_encoding in diff --git a/src/proto_alpha/bin_sc_rollup_node/configuration.mli b/src/proto_alpha/bin_sc_rollup_node/configuration.mli index 22058666b750..73237ec9044b 100644 --- a/src/proto_alpha/bin_sc_rollup_node/configuration.mli +++ b/src/proto_alpha/bin_sc_rollup_node/configuration.mli @@ -39,7 +39,7 @@ type purpose = Publish | Add_messages | Cement | Timeout | Refute module Operator_purpose_map : Map.S with type key = purpose -type operators = Tezos_crypto.Signature.Public_key_hash.t Operator_purpose_map.t +type operators = Signature.Public_key_hash.t Operator_purpose_map.t type fee_parameters = Injection.fee_parameter Operator_purpose_map.t diff --git a/src/proto_alpha/bin_sc_rollup_node/daemon.ml b/src/proto_alpha/bin_sc_rollup_node/daemon.ml index 0d8efa5b13ad..9cb48ef7bb8f 100644 --- a/src/proto_alpha/bin_sc_rollup_node/daemon.ml +++ b/src/proto_alpha/bin_sc_rollup_node/daemon.ml @@ -440,18 +440,13 @@ module Make (PVM : Pvm.S) = struct |> List.fold_left (fun acc (purpose, operator) -> let purposes = - match - Tezos_crypto.Signature.Public_key_hash.Map.find operator acc - with + match Signature.Public_key_hash.Map.find operator acc with | None -> [purpose] | Some ps -> purpose :: ps in - Tezos_crypto.Signature.Public_key_hash.Map.add - operator - purposes - acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty - |> Tezos_crypto.Signature.Public_key_hash.Map.bindings + Signature.Public_key_hash.Map.add operator purposes acc) + Signature.Public_key_hash.Map.empty + |> Signature.Public_key_hash.Map.bindings |> List.map (fun (operator, purposes) -> let strategy = match purposes with diff --git a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml index 5f3f62aea8a2..73630aba5c02 100644 --- a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml +++ b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml @@ -50,7 +50,7 @@ let sc_rollup_node_operator_param = let parse_pkh s = let from_alias s = Client_keys.Public_key_hash.find cctxt s in let from_key s = - match Tezos_crypto.Signature.Public_key_hash.of_b58check_opt s with + match Signature.Public_key_hash.of_b58check_opt s with | None -> failwith "Could not read public key hash for rollup node operator" | Some pkh -> return pkh diff --git a/src/proto_alpha/bin_sc_rollup_node/node_context.ml b/src/proto_alpha/bin_sc_rollup_node/node_context.ml index d05a41ceac55..70d8d58886bb 100644 --- a/src/proto_alpha/bin_sc_rollup_node/node_context.ml +++ b/src/proto_alpha/bin_sc_rollup_node/node_context.ml @@ -57,7 +57,7 @@ let get_operator node_ctxt purpose = let is_operator node_ctxt pkh = Configuration.Operator_purpose_map.exists - (fun _ operator -> Tezos_crypto.Signature.Public_key_hash.(operator = pkh)) + (fun _ operator -> Signature.Public_key_hash.(operator = pkh)) node_ctxt.operators let get_fee_parameter node_ctxt purpose = diff --git a/src/proto_alpha/bin_sc_rollup_node/node_context.mli b/src/proto_alpha/bin_sc_rollup_node/node_context.mli index fc1769ceff9d..bed9f201fb97 100644 --- a/src/proto_alpha/bin_sc_rollup_node/node_context.mli +++ b/src/proto_alpha/bin_sc_rollup_node/node_context.mli @@ -75,13 +75,11 @@ type ro = [`Read] t who has purpose [purpose], if any. *) val get_operator : - _ t -> - Configuration.purpose -> - Tezos_crypto.Signature.Public_key_hash.t option + _ t -> Configuration.purpose -> Signature.Public_key_hash.t option (** [is_operator cctxt pkh] returns [true] if the public key hash [pkh] is an operator for the node (for any purpose). *) -val is_operator : _ t -> Tezos_crypto.Signature.Public_key_hash.t -> bool +val is_operator : _ t -> Signature.Public_key_hash.t -> bool (** [get_fee_parameter cctxt purpose] returns the fee parameter to inject an operation for a given [purpose]. If no specific fee parameters were diff --git a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml index 4178c1117dc4..e97eb8c2975e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml @@ -430,7 +430,7 @@ module Make (Interpreter : Interpreter.S) : let open Sc_rollup.Game in match game_result with | Some (Loser {loser; _}) -> - let is_it_me = Tezos_crypto.Signature.Public_key_hash.(self = loser) in + let is_it_me = Signature.Public_key_hash.(self = loser) in return (not is_it_me) | _ -> return_false diff --git a/src/proto_alpha/bin_sc_rollup_node/refutation_game_event.ml b/src/proto_alpha/bin_sc_rollup_node/refutation_game_event.ml index 996b63ed080a..b7b96030d013 100644 --- a/src/proto_alpha/bin_sc_rollup_node/refutation_game_event.ml +++ b/src/proto_alpha/bin_sc_rollup_node/refutation_game_event.ml @@ -41,7 +41,7 @@ module Simple = struct "The rollup node has been slashed because of a timeout issued by \ {address}" ~level:Notice - ("address", Tezos_crypto.Signature.Public_key_hash.encoding) + ("address", Signature.Public_key_hash.encoding) let invalid_move = declare_0 diff --git a/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml b/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml index e4fec530e84d..6a02cd2565d3 100644 --- a/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml +++ b/src/proto_alpha/bin_sc_rollup_node/sc_rollup_node_errors.ml @@ -212,7 +212,7 @@ let () = ppf "The rollup node lost the refutation game for operator %a and was \ slashed %s%a, for reason: %a." - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp loser tez_sym Tez.pp @@ -221,7 +221,7 @@ let () = reason) Data_encoding.( obj3 - (req "loser" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "loser" Signature.Public_key_hash.encoding) (req "reason" Protocol.Alpha_context.Sc_rollup.Game.reason_encoding) (req "slashed" Tez.encoding)) (function diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index 64667ddc577f..a2c4fb252d27 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -2509,17 +2509,14 @@ module Registration_section = struct ~kinstr:(ILevel (dummy_loc, halt)) () - let check_signature (algo : Tezos_crypto.Signature.algo) ~for_intercept = + let check_signature (algo : Signature.algo) ~for_intercept = let name = match algo with - | Tezos_crypto.Signature.Ed25519 -> - Interpreter_workload.N_ICheck_signature_ed25519 - | Tezos_crypto.Signature.Secp256k1 -> + | Signature.Ed25519 -> Interpreter_workload.N_ICheck_signature_ed25519 + | Signature.Secp256k1 -> Interpreter_workload.N_ICheck_signature_secp256k1 - | Tezos_crypto.Signature.P256 -> - Interpreter_workload.N_ICheck_signature_p256 - | Tezos_crypto.Signature.Bls -> - Interpreter_workload.N_ICheck_signature_bls + | Signature.P256 -> Interpreter_workload.N_ICheck_signature_p256 + | Signature.Bls -> Interpreter_workload.N_ICheck_signature_bls in benchmark_with_stack_sampler ~intercept:for_intercept @@ -2536,9 +2533,7 @@ module Registration_section = struct if for_intercept then Environment.Bytes.empty else Samplers.Random_value.value Script_typed_ir.bytes_t rng_state in - let signed_message = - Tezos_crypto.Signature.sign sk unsigned_message - in + let signed_message = Signature.sign sk unsigned_message in let signed_message = Script_signature.make signed_message in (pk, (signed_message, (unsigned_message, eos)))) () @@ -2547,13 +2542,13 @@ 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 Signature.Ed25519 - let () = check_signature Tezos_crypto.Signature.Secp256k1 + let () = check_signature Signature.Secp256k1 - let () = check_signature Tezos_crypto.Signature.P256 + let () = check_signature Signature.P256 - let () = check_signature Tezos_crypto.Signature.Bls + let () = check_signature Signature.Bls let () = simple_benchmark @@ -3264,9 +3259,8 @@ module Registration_section = struct let open Alpha_context in let step_constants = { - source = - Contract (Implicit Tezos_crypto.Signature.Public_key_hash.zero); - payer = Tezos_crypto.Signature.Public_key_hash.zero; + source = Contract (Implicit Signature.Public_key_hash.zero); + payer = Signature.Public_key_hash.zero; self = Contract_hash.zero; amount = Tez.zero; balance = Tez.zero; diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml index efab9da028b3..8e16ffabbda7 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml @@ -1407,32 +1407,24 @@ let extract_ir_sized_step : | ILevel (_, _), _ -> Instructions.level | ICheck_signature (_, _), (public_key, (_signature, (message, _))) -> ( match public_key with - | Tezos_crypto.Signature.Ed25519 pk -> - let pk = - Size.of_int (Tezos_crypto.Signature.Ed25519.Public_key.size pk) - in - let signature = Size.of_int Tezos_crypto.Signature.Ed25519.size in + | Signature.Ed25519 pk -> + let pk = Size.of_int (Signature.Ed25519.Public_key.size pk) in + let signature = Size.of_int Signature.Ed25519.size in let message = Size.bytes message in Instructions.check_signature_ed25519 pk signature message - | Tezos_crypto.Signature.Secp256k1 pk -> - let pk = - Size.of_int (Tezos_crypto.Signature.Secp256k1.Public_key.size pk) - in - let signature = Size.of_int Tezos_crypto.Signature.Secp256k1.size in + | Signature.Secp256k1 pk -> + let pk = Size.of_int (Signature.Secp256k1.Public_key.size pk) in + let signature = Size.of_int Signature.Secp256k1.size in let message = Size.bytes message in Instructions.check_signature_secp256k1 pk signature message - | Tezos_crypto.Signature.P256 pk -> - let pk = - Size.of_int (Tezos_crypto.Signature.P256.Public_key.size pk) - in - let signature = Size.of_int Tezos_crypto.Signature.P256.size in + | Signature.P256 pk -> + let pk = Size.of_int (Signature.P256.Public_key.size pk) in + let signature = Size.of_int Signature.P256.size in let message = Size.bytes message in Instructions.check_signature_p256 pk signature message - | Tezos_crypto.Signature.Bls pk -> - let pk = - Size.of_int (Tezos_crypto.Signature.Bls.Public_key.size pk) - in - let signature = Size.of_int Tezos_crypto.Signature.Bls.size in + | Signature.Bls pk -> + let pk = Size.of_int (Signature.Bls.Public_key.size pk) in + let signature = Size.of_int Signature.Bls.size in let message = Size.bytes message in Instructions.check_signature_bls pk signature message) | IHash_key (_, _), _ -> Instructions.hash_key diff --git a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml index 237da10839e0..b59efb8a5106 100644 --- a/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/ticket_benchmarks.ml @@ -252,12 +252,7 @@ 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 - ~seed - () - in + let pkh, _, _ = Signature.generate_key ~algo:Signature.Ed25519 ~seed () in let ticketer = Alpha_context.Contract.Implicit pkh in Script_typed_ir. {ticketer; contents = Script_int.zero; amount = Ticket_amount.one} diff --git a/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml index a3034da86548..2275a1c067a4 100644 --- a/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/tx_rollup_benchmarks.ml @@ -250,7 +250,7 @@ let unique_ticket_id = let gen_l2_account rng_state = let seed = Base_samplers.uniform_bytes ~nbytes:32 rng_state in - Tezos_crypto.Signature.Bls.generate_key ~seed () + Signature.Bls.generate_key ~seed () let hash_key_exn ctxt ~ticketer ~typ ~contents ~owner = let ticketer = Micheline.root @@ Expr.from_string ticketer in diff --git a/src/proto_alpha/lib_client/client_proto_args.ml b/src/proto_alpha/lib_client/client_proto_args.ml index fbdb7fc71f6b..ffbecef28e71 100644 --- a/src/proto_alpha/lib_client/client_proto_args.ml +++ b/src/proto_alpha/lib_client/client_proto_args.ml @@ -623,7 +623,7 @@ let no_confirmation = let signature_parameter = Tezos_clic.parameter (fun (cctxt : #Client_context.full) s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Signature.of_b58check_opt s with | Some s -> return s | None -> cctxt#error "Not given a valid signature") diff --git a/src/proto_alpha/lib_client/client_proto_args.mli b/src/proto_alpha/lib_client/client_proto_args.mli index c6fe4627c515..065a52870b35 100644 --- a/src/proto_alpha/lib_client/client_proto_args.mli +++ b/src/proto_alpha/lib_client/client_proto_args.mli @@ -60,8 +60,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 +val delegate_arg : (Signature.Public_key_hash.t option, full) Tezos_clic.arg val max_priority_arg : (int option, full) Tezos_clic.arg @@ -118,7 +117,7 @@ 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 : (Signature.t, full) Tezos_clic.parameter module Daemon : sig val baking_switch : (bool, full) Tezos_clic.arg diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 1faaf46e9b9e..ea7acee0935b 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -324,7 +324,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 = Signature.Public_key.hash src_pk in let delegate_op = build_delegate_operation ?fee (Some source) in match consensus_pk with | None -> ( @@ -385,7 +385,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 = Signature.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 @@ -624,7 +624,7 @@ let register_global_constant (cctxt : #full) ~chain ~block ?confirmations return (oph, op, result) type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -635,7 +635,7 @@ type activation_key = { let raw_activation_key_encoding = let open Data_encoding in obj6 - (req "pkh" Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "activation_code" Blinded_public_key_hash.activation_code_encoding) (req "mnemonic" (list string)) @@ -665,9 +665,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req - "pkh" - Tezos_crypto.Signature.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -715,14 +713,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 : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.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 = Signature.Secret_key.to_public_key sk in + let pkh = Signature.Public_key.hash pk in return (pkh, pk, sk) let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias @@ -747,7 +745,7 @@ let inject_activate_operation cctxt ~chain ~block ?confirmations ?dry_run alias cctxt#message "Account %s (%a) activated with %s%a." alias - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -762,17 +760,17 @@ 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)) + (Signature.Public_key_hash.equal pkh (Ed25519 key.pkh)) (error_of_fmt "@[<v 2>Inconsistent activation key:@ Computed pkh: %a@ Embedded pkh: \ %a @]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.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 + let pk = Signature.Of_V1.public_key pk in + let sk = Signature.Of_V1.secret_key sk in Tezos_signer_backends.Unencrypted.make_pk pk >>?= fun pk_uri -> (if encrypted then Tezos_signer_backends.Encrypted.prompt_twice_and_encrypt cctxt sk diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index 8745c2772806..36b01a3388bf 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -81,8 +81,8 @@ val register_global_constant : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Manager_counter.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> + source:Signature.public_key_hash -> + src_pk:Signature.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> constant:string -> @@ -151,7 +151,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 -> + Signature.Public_key_hash.t -> Tez.t option tzresult Lwt.t (** Calls {!Injection.prepare_manager_operation} @@ -191,10 +191,10 @@ val update_consensus_key : ?verbose_signing:bool -> ?simulation:bool -> ?fee:Tez.tez -> - consensus_pk:Tezos_crypto.Signature.public_key -> + consensus_pk:Signature.public_key -> manager_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> - Tezos_crypto.Signature.public_key -> + Signature.public_key -> Kind.update_consensus_key Kind.manager Injection.result tzresult Lwt.t val drain_delegate : @@ -206,9 +206,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:Signature.public_key_hash -> + ?destination:Signature.public_key_hash -> + delegate:Signature.public_key_hash -> unit -> Kind.drain_delegate Injection.result tzresult Lwt.t @@ -254,7 +254,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 {!Signature.Public_key.hash} [src_pk]. *) val register_as_delegate : #Protocol_client_context.full -> chain:Shell_services.chain -> @@ -418,7 +418,7 @@ val reveal : Kind.reveal Kind.manager Injection.result tzresult Lwt.t type activation_key = { - pkh : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + pkh : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -455,7 +455,7 @@ val activate_account : (** Activate an existing account, by calling {!Injection.inject_operation} with [activation code]. - It fails if the account is unknown or if the account is not [Tezos_crypto.Ed25519]. *) + It fails if the account is unknown or if the account is not [Signature.Ed25519]. *) val activate_existing_account : #Protocol_client_context.full -> chain:Shell_services.chain -> @@ -592,8 +592,8 @@ val transfer_ticket : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Manager_counter.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> + source:Signature.public_key_hash -> + src_pk:Signature.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> contents:string -> @@ -790,8 +790,8 @@ val sc_rollup_recover_bond : ?gas_limit:Gas.Arith.integral -> ?storage_limit:Z.t -> ?counter:Manager_counter.t -> - source:Tezos_crypto.Signature.public_key_hash -> - src_pk:Tezos_crypto.Signature.public_key -> + source:Signature.public_key_hash -> + src_pk:Signature.public_key -> src_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> sc_rollup:Sc_rollup.t -> diff --git a/src/proto_alpha/lib_client/client_proto_fa12.mli b/src/proto_alpha/lib_client/client_proto_fa12.mli index 8dccc6bbca64..cfd100f44a46 100644 --- a/src/proto_alpha/lib_client/client_proto_fa12.mli +++ b/src/proto_alpha/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:Signature.public_key_hash -> ?gas:Gas.Arith.integral -> unparsing_mode:Script_ir_unparser.unparsing_mode -> unit -> diff --git a/src/proto_alpha/lib_client/client_proto_multisig.ml b/src/proto_alpha/lib_client/client_proto_multisig.ml index 9d8d9e8e7f7e..cf5eda9d6fd0 100644 --- a/src/proto_alpha/lib_client/client_proto_multisig.ml +++ b/src/proto_alpha/lib_client/client_proto_multisig.ml @@ -136,12 +136,8 @@ let () = "A signature was given for a multisig contract that matched none of the \ public keys of the contract signers" ~pp:(fun ppf s -> - Format.fprintf - ppf - "Invalid signature %s." - (Tezos_crypto.Signature.to_b58check s)) - Data_encoding.( - obj1 (req "invalid_signature" Tezos_crypto.Signature.encoding)) + Format.fprintf ppf "Invalid signature %s." (Signature.to_b58check s)) + Data_encoding.(obj1 (req "invalid_signature" Signature.encoding)) (function Invalid_signature s -> Some s | _ -> None) (fun s -> Invalid_signature s) ; register_error_kind @@ -588,12 +584,11 @@ let lambda_action_t ~loc = lambda_t ~loc (unit_t ~loc) (operations_t ~loc) (* Conversion functions from common types to Script_expr using the optimized representation *) 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) = +let optimized_key_hash ~loc (key_hash : Signature.Public_key_hash.t) = bytes ~loc (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Signature.Public_key_hash.encoding key_hash) let optimized_address ~loc ~(address : Contract.t) ~(entrypoint : Entrypoint.t) @@ -604,12 +599,10 @@ 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 : Signature.Public_key.t) = bytes ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key.encoding - key) + (Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding key) (** * Actions *) @@ -714,7 +707,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 + Signature.Public_key.encoding s | _ -> fail ()) key_bytes @@ -790,7 +783,7 @@ let action_of_expr_not_generic e = @@ Change_delegate (Some (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Signature.Public_key_hash.encoding s)) | Tezos_micheline.Micheline.Prim ( _, @@ -817,7 +810,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 + Signature.Public_key.encoding s | _ -> fail ()) key_bytes @@ -827,7 +820,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 = Signature.Public_key.t list (* The relevant information that we can get about a multisig smart contract *) type multisig_contract_information = { @@ -854,8 +847,7 @@ let multisig_get_information (cctxt : #Protocol_client_context.full) ~chain List.map_es (function | String (_, key_str) -> - return - @@ Tezos_crypto.Signature.Public_key.of_b58check_exn key_str + return @@ Signature.Public_key.of_b58check_exn key_str | _ -> fail (Contract_has_unexpected_storage contract)) key_nodes >>=? fun keys -> return {counter; threshold; keys} @@ -867,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 = Signature.Public_key.to_b58check key in return (String (loc, key_str))) keys >>=? fun l -> @@ -888,10 +880,7 @@ let multisig_create_param ~counter ~generic ~action ~optional_signatures () : match sig_opt with | None -> return @@ none ~loc () | Some signature -> - return - @@ some - ~loc - (String (loc, Tezos_crypto.Signature.to_b58check signature))) + return @@ some ~loc (String (loc, Signature.to_b58check signature))) optional_signatures >>=? fun l -> Lwt.return @@ action_to_expr ~loc ~generic action >>=? fun expr -> @@ -1060,7 +1049,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 Signature.check key signature bytes then ( matching_key_found := true ; opt_sigs_arr.(i) <- Some signature) in diff --git a/src/proto_alpha/lib_client/client_proto_multisig.mli b/src/proto_alpha/lib_client/client_proto_multisig.mli index cb82be9493a1..5ebfd1448d0f 100644 --- a/src/proto_alpha/lib_client/client_proto_multisig.mli +++ b/src/proto_alpha/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:Signature.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:Signature.t list -> amount:Tez.t -> ?fee:Tez.t -> ?gas_limit:Gas.Arith.integral -> diff --git a/src/proto_alpha/lib_client/client_proto_programs.ml b/src/proto_alpha/lib_client/client_proto_programs.ml index 3f944c498f9f..4412d16c001c 100644 --- a/src/proto_alpha/lib_client/client_proto_programs.ml +++ b/src/proto_alpha/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 : Signature.public_key_hash option; gas : Gas.Arith.integral option; } diff --git a/src/proto_alpha/lib_client/client_proto_programs.mli b/src/proto_alpha/lib_client/client_proto_programs.mli index 8e5c87d2ef5e..383d2116b10b 100644 --- a/src/proto_alpha/lib_client/client_proto_programs.mli +++ b/src/proto_alpha/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 : Signature.public_key_hash option; gas : Gas.Arith.integral option; } diff --git a/src/proto_alpha/lib_client/client_proto_utils.ml b/src/proto_alpha/lib_client/client_proto_utils.ml index 5f98e3c92286..be6844cc5cf7 100644 --- a/src/proto_alpha/lib_client/client_proto_utils.ml +++ b/src/proto_alpha/lib_client/client_proto_utils.ml @@ -40,11 +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 - cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation - src_sk - bytes + Client_keys.sign cctxt ~watermark:Signature.Generic_operation src_sk bytes let check_message (cctxt : #full) ~block ~key_locator ~quiet ~message ~signature = @@ -53,7 +49,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:Signature.Generic_operation key_locator signature bytes diff --git a/src/proto_alpha/lib_client/client_proto_utils.mli b/src/proto_alpha/lib_client/client_proto_utils.mli index 3c06f0108ea8..c535e4b24ecb 100644 --- a/src/proto_alpha/lib_client/client_proto_utils.mli +++ b/src/proto_alpha/lib_client/client_proto_utils.mli @@ -28,7 +28,7 @@ val sign_message : src_sk:Client_keys.sk_uri -> block:Block_hash.t -> message:string -> - Tezos_crypto.Signature.t tzresult Lwt.t + Signature.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:Signature.t -> bool tzresult Lwt.t diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index 1ae1dbcef8e9..70a00096eaa8 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -189,10 +189,9 @@ let print_for_verbose_signing ppf ~watermark ~bytes ~branch ~contents = fprintf ppf "Watermark: `%a` (0x%s)" - Tezos_crypto.Signature.pp_watermark + Signature.pp_watermark watermark - (Hex.of_bytes (Tezos_crypto.Signature.bytes_of_watermark watermark) - |> Hex.show)) ; + (Hex.of_bytes (Signature.bytes_of_watermark watermark) |> Hex.show)) ; item (fun ppf () -> pp_print_text ppf "Operation bytes: " ; TzString.fold_left (* We split the bytes into lines for display: *) @@ -215,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 [Signature.bytes_of_watermark watermark; bytes]) ; let json = Data_encoding.Json.construct Operation.unsigned_encoding @@ -241,7 +240,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 + | _ -> Signature.Generic_operation in (if verbose_signing then cctxt#message @@ -631,14 +630,14 @@ let detect_script_failure : type kind. kind operation_metadata -> _ = in fun {contents} -> detect_script_failure contents -let signature_size_of_algo : Tezos_crypto.Signature.algo -> int = function - | Ed25519 -> Tezos_crypto.Signature.Ed25519.size - | Secp256k1 -> Tezos_crypto.Signature.Secp256k1.size - | P256 -> Tezos_crypto.Signature.P256.size +let signature_size_of_algo : Signature.algo -> int = function + | Ed25519 -> Signature.Ed25519.size + | Secp256k1 -> Signature.Secp256k1.size + | P256 -> Signature.P256.size | Bls -> (* BLS signatures in operations are encoded with 2 extra bytes: a [ff] prefix and a tag [03]. *) - Tezos_crypto.Signature.Bls.size + 2 + Signature.Bls.size + 2 (* This value is used as a safety guard for gas limit. *) let safety_guard = Gas.Arith.(integral_of_int_exn 100) @@ -1223,10 +1222,10 @@ 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 Signature.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 Signature.Public_key_hash.equal source src -> Contents_list contents :: acc | _ -> acc) [] @@ -1349,14 +1348,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 + Signature.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 + Signature.Public_key_hash.pp source (List.length l) >>= fun () -> exit 1 @@ -1407,7 +1406,7 @@ let inject_manager_operation cctxt ~chain ~block ?successor_level ?branch in let signature_algo = match src_pk with - | Ed25519 _ -> Tezos_crypto.Signature.Ed25519 + | Ed25519 _ -> Signature.Ed25519 | Secp256k1 _ -> Secp256k1 | P256 _ -> P256 | Bls _ -> Bls diff --git a/src/proto_alpha/lib_client/injection.mli b/src/proto_alpha/lib_client/injection.mli index 18d87a3c0ba7..d66775157c80 100644 --- a/src/proto_alpha/lib_client/injection.mli +++ b/src/proto_alpha/lib_client/injection.mli @@ -103,8 +103,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:Signature.Public_key_hash.t -> + src_pk:Signature.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_alpha/lib_client/managed_contract.ml b/src/proto_alpha/lib_client/managed_contract.ml index 3edbaae33415..5d406c127648 100644 --- a/src/proto_alpha/lib_client/managed_contract.ml +++ b/src/proto_alpha/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 + Signature.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 Signature.Public_key_hash.of_b58check_opt value with | Some k -> return k | None -> cctxt#error @@ -89,9 +89,7 @@ let parse code = let build_lambda_for_set_delegate ~delegate = match delegate with | Some delegate -> - let (`Hex delegate) = - Tezos_crypto.Signature.Public_key_hash.to_hex delegate - in + let (`Hex delegate) = Signature.Public_key_hash.to_hex delegate in Format.asprintf "{ DROP ; NIL operation ; PUSH key_hash 0x%s ; SOME ; SET_DELEGATE ; \ CONS }" @@ -106,7 +104,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 : Signature.public_key_hash option) = let entrypoint = entrypoint_do in (Michelson_v1_entrypoints.contract_entrypoint_type cctxt @@ -141,7 +139,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 + Signature.Public_key_hash.to_hex delegate in "0x" ^ delegate | None -> "Unit" @@ -162,7 +160,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 : Signature.public_key_hash option) = build_delegate_operation cctxt ~chain ~block ?fee contract delegate >>=? fun operation -> let operation = Annotated_manager_operation.Single_manager operation in @@ -192,9 +190,7 @@ let t_unit = Micheline.strip_locations (Prim (0, Michelson_v1_primitives.T_unit, [], [])) let build_lambda_for_transfer_to_implicit ~destination ~amount = - let (`Hex destination) = - Tezos_crypto.Signature.Public_key_hash.to_hex destination - in + let (`Hex destination) = Signature.Public_key_hash.to_hex destination in Format.asprintf "{ DROP ; NIL operation ;PUSH key_hash 0x%s; IMPLICIT_ACCOUNT;PUSH mutez \ %Ld ;UNIT;TRANSFER_TOKENS ; CONS }" diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index 09e517f76749..7ba34abb0722 100644 --- a/src/proto_alpha/lib_client/mockup.ml +++ b/src/proto_alpha/lib_client/mockup.ml @@ -99,7 +99,7 @@ module Parsed_account = struct let to_bootstrap_account repr = Tezos_client_base.Client_keys.neuterize repr.sk_uri >>=? fun pk_uri -> Tezos_client_base.Client_keys.public_key pk_uri >>=? fun public_key -> - let public_key_hash = Tezos_crypto.Signature.Public_key.hash public_key in + let public_key_hash = Signature.Public_key.hash public_key in return Parameters. { @@ -165,11 +165,11 @@ 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" Signature.Public_key_hash.encoding) + (opt "public_key" Signature.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" Signature.Public_key_hash.encoding) + (opt "consensus_key" Signature.Public_key.encoding)) end module Bootstrap_contract = struct @@ -180,7 +180,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" Signature.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "script" Script.encoding)) end @@ -498,7 +498,7 @@ let mem_init : [Block_hash.to_bytes hash; Operation_list_hash.(to_bytes @@ compute [])] in let open Protocol.Alpha_context.Block_header in - let _, _, sk = Tezos_crypto.Signature.generate_key () in + let _, _, sk = Signature.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -518,7 +518,7 @@ let mem_init : (shell_header, contents) in let signature = - Tezos_crypto.Signature.sign + Signature.sign ~watermark: Protocol.Alpha_context.Block_header.( to_watermark (Block_header chain_id)) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 14a6658ed476..fa879aaf834f 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -96,13 +96,13 @@ let pp_internal_operation ppf (Internal_operation {operation; source; _}) = Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp delegate) | Delegation delegate_opt -> ( Format.fprintf ppf "Delegation:@,Contract: %a@,To: " Destination.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 -> Signature.Public_key_hash.pp ppf delegate) | Event {ty; tag; payload} -> Format.fprintf ppf @@ -169,7 +169,7 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "@,Delegate: %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp delegate) | Reveal key -> Format.fprintf @@ -177,13 +177,13 @@ 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 + Signature.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 -> Signature.Public_key_hash.pp ppf delegate) | Register_global_constant {value} -> Format.fprintf ppf @@ -213,8 +213,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) + Signature.Public_key_hash.pp + (Signature.Public_key.hash pk) | Tx_rollup_origination -> Format.fprintf ppf @@ -389,7 +389,7 @@ let pp_manager_operation_content (type kind) source ppf "Smart rollup bond retrieval:@,Address: %a@,Staker: %a" Sc_rollup.Address.pp sc_rollup - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp staker | Dal_publish_slot_header operation -> Format.fprintf @@ -410,12 +410,9 @@ let pp_balance_updates ppf balance_updates = (tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU). Instead of printing this key hash, we want to make the result more informative. *) let pp_baker ppf baker = - if - Tezos_crypto.Signature.Public_key_hash.equal - baker - Tezos_crypto.Signature.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 + if Signature.Public_key_hash.equal baker Signature.Public_key_hash.zero then + Format.fprintf ppf "the baker who will include this operation" + else Signature.Public_key_hash.pp ppf baker in let balance_updates = List.map @@ -974,11 +971,7 @@ let pp_manager_operation_result ppf Manager_operation_result {balance_updates; operation_result; internal_operation_results} ) = Format.fprintf ppf "@[<v 2>Manager signed operations:" ; - Format.fprintf - ppf - "@,From: %a" - Tezos_crypto.Signature.Public_key_hash.pp - source ; + Format.fprintf ppf "@,From: %a" Signature.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" Manager_counter.pp counter ; Format.fprintf ppf "@,Gas limit: %a" Gas.Arith.pp_integral gas_limit ; @@ -1073,7 +1066,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Slot attestation:@,Delegate: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp delegate | ( Double_endorsement_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> @@ -1112,7 +1105,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Signature.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1120,7 +1113,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Proposals:@,From: %a@,Period: %ld@,Protocols:@, @[<v 0>%a@]@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp source period (Format.pp_print_list Protocol_hash.pp) @@ -1129,7 +1122,7 @@ let pp_contents_and_result : Format.fprintf ppf "@[<v 2>Ballot:@,From: %a@,Period: %ld@,Protocol: %a@,Vote: %a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp source period Protocol_hash.pp @@ -1145,11 +1138,11 @@ let pp_contents_and_result : Consensus key hash: %a@,\ Delegate: %a@,\ Destination: %a%s%a@]" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp consensus_key - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp delegate - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp destination (if allocated_destination_contract then " (allocated)" else "") pp_balance_updates diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index 96c198bbb388..9070a0e6d51b 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -2223,7 +2223,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 + Signature.Public_key_hash.pp src_pkh src_name ; if !errors <> [] then @@ -2384,7 +2384,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 + Signature.Public_key_hash.pp src_pkh src_name in @@ -2984,7 +2984,7 @@ let commands_rw () = (fun (_, alice, bob) -> let stakers = Sc_rollup.Game.Index.make staker1 staker2 in return - Tezos_crypto.Signature.Public_key_hash.( + Signature.Public_key_hash.( alice = stakers.alice && bob = stakers.bob)) games in diff --git a/src/proto_alpha/lib_client_commands/client_proto_fa12_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_fa12_commands.ml index 20a9b367fa06..3072a31c76ab 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_fa12_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_fa12_commands.ml @@ -110,8 +110,7 @@ let view_options = payer_arg (unparsing_mode_arg ~default:"Readable") -let dummy_callback = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero +let dummy_callback = Contract.Implicit Signature.Public_key_hash.zero let get_contract_caller_keys (cctxt : #Client_context.full) (caller : Contract.t) = diff --git a/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml index a5d6b4fdba5f..f8b6ede352ad 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_multisig_commands.ml +++ b/src/proto_alpha/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)) + Signature.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@." Signature.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@." Signature.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@." Signature.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@." Signature.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@." Signature.pp signature ; return_unit); command ~group diff --git a/src/proto_alpha/lib_client_commands/client_proto_programs_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_programs_commands.ml index 2a578de23455..75ab5c017002 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_programs_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_programs_commands.ml @@ -123,7 +123,7 @@ let commands () = in let signature_parameter = parameter (fun (cctxt : #Client_context.full) s -> - match Tezos_crypto.Signature.of_b58check_opt s with + match Signature.of_b58check_opt s with | Some s -> Lwt_result_syntax.return s | None -> cctxt#error "Not given a valid signature") in @@ -732,9 +732,7 @@ let commands () = (fun () bytes sk cctxt -> 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 - in + let*! () = cctxt#message "Signature: %a" Signature.pp signature in return_unit); command ~group 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 22e4ed088ee8..d5e33b91cb58 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 @@ -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 : Signature.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 : Signature.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 Signature.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 : Signature.Public_key_hash.Set.t; mutable last_block : Block_hash.t; mutable last_level : int; mutable target_block : Block_hash.t; @@ -161,9 +161,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" Signature.Public_key_hash.encoding) + (req "pk" Signature.Public_key.encoding) + (req "sk" Signature.Secret_key.encoding)) (function Explicit {pkh; pk; sk} -> Some (pkh, pk, sk) | _ -> None) (fun (pkh, pk, sk) -> Explicit {pkh; pk; sk}); case @@ -175,7 +175,7 @@ let input_source_encoding = case ~title:"pkh" (Tag 2) - (obj1 (req "pkh" Tezos_crypto.Signature.Public_key_hash.encoding)) + (obj1 (req "pkh" Signature.Public_key_hash.encoding)) (function Wallet_pkh pkh -> Some pkh | _ -> None) (fun pkh -> Wallet_pkh pkh); ] @@ -239,14 +239,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 + Signature.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 Signature.Of_V_latest.secret_key in let key_from_alias alias = let warning msg alias = @@ -281,9 +281,7 @@ let normalize_source cctxt = in let key_from_wallet pkh = let warning msg pkh = - let* () = - cctxt#warning msg Tezos_crypto.Signature.Public_key_hash.pp pkh - in + let* () = cctxt#warning msg Signature.Public_key_hash.pp pkh in return_none in let* key = @@ -298,7 +296,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 + Signature.Public_key_hash.pp pkh alias in @@ -363,7 +361,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 = Signature.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 ; @@ -454,7 +452,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 + Signature.Public_key_hash.pp src.pkh) in (* Sampled source has zero balance: the transfer that created that @@ -500,11 +498,7 @@ let inject_contents (cctxt : Protocol_client_context.full) branch sk contents = ({branch}, Contents_list contents) in let signature = - Some - (Tezos_crypto.Signature.sign - ~watermark:Tezos_crypto.Signature.Generic_operation - sk - bytes) + Some (Signature.sign ~watermark:Signature.Generic_operation sk bytes) in let op : _ Operation.t = {shell = {branch}; protocol_data = {contents; signature}} @@ -557,19 +551,14 @@ let inject_transfer (cctxt : Protocol_client_context.full) parameters state Alpha_services.Contract.counter cctxt (`Main, `Head 0) transfer.src.pkh in let* already_revealed = - if - Tezos_crypto.Signature.Public_key_hash.Set.mem - transfer.src.pkh - state.revealed - then return true + if Signature.Public_key_hash.Set.mem transfer.src.pkh state.revealed then + return true else ( (* Either the [manager_key] RPC tells us the key is already 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 - transfer.src.pkh - state.revealed ; + Signature.Public_key_hash.Set.add transfer.src.pkh state.revealed ; let* pk_opt = Alpha_services.Contract.manager_key cctxt @@ -603,7 +592,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 + Signature.Public_key_hash.pp transfer.src.pkh Manager_counter.pp reveal_counter @@ -629,7 +618,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 + Signature.Public_key_hash.pp transfer.src.pkh Manager_counter.pp transf_counter @@ -1159,9 +1148,7 @@ let generate_random_transactions = let sources = List.sort_uniq (fun src1 src2 -> - Tezos_crypto.Signature.Secret_key.compare - src1.source.sk - src2.source.sk) + Signature.Secret_key.compare src1.source.sk src2.source.sk) sources in let rng_state = Random.State.make [|parameters.seed|] in @@ -1192,7 +1179,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 = Signature.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; @@ -1477,14 +1464,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 -> + || Signature.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 = Signature.Secret_key.of_b58check_exn payload in aux ({pkh; pk; pk_uri; sk; sk_uri} :: acc) tl in aux [] keys @@ -1497,7 +1484,7 @@ let source_key_arg = "Source key public key hash from which the tokens will be transferred to \ start the funding." (parameter (fun (cctxt : #Client_context.full) s -> - let r = Tezos_crypto.Signature.Public_key_hash.of_b58check s in + let r = Signature.Public_key_hash.of_b58check s in match r with | Ok pkh -> Lwt_result_syntax.return pkh | Error e -> @@ -1782,7 +1769,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 + Signature.Public_key_hash.pp source_pkh batch_size batches_per_block @@ -1849,7 +1836,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 + Signature.Public_key_hash.pp source_pkh else let*! () = @@ -1858,7 +1845,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 + Signature.Public_key_hash.pp source_pkh Tez.pp source_balance) diff --git a/src/proto_alpha/lib_client_commands/client_proto_utils_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_utils_commands.ml index 798304e22f30..b2978ba30b81 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_utils_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_utils_commands.ml @@ -94,9 +94,7 @@ let commands () = () in let* signature = sign_message cctxt ~src_sk ~block ~message in - let*! () = - cctxt#message "Signature: %a" Tezos_crypto.Signature.pp signature - in + let*! () = cctxt#message "Signature: %a" Signature.pp signature in return_unit); command ~group @@ -176,8 +174,6 @@ let commands () = sk unsigned_header in - let*! () = - cctxt#message "%a" Hex.pp (Tezos_crypto.Signature.to_hex s) - in + let*! () = cctxt#message "%a" Hex.pp (Signature.to_hex s) in return_unit); ] diff --git a/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml b/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml index 4c8cbdab0c9f..7e9c38702551 100644 --- a/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml @@ -70,9 +70,7 @@ let bound_data_of_public_key_hash cctxt dst = let open Tezos_micheline in let open Protocol.Michelson_v1_primitives in let pkh_bytes = - Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding - dst + Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding dst in let micheline_bytes = Micheline.(Bytes (0, pkh_bytes) |> strip_locations) in let micheline_pkh_type = diff --git a/src/proto_alpha/lib_dal/dal_plugin_registration.ml b/src/proto_alpha/lib_dal/dal_plugin_registration.ml index 935a70af0325..d61429958960 100644 --- a/src/proto_alpha/lib_dal/dal_plugin_registration.ml +++ b/src/proto_alpha/lib_dal/dal_plugin_registration.ml @@ -104,9 +104,8 @@ module Plugin = struct Plugin.RPC.Dal.dal_shards cpctxt (cpctxt#chain, cpctxt#block) ~level () in List.fold_left - (fun acc (pkh, s) -> - Tezos_crypto.Signature.Public_key_hash.Map.add pkh s acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty + (fun acc (pkh, s) -> Signature.Public_key_hash.Map.add pkh s acc) + Signature.Public_key_hash.Map.empty pkh_to_shards let attested_slot_headers hash (block : block_info) ~number_of_slots = diff --git a/src/proto_alpha/lib_delegate/baking_commands.ml b/src/proto_alpha/lib_delegate/baking_commands.ml index 9d76b8745fff..b827d5b7cadd 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.ml +++ b/src/proto_alpha/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 : Signature.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_alpha/lib_delegate/baking_highwatermarks.ml b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml index 4af172f183fe..91b56b3e50b1 100644 --- a/src/proto_alpha/lib_delegate/baking_highwatermarks.ml +++ b/src/proto_alpha/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 = Signature.Public_key_hash.t - let compare = Tezos_crypto.Signature.Public_key_hash.compare + let compare = Signature.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" Signature.Public_key_hash.encoding) (req "highwatermark" highwatermark_encoding))) type highwatermarks = { diff --git a/src/proto_alpha/lib_delegate/baking_highwatermarks.mli b/src/proto_alpha/lib_delegate/baking_highwatermarks.mli index 30d4d6f4ea3e..757b667c58bb 100644 --- a/src/proto_alpha/lib_delegate/baking_highwatermarks.mli +++ b/src/proto_alpha/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:Signature.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:Signature.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:Signature.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:Signature.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:Signature.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:Signature.public_key_hash -> level:int32 -> round:Round.t -> unit tzresult Lwt.t diff --git a/src/proto_alpha/lib_delegate/baking_nonces.ml b/src/proto_alpha/lib_delegate/baking_nonces.ml index 5af73f61735e..fc1c9ada635a 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.ml +++ b/src/proto_alpha/lib_delegate/baking_nonces.ml @@ -239,9 +239,7 @@ let inject_seed_nonce_revelation (cctxt : #Protocol_client_context.full) ~chain ~nonce () >>=? fun bytes -> - let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero - in + let bytes = Signature.concat bytes Signature.zero in Shell_services.Injection.operation ~async:true cctxt ~chain bytes >>=? fun oph -> Events.( diff --git a/src/proto_alpha/lib_delegate/baking_state.ml b/src/proto_alpha/lib_delegate/baking_state.ml index b2dc19ae851a..74c047bf1437 100644 --- a/src/proto_alpha/lib_delegate/baking_state.ml +++ b/src/proto_alpha/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 : Signature.Public_key.t; + public_key_hash : Signature.Public_key_hash.t; secret_key_uri : Client_keys.sk_uri; } @@ -56,48 +56,39 @@ 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" Signature.Public_key.encoding) + (req "public_key_hash" Signature.Public_key_hash.encoding) (req "secret_key_uri" string)) let pp_consensus_key fmt {alias; public_key_hash; _} = match alias with - | None -> - Format.fprintf - fmt - "%a" - Tezos_crypto.Signature.Public_key_hash.pp - public_key_hash + | None -> Format.fprintf fmt "%a" Signature.Public_key_hash.pp public_key_hash | Some alias -> Format.fprintf fmt "%s (%a)" alias - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp public_key_hash -type consensus_key_and_delegate = - consensus_key * Tezos_crypto.Signature.Public_key_hash.t +type consensus_key_and_delegate = consensus_key * Signature.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" Signature.Public_key_hash.encoding)) let pp_consensus_key_and_delegate fmt (consensus_key, delegate) = - if - Tezos_crypto.Signature.Public_key_hash.equal - consensus_key.public_key_hash - delegate - then pp_consensus_key fmt consensus_key + if Signature.Public_key_hash.equal consensus_key.public_key_hash delegate then + pp_consensus_key fmt consensus_key else Format.fprintf fmt "%a@,on behalf of %a" pp_consensus_key consensus_key - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp delegate type validation_mode = Node | Local of Abstract_context_index.t @@ -763,7 +754,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' + Signature.Public_key_hash.compare pkh pkh' end) let find_pkh pkh s = @@ -771,8 +762,8 @@ module DelegateSet = struct try iter (fun ({public_key_hash; _} as delegate) -> - if Tezos_crypto.Signature.Public_key_hash.equal pkh public_key_hash - then raise (Found delegate) + if Signature.Public_key_hash.equal pkh public_key_hash then + raise (Found delegate) else ()) s ; None diff --git a/src/proto_alpha/lib_delegate/baking_state.mli b/src/proto_alpha/lib_delegate/baking_state.mli index 14296c3823a9..c636037f3e92 100644 --- a/src/proto_alpha/lib_delegate/baking_state.mli +++ b/src/proto_alpha/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 : Signature.public_key; + public_key_hash : Signature.public_key_hash; secret_key_uri : Client_keys.sk_uri; } @@ -37,8 +37,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 +type consensus_key_and_delegate = consensus_key * Signature.Public_key_hash.t val consensus_key_and_delegate_encoding : consensus_key_and_delegate Data_encoding.t diff --git a/src/proto_alpha/lib_delegate/baking_vdf.ml b/src/proto_alpha/lib_delegate/baking_vdf.ml index 8d2caefb709b..b08fd5ebea7b 100644 --- a/src/proto_alpha/lib_delegate/baking_vdf.ml +++ b/src/proto_alpha/lib_delegate/baking_vdf.ml @@ -156,7 +156,7 @@ 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 = Signature.concat bytes Signature.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_alpha/lib_delegate/block_forge.ml b/src/proto_alpha/lib_delegate/block_forge.ml index 917133e0e553..062306d6367d 100644 --- a/src/proto_alpha/lib_delegate/block_forge.ml +++ b/src/proto_alpha/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 = Signature.zero; } let convert_operation (op : packed_operation) : Tezos_base.Operation.t = @@ -389,7 +389,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 = Signature.zero}; } in return {unsigned_block_header; operations} diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index 19a7712b1698..69a0f7c23ef0 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/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 (Signature.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 @@ -175,9 +175,7 @@ let process_consensus_op (type kind) cctxt ~op2 () >>=? fun bytes -> - let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero - in + let bytes = Signature.concat bytes Signature.zero in let double_op_detected, double_op_denounced = Events.( match op_kind with @@ -303,9 +301,7 @@ let process_block (cctxt : #Protocol_client_context.full) state ~bh2 () >>=? fun bytes -> - let bytes = - Tezos_crypto.Signature.concat bytes Tezos_crypto.Signature.zero - in + let bytes = Signature.concat bytes Signature.zero in Events.(emit double_baking_detected) () >>= fun () -> Shell_services.Injection.operation cctxt ~chain bytes >>=? fun op_hash -> diff --git a/src/proto_alpha/lib_delegate/operation_selection.ml b/src/proto_alpha/lib_delegate/operation_selection.ml index 089f4b439a93..9a4fbf4d0b92 100644 --- a/src/proto_alpha/lib_delegate/operation_selection.ml +++ b/src/proto_alpha/lib_delegate/operation_selection.ml @@ -57,9 +57,7 @@ module PrioritizedManagerSet = Set.Make (struct let compare {source; counter; weight; op; _} {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' - in + let cmp_src = Signature.Public_key_hash.compare source source' in if cmp_src = 0 then (* we want the smallest counter first *) let c = Manager_counter.compare counter counter' in diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index b391b3b272bd..0bc82a0ef97a 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -842,7 +842,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 : Signature.secret_key) (predecessor_hash : Block_hash.t) (block_header : Block_header.shell_header) : Bytes.t = let proof_of_work_nonce = @@ -871,7 +871,7 @@ let genesis_protocol_data (baker_sk : Tezos_crypto.Signature.secret_key) (block_header, contents) in let signature = - Tezos_crypto.Signature.sign + Signature.sign ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) baker_sk @@ -887,7 +887,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 = + Signature.secret_key tzresult Lwt.t = (match (total_accounts, level) with | _, 0 -> return 0 (* apparently this doesn't really matter *) | _ -> @@ -902,8 +902,7 @@ let deduce_baker_sk |> WithExceptions.Option.get ~loc:__LOC__ in let secret_key = - Tezos_crypto.Signature.Secret_key.of_b58check_exn - (Uri.path (secret.sk_uri :> Uri.t)) + Signature.Secret_key.of_b58check_exn (Uri.path (secret.sk_uri :> Uri.t)) in return secret_key @@ -1078,8 +1077,7 @@ type config = { round0 : int64; round1 : int64; timeout : int; - delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + delegate_selection : (int32 * (int32 * Signature.public_key_hash) list) list; initial_seed : State_hash.t option; consensus_committee_size : int; consensus_threshold : int; @@ -1215,7 +1213,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) (block_header.shell, protocol_data.contents) in if - Tezos_crypto.Signature.check + Signature.check ~watermark: Alpha_context.Block_header.(to_watermark (Block_header chain_id)) public_key @@ -1227,7 +1225,7 @@ let check_block_signature ~block_hash ~(block_header : Block_header.t) "unexpected signature for %a; tried with %a@." Block_hash.pp block_hash - Tezos_crypto.Signature.Public_key.pp + Signature.Public_key.pp public_key type op_predicate = @@ -1262,7 +1260,7 @@ let op_is_signed_by ~public_key (op_hash : 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) + | _ -> Signature.Generic_operation) | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) >>=? fun watermark -> match d.signature with @@ -1278,7 +1276,7 @@ let op_is_signed_by ~public_key (op_hash : Operation_hash.t) (op.shell, Contents_list d.contents) in return - (Tezos_crypto.Signature.check + (Signature.check ~watermark public_key signature diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli index 2fc5f544597a..c01782653bdf 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.mli @@ -139,8 +139,7 @@ type config = { (** Maximal duration of the test. If the test takes longer to terminate it'll be aborted with an error. *) - delegate_selection : - (int32 * (int32 * Tezos_crypto.Signature.public_key_hash) list) list; + delegate_selection : (int32 * (int32 * Signature.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) *) @@ -172,21 +171,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 : Signature.public_key -val bootstrap2 : Tezos_crypto.Signature.public_key +val bootstrap2 : Signature.public_key -val bootstrap3 : Tezos_crypto.Signature.public_key +val bootstrap3 : Signature.public_key -val bootstrap4 : Tezos_crypto.Signature.public_key +val bootstrap4 : Signature.public_key -val bootstrap5 : Tezos_crypto.Signature.public_key +val bootstrap5 : Signature.public_key (** Check if a block header is signed by a given delegate. *) val check_block_signature : block_hash:Block_hash.t -> block_header:Block_header.t -> - public_key:Tezos_crypto.Signature.public_key -> + public_key:Signature.public_key -> unit tzresult Lwt.t (** A shortcut type for predicates on operations. *) @@ -216,8 +215,7 @@ val mempool_has_op_ref : unit tzresult Lwt.t (** Check if an operation is signed by the given delegate. *) -val op_is_signed_by : - public_key:Tezos_crypto.Signature.public_key -> op_predicate +val op_is_signed_by : public_key:Signature.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_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml index fdc0a6dc5abb..ce3f8bba6380 100644 --- a/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml +++ b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml @@ -26,9 +26,7 @@ open Protocol type delegate_selection = - (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) - list + (Raw_level_repr.t * (Round_repr.t * Signature.public_key_hash) list) list module LevelRoundMap = Map.Make (struct type t = Level_repr.t * Round_repr.t @@ -105,12 +103,8 @@ let check ctxt ~selection = Delegate_sampler.baking_rights_owner ctxt level ~round >|= Environment.wrap_tzresult >>=? fun (ctxt, _, pk) -> - if - not - (Tezos_crypto.Signature.Public_key_hash.equal - delegate - pk.delegate) - then raise Exit + if not (Signature.Public_key_hash.equal delegate pk.delegate) then + raise Exit else return ctxt) selection ctxt diff --git a/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.mli b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.mli index c13cc23edb60..7b6915d2cfd2 100644 --- a/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.mli +++ b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.mli @@ -29,9 +29,7 @@ open Protocol one can provide a public key hash that would be the proposer. All non- specified level and rounds are not constrained. *) type delegate_selection = - (Raw_level_repr.t - * (Round_repr.t * Tezos_crypto.Signature.public_key_hash) list) - list + (Raw_level_repr.t * (Round_repr.t * Signature.public_key_hash) list) list (** Brute-force an initial seed nonce for the desired delegate selection. When found, the seed nonce is returned as a byte sequence of size 32. If diff --git a/src/proto_alpha/lib_delegate/test/tenderbrute/tenderbrute_main.ml b/src/proto_alpha/lib_delegate/test/tenderbrute/tenderbrute_main.ml index 123db4e59248..f3558b1a1985 100644 --- a/src/proto_alpha/lib_delegate/test/tenderbrute/tenderbrute_main.ml +++ b/src/proto_alpha/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 + Signature.Public_key_hash.encoding (function `Pkh p -> Some p | _ -> None) (fun p -> `Pkh p); case diff --git a/src/proto_alpha/lib_delegate/test/test_scenario.ml b/src/proto_alpha/lib_delegate/test/test_scenario.ml index 14371ce474be..cb34cc8d3d63 100644 --- a/src/proto_alpha/lib_delegate/test/test_scenario.ml +++ b/src/proto_alpha/lib_delegate/test/test_scenario.ml @@ -1,14 +1,14 @@ open Mockup_simulator -let bootstrap1 = Tezos_crypto.Signature.Public_key.hash bootstrap1 +let bootstrap1 = Signature.Public_key.hash bootstrap1 -let bootstrap2 = Tezos_crypto.Signature.Public_key.hash bootstrap2 +let bootstrap2 = Signature.Public_key.hash bootstrap2 -let bootstrap3 = Tezos_crypto.Signature.Public_key.hash bootstrap3 +let bootstrap3 = Signature.Public_key.hash bootstrap3 -let bootstrap4 = Tezos_crypto.Signature.Public_key.hash bootstrap4 +let bootstrap4 = Signature.Public_key.hash bootstrap4 -let bootstrap5 = Tezos_crypto.Signature.Public_key.hash bootstrap5 +let bootstrap5 = Signature.Public_key.hash bootstrap5 let some_seed s = Some (Protocol.State_hash.of_b58check_exn s) diff --git a/src/proto_alpha/lib_injector/injector_common.ml b/src/proto_alpha/lib_injector/injector_common.ml index ad6336e2a24c..9ceb0f772172 100644 --- a/src/proto_alpha/lib_injector/injector_common.ml +++ b/src/proto_alpha/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 : Signature.public_key_hash; + pk : Signature.public_key; sk : Client_keys.sk_uri; } diff --git a/src/proto_alpha/lib_injector/injector_common.mli b/src/proto_alpha/lib_injector/injector_common.mli index c5bfb943322f..9f7d6956fbe0 100644 --- a/src/proto_alpha/lib_injector/injector_common.mli +++ b/src/proto_alpha/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 : Signature.public_key_hash; + pk : Signature.public_key; sk : Client_keys.sk_uri; } @@ -44,9 +44,7 @@ type 'block reorg = { (** Retrieve a signer from the client wallet. *) val get_signer : - #Client_context.wallet -> - Tezos_crypto.Signature.public_key_hash -> - signer tzresult Lwt.t + #Client_context.wallet -> Signature.public_key_hash -> signer tzresult Lwt.t val no_reorg : 'a reorg diff --git a/src/proto_alpha/lib_injector/injector_errors.ml b/src/proto_alpha/lib_injector/injector_errors.ml index b2e5b98bebc3..c6c9f590ef93 100644 --- a/src/proto_alpha/lib_injector/injector_errors.ml +++ b/src/proto_alpha/lib_injector/injector_errors.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -type error += No_worker_for_source of Tezos_crypto.Signature.Public_key_hash.t +type error += No_worker_for_source of Signature.Public_key_hash.t let () = register_error_kind @@ -35,11 +35,10 @@ let () = Format.fprintf ppf "No worker for source %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp s) `Permanent - Data_encoding.( - obj1 (req "source" Tezos_crypto.Signature.Public_key_hash.encoding)) + Data_encoding.(obj1 (req "source" Signature.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_alpha/lib_injector/injector_errors.mli b/src/proto_alpha/lib_injector/injector_errors.mli index 1c39b4ffc53a..e3e0f56666c9 100644 --- a/src/proto_alpha/lib_injector/injector_errors.mli +++ b/src/proto_alpha/lib_injector/injector_errors.mli @@ -25,7 +25,7 @@ (** 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 Signature.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_alpha/lib_injector/injector_events.ml b/src/proto_alpha/lib_injector/injector_events.ml index b1a4cedb3371..5a5236975eef 100644 --- a/src/proto_alpha/lib_injector/injector_events.ml +++ b/src/proto_alpha/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", Signature.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Signature.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", Signature.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Signature.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", Signature.Public_key_hash.encoding) ("tags", Tags.encoding) enc1 enc2 enc3 - ~pp1:Tezos_crypto.Signature.Public_key_hash.pp_short + ~pp1:Signature.Public_key_hash.pp_short ~pp2:Tags.pp ?pp3:pp1 ?pp4:pp2 diff --git a/src/proto_alpha/lib_injector/injector_functor.ml b/src/proto_alpha/lib_injector/injector_functor.ml index 898aeb1f96e1..408b7717d5ec 100644 --- a/src/proto_alpha/lib_injector/injector_functor.ml +++ b/src/proto_alpha/lib_injector/injector_functor.ml @@ -520,7 +520,7 @@ module Make (Rollup : PARAMETERS) = struct let* signature = Client_keys.sign state.cctxt - ~watermark:Tezos_crypto.Signature.Generic_operation + ~watermark:Signature.Generic_operation state.signer.sk unsigned_op_bytes in @@ -634,7 +634,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 = Signature.zero in let branch = Block_hash.zero in let operation = { @@ -1014,9 +1014,7 @@ module Make (Rollup : PARAMETERS) = struct (fun acc (signer, strategy, tags) -> let tags = Tags.of_list tags in let strategy, tags = - match - Tezos_crypto.Signature.Public_key_hash.Map.find_opt signer acc - with + match Signature.Public_key_hash.Map.find_opt signer acc with | None -> (strategy, tags) | Some (other_strategy, other_tags) -> let strategy = @@ -1030,17 +1028,14 @@ module Make (Rollup : PARAMETERS) = struct in (strategy, Tags.union other_tags tags) in - Tezos_crypto.Signature.Public_key_hash.Map.add - signer - (strategy, tags) - acc) - Tezos_crypto.Signature.Public_key_hash.Map.empty + Signature.Public_key_hash.Map.add signer (strategy, tags) acc) + Signature.Public_key_hash.Map.empty signers in let* constants = Protocol.Constants_services.all cctxt (cctxt#chain, cctxt#block) in - Tezos_crypto.Signature.Public_key_hash.Map.iter_es + Signature.Public_key_hash.Map.iter_es (fun signer (strategy, tags) -> let+ worker = Worker.launch diff --git a/src/proto_alpha/lib_injector/injector_worker_types.ml b/src/proto_alpha/lib_injector/injector_worker_types.ml index 8ea98a4b4871..fca7eed3f8ff 100644 --- a/src/proto_alpha/lib_injector/injector_worker_types.ml +++ b/src/proto_alpha/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 = Signature.Public_key_hash.encoding let base = ["tx_rollup_injector"] - let pp = Tezos_crypto.Signature.Public_key_hash.pp_short + let pp = Signature.Public_key_hash.pp_short - let equal = Tezos_crypto.Signature.Public_key_hash.equal + let equal = Signature.Public_key_hash.equal end diff --git a/src/proto_alpha/lib_injector/l1_operation.ml b/src/proto_alpha/lib_injector/l1_operation.ml index c140f9901087..59438c487992 100644 --- a/src/proto_alpha/lib_injector/l1_operation.ml +++ b/src/proto_alpha/lib_injector/l1_operation.ml @@ -149,7 +149,7 @@ module Manager_operation = struct ty pp_lazy_expr contents - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp claimer in Format.fprintf diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 873392b09452..f665437ecbe2 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -419,8 +419,8 @@ 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 = Signature.Public_key.of_b58check_exn s in + let public_key_hash = Signature.Public_key.hash public_key in Parameters. { public_key_hash; diff --git a/src/proto_alpha/lib_parameters/default_parameters.mli b/src/proto_alpha/lib_parameters/default_parameters.mli index f930bc38fd87..eff7da674972 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.mli +++ b/src/proto_alpha/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 + Signature.public_key_hash + * Signature.public_key * Tez.t - * Tezos_crypto.Signature.public_key_hash option - * Tezos_crypto.Signature.public_key option -> + * Signature.public_key_hash option + * Signature.public_key option -> Parameters.bootstrap_account val parameters_of_constants : diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 7b24e94e442f..6281adc2d03c 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -940,7 +940,7 @@ module Scripts = struct type run_code_config = { balance : Tez.t; self : Contract_hash.t; - payer : Tezos_crypto.Signature.public_key_hash; + payer : Signature.public_key_hash; source : Contract.t; } @@ -970,9 +970,8 @@ module Scripts = struct let source_and_payer ~src_opt ~pay_opt ~default_src = match (src_opt, pay_opt) with | None, None -> - ( Contract.Originated default_src, - Tezos_crypto.Signature.Public_key_hash.zero ) - | Some c, None -> (c, Tezos_crypto.Signature.Public_key_hash.zero) + (Contract.Originated default_src, Signature.Public_key_hash.zero) + | Some c, None -> (c, Signature.Public_key_hash.zero) | None, Some c -> (Contract.Implicit c, c) | Some src, Some pay -> (src, pay) in @@ -3024,10 +3023,10 @@ module Baking_rights = struct {level; delegate; consensus_key; round; timestamp}) (obj5 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Signature.Public_key_hash.encoding) (req "round" Round.encoding) (opt "estimated_time" Timestamp.encoding) - (req "consensus_key" Tezos_crypto.Signature.Public_key_hash.encoding)) + (req "consensus_key" Signature.Public_key_hash.encoding)) let default_max_round = 64 @@ -3039,8 +3038,8 @@ 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; - consensus_keys : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Signature.Public_key_hash.t list; + consensus_keys : Signature.Public_key_hash.t list; max_round : int option; all : bool; } @@ -3130,16 +3129,12 @@ 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) + Signature.Public_key_hash.Set.exists + (Signature.Public_key_hash.equal r.delegate) previous then (acc, previous) - else - ( r :: acc, - Tezos_crypto.Signature.Public_key_hash.Set.add - r.delegate - previous )) - ([], Tezos_crypto.Signature.Public_key_hash.Set.empty) + else (r :: acc, Signature.Public_key_hash.Set.add r.delegate previous)) + ([], Signature.Public_key_hash.Set.empty) rights let register () = @@ -3175,7 +3170,7 @@ module Baking_rights = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Signature.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights @@ -3186,7 +3181,7 @@ module Baking_rights = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.consensus_key) + (Signature.Public_key_hash.equal p.consensus_key) delegates in List.filter is_requested rights @@ -3205,8 +3200,8 @@ end module Endorsing_rights = struct type delegate_rights = { - delegate : Tezos_crypto.Signature.Public_key_hash.t; - consensus_key : Tezos_crypto.Signature.Public_key_hash.t; + delegate : Signature.Public_key_hash.t; + consensus_key : Signature.Public_key_hash.t; first_slot : Slot.t; endorsing_power : int; } @@ -3225,10 +3220,10 @@ module Endorsing_rights = struct (fun (delegate, first_slot, endorsing_power, consensus_key) -> {delegate; first_slot; endorsing_power; consensus_key}) (obj4 - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Signature.Public_key_hash.encoding) (req "first_slot" Slot.encoding) (req "endorsing_power" uint16) - (req "consensus_key" Tezos_crypto.Signature.Public_key_hash.encoding)) + (req "consensus_key" Signature.Public_key_hash.encoding)) let encoding = let open Data_encoding in @@ -3250,8 +3245,8 @@ 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; - consensus_keys : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Signature.Public_key_hash.t list; + consensus_keys : Signature.Public_key_hash.t list; } let endorsing_rights_query = @@ -3339,10 +3334,10 @@ module Endorsing_rights = struct | _, _ -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.consensus_key) + (Signature.Public_key_hash.equal p.consensus_key) q.consensus_keys || List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Signature.Public_key_hash.equal p.delegate) q.delegates in List.filter_map @@ -3370,8 +3365,8 @@ end module Validators = struct type t = { level : Raw_level.t; - delegate : Tezos_crypto.Signature.Public_key_hash.t; - consensus_key : Tezos_crypto.Signature.public_key_hash; + delegate : Signature.Public_key_hash.t; + consensus_key : Signature.public_key_hash; slots : Slot.t list; } @@ -3384,9 +3379,9 @@ module Validators = struct {level; delegate; consensus_key; slots}) (obj4 (req "level" Raw_level.encoding) - (req "delegate" Tezos_crypto.Signature.Public_key_hash.encoding) + (req "delegate" Signature.Public_key_hash.encoding) (req "slots" (list Slot.encoding)) - (req "consensus_key" Tezos_crypto.Signature.Public_key_hash.encoding)) + (req "consensus_key" Signature.Public_key_hash.encoding)) module S = struct open Data_encoding @@ -3395,8 +3390,8 @@ module Validators = struct type validators_query = { levels : Raw_level.t list; - delegates : Tezos_crypto.Signature.Public_key_hash.t list; - consensus_keys : Tezos_crypto.Signature.Public_key_hash.t list; + delegates : Signature.Public_key_hash.t list; + consensus_keys : Signature.Public_key_hash.t list; } let validators_query = @@ -3451,7 +3446,7 @@ module Validators = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.delegate) + (Signature.Public_key_hash.equal p.delegate) delegates in List.filter is_requested rights @@ -3462,7 +3457,7 @@ module Validators = struct | _ :: _ as delegates -> let is_requested p = List.exists - (Tezos_crypto.Signature.Public_key_hash.equal p.consensus_key) + (Signature.Public_key_hash.equal p.consensus_key) delegates in List.filter is_requested rights diff --git a/src/proto_alpha/lib_plugin/test/generators.ml b/src/proto_alpha/lib_plugin/test/generators.ml index affc95dd5a77..2987fab6c3ca 100644 --- a/src/proto_alpha/lib_plugin/test/generators.ml +++ b/src/proto_alpha/lib_plugin/test/generators.ml @@ -28,14 +28,12 @@ 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) + (Signature.public_key_hash * Signature.public_key * Signature.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 () + Signature.generate_key ~seed () (* TODO: https://gitlab.com/tezos/tezos/-/issues/2407 move this function to an helper file? *) @@ -49,7 +47,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 = Signature.Public_key_hash.zero in let counter = Manager_counter.Internal_for_tests.of_int 0 in let storage_limit = Z.zero in let operation = Set_deposits_limit None in @@ -58,9 +56,7 @@ let dummy_manager_op_info = {source; fee; counter; operation; gas_limit; storage_limit} in let contents = Single contents in - let protocol_data = - {contents; signature = Some Tezos_crypto.Signature.zero} - in + let protocol_data = {contents; signature = Some Signature.zero} in let branch = Block_hash.zero in Mempool.Manager_op {shell = {branch}; protocol_data} in diff --git a/src/proto_alpha/lib_protocol/test/helpers/account.ml b/src/proto_alpha/lib_protocol/test/helpers/account.ml index 3e7d428897e5..7f0144c19454 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/account.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/account.ml @@ -27,20 +27,20 @@ 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 : Signature.Public_key_hash.t; + pk : Signature.Public_key.t; + sk : Signature.Secret_key.t; } type account = t -let known_accounts = Tezos_crypto.Signature.Public_key_hash.Table.create 17 +let known_accounts = Signature.Public_key_hash.Table.create 17 let random_seed ~rng_state = Bytes.init Tezos_crypto.Hacl.Ed25519.sk_size (fun _i -> Char.chr (Random.State.int rng_state 256)) -let random_algo ~rng_state : Tezos_crypto.Signature.algo = +let random_algo ~rng_state : Signature.algo = match Random.State.int rng_state 3 with | 0 -> Ed25519 | 1 -> Secp256k1 @@ -50,35 +50,29 @@ let random_algo ~rng_state : Tezos_crypto.Signature.algo = let new_account ?(rng_state = Random.State.make_self_init ()) ?(seed = random_seed ~rng_state) ?(algo = random_algo ~rng_state) () = - let pkh, pk, sk = Tezos_crypto.Signature.generate_key ~algo ~seed () in + let pkh, pk, sk = Signature.generate_key ~algo ~seed () in let account = {pkh; pk; sk} in - Tezos_crypto.Signature.Public_key_hash.Table.add known_accounts pkh account ; + Signature.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 + Signature.Public_key_hash.Table.add known_accounts pkh account let activator_account = let seed = random_seed ~rng_state:(Random.State.make [|0x1337533D|]) in new_account ~seed () let find pkh = - match - Tezos_crypto.Signature.Public_key_hash.Table.find known_accounts pkh - with + match Signature.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 - pkh + | None -> failwith "Missing account: %a" Signature.Public_key_hash.pp pkh let find_alternate pkh = let exception Found of t in try - Tezos_crypto.Signature.Public_key_hash.Table.iter + Signature.Public_key_hash.Table.iter (fun pkh' account -> - if not (Tezos_crypto.Signature.Public_key_hash.equal pkh pkh') then + if not (Signature.Public_key_hash.equal pkh pkh') then raise (Found account)) known_accounts ; raise Not_found @@ -93,7 +87,7 @@ let dummy_account = let default_initial_balance = Tez.of_mutez_exn 4_000_000_000_000L let generate_accounts ?rng_state n : t list tzresult = - Tezos_crypto.Signature.Public_key_hash.Table.clear known_accounts ; + Signature.Public_key_hash.Table.clear known_accounts ; List.init ~when_negative_length:[] n (fun _i -> new_account ?rng_state ()) let commitment_secret = @@ -102,9 +96,7 @@ let commitment_secret = |> WithExceptions.Option.get ~loc:__LOC__ let new_commitment ?seed () = - let pkh, pk, sk = - Tezos_crypto.Signature.generate_key ?seed ~algo:Ed25519 () - in + let pkh, pk, sk = Signature.generate_key ?seed ~algo:Ed25519 () in let unactivated_account = {pkh; pk; sk} in let open Commitment in let pkh = match pkh with Ed25519 pkh -> pkh | _ -> assert false in diff --git a/src/proto_alpha/lib_protocol/test/helpers/account.mli b/src/proto_alpha/lib_protocol/test/helpers/account.mli index f97b60d4d883..62ae056b2e6a 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/account.mli +++ b/src/proto_alpha/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 : Signature.Public_key_hash.t; + pk : Signature.Public_key.t; + sk : Signature.Secret_key.t; } type account = t -val known_accounts : t Tezos_crypto.Signature.Public_key_hash.Table.t +val known_accounts : t Signature.Public_key_hash.Table.t val activator_account : account @@ -47,15 +47,15 @@ val dummy_account : account val new_account : ?rng_state:Random.State.t -> ?seed:Bytes.t -> - ?algo:Tezos_crypto.Signature.algo -> + ?algo:Signature.algo -> unit -> account val add_account : t -> unit -val find : Tezos_crypto.Signature.Public_key_hash.t -> t tzresult Lwt.t +val find : Signature.Public_key_hash.t -> t tzresult Lwt.t -val find_alternate : Tezos_crypto.Signature.Public_key_hash.t -> t +val find_alternate : Signature.Public_key_hash.t -> t (** 4.000.000.000 tez *) val default_initial_balance : Tez.t @@ -72,7 +72,7 @@ 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 -> Signature.Public_key_hash.t (** [make_bootstrap_account ~initial_balance ~delegate_to account] creates a {!Parameters.bootstrap_account} from an account with the default or set @@ -81,8 +81,8 @@ val pkh_of_contract_exn : Contract.t -> Tezos_crypto.Signature.Public_key_hash.t *) val make_bootstrap_account : ?balance:Tez.t -> - ?delegate_to:Tezos_crypto.Signature.public_key_hash option -> - ?consensus_key:Tezos_crypto.Signature.public_key option -> + ?delegate_to:Signature.public_key_hash option -> + ?consensus_key:Signature.public_key option -> t -> Parameters.bootstrap_account @@ -94,7 +94,7 @@ val make_bootstrap_account : *) val make_bootstrap_accounts : ?bootstrap_balances:int64 list -> - ?bootstrap_delegations:Tezos_crypto.Signature.public_key_hash option list -> - ?bootstrap_consensus_keys:Tezos_crypto.Signature.public_key option list -> + ?bootstrap_delegations:Signature.public_key_hash option list -> + ?bootstrap_consensus_keys:Signature.public_key option list -> t list -> Parameters.bootstrap_account list diff --git a/src/proto_alpha/lib_protocol/test/helpers/assert.ml b/src/proto_alpha/lib_protocol/test/helpers/assert.ml index 983cc13fc8e9..4e491c3b2947 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/assert.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/assert.ml @@ -163,14 +163,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 : Signature.Public_key_hash.t) + (b : Signature.Public_key_hash.t) = + let module PKH = Signature.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 : Signature.Public_key_hash.t) + (b : Signature.Public_key_hash.t) = + let module PKH = Signature.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_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index e88f7ad7e438..76202df1e2c2 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -93,11 +93,7 @@ let get_next_baker_by_account pkh block = >>=? fun bakers -> (match List.hd bakers with | Some b -> return b - | None -> - failwith - "No slots found for %a" - Tezos_crypto.Signature.Public_key_hash.pp - pkh) + | None -> failwith "No slots found for %a" Signature.Public_key_hash.pp pkh) >>=? fun { Plugin.RPC.Baking_rights.delegate = pkh; consensus_key; @@ -126,7 +122,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:Signature.Public_key_hash.equal consensus_key excludes)) bakers @@ -203,7 +199,7 @@ module Forge = struct (shell, contents) in let signature = - Tezos_crypto.Signature.sign + Signature.sign ~watermark: Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) signer_account.sk @@ -444,11 +440,7 @@ let genesis_with_parameters parameters = >|=? fun {context; _} -> { hash; - header = - { - shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; - }; + header = {shell; protocol_data = {contents; signature = Signature.zero}}; operations = []; context; } @@ -640,11 +632,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum in { hash; - header = - { - shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; - }; + header = {shell; protocol_data = {contents; signature = Signature.zero}}; operations = []; context; } diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.mli b/src/proto_alpha/lib_protocol/test/helpers/block.mli index 77498b11df15..f89a68a844a2 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.mli +++ b/src/proto_alpha/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:Signature.public_key_hash -> header -> header diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 5aa436ff163b..7a5ececff0e7 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -140,8 +140,7 @@ let get_endorser_slot ctxt pkh = List.find_map (function | {Plugin.RPC.Validators.consensus_key; slots; _} -> - if Tezos_crypto.Signature.Public_key_hash.(consensus_key = pkh) then - Some slots + if Signature.Public_key_hash.(consensus_key = pkh) then Some slots else None) endorsers @@ -157,7 +156,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 Signature.Public_key_hash.equal delegate pkh then return (List.length slots) else find_slots_for_delegate t in @@ -180,8 +179,7 @@ let get_baker ctxt ~round = let get_first_different_baker baker bakers = WithExceptions.Option.get ~loc:__LOC__ @@ List.find - (fun baker' -> - Tezos_crypto.Signature.Public_key_hash.( <> ) baker baker') + (fun baker' -> Signature.Public_key_hash.( <> ) baker baker') bakers let get_first_different_bakers ctxt = @@ -355,9 +353,8 @@ 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; - pending_consensus_keys : - (Cycle.t * Tezos_crypto.Signature.Public_key_hash.t) list; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; } let info ctxt pkh = Delegate_services.info rpc_ctxt ctxt pkh diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 639c6a1297d7..87c3415b8e44 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -116,8 +116,7 @@ module Vote : sig val get_ballots : t -> Vote.ballots tzresult Lwt.t val get_ballot_list : - t -> - (Tezos_crypto.Signature.Public_key_hash.t * Vote.ballot) list tzresult Lwt.t + t -> (Signature.Public_key_hash.t * Vote.ballot) list tzresult Lwt.t val get_current_period : t -> Voting_period.info tzresult Lwt.t @@ -126,7 +125,7 @@ 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 -> (Signature.Public_key_hash.t * int64) list tzresult Lwt.t val get_proposals : t -> int64 Protocol_hash.Map.t tzresult Lwt.t @@ -195,9 +194,8 @@ module Delegate : sig deactivated : bool; grace_period : Cycle.t; voting_info : Vote.delegate_info; - active_consensus_key : Tezos_crypto.Signature.Public_key_hash.t; - pending_consensus_keys : - (Cycle.t * Tezos_crypto.Signature.Public_key_hash.t) list; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; } val info : t -> public_key_hash -> Delegate_services.info tzresult Lwt.t @@ -243,17 +241,15 @@ module Sc_rollup : sig val timeout : t -> Sc_rollup.t -> - Tezos_crypto.Signature.Public_key_hash.t -> - Tezos_crypto.Signature.Public_key_hash.t -> + Signature.Public_key_hash.t -> + Signature.Public_key_hash.t -> Sc_rollup.Game.timeout option tzresult Lwt.t val ongoing_games_for_staker : t -> Sc_rollup.t -> - Tezos_crypto.Signature.public_key_hash -> - (Sc_rollup.Game.t - * Tezos_crypto.Signature.public_key_hash - * Tezos_crypto.Signature.public_key_hash) + Signature.public_key_hash -> + (Sc_rollup.Game.t * Signature.public_key_hash * Signature.public_key_hash) list tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml index 7385aaecb219..d3dffd21c749 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml +++ b/src/proto_alpha/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 = Signature.Public_key_hash.zero let default_source = Contract.Implicit default_payer diff --git a/src/proto_alpha/lib_protocol/test/helpers/dummy_zk_rollup.ml b/src/proto_alpha/lib_protocol/test/helpers/dummy_zk_rollup.ml index 71407dfdd7aa..86cd66d7cf3e 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/dummy_zk_rollup.ml +++ b/src/proto_alpha/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 Signature.Public_key_hash.encoding) + (encoding_of_scalar Signature.Public_key_hash.encoding) scalar_encoding let amount_encoding ~safety = Bounded_e.encoding ~safety Bound.bound_amount @@ -596,7 +596,7 @@ end = struct {id; amount = Z.zero}); l1_dst = Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Public_key_hash.encoding + Signature.Public_key_hash.encoding dummy_l1_dst; rollup_id = Data_encoding.Binary.of_bytes_exn diff --git a/src/proto_alpha/lib_protocol/test/helpers/expr_common.ml b/src/proto_alpha/lib_protocol/test/helpers/expr_common.ml index e6444892c600..554bba47ce07 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/expr_common.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/expr_common.ml @@ -78,7 +78,7 @@ 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 Signature.Public_key.encoding b let address_of_bytes_exn b = Data_encoding.Binary.of_bytes_exn Contract.encoding b diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index c1c382ffbe86..1559d909017e 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/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 = Signature.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 = Context_hash.zero; operations_hash = Operation_list_list_hash.zero; }; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; + protocol_data = {contents; signature = Signature.zero}; } in begin_validation_and_application diff --git a/src/proto_alpha/lib_protocol/test/helpers/liquidity_baking_machine.ml b/src/proto_alpha/lib_protocol/test/helpers/liquidity_baking_machine.ml index 5ee590fa6812..c0feb9d7e5ab 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/liquidity_baking_machine.ml +++ b/src/proto_alpha/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 + Signature.Public_key_hash.of_b58check_exn "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"; pk = - Tezos_crypto.Signature.Public_key.of_b58check_exn + Signature.Public_key.of_b58check_exn "edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav"; sk = - Tezos_crypto.Signature.Secret_key.of_b58check_exn + Signature.Secret_key.of_b58check_exn "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh"; } diff --git a/src/proto_alpha/lib_protocol/test/helpers/lqt_fa12_repr.ml b/src/proto_alpha/lib_protocol/test/helpers/lqt_fa12_repr.ml index 168bbb43dac6..af27ec2e2e93 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/lqt_fa12_repr.ml +++ b/src/proto_alpha/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 Signature.Public_key_hash.zero; totalSupply = Z.zero; } diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 6fc57ee26f8d..bd0cfa8fbe42 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -31,14 +31,13 @@ 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 branch - contents = +let sign ?(watermark = Signature.Generic_operation) sk branch contents = let unsigned = Data_encoding.Binary.to_bytes_exn Operation.unsigned_encoding ({branch}, Contents_list contents) in - let signature = Some (Tezos_crypto.Signature.sign ~watermark sk unsigned) in + let signature = Some (Signature.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 @@ -270,7 +269,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 = Signature.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -340,7 +339,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 = Signature.Public_key.hash public_key; fee; counter; operation; @@ -356,7 +355,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 = Signature.Public_key.hash public_key; fee = Tez.zero; counter; operation = Reveal public_key; @@ -367,7 +366,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 = Signature.Public_key.hash public_key; fee; counter = Manager_counter.succ counter; operation; @@ -386,7 +385,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 -> Signature.Public_key.hash public_key in resolve_gas_limit ctxt gas_limit >>=? fun gas_limit -> let source = Contract.Implicit pkh in @@ -548,15 +547,14 @@ let increase_paid_storage ?force_reveal ?counter ?fee ?gas_limit ?storage_limit Context.Contract.manager ctxt source >|=? fun account -> sign account.sk (Context.branch ctxt) sop -let activation ctxt (pkh : Tezos_crypto.Signature.Public_key_hash.t) - activation_code = +let activation ctxt (pkh : Signature.Public_key_hash.t) activation_code = (match pkh with | Ed25519 edpkh -> return edpkh | _ -> 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 + Signature.Ed25519 encrypted public key hash" + Signature.Public_key_hash.pp pkh) >|=? fun id -> let contents = Single (Activate_account {id; activation_code}) in diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.mli b/src/proto_alpha/lib_protocol/test/helpers/op.mli index c6cc27152b8d..dc4c645b43cf 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/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:Signature.watermark -> + Signature.secret_key -> Block_hash.t -> packed_contents_list -> packed_operation @@ -272,7 +272,7 @@ val originated_contract : Operation.packed -> Contract.t val register_global_constant : ?force_reveal:bool -> ?counter:Manager_counter.t -> - ?public_key:Tezos_crypto.Signature.public_key -> + ?public_key:Signature.public_key -> ?fee:Tez.tez -> ?gas_limit:gas_limit -> ?storage_limit:Z.t -> @@ -303,7 +303,7 @@ val double_baking : val activation : Context.t -> - Tezos_crypto.Signature.Public_key_hash.t -> + Signature.Public_key_hash.t -> Blinded_public_key_hash.activation_code -> Operation.packed tzresult Lwt.t @@ -598,9 +598,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:Signature.Public_key_hash.t -> + delegate:Signature.Public_key_hash.t -> + destination:Signature.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_alpha/lib_protocol/test/helpers/operation_generator.ml b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml index ab1d4c38223b..adb9886f7089 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -133,7 +133,7 @@ let random_payload_hash = let module G = Gen_hash (Block_payload_hash) in G.gen -let gen_algo = QCheck2.Gen.oneofl Tezos_crypto.Signature.algos +let gen_algo = QCheck2.Gen.oneofl Signature.algos let random_seed = let open QCheck2.Gen in @@ -144,40 +144,29 @@ let random_keys = let open QCheck2.Gen in let* algo = gen_algo in let+ seed = random_seed in - Tezos_crypto.Signature.generate_key ~algo ~seed () + Signature.generate_key ~algo ~seed () let random_tz1 = let open QCheck2.Gen in - let+ str = - string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) - in - (Ed25519 (Tezos_crypto.Signature.Ed25519.Public_key_hash.of_string_exn str) + let+ str = string_size (pure Signature.Ed25519.Public_key_hash.size) in + (Ed25519 (Signature.Ed25519.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz2 = let open QCheck2.Gen in - let+ str = - string_size (pure Tezos_crypto.Signature.Secp256k1.Public_key_hash.size) - in - (Secp256k1 - (Tezos_crypto.Signature.Secp256k1.Public_key_hash.of_string_exn str) + let+ str = string_size (pure Signature.Secp256k1.Public_key_hash.size) in + (Secp256k1 (Signature.Secp256k1.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz3 = let open QCheck2.Gen in - let+ str = - string_size (pure Tezos_crypto.Signature.P256.Public_key_hash.size) - in - (P256 (Tezos_crypto.Signature.P256.Public_key_hash.of_string_exn str) - : public_key_hash) + let+ str = string_size (pure Signature.P256.Public_key_hash.size) in + (P256 (Signature.P256.Public_key_hash.of_string_exn str) : public_key_hash) let random_tz4 = let open QCheck2.Gen in - let+ str = - string_size (pure Tezos_crypto.Signature.Bls.Public_key_hash.size) - in - (Bls (Tezos_crypto.Signature.Bls.Public_key_hash.of_string_exn str) - : public_key_hash) + let+ str = string_size (pure Signature.Bls.Public_key_hash.size) in + (Bls (Signature.Bls.Public_key_hash.of_string_exn str) : public_key_hash) let random_pkh = let open QCheck2.Gen in @@ -198,35 +187,32 @@ let random_signature = let* algo = option ~ratio:0.8 gen_algo in match algo with | None -> - let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in - (Unknown (Bytes.unsafe_of_string str) : Tezos_crypto.Signature.t) + let+ str = string_size (pure Signature.Ed25519.size) in + (Unknown (Bytes.unsafe_of_string str) : Signature.t) | Some Ed25519 -> - let+ str = string_size (pure Tezos_crypto.Signature.Ed25519.size) in - (Ed25519 (Tezos_crypto.Signature.Ed25519.of_string_exn str) - : Tezos_crypto.Signature.t) + let+ str = string_size (pure Signature.Ed25519.size) in + (Ed25519 (Signature.Ed25519.of_string_exn str) : Signature.t) | Some Secp256k1 -> - let+ str = string_size (pure Tezos_crypto.Signature.Secp256k1.size) in - (Secp256k1 (Tezos_crypto.Signature.Secp256k1.of_string_exn str) - : Tezos_crypto.Signature.t) + let+ str = string_size (pure Signature.Secp256k1.size) in + (Secp256k1 (Signature.Secp256k1.of_string_exn str) : Signature.t) | Some P256 -> - let+ str = string_size (pure Tezos_crypto.Signature.P256.size) in - (P256 (Tezos_crypto.Signature.P256.of_string_exn str) - : Tezos_crypto.Signature.t) + let+ str = string_size (pure Signature.P256.size) in + (P256 (Signature.P256.of_string_exn str) : Signature.t) | Some Bls -> let+ seed = random_seed in - let _, _, sk = Tezos_crypto.Signature.generate_key ~algo:Bls ~seed () in - Tezos_crypto.Signature.sign sk Bytes.empty + let _, _, sk = Signature.generate_key ~algo:Bls ~seed () in + Signature.sign sk Bytes.empty let random_signature = let open QCheck2.Gen in graft_corners random_signature - Tezos_crypto.Signature. + Signature. [ - of_ed25519 Tezos_crypto.Signature.Ed25519.zero; - of_secp256k1 Tezos_crypto.Signature.Secp256k1.zero; - of_p256 Tezos_crypto.Signature.P256.zero; - of_bls Tezos_crypto.Signature.Bls.zero; + of_ed25519 Signature.Ed25519.zero; + of_secp256k1 Signature.Secp256k1.zero; + of_p256 Signature.P256.zero; + of_bls Signature.Bls.zero; Unknown (Bytes.make 64 '\000'); ] () @@ -265,9 +251,7 @@ let random_proto = let random_code = let open QCheck2.Gen in - let+ str = - string_size (pure Tezos_crypto.Signature.Ed25519.Public_key_hash.size) - in + let+ str = string_size (pure Signature.Ed25519.Public_key_hash.size) in let (`Hex hex) = Hex.of_string str in Blinded_public_key_hash.activation_code_of_hex hex |> WithExceptions.Option.get ~loc:__LOC__ @@ -442,11 +426,7 @@ let generate_activate_account = let open QCheck2.Gen in let* activation_code = random_code in let+ id = random_tz1 in - let id = - match id with - | Tezos_crypto.Signature.Ed25519 pkh -> pkh - | _ -> assert false - in + let id = match id with Signature.Ed25519 pkh -> pkh | _ -> assert false in Activate_account {id; activation_code} let random_period = diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml index 7b53651b5635..8dd765e5fcab 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml @@ -170,7 +170,7 @@ 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 Signature.Public_key_hash.equal c_pkh pkh then return c else find_contract t in find_contract contracts @@ -223,7 +223,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 Signature.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 -> @@ -265,8 +265,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 - baking_reward + if Signature.Public_key_hash.equal baker_b2 baker_b1 then baking_reward else Tez.zero in let expected_balance = @@ -283,8 +282,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 - baking_reward + if Signature.Public_key_hash.equal baker_b2' baker_b1 then baking_reward else Tez.zero in let expected_balance' = @@ -390,7 +388,7 @@ let test_committee_sampling () = Format.fprintf ppf "@[<h>- %a %d%a@]@," - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp pkh n (fun ppf failed -> diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml index 227e19498598..912d7b5e758c 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_consensus_key.ml @@ -193,7 +193,7 @@ let test_tz4_consensus_key () = Environment.Ecoproto_error (Delegate_consensus_key.Invalid_consensus_key_update_tz4 pk); ] - when Tezos_crypto.Signature.Bls.Public_key.(pk = tz4_pk) -> + when Signature.Bls.Public_key.(pk = tz4_pk) -> return_unit | err -> failwith diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml index a8fa7b8e547b..393330708fea 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml @@ -311,7 +311,7 @@ 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 (Signature.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 +325,7 @@ 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 (Signature.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_alpha/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml index 527ad98cd70d..995ff2d40c9d 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml @@ -1390,7 +1390,7 @@ let test_bls_account_cannot_self_delegate () = Environment.Ecoproto_error (Contract_delegate_storage.Forbidden_tz4_delegate pkh); ] - when Tezos_crypto.Signature.Bls.Public_key_hash.(pkh = tz4_pkh) -> + when Signature.Bls.Public_key_hash.(pkh = tz4_pkh) -> return_unit | err -> failwith diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml index cd7b92e17e21..ce777f8cbf17 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -119,8 +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 - e1.delegate + if Signature.Public_key_hash.( = ) e1.delegate baker1 then e1.delegate else e2.delegate in Op.raw_endorsement ~delegate blk_a >>=? fun endorsement_a -> @@ -166,8 +165,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 - e1.delegate + if Signature.Public_key_hash.( = ) e1.delegate baker1 then e1.delegate else e2.delegate in Op.raw_endorsement ~delegate blk_a >>=? fun endorsement_a -> diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml index 8417f6911f0f..4db83c0171ad 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -254,11 +254,8 @@ let test_different_delegates () = Context.get_first_different_endorsers (B blk_b) >>=? fun (endorser_b1c, endorser_b2c) -> let endorser_b = - if - Tezos_crypto.Signature.Public_key_hash.( = ) - endorser_a - endorser_b1c.delegate - then endorser_b2c.delegate + if Signature.Public_key_hash.( = ) endorser_a endorser_b1c.delegate then + endorser_b2c.delegate else endorser_b1c.delegate in Op.raw_endorsement ~delegate:endorser_a blk_a >>=? fun e_a -> @@ -284,8 +281,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 = - if Tezos_crypto.Signature.Public_key_hash.equal endorser_a endorser0 then - endorser1 + if Signature.Public_key_hash.equal endorser_a endorser0 then endorser1 else endorser0 in Op.raw_endorsement ~delegate:endorser_b blk_b >>=? fun endorsement_b -> @@ -303,11 +299,8 @@ 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 - then d1 - else if - Tezos_crypto.Signature.Public_key_hash.equal account d2.delegate - then d2 + (if Signature.Public_key_hash.equal account d1.delegate then d1 + else if Signature.Public_key_hash.equal account d2.delegate then d2 else assert false) .slots | _ -> assert false @@ -334,8 +327,7 @@ let test_freeze_more_with_low_balance = in let check_unique_endorser b account2 = Context.get_endorsers (B b) >>=? function - | [{delegate; _}] - when Tezos_crypto.Signature.Public_key_hash.equal account2 delegate -> + | [{delegate; _}] when Signature.Public_key_hash.equal account2 delegate -> return_unit | _ -> failwith "We are supposed to only have account2 as endorser." in diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index 81dbcd956388..f1c8be80ebb2 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_alpha/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 Signature.Public_key_hash.equal baker d1 then Test_tez.(lost_deposit -! denun_reward) else lost_deposit in @@ -164,8 +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 - (bal_good, bal_bad) + if Signature.Public_key_hash.equal baker d1 then (bal_good, bal_bad) else (bal_bad, bal_good) in let diff_baker = Test_tez.(high -! low) in diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_participation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_participation.ml index edfa1f50b635..d8e845126282 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_participation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_participation.ml @@ -42,7 +42,7 @@ 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 + if Signature.Public_key_hash.equal delegate endorser then Some (delegate, slots) else None) endorsers_list diff --git a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml index 9fe85ead49c5..c7c7f2ed7729 100644 --- a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_costs.ml +++ b/src/proto_alpha/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 + Signature.Public_key.of_b58check_exn "edpkuFrRoDSEbJYgxRtLx2ps82UdaYc1WwfS9sE11yhauZt5DgCHbU" let dummy_bytes = Bytes.of_string "dummy" diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml index ebb8358c3f49..302eb4dcac7b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml @@ -204,9 +204,7 @@ let test_json_roundtrip_err name e () = e let error_encoding_tests = - let contract_zero = - Contract.Implicit Tezos_crypto.Signature.Public_key_hash.zero - in + let contract_zero = Contract.Implicit Signature.Public_key_hash.zero in let script_expr_int = Micheline.strip_locations (Micheline.Int (0, Z.zero)) in List.map (fun (name, e) -> diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml index 18d132b7f79e..cd93f3f74078 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_script_typed_ir_size.ml +++ b/src/proto_alpha/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 + Signature.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 = Signature.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 = Signature.Public_key.pp in exs nsample show Key_t ": key_t") (* Timestamp_t diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml index 631e8753e7a4..b04b89a1884b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_balance.ml @@ -37,7 +37,7 @@ open Alpha_context type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Signature.public_key_hash; contract : Contract.t; } diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_manager.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_manager.ml index d5fd22a2eca2..d30cacf107b0 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_manager.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_ticket_manager.ml @@ -43,7 +43,7 @@ open Alpha_context type init_env = { block : Block.t; - baker : Tezos_crypto.Signature.public_key_hash; + baker : Signature.public_key_hash; contract : Contract.t; } diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml index 0bbf9e283fb0..5f6e34a3046e 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_activation.ml +++ b/src/proto_alpha/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 : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.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 = Signature.Secret_key.to_public_key sk in + let pkh = Signature.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 = Signature.Public_key_hash.of_b58check_exn pkh in + assert (Signature.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 + Signature.Public_key_hash.of_b58check_exn "tz1PeQHGKPWSpNoozvxgqLN9TFsj6rDqNV3o" in Op.activation (B blk) inexistent_pkh activation_code >>=? fun operation -> diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_reveal.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_reveal.ml index d8f5ef94b4aa..c4179f275bda 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_reveal.ml +++ b/src/proto_alpha/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_ (Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Signature.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_ (Signature.Public_key_hash.equal a_pkh b_pkh) (fun () -> failwith "Expected different pkhs: got %a %a" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp a_pkh - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp b_pkh) >>=? fun () -> Op.transaction (B blk) bootstrap a_contract Tez.one >>=? fun oa -> diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml index 0182455432a8..f8b72c195c90 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_sc_rollup.ml @@ -1929,7 +1929,7 @@ let test_number_of_parallel_games_bounded () = xstaker) :: _ -> assert ( - Tezos_crypto.Signature.Public_key_hash.( + Signature.Public_key_hash.( xstaker = Account.pkh_of_contract_exn staker)) ; return_unit | _ -> @@ -2036,17 +2036,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 + Signature.Public_key_hash.pp pkh1 blocks_left - Tezos_crypto.Signature.Public_key_hash.pp + Signature.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 + Signature.Public_key_hash.pp pkh1 in let* timeout = Op.sc_rollup_timeout (B block) account3 rollup game_index in diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml index 83a5ce913c84..46f377155405 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_voting.ml @@ -1259,9 +1259,7 @@ let test_proposals_invalid_signature () = let open Lwt_result_syntax in 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 - in + let op = Op.pack_operation (B block) (Some Signature.zero) contents in Incremental.assert_validate_operation_fails (invalid_signature __LOC__) op @@ -1692,9 +1690,7 @@ let test_ballot_invalid_signature () = let open Lwt_result_syntax in 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 - in + let op = Op.pack_operation (B block) (Some Signature.zero) contents in Incremental.assert_validate_operation_fails (invalid_signature __LOC__) op diff --git a/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml b/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml index 74590d73cea9..5a8bde97f527 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_frozen_bonds.ml +++ b/src/proto_alpha/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, _ = Signature.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, _, _ = Signature.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, _ = Signature.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_alpha/lib_protocol/test/integration/test_token.ml b/src/proto_alpha/lib_protocol/test/integration/test_token.ml index 69eea30ce50c..89d9389517ca 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_token.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_token.ml @@ -58,7 +58,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 = Signature.generate_key () in let dest = `Contract (Contract.Implicit pkh) in let amount = Tez.one in wrap (Token.transfer ctxt src dest amount) >>=? fun (ctxt', _) -> @@ -78,7 +78,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 = Signature.generate_key () in let dest = Contract.Implicit pkh in let amount = Tez.one in wrap (Token.transfer ctxt (`Contract src) (`Contract dest) amount) @@ -128,7 +128,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 = Signature.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 @@ -184,7 +184,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 = Signature.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -203,7 +203,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 = Signature.generate_key () in let dest = Contract.Implicit pkh in let amount = random_amount () in test_transferring_to_sink @@ -213,7 +213,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 = Signature.generate_key () in let amount = random_amount () in test_transferring_to_sink ctxt @@ -256,7 +256,7 @@ let test_transferring_to_burned ctxt = ]) true >>=? fun () -> - let pkh = Tezos_crypto.Signature.Public_key_hash.zero in + let pkh = Signature.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) @@ -282,7 +282,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 = Signature.generate_key () in let contract = Contract.Implicit pkh in let sc_rollup = sc_rollup () in let bond_id = Bond_id.Sc_rollup_bond_id sc_rollup in @@ -386,7 +386,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 = Signature.generate_key () in let src = Contract.Implicit pkh in let amount = random_amount () in test_transferring_from_bounded_source @@ -405,7 +405,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 = Signature.generate_key () in let amount = random_amount () in let src = Contract.Implicit pkh in test_transferring_from_bounded_source @@ -415,7 +415,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 = Signature.generate_key () in let amount = random_amount () in test_transferring_from_bounded_source ctxt @@ -432,7 +432,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 = Signature.generate_key () in let contract = Contract.Implicit pkh in let sc_rollup = sc_rollup () in let bond_id = Bond_id.Sc_rollup_bond_id sc_rollup in @@ -504,13 +504,13 @@ let build_test_cases () = let open Lwt_result_wrap_syntax in create_context () >>=? fun (ctxt, pkh) -> let origin = `Contract (Contract.Implicit pkh) in - let user1, _, _ = Tezos_crypto.Signature.generate_key () in + let user1, _, _ = Signature.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Signature.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let baker1, baker1_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker1, baker1_pk, _ = Signature.generate_key () in let baker1c = `Contract (Contract.Implicit baker1) in - let baker2, baker2_pk, _ = Tezos_crypto.Signature.generate_key () in + let baker2, baker2_pk, _ = Signature.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 ())) @@ -717,13 +717,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, _, _ = Signature.generate_key () in let user1c = `Contract (Contract.Implicit user1) in - let user2, _, _ = Tezos_crypto.Signature.generate_key () in + let user2, _, _ = Signature.generate_key () in let user2c = `Contract (Contract.Implicit user2) in - let user3, _, _ = Tezos_crypto.Signature.generate_key () in + let user3, _, _ = Signature.generate_key () in let user3c = `Contract (Contract.Implicit user3) in - let user4, _, _ = Tezos_crypto.Signature.generate_key () in + let user4, _, _ = Signature.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_alpha/lib_protocol/test/integration/validate/manager_operation_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/manager_operation_helpers.ml index 38356be68bfa..6a38df40f559 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/manager_operation_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/manager_operation_helpers.ml @@ -1073,7 +1073,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 : Signature.Public_key_hash.t; fee : Tez.tez; gas_limit : Gas.Arith.integral; nb_counter : int; @@ -1194,7 +1194,7 @@ let observe ~mode ~deallocated ctxt_pre ctxt_post op = | Ok () -> failwith "%a should have been deallocated@." - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp (Context.Contract.pkh contract) | Error [ diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml index 875b130154c4..6091e4730daa 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml @@ -88,7 +88,7 @@ let protos = type secret_account = { blinded_public_key_hash : Blinded_public_key_hash.t; - account : Tezos_crypto.Signature.Ed25519.Public_key_hash.t; + account : Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -103,23 +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 : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Signature.Ed25519.Secret_key.encoding + Signature.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 = Signature.Secret_key.to_public_key sk in + let pkh = Signature.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.Ed25519.Public_key_hash.of_b58check_exn pkh - in - assert (Tezos_crypto.Signature.Public_key_hash.equal (Ed25519 pkh) pkh') ; + let pkh = Signature.Ed25519.Public_key_hash.of_b58check_exn pkh in + assert (Signature.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_alpha/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml index f537dd58abd8..767bbd4a4a52 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml @@ -1022,7 +1022,7 @@ let pp_strategy fmt = function | Nostalgic -> Format.pp_print_string fmt "Nostalgic" type player = { - pkh : Tezos_crypto.Signature.Public_key_hash.t; + pkh : Signature.Public_key_hash.t; contract : Contract.t; strategy : strategy; game_player : Game.player; @@ -1032,7 +1032,7 @@ let pp_player ppf {pkh; contract = _; strategy; game_player} = Format.fprintf ppf "pkh: %a@,strategy: %a@,game_player: %s" - Tezos_crypto.Signature.Public_key_hash.pp_short + Signature.Public_key_hash.pp_short pkh pp_strategy strategy @@ -1442,8 +1442,7 @@ let make_players ~p1_strategy ~contract1 ~p2_strategy ~contract2 = let pkh2 = Account.pkh_of_contract_exn contract2 in let ({alice; bob = _} : Game.Index.t) = Game.Index.make pkh1 pkh2 in let player1, player2 = - if Tezos_crypto.Signature.Public_key_hash.equal alice pkh1 then - Game.(Alice, Bob) + if Signature.Public_key_hash.equal alice pkh1 then Game.(Alice, Bob) else Game.(Bob, Alice) in ( { diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml index bb742d2cc88e..52cb5f397732 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml @@ -232,7 +232,7 @@ let gen_inbox_message = (* We won't test the encoding of these values. It's out of scope. *) let payload = Script_repr.unit in let sender = Contract_hash.zero in - let source = Tezos_crypto.Signature.Public_key_hash.zero in + let source = Signature.Public_key_hash.zero in (* But the encoding of the rollup's address is our problem. *) let+ destination = gen_rollup in Internal (Transfer {payload; sender; source; destination}) diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml b/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml index 3b5a68bff87b..cd36907a6e4c 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_script_comparison.ml @@ -57,9 +57,8 @@ 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 - | Key_t, x, y -> - normalize_compare @@ Tezos_crypto.Signature.Public_key.compare x y + normalize_compare @@ Signature.Public_key_hash.compare x y + | Key_t, x, y -> normalize_compare @@ Signature.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_alpha/lib_protocol/test/pbt/test_zk_rollup_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_zk_rollup_encoding.ml index df5be1fb0d9d..af73f250bd46 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_zk_rollup_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_zk_rollup_encoding.ml @@ -96,7 +96,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, _, _ = Signature.generate_key ~algo:Ed25519 () in Gen.return pkh let gen_z = diff --git a/src/proto_alpha/lib_protocol/test/unit/test_consensus_key.ml b/src/proto_alpha/lib_protocol/test/unit/test_consensus_key.ml index f985e4cea1e1..1b3c2b7cdbbc 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_consensus_key.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_consensus_key.ml @@ -73,18 +73,18 @@ module Assert = struct let equal_pkh ~__LOC__ a b = Assert.equal ~loc:__LOC__ - Tezos_crypto.Signature.Public_key_hash.equal + Signature.Public_key_hash.equal "pkh" - Tezos_crypto.Signature.Public_key_hash.pp + Signature.Public_key_hash.pp a b let equal_pk ~__LOC__ a b = Assert.equal ~loc:__LOC__ - Tezos_crypto.Signature.Public_key.equal + Signature.Public_key.equal "pk" - Tezos_crypto.Signature.Public_key.pp + Signature.Public_key.pp a b diff --git a/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml index a372d293904e..1f7f33a7cfa6 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_contract_repr.ml @@ -61,8 +61,7 @@ module Test_contract_repr = struct in Contract_hash.hash_bytes [data] - let dummy_implicit_contract = - Implicit Tezos_crypto.Signature.Public_key_hash.zero + let dummy_implicit_contract = Implicit Signature.Public_key_hash.zero let dummy_originated_contract = originated_contract @@ dummy_origination_nonce @@ -73,7 +72,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) + Signature.Public_key_hash.(to_b58check zero) let test_to_b58check_originated () = Assert.equal diff --git a/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml index 7b4bb78595e9..6d24160ecf3a 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml @@ -93,16 +93,11 @@ module Test_operation_repr = struct | Error _ -> return_unit let zero_bls = - match - Tezos_crypto.Signature.( - split_signature (Bls Tezos_crypto.Signature.Bls.zero)) - with + match Signature.(split_signature (Bls Signature.Bls.zero)) with | {prefix = None; _} -> assert false | {prefix = Some prefix; suffix} -> let prefix = - Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Signature.prefix_encoding - prefix + Data_encoding.Binary.to_bytes_exn Signature.prefix_encoding prefix in (Bytes.cat (Bytes.of_string "\255") prefix, suffix) diff --git a/src/proto_alpha/lib_protocol/test/unit/test_receipt.ml b/src/proto_alpha/lib_protocol/test/unit/test_receipt.ml index f080b4539b40..77290a3fd080 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_receipt.ml +++ b/src/proto_alpha/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 = Signature.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_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index 85ad7450d318..228f0cbd9c51 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -452,7 +452,7 @@ let dummy_internal_transfer address = let source = WithExceptions.Result.get_ok ~loc:__LOC__ - (Tezos_crypto.Signature.Public_key_hash.of_b58check + (Signature.Public_key_hash.of_b58check "tz1RjtZUVeLhADFHDL8UwDZA6vjWWhojpu5w") in let payload = Bytes.of_string "foo" in diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml index 708cd2c3aea1..f3d69d1b50d0 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml @@ -109,7 +109,7 @@ let test_encode_decode_internal_inbox_message_transfer () = let source = Result.get_ok ~loc:__LOC__ - (Tezos_crypto.Signature.Public_key_hash.of_b58check + (Signature.Public_key_hash.of_b58check "tz1RjtZUVeLhADFHDL8UwDZA6vjWWhojpu5w") in let*? (Script_typed_ir.Ty_ex_c pair_nat_ticket_string_ty) = diff --git a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml b/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml index cd548d976991..c90cbb95bfb8 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml +++ b/src/proto_alpha/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 = Signature.Public_key_hash.t - let pkh_encoding = Tezos_crypto.Signature.Public_key_hash.encoding + let pkh_encoding = Signature.Public_key_hash.encoding type ticket_hash = Alpha_context.Ticket_hash.t @@ -139,7 +139,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, _, _ = Signature.generate_key () in let op = no_ticket Zk_rollup_operation_repr. @@ -168,7 +168,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, _, _ = Signature.generate_key () in let op = no_ticket Zk_rollup_operation_repr. @@ -216,7 +216,7 @@ module Raw_context_tests = struct let pending_list_get () = let open Lwt_result_syntax in let* ctx, rollup, _contract = originate_ctx () in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Signature.generate_key () in let op = no_ticket Zk_rollup_operation_repr. @@ -237,7 +237,7 @@ module Raw_context_tests = struct let pending_list_errors () = let open Lwt_result_syntax in let* ctx, rollup, _contract = originate_ctx () in - let pkh, _pk, _sk = Tezos_crypto.Signature.generate_key () in + let pkh, _pk, _sk = Signature.generate_key () in let op = no_ticket Zk_rollup_operation_repr. -- GitLab From faf2422d6ddc07d4066abde844f87352974f2ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= <code@bnwr.net> Date: Fri, 23 Dec 2022 14:55:14 +0100 Subject: [PATCH 6/6] Crypto: place Chain_id in Hashed --- devtools/get_contracts/get_contracts.ml | 2 +- src/bin_node/node_storage_command.ml | 4 +- src/bin_signer/handler.ml | 10 ++--- src/lib_base/test_chain_status.ml | 6 +-- src/lib_base/test_chain_status.mli | 2 +- src/lib_base/tzPervasives.mli | 1 + .../client_context_unix.mli | 2 +- .../client_helpers_commands.ml | 8 ++-- src/lib_context/disk/context.ml | 5 +-- src/lib_context/memory/context.ml | 5 +-- src/lib_context/memory/test/test.ml | 2 +- src/lib_context/sigs/context.ml | 8 ++-- src/lib_context/test/test_context.ml | 2 +- src/lib_crypto/tezos_crypto.ml | 2 +- src/lib_mockup/RPC_client.ml | 5 +-- src/lib_mockup/local_services.ml | 23 ++++++----- src/lib_mockup/mockup_args.ml | 2 +- src/lib_mockup/mockup_args.mli | 7 ++-- src/lib_mockup/persistence.ml | 4 +- src/lib_mockup/persistence_intf.ml | 2 +- src/lib_mockup/registration_intf.ml | 2 +- .../test/test_fuzzing_mockup_args.ml | 2 +- src/lib_mockup/test/test_mockup_args.ml | 6 ++- .../environment_V0.ml | 2 +- .../environment_V0.mli | 2 +- .../environment_V1.ml | 2 +- .../environment_V1.mli | 2 +- .../environment_V2.ml | 2 +- .../environment_V2.mli | 2 +- .../environment_V3.ml | 4 +- .../environment_V3.mli | 2 +- .../environment_V4.ml | 4 +- .../environment_V4.mli | 2 +- .../environment_V5.ml | 4 +- .../environment_V5.mli | 2 +- .../environment_V6.ml | 4 +- .../environment_V6.mli | 2 +- .../environment_V7.ml | 4 +- .../environment_V7.mli | 2 +- .../environment_V8.ml | 4 +- .../environment_V8.mli | 2 +- .../environment_V9.ml | 4 +- .../environment_V9.mli | 2 +- .../environment_protocol_T.ml | 6 +-- .../environment_protocol_T_V0.ml | 6 +-- .../environment_protocol_T_V3.ml | 8 ++-- .../environment_protocol_T_V6.ml | 10 ++--- .../environment_protocol_T_V7.ml | 10 ++--- .../structs/v0_chain_id.ml | 16 ++++---- src/lib_shell/block_validator_process.ml | 14 +++---- src/lib_shell/block_validator_process.mli | 5 +-- src/lib_shell/chain_directory.mli | 5 +-- src/lib_shell/chain_validator.ml | 21 +++++----- src/lib_shell/chain_validator.mli | 8 ++-- src/lib_shell/distributed_db.ml | 19 ++++----- src/lib_shell/distributed_db.mli | 2 +- src/lib_shell/distributed_db_message.ml | 39 +++++++++---------- src/lib_shell/distributed_db_message.mli | 18 ++++----- src/lib_shell/legacy_prevalidation.ml | 2 +- src/lib_shell/legacy_prevalidation.mli | 2 +- src/lib_shell/legacy_prevalidator_internal.ml | 2 +- .../legacy_prevalidator_internal.mli | 2 +- src/lib_shell/monitor_directory.ml | 6 +-- src/lib_shell/p2p_reader.ml | 28 ++++++------- src/lib_shell/p2p_reader.mli | 4 +- src/lib_shell/peer_validator.ml | 18 +++------ src/lib_shell/peer_validator.mli | 3 +- src/lib_shell/prevalidation.ml | 2 +- src/lib_shell/prevalidation.mli | 4 +- src/lib_shell/prevalidator.ml | 4 +- src/lib_shell/prevalidator.mli | 3 +- src/lib_shell/prevalidator_internal.ml | 2 +- src/lib_shell/prevalidator_internal.mli | 2 +- src/lib_shell/prevalidator_internal_common.ml | 9 ++--- .../prevalidator_internal_common.mli | 3 +- src/lib_shell/shell_metrics.ml | 2 +- src/lib_shell/shell_metrics.mli | 2 +- .../test/legacy_test_prevalidation_t.ml | 2 +- src/lib_shell/test/shell_test_helpers.ml | 2 +- src/lib_shell/validator.ml | 18 ++++----- src/lib_shell/validator.mli | 15 +++---- src/lib_shell/validator_event.ml | 4 +- src/lib_shell/worker_directory.ml | 12 +++--- .../encoding_benchmarks.ml | 18 ++++----- src/lib_shell_benchmarks/io_helpers.ml | 2 +- src/lib_shell_services/block_services.ml | 18 ++++----- src/lib_shell_services/block_services.mli | 8 ++-- .../block_validator_errors.ml | 6 +-- .../block_validator_errors.mli | 2 +- .../block_validator_worker_state.ml | 12 +++--- .../block_validator_worker_state.mli | 4 +- src/lib_shell_services/chain_services.ml | 4 +- src/lib_shell_services/chain_services.mli | 13 ++----- src/lib_shell_services/monitor_services.ml | 14 +++---- src/lib_shell_services/monitor_services.mli | 11 +++--- src/lib_shell_services/state_events.ml | 2 +- src/lib_shell_services/store_errors.ml | 6 +-- src/lib_shell_services/validation_errors.ml | 13 +++---- src/lib_shell_services/validation_errors.mli | 4 +- src/lib_shell_services/worker_services.ml | 4 +- src/lib_shell_services/worker_services.mli | 8 ++-- .../unix/ledger.available.ml | 19 +++------ .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml | 4 +- src/proto_009_PsFLoren/lib_plugin/plugin.ml | 4 +- src/proto_010_PtGRANAD/lib_plugin/plugin.ml | 6 +-- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_011_PtHangz2/lib_client/mockup.ml | 11 ++---- .../client_sapling_commands.ml | 2 +- src/proto_011_PtHangz2/lib_plugin/plugin.ml | 8 ++-- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_012_Psithaca/lib_client/mockup.ml | 11 ++---- .../client_sapling_commands.ml | 2 +- src/proto_012_Psithaca/lib_plugin/plugin.ml | 8 ++-- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_013_PtJakart/lib_client/mockup.ml | 11 ++---- .../client_sapling_commands.ml | 2 +- src/proto_013_PtJakart/lib_plugin/plugin.ml | 12 +++--- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_014_PtKathma/lib_client/mockup.ml | 11 ++---- .../client_sapling_commands.ml | 2 +- src/proto_014_PtKathma/lib_plugin/RPC.ml | 12 +++--- .../lib_benchmark/execution_context.ml | 2 +- .../interpreter_benchmarks.ml | 2 +- .../storage_benchmarks.ml | 2 +- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_015_PtLimaPt/lib_client/mockup.ml | 4 +- .../client_sapling_commands.ml | 2 +- .../lib_delegate/baking_files.ml | 2 +- .../lib_delegate/baking_files.mli | 2 +- .../lib_delegate/baking_nonces.mli | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- .../lib_delegate/baking_state.ml | 4 +- .../lib_delegate/baking_state.mli | 2 +- .../lib_delegate/block_forge.mli | 2 +- .../lib_delegate/client_baking_blocks.ml | 6 +-- .../lib_delegate/client_baking_blocks.mli | 2 +- .../client_baking_denunciation.ml | 4 +- .../mockup_simulator/faked_client_context.ml | 4 +- .../test/mockup_simulator/mockup_simulator.ml | 2 +- .../lib_protocol/test/helpers/block.ml | 15 ++++--- .../lib_protocol/test/helpers/context.ml | 2 +- .../test/helpers/contract_helpers.ml | 2 +- .../lib_protocol/test/helpers/incremental.ml | 2 +- .../lib_protocol/test/helpers/op.ml | 6 +-- .../test/helpers/sapling_helpers.ml | 7 +--- .../test/integration/gas/test_gas_levels.ml | 2 +- .../test/integration/validate/test_mempool.ml | 14 +++---- .../lib_benchmark/execution_context.ml | 2 +- .../interpreter_benchmarks.ml | 2 +- .../storage_benchmarks.ml | 2 +- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_016_PtMumbai/lib_client/mockup.ml | 4 +- .../client_sapling_commands.ml | 2 +- .../lib_delegate/baking_files.ml | 2 +- .../lib_delegate/baking_files.mli | 2 +- .../lib_delegate/baking_nonces.mli | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- .../lib_delegate/baking_state.ml | 4 +- .../lib_delegate/baking_state.mli | 2 +- .../lib_delegate/block_forge.mli | 2 +- .../lib_delegate/client_baking_blocks.ml | 6 +-- .../lib_delegate/client_baking_blocks.mli | 2 +- .../client_baking_denunciation.ml | 4 +- .../mockup_simulator/faked_client_context.ml | 4 +- .../test/mockup_simulator/mockup_simulator.ml | 2 +- src/proto_016_PtMumbai/lib_plugin/RPC.ml | 12 +++--- .../lib_protocol/test/helpers/block.ml | 15 ++++--- .../lib_protocol/test/helpers/context.ml | 2 +- .../test/helpers/contract_helpers.ml | 2 +- .../lib_protocol/test/helpers/incremental.ml | 2 +- .../lib_protocol/test/helpers/op.ml | 6 +-- .../test/helpers/sapling_helpers.ml | 7 +--- .../test/integration/gas/test_gas_levels.ml | 2 +- .../test/integration/validate/test_mempool.ml | 14 +++---- .../lib_benchmark/execution_context.ml | 2 +- .../interpreter_benchmarks.ml | 2 +- .../storage_benchmarks.ml | 2 +- .../lib_client/client_proto_multisig.ml | 10 +---- src/proto_alpha/lib_client/mockup.ml | 4 +- .../client_sapling_commands.ml | 2 +- src/proto_alpha/lib_delegate/baking_files.ml | 2 +- src/proto_alpha/lib_delegate/baking_files.mli | 2 +- .../lib_delegate/baking_nonces.mli | 4 +- .../lib_delegate/baking_simulator.mli | 2 +- src/proto_alpha/lib_delegate/baking_state.ml | 4 +- src/proto_alpha/lib_delegate/baking_state.mli | 2 +- src/proto_alpha/lib_delegate/block_forge.mli | 2 +- .../lib_delegate/client_baking_blocks.ml | 6 +-- .../lib_delegate/client_baking_blocks.mli | 2 +- .../client_baking_denunciation.ml | 4 +- .../mockup_simulator/faked_client_context.ml | 4 +- .../test/mockup_simulator/mockup_simulator.ml | 2 +- src/proto_alpha/lib_plugin/RPC.ml | 12 +++--- .../lib_protocol/test/helpers/block.ml | 15 ++++--- .../lib_protocol/test/helpers/context.ml | 2 +- .../test/helpers/contract_helpers.ml | 2 +- .../lib_protocol/test/helpers/incremental.ml | 2 +- .../lib_protocol/test/helpers/op.ml | 6 +-- .../test/helpers/sapling_helpers.ml | 7 +--- .../test/integration/gas/test_gas_levels.ml | 2 +- .../test/integration/validate/test_mempool.ml | 14 +++---- tezt/lib_tezos/operation_core.ml | 2 +- tezt/long_tests/qcheck_rpc.ml | 2 +- 204 files changed, 517 insertions(+), 665 deletions(-) diff --git a/devtools/get_contracts/get_contracts.ml b/devtools/get_contracts/get_contracts.ml index ed3bb65a4aeb..e874667c402d 100644 --- a/devtools/get_contracts/get_contracts.ml +++ b/devtools/get_contracts/get_contracts.ml @@ -778,7 +778,7 @@ let commands = Printf.printf "Getting main chain storage and head...\n%!" ; let chain_store = Tezos_store.Store.main_chain_store store in let chain_id = Tezos_store.Store.Chain.chain_id chain_store in - Format.printf "Chain id: %a\n%!" Tezos_crypto.Chain_id.pp chain_id ; + Format.printf "Chain id: %a\n%!" Chain_id.pp chain_id ; let*! head = Tezos_store.Store.Chain.current_head chain_store in Format.printf "Head block: %a\n%!" diff --git a/src/bin_node/node_storage_command.ml b/src/bin_node/node_storage_command.ml index 0bfa353d3518..f023759afaaf 100644 --- a/src/bin_node/node_storage_command.ml +++ b/src/bin_node/node_storage_command.ml @@ -193,7 +193,7 @@ module Term = struct let ({genesis; _} : Config_file.blockchain_network) = node_config.blockchain_network in - let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis.block in + let chain_id = Chain_id.of_block_hash genesis.block in let data_dir = (* The --data-dir argument overrides the potentially given configuration file. *) @@ -253,7 +253,7 @@ module Term = struct let ({genesis; _} : Config_file.blockchain_network) = node_config.blockchain_network in - let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis.block in + let chain_id = Chain_id.of_block_hash genesis.block in let data_dir = (* The --data-dir argument overrides the potentially given configuration file. *) diff --git a/src/bin_signer/handler.ml b/src/bin_signer/handler.ml index 30cb791bb114..840e04905e9c 100644 --- a/src/bin_signer/handler.ml +++ b/src/bin_signer/handler.ml @@ -32,9 +32,9 @@ module High_watermark = struct in conv (List.map (fun (chain_id, marks) -> - (Tezos_crypto.Chain_id.to_b58check chain_id, marks))) + (Chain_id.to_b58check chain_id, marks))) (List.map (fun (chain_id, marks) -> - (Tezos_crypto.Chain_id.of_b58check_exn chain_id, marks))) + (Chain_id.of_b58check_exn chain_id, marks))) @@ assoc @@ conv (List.map (fun (pkh, mark) -> @@ -164,14 +164,12 @@ module High_watermark = struct failwith "byte sequence too short to be %s %s" art name else let hash = Tezos_crypto.Blake2B.hash_bytes [bytes] in - let chain_id = - Tezos_crypto.Chain_id.of_bytes_exn (Bytes.sub bytes 1 4) - in + let chain_id = Chain_id.of_bytes_exn (Bytes.sub bytes 1 4) in let* level, round_opt = get_level_and_round () in let* o = match Option.bind - (List.assoc_opt ~equal:Tezos_crypto.Chain_id.equal chain_id all) + (List.assoc_opt ~equal:Chain_id.equal chain_id all) (List.assoc_opt ~equal:Tezos_crypto.Signature.Public_key_hash.equal pkh) diff --git a/src/lib_base/test_chain_status.ml b/src/lib_base/test_chain_status.ml index dee8f64d5144..96ca0ef65aba 100644 --- a/src/lib_base/test_chain_status.ml +++ b/src/lib_base/test_chain_status.ml @@ -30,7 +30,7 @@ type t = expiration : Time.Protocol.t; } | Running of { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Tezos_crypto.Hashed.Chain_id.t; genesis : Tezos_crypto.Hashed.Block_hash.t; protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; @@ -68,7 +68,7 @@ let encoding = ~title:"Running" (obj5 (req "status" (constant "running")) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Tezos_crypto.Hashed.Chain_id.encoding) (req "genesis" Tezos_crypto.Hashed.Block_hash.encoding) (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) (req "expiration" Time.Protocol.encoding)) @@ -98,7 +98,7 @@ let pp ppf = function protocol Tezos_crypto.Hashed.Block_hash.pp genesis - Tezos_crypto.Chain_id.pp + Tezos_crypto.Hashed.Chain_id.pp chain_id Time.System.pp_hum (Time.System.of_protocol_exn expiration) diff --git a/src/lib_base/test_chain_status.mli b/src/lib_base/test_chain_status.mli index ffe08742fff0..172d3d083ff1 100644 --- a/src/lib_base/test_chain_status.mli +++ b/src/lib_base/test_chain_status.mli @@ -30,7 +30,7 @@ type t = expiration : Time.Protocol.t; } | Running of { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Tezos_crypto.Hashed.Chain_id.t; genesis : Tezos_crypto.Hashed.Block_hash.t; protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; diff --git a/src/lib_base/tzPervasives.mli b/src/lib_base/tzPervasives.mli index 444ac18f6b58..16e8f507989d 100644 --- a/src/lib_base/tzPervasives.mli +++ b/src/lib_base/tzPervasives.mli @@ -94,6 +94,7 @@ module Distributed_db_version = Distributed_db_version module Network_version = Network_version module Block_hash = Tezos_crypto.Hashed.Block_hash module Block_metadata_hash = Tezos_crypto.Hashed.Block_metadata_hash +module Chain_id = Tezos_crypto.Hashed.Chain_id module Context_hash = Tezos_crypto.Hashed.Context_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_client_base_unix/client_context_unix.mli b/src/lib_client_base_unix/client_context_unix.mli index 97adf9ab4092..425e10c42189 100644 --- a/src/lib_client_base_unix/client_context_unix.mli +++ b/src/lib_client_base_unix/client_context_unix.mli @@ -50,7 +50,7 @@ class unix_mockup : base_dir:string -> mem_only:bool -> mockup_env:Tezos_mockup_registration.Registration.mockup_environment - -> chain_id:Tezos_crypto.Chain_id.t + -> chain_id:Chain_id.t -> rpc_context:Tezos_protocol_environment.rpc_context -> protocol_data:bytes -> Client_context.full diff --git a/src/lib_client_commands/client_helpers_commands.ml b/src/lib_client_commands/client_helpers_commands.ml index bbf11e95a601..149e462b433a 100644 --- a/src/lib_client_commands/client_helpers_commands.ml +++ b/src/lib_client_commands/client_helpers_commands.ml @@ -73,8 +73,8 @@ let commands () = @@ stop) (fun () block_hash_str (cctxt : #Client_context.full) -> let* block_hash = Lwt.return (Block_hash.of_b58check block_hash_str) in - let chain_id = Tezos_crypto.Chain_id.of_block_hash block_hash in - let*! () = cctxt#message "%a" Tezos_crypto.Chain_id.pp chain_id in + let chain_id = Chain_id.of_block_hash block_hash in + let*! () = cctxt#message "%a" Chain_id.pp chain_id in return_unit); command ~desc:"Computes a chain id from a seed" @@ -85,7 +85,7 @@ let commands () = ~desc:"the seed from which to compute the chain id" @@ stop) (fun () seed_str (cctxt : #Client_context.full) -> - let chain_id = Tezos_crypto.Chain_id.hash_string [seed_str] in - let*! () = cctxt#message "%a" Tezos_crypto.Chain_id.pp chain_id in + let chain_id = Chain_id.hash_string [seed_str] in + let*! () = cctxt#message "%a" Chain_id.pp chain_id in return_unit); ] diff --git a/src/lib_context/disk/context.ml b/src/lib_context/disk/context.ml index 4028701e8e48..c3ae143352d9 100644 --- a/src/lib_context/disk/context.ml +++ b/src/lib_context/disk/context.ml @@ -793,8 +793,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let _interrupted_gc = Store.Gc.cancel index.repo in Store.Repo.close index.repo - let get_branch chain_id = - Format.asprintf "%a" Tezos_crypto.Chain_id.pp chain_id + let get_branch chain_id = Format.asprintf "%a" Chain_id.pp chain_id let empty index = {index; tree = Store.Tree.empty (); parents = []; ops = 0} @@ -816,7 +815,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let compute_testchain_chain_id genesis = let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in - Tezos_crypto.Chain_id.of_block_hash genesis_hash + Chain_id.of_block_hash genesis_hash let compute_testchain_genesis forked_block = let genesis = Block_hash.hash_bytes [Block_hash.to_bytes forked_block] in diff --git a/src/lib_context/memory/context.ml b/src/lib_context/memory/context.ml index 8b2ae76c4b6c..703f7a1c85c9 100644 --- a/src/lib_context/memory/context.ml +++ b/src/lib_context/memory/context.ml @@ -532,8 +532,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let is_empty t = Tree.is_empty t.tree - let get_branch chain_id = - Format.asprintf "%a" Tezos_crypto.Chain_id.pp chain_id + let get_branch chain_id = Format.asprintf "%a" Chain_id.pp chain_id let commit_genesis index ~chain_id ~time ~protocol = let open Lwt_result_syntax in @@ -595,7 +594,7 @@ module Make (Encoding : module type of Tezos_context_encoding.Context) = struct let compute_testchain_chain_id genesis = let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in - Tezos_crypto.Chain_id.of_block_hash genesis_hash + Chain_id.of_block_hash genesis_hash let compute_testchain_genesis forked_block = let genesis = Block_hash.hash_bytes [Block_hash.to_bytes forked_block] in diff --git a/src/lib_context/memory/test/test.ml b/src/lib_context/memory/test/test.ml index 4f7baf6aa93c..1b15b7a4d746 100644 --- a/src/lib_context/memory/test/test.ml +++ b/src/lib_context/memory/test/test.ml @@ -39,7 +39,7 @@ module C = struct let genesis_time = Time.Protocol.of_seconds 0L - let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis_block + let chain_id = Chain_id.of_block_hash genesis_block let make_context () = (* there is no simple way to build a context *) diff --git a/src/lib_context/sigs/context.ml b/src/lib_context/sigs/context.ml index 4bab8855fd31..d05cb41f2a75 100644 --- a/src/lib_context/sigs/context.ml +++ b/src/lib_context/sigs/context.ml @@ -676,7 +676,7 @@ module type TEZOS_CONTEXT = sig (** Close the index. Does not fail when the context is already closed. *) val close : index -> unit Lwt.t - val compute_testchain_chain_id : Block_hash.t -> Tezos_crypto.Chain_id.t + val compute_testchain_chain_id : Block_hash.t -> Chain_id.t val compute_testchain_genesis : Block_hash.t -> Block_hash.t @@ -689,7 +689,7 @@ module type TEZOS_CONTEXT = sig val commit_genesis : index -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> time:Time.Protocol.t -> protocol:Protocol_hash.t -> Context_hash.t tzresult Lwt.t @@ -795,7 +795,7 @@ module type TEZOS_CONTEXT = sig val export_snapshot : index -> Context_hash.t -> path:string -> unit Lwt.t val set_head : - index -> Tezos_crypto.Chain_id.t -> Context_hash.t -> unit Lwt.t + index -> Tezos_crypto.Hashed.Chain_id.t -> Context_hash.t -> unit Lwt.t val set_master : index -> Context_hash.t -> unit Lwt.t @@ -828,7 +828,7 @@ module type TEZOS_CONTEXT = sig expiration:Time.Protocol.t -> context Lwt.t - val clear_test_chain : index -> Tezos_crypto.Chain_id.t -> unit Lwt.t + val clear_test_chain : index -> Chain_id.t -> unit Lwt.t val find_predecessor_block_metadata_hash : context -> Block_metadata_hash.t option Lwt.t diff --git a/src/lib_context/test/test_context.ml b/src/lib_context/test/test_context.ml index 9affde951717..43b0f2ebebe9 100644 --- a/src/lib_context/test/test_context.ml +++ b/src/lib_context/test/test_context.ml @@ -63,7 +63,7 @@ let genesis_protocol = let genesis_time = Time.Protocol.of_seconds 0L -let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis_block +let chain_id = Chain_id.of_block_hash genesis_block (** Test functors *) diff --git a/src/lib_crypto/tezos_crypto.ml b/src/lib_crypto/tezos_crypto.ml index 36affe5c6959..f26cd64bdb95 100644 --- a/src/lib_crypto/tezos_crypto.ml +++ b/src/lib_crypto/tezos_crypto.ml @@ -28,6 +28,7 @@ module Intfs = S module Hashed = struct module Block_hash = Block_hash module Block_metadata_hash = Block_metadata_hash + module Chain_id = Chain_id module Context_hash = Context_hash module Operation_hash = Operation_hash module Operation_list_hash = Operation_list_hash @@ -49,7 +50,6 @@ end module Aggregate_signature = Aggregate_signature module Base58 = Base58 module Blake2B = Blake2B -module Chain_id = Chain_id module Crypto_box = Crypto_box module Hacl = Hacl module Helpers = Helpers diff --git a/src/lib_mockup/RPC_client.ml b/src/lib_mockup/RPC_client.ml index 8c945f8d712d..0cd8f8a81bb6 100644 --- a/src/lib_mockup/RPC_client.ml +++ b/src/lib_mockup/RPC_client.ml @@ -25,9 +25,8 @@ class mockup_ctxt (base_dir : string) (mem_only : bool) (mockup_env : Tezos_mockup_registration.Registration.mockup_environment) - (chain_id : Tezos_crypto.Chain_id.t) - (rpc_context : Tezos_protocol_environment.rpc_context) protocol_data : - Tezos_rpc.Context.generic = + (chain_id : Chain_id.t) (rpc_context : Tezos_protocol_environment.rpc_context) + protocol_data : Tezos_rpc.Context.generic = let local_ctxt = Tezos_mockup_proxy.RPC_client.local_ctxt (Local_services.build_directory diff --git a/src/lib_mockup/local_services.ml b/src/lib_mockup/local_services.ml index 192e154a7021..9a6889d19a0c 100644 --- a/src/lib_mockup/local_services.ml +++ b/src/lib_mockup/local_services.ml @@ -79,7 +79,7 @@ let () = module type MENV = sig include Registration.MOCKUP - val chain_id : Tezos_crypto.Chain_id.t + val chain_id : Chain_id.t val rpc_context : Tezos_protocol_environment.rpc_context @@ -155,13 +155,13 @@ module Make (E : MENV) = struct Tezos_rpc.Answer.return (block_hash, block_header.timestamp)) let chain_chain_id = function - | `Main -> Tezos_crypto.Chain_id.hash_string ["main"] - | `Test -> Tezos_crypto.Chain_id.hash_string ["test"] + | `Main -> Chain_id.hash_string ["main"] + | `Test -> Chain_id.hash_string ["test"] | `Hash cid -> cid let check_chain ?caller_name (chain : Block_services.chain) = unless - (Tezos_crypto.Chain_id.equal E.chain_id (chain_chain_id chain)) + (Chain_id.equal E.chain_id (chain_chain_id chain)) (fun () -> let msg = let open Format in @@ -175,17 +175,17 @@ module Make (E : MENV) = struct fprintf ppf "main (%a)" - Tezos_crypto.Chain_id.pp - (Tezos_crypto.Chain_id.hash_string ["main"]) + Chain_id.pp + (Chain_id.hash_string ["main"]) | `Test -> fprintf ppf "test (%a)" - Tezos_crypto.Chain_id.pp - (Tezos_crypto.Chain_id.hash_string ["test"]) - | `Hash chain_id -> Tezos_crypto.Chain_id.pp ppf chain_id) + Chain_id.pp + (Chain_id.hash_string ["test"]) + | `Hash chain_id -> Chain_id.pp ppf chain_id) chain - Tezos_crypto.Chain_id.pp + Chain_id.pp E.chain_id in Lwt.fail_with msg) @@ -997,8 +997,7 @@ let build_shell_directory (base_dir : string) [rpc_context] is data used when honoring an RPC. *) let build_directory (base_dir : string) (mem_only : bool) - (mockup_env : Registration.mockup_environment) - (chain_id : Tezos_crypto.Chain_id.t) + (mockup_env : Registration.mockup_environment) (chain_id : Chain_id.t) (rpc_context : Tezos_protocol_environment.rpc_context) protocol_data : unit Tezos_rpc.Directory.t = let write_context rpc_context protocol_data = diff --git a/src/lib_mockup/mockup_args.ml b/src/lib_mockup/mockup_args.ml index ecc425edd405..17f2bfefdc09 100644 --- a/src/lib_mockup/mockup_args.ml +++ b/src/lib_mockup/mockup_args.ml @@ -24,7 +24,7 @@ (*****************************************************************************) module Chain_id = struct - let of_string s = Tezos_crypto.Chain_id.hash_string ~key:"mockup" [s] + let of_string s = Chain_id.hash_string ~key:"mockup" [s] let dummy = of_string "chain" diff --git a/src/lib_mockup/mockup_args.mli b/src/lib_mockup/mockup_args.mli index 4c8c25bafbb1..9ef4a1789acd 100644 --- a/src/lib_mockup/mockup_args.mli +++ b/src/lib_mockup/mockup_args.mli @@ -29,13 +29,13 @@ module Chain_id : sig ** This function is useful to get valid, but dummy, chain identifiers out of ** command lines in the context of a mockup client. *) - val of_string : string -> Tezos_crypto.Chain_id.t + val of_string : string -> Chain_id.t (** [dummy] is a valid dummy chain identifier. ** ** Do not use it outside of the context of a mockup client. *) - val dummy : Tezos_crypto.Chain_id.t + val dummy : Chain_id.t (** [choose ~from_config_file] ** produces a valid chain id from the optionally given one. @@ -44,6 +44,5 @@ module Chain_id : sig ** one from the config file. ** When both values are [None], it uses the {!dummy}. *) - val choose : - from_config_file:Tezos_crypto.Chain_id.t option -> Tezos_crypto.Chain_id.t + val choose : from_config_file:Chain_id.t option -> Chain_id.t end diff --git a/src/lib_mockup/persistence.ml b/src/lib_mockup/persistence.ml index e0762b91be83..8d0b7dde126d 100644 --- a/src/lib_mockup/persistence.ml +++ b/src/lib_mockup/persistence.ml @@ -53,7 +53,7 @@ module Make (Registration : Registration.S) = struct module Persistent_mockup_environment = struct type t = { protocol_hash : Protocol_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; rpc_context : Tezos_protocol_environment.rpc_context; protocol_data : bytes; } @@ -67,7 +67,7 @@ module Make (Registration : Registration.S) = struct {protocol_hash; chain_id; rpc_context; protocol_data}) (obj4 (req "protocol_hash" Protocol_hash.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "context" rpc_context_encoding) (req "protocol_data" Variable.bytes)) diff --git a/src/lib_mockup/persistence_intf.ml b/src/lib_mockup/persistence_intf.ml index 9743eb2ec48e..f523a7239dc6 100644 --- a/src/lib_mockup/persistence_intf.ml +++ b/src/lib_mockup/persistence_intf.ml @@ -68,7 +68,7 @@ module type S = sig (** Overwrites an on-disk mockup environment. *) val overwrite_mockup : protocol_hash:Protocol_hash.t -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> rpc_context:Tezos_protocol_environment.rpc_context -> protocol_data:bytes -> base_dir:string -> diff --git a/src/lib_mockup/registration_intf.ml b/src/lib_mockup/registration_intf.ml index 43c474e977d4..76a693b7a73d 100644 --- a/src/lib_mockup/registration_intf.ml +++ b/src/lib_mockup/registration_intf.ml @@ -25,7 +25,7 @@ (** Type of a mockup environment *) type t = { - chain : Tezos_crypto.Chain_id.t; + chain : Chain_id.t; rpc_context : Tezos_protocol_environment.rpc_context; protocol_data : bytes; } diff --git a/src/lib_mockup/test/test_fuzzing_mockup_args.ml b/src/lib_mockup/test/test_fuzzing_mockup_args.ml index 053a679aa9d1..306244f4a124 100644 --- a/src/lib_mockup/test/test_fuzzing_mockup_args.ml +++ b/src/lib_mockup/test/test_fuzzing_mockup_args.ml @@ -39,7 +39,7 @@ let chain_id_gen = QCheck2.Gen.(map Chain_id.of_string string) let test_config_file_has_priority_over_default_value from_config_file_val = let expected = from_config_file_val in let actual = Chain_id.choose ~from_config_file:(Some from_config_file_val) in - let pp = Tezos_crypto.Chain_id.pp in + let pp = Tezos_crypto.Hashed.Chain_id.pp in qcheck_eq' ~pp ~expected ~actual () let test_prioritize_config_file = diff --git a/src/lib_mockup/test/test_mockup_args.ml b/src/lib_mockup/test/test_mockup_args.ml index 55f5a33333a6..60abecb32d4e 100644 --- a/src/lib_mockup/test/test_mockup_args.ml +++ b/src/lib_mockup/test/test_mockup_args.ml @@ -33,9 +33,11 @@ open Tezos_mockup_registration.Mockup_args let testable_chain_id = - Alcotest.testable Tezos_crypto.Chain_id.pp Tezos_crypto.Chain_id.( = ) + Alcotest.testable + Tezos_crypto.Hashed.Chain_id.pp + Tezos_crypto.Hashed.Chain_id.( = ) -(** {!val:Tezos_crypto.Chain_id.choose} uses the dummy value if no config file +(** {!val:Chain_id.choose} uses the dummy value if no config file is specified *) let test_no_config_file_dummy () = let expected = Chain_id.dummy in diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index b398ccebc349..dd7852177506 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index b70e4f003823..16aca09f9c6d 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index c45638753b81..6a04507f9cd2 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -36,7 +36,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index 5ac0b5e377f1..8520815a2f34 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index 9fb572b4805f..4586a6e800d4 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -36,7 +36,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index 9a1e87e46ba0..ae13045d8437 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index eed6de81bd0f..54b5f67104b0 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -36,7 +36,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -680,7 +680,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index acde51bfcb0d..31003957ccf3 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index 9089678aae75..1f321b26b945 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -40,7 +40,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -711,7 +711,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index 4fb64aefdbda..f83be6ac1911 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -35,7 +35,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index aa8789717ed8..e597863021af 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -684,7 +684,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index e88e0fa97b44..9996bb4dfc6a 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -44,7 +44,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index ce9d1fbbd5ae..26a31281ca74 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -686,7 +686,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V6.mli b/src/lib_protocol_environment/environment_V6.mli index 342aa3bb7b56..7b1b244048bf 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -44,7 +44,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 35b2c2cd9e4f..6bbed8714e8b 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -695,7 +695,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V7.mli b/src/lib_protocol_environment/environment_V7.mli index 40d6d0810b67..9c04bdf8b654 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index e3b99c178149..5642c848880e 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = @@ -736,7 +736,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Tezos_crypto.Hashed.Chain_id module Block_hash = Tezos_crypto.Hashed.Block_hash module Operation_hash = Tezos_crypto.Hashed.Operation_hash module Operation_list_hash = Tezos_crypto.Hashed.Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V8.mli b/src/lib_protocol_environment/environment_V8.mli index 9a1b571fde7a..aff6d261564f 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Tezos_crypto.Hashed.Chain_id.t and type Block_hash.t = Tezos_crypto.Hashed.Block_hash.t and type Operation_hash.t = Tezos_crypto.Hashed.Operation_hash.t and type Operation_list_hash.t = diff --git a/src/lib_protocol_environment/environment_V9.ml b/src/lib_protocol_environment/environment_V9.ml index e0ab699b1eac..8f226f400616 100644 --- a/src/lib_protocol_environment/environment_V9.ml +++ b/src/lib_protocol_environment/environment_V9.ml @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Chain_id.t and type Block_hash.t = Block_hash.t and type Operation_hash.t = Operation_hash.t and type Operation_list_hash.t = Operation_list_hash.t @@ -739,7 +739,7 @@ struct let wrap_tzresult r = Result.map_error wrap_tztrace r - module Chain_id = Tezos_crypto.Chain_id + module Chain_id = Chain_id module Block_hash = Block_hash module Operation_hash = Operation_hash module Operation_list_hash = Operation_list_hash diff --git a/src/lib_protocol_environment/environment_V9.mli b/src/lib_protocol_environment/environment_V9.mli index 8cd927b3fe81..6426410d4b4d 100644 --- a/src/lib_protocol_environment/environment_V9.mli +++ b/src/lib_protocol_environment/environment_V9.mli @@ -43,7 +43,7 @@ module type T = sig and type 'a Data_encoding.lazy_t = 'a Data_encoding.lazy_t and type 'a Lwt.t = 'a Lwt.t and type ('a, 'b) Pervasives.result = ('a, 'b) result - and type Chain_id.t = Tezos_crypto.Chain_id.t + and type Chain_id.t = Chain_id.t and type Block_hash.t = Block_hash.t and type Operation_hash.t = Operation_hash.t and type Operation_list_hash.t = Operation_list_hash.t diff --git a/src/lib_protocol_environment/environment_protocol_T.ml b/src/lib_protocol_environment/environment_protocol_T.ml index 581f775c127f..f8b81badf9e2 100644 --- a/src/lib_protocol_environment/environment_protocol_T.ml +++ b/src/lib_protocol_environment/environment_protocol_T.ml @@ -253,7 +253,7 @@ module type PROTOCOL = sig val begin_validation : Context.t -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> mode -> predecessor:Block_header.shell_header -> cache:Context.source_of_cache -> @@ -261,7 +261,7 @@ module type PROTOCOL = sig val begin_application : Context.t -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> mode -> predecessor:Block_header.shell_header -> cache:Context.source_of_cache -> @@ -272,7 +272,7 @@ module type PROTOCOL = sig val init : Context.t -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> head_hash:Tezos_crypto.Hashed.Block_hash.t -> head:Block_header.shell_header -> cache:Context.source_of_cache -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V0.ml b/src/lib_protocol_environment/environment_protocol_T_V0.ml index f39328d9955b..f2ab9c6d91df 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V0.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V0.ml @@ -81,7 +81,7 @@ module type T = sig val current_context : validation_state -> context tzresult Lwt.t val begin_partial_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> ancestor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -89,7 +89,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -97,7 +97,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_construction : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V3.ml b/src/lib_protocol_environment/environment_protocol_T_V3.ml index 381d5e394536..2cfff72e978d 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V3.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V3.ml @@ -80,7 +80,7 @@ module type T = sig type validation_state val begin_partial_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> ancestor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -88,7 +88,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -96,7 +96,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_construction : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> @@ -127,7 +127,7 @@ module type T = sig type cache_key val value_of_key : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V6.ml b/src/lib_protocol_environment/environment_protocol_T_V6.ml index f3e51984f625..314a8f18278b 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V6.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V6.ml @@ -80,7 +80,7 @@ module type T = sig type validation_state val begin_partial_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> ancestor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -88,7 +88,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_application : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_fitness:Fitness.t -> @@ -96,7 +96,7 @@ module type T = sig validation_state tzresult Lwt.t val begin_construction : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> @@ -120,7 +120,7 @@ module type T = sig val rpc_services : rpc_context Tezos_rpc.Directory.t val init : - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> context -> Block_header.shell_header -> validation_result tzresult Lwt.t @@ -130,7 +130,7 @@ module type T = sig type cache_key val value_of_key : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V7.ml b/src/lib_protocol_environment/environment_protocol_T_V7.ml index 4c999e88e6e6..128654e89cfb 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V7.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V7.ml @@ -101,7 +101,7 @@ module type T = sig val begin_validation : context -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> mode -> predecessor:Block_header.shell_header -> validation_state tzresult Lwt.t @@ -117,7 +117,7 @@ module type T = sig val begin_application : context -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> mode -> predecessor:Block_header.shell_header -> application_state tzresult Lwt.t @@ -136,7 +136,7 @@ module type T = sig val rpc_services : rpc_context Tezos_rpc.Directory.t val init : - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> context -> Block_header.shell_header -> validation_result tzresult Lwt.t @@ -146,7 +146,7 @@ module type T = sig type cache_key val value_of_key : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Tezos_crypto.Hashed.Chain_id.t -> predecessor_context:context -> predecessor_timestamp:Time.Protocol.t -> predecessor_level:Int32.t -> @@ -186,7 +186,7 @@ module type T = sig val init : context -> - Tezos_crypto.Chain_id.t -> + Tezos_crypto.Hashed.Chain_id.t -> head_hash:Tezos_crypto.Hashed.Block_hash.t -> head:Block_header.shell_header -> (validation_info * t) tzresult Lwt.t diff --git a/src/lib_protocol_environment/structs/v0_chain_id.ml b/src/lib_protocol_environment/structs/v0_chain_id.ml index d4eb3d1a62cc..c800e12bbdcc 100644 --- a/src/lib_protocol_environment/structs/v0_chain_id.ml +++ b/src/lib_protocol_environment/structs/v0_chain_id.ml @@ -23,31 +23,32 @@ (* *) (*****************************************************************************) -include Tezos_crypto.Chain_id +include Tezos_crypto.Hashed.Chain_id module Set = struct - include Stdlib.Set.Make (Tezos_crypto.Chain_id) + include Stdlib.Set.Make (Tezos_crypto.Hashed.Chain_id) let encoding = Data_encoding.conv elements (fun l -> List.fold_left (fun m x -> add x m) empty l) - Data_encoding.(list Tezos_crypto.Chain_id.encoding) + Data_encoding.(list Tezos_crypto.Hashed.Chain_id.encoding) end module Map = struct - include Stdlib.Map.Make (Tezos_crypto.Chain_id) + include Stdlib.Map.Make (Tezos_crypto.Hashed.Chain_id) let encoding arg_encoding = Data_encoding.conv bindings (fun l -> List.fold_left (fun m (k, v) -> add k v m) empty l) - Data_encoding.(list (tup2 Tezos_crypto.Chain_id.encoding arg_encoding)) + Data_encoding.( + list (tup2 Tezos_crypto.Hashed.Chain_id.encoding arg_encoding)) end module Table = struct include Stdlib.Hashtbl.MakeSeeded (struct - include Tezos_crypto.Chain_id + include Tezos_crypto.Hashed.Chain_id (* See [src/lib_base/tzPervasives.ml] for an explanation *) [@@@ocaml.warning "-32"] @@ -66,5 +67,6 @@ module Table = struct let h = create (List.length l) in List.iter (fun (k, v) -> add h k v) l ; h) - Data_encoding.(list (tup2 Tezos_crypto.Chain_id.encoding arg_encoding)) + Data_encoding.( + list (tup2 Tezos_crypto.Hashed.Chain_id.encoding arg_encoding)) end diff --git a/src/lib_shell/block_validator_process.ml b/src/lib_shell/block_validator_process.ml index e588c5e6d076..2f08bd7c732b 100644 --- a/src/lib_shell/block_validator_process.ml +++ b/src/lib_shell/block_validator_process.ml @@ -68,7 +68,7 @@ module type S = sig val preapply_block : t -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> timestamp:Time.Protocol.t -> protocol_data:bytes -> live_blocks:Block_hash.Set.t -> @@ -100,15 +100,11 @@ module type S = sig val context_split : t -> Context_ops.index -> unit tzresult Lwt.t - val commit_genesis : - t -> chain_id:Tezos_crypto.Chain_id.t -> Context_hash.t tzresult Lwt.t + val commit_genesis : t -> chain_id:Chain_id.t -> Context_hash.t tzresult Lwt.t (** [init_test_chain] must only be called on a forking block. *) val init_test_chain : - t -> - Tezos_crypto.Chain_id.t -> - Store.Block.t -> - Block_header.t tzresult Lwt.t + t -> Chain_id.t -> Store.Block.t -> Block_header.t tzresult Lwt.t val reconfigure_event_logging : t -> Internal_event_unix.Configuration.t -> unit tzresult Lwt.t @@ -145,8 +141,8 @@ module Internal_validator_process = struct ~msg:"requesting validation of {block} for chain {chain}" ~pp1:Block_hash.pp ("block", Block_hash.encoding) - ~pp2:Tezos_crypto.Chain_id.pp - ("chain", Tezos_crypto.Chain_id.encoding) + ~pp2:Chain_id.pp + ("chain", Chain_id.encoding) let validation_success = declare_2 diff --git a/src/lib_shell/block_validator_process.mli b/src/lib_shell/block_validator_process.mli index 6321ded3cf6c..0d98198bc556 100644 --- a/src/lib_shell/block_validator_process.mli +++ b/src/lib_shell/block_validator_process.mli @@ -129,9 +129,8 @@ val context_garbage_collection : layout into a new chunk. *) val context_split : t -> Context_ops.index -> unit tzresult Lwt.t -val commit_genesis : - t -> chain_id:Tezos_crypto.Chain_id.t -> Context_hash.t tzresult Lwt.t +val commit_genesis : t -> chain_id:Chain_id.t -> Context_hash.t tzresult Lwt.t (** [init_test_chain] must only be called on a forking block. *) val init_test_chain : - t -> Tezos_crypto.Chain_id.t -> Store.Block.t -> Block_header.t tzresult Lwt.t + t -> Chain_id.t -> Store.Block.t -> Block_header.t tzresult Lwt.t diff --git a/src/lib_shell/chain_directory.mli b/src/lib_shell/chain_directory.mli index d24746095339..4e15fa460529 100644 --- a/src/lib_shell/chain_directory.mli +++ b/src/lib_shell/chain_directory.mli @@ -24,11 +24,10 @@ (* *) (*****************************************************************************) -val get_chain_id : - Store.t -> Chain_services.chain -> Tezos_crypto.Chain_id.t Lwt.t +val get_chain_id : Store.t -> Chain_services.chain -> Chain_id.t Lwt.t val get_chain_id_opt : - Store.t -> Chain_services.chain -> Tezos_crypto.Chain_id.t option Lwt.t + Store.t -> Chain_services.chain -> Chain_id.t option Lwt.t val get_chain_store_exn : Store.t -> Chain_services.chain -> Store.chain_store Lwt.t diff --git a/src/lib_shell/chain_validator.ml b/src/lib_shell/chain_validator.ml index 0076d3bc153e..a19236da00a3 100644 --- a/src/lib_shell/chain_validator.ml +++ b/src/lib_shell/chain_validator.ml @@ -27,15 +27,15 @@ open Chain_validator_worker_state module Name = struct - type t = Tezos_crypto.Chain_id.t + type t = Chain_id.t - let encoding = Tezos_crypto.Chain_id.encoding + let encoding = Chain_id.encoding let base = ["validator"; "chain"] - let pp = Tezos_crypto.Chain_id.pp_short + let pp = Chain_id.pp_short - let equal = Tezos_crypto.Chain_id.equal + let equal = Chain_id.equal end module Request = struct @@ -72,7 +72,7 @@ module Types = struct block_validator : Block_validator.t; block_validator_process : Block_validator_process.t; global_valid_block_input : Store.Block.t Lwt_watcher.input; - global_chains_input : (Tezos_crypto.Chain_id.t * bool) Lwt_watcher.input; + global_chains_input : (Chain_id.t * bool) Lwt_watcher.input; start_prevalidator : bool; prevalidator_limits : Shell_limits.prevalidator_limits; peer_validator_limits : Shell_limits.peer_validator_limits; @@ -116,7 +116,7 @@ let shutdown_child nv active_chains = (fun ({parameters = {chain_store; global_chains_input; _}; _}, shutdown) -> let test_chain_id = Store.Chain.chain_id chain_store in Lwt_watcher.notify global_chains_input (test_chain_id, false) ; - Tezos_crypto.Chain_id.Table.remove active_chains test_chain_id ; + Chain_id.Table.remove active_chains test_chain_id ; let* r = Store.Chain.shutdown_testchain nv.parameters.chain_store in match r with | Error _err -> @@ -159,7 +159,7 @@ let notify_new_block w peer {Block_validator.block; resulting_context_hash} = let nv = Worker.state w in Option.iter (fun id -> - List.assoc ~equal:Tezos_crypto.Chain_id.equal id (Worker.list table) + List.assoc ~equal:Chain_id.equal id (Worker.list table) |> Option.iter (fun w -> let nv = Worker.state w in Lwt_watcher.notify nv.valid_block_input block)) @@ -918,10 +918,7 @@ let rec create ~start_testchain ~active_chains ?parent ~block_validator_process } in let* w = Worker.launch table chain_id parameters (module Handlers) in - Tezos_crypto.Chain_id.Table.add - active_chains - (Store.Chain.chain_id chain_store) - w ; + Chain_id.Table.add active_chains (Store.Chain.chain_id chain_store) w ; register_garbage_collect_callback w ; register_split_callback w ; Lwt_watcher.notify global_chains_input (Store.Chain.chain_id chain_store, true) ; @@ -969,7 +966,7 @@ let child w = (Worker.state w).child (fun ({parameters = {chain_store; _}; _}, _) -> List.assoc - ~equal:Tezos_crypto.Chain_id.equal + ~equal:Chain_id.equal (Store.Chain.chain_id chain_store) (Worker.list table)) diff --git a/src/lib_shell/chain_validator.mli b/src/lib_shell/chain_validator.mli index 47d1379cf246..c01122f1b791 100644 --- a/src/lib_shell/chain_validator.mli +++ b/src/lib_shell/chain_validator.mli @@ -29,19 +29,19 @@ type t val create : start_prevalidator:bool -> start_testchain:bool -> - active_chains:t Tezos_crypto.Chain_id.Table.t -> + active_chains:t Chain_id.Table.t -> block_validator_process:Block_validator_process.t -> Shell_limits.peer_validator_limits -> Shell_limits.prevalidator_limits -> Block_validator.t -> Store.Block.t Lwt_watcher.input -> - (Tezos_crypto.Chain_id.t * bool) Lwt_watcher.input -> + (Chain_id.t * bool) Lwt_watcher.input -> Distributed_db.t -> Store.chain_store -> Shell_limits.chain_validator_limits -> t tzresult Lwt.t -val chain_id : t -> Tezos_crypto.Chain_id.t +val chain_id : t -> Chain_id.t val chain_store : t -> Store.chain_store @@ -80,7 +80,7 @@ val valid_block_watcher : t -> Store.Block.t Lwt_stream.t * Lwt_watcher.stopper val new_head_watcher : t -> Store.Block.t Lwt_stream.t * Lwt_watcher.stopper -val running_workers : unit -> (Tezos_crypto.Chain_id.t * t) list +val running_workers : unit -> (Chain_id.t * t) list val status : t -> Worker_types.worker_status diff --git a/src/lib_shell/distributed_db.ml b/src/lib_shell/distributed_db.ml index 61f9af1dec95..7ca276f20c0a 100644 --- a/src/lib_shell/distributed_db.ml +++ b/src/lib_shell/distributed_db.ml @@ -56,7 +56,7 @@ type db = { p2p : p2p; p2p_readers : P2p_reader.t P2p_peer.Table.t; disk : Store.t; - active_chains : P2p_reader.chain_db Tezos_crypto.Chain_id.Table.t; + active_chains : P2p_reader.chain_db Chain_id.Table.t; protocol_db : Distributed_db_requester.Raw_protocol.t; } @@ -74,8 +74,7 @@ let information {global_db; reader_chain_db} = { Chain_validator_worker_state.Distributed_db_state.p2p_readers_length = P2p_peer.Table.length global_db.p2p_readers; - active_chains_length = - Tezos_crypto.Chain_id.Table.length global_db.active_chains; + active_chains_length = Chain_id.Table.length global_db.active_chains; operation_db = Distributed_db_requester.Raw_operation.state_of_t reader_chain_db.operation_db; @@ -115,7 +114,7 @@ let create disk p2p = let protocol_db = Distributed_db_requester.Raw_protocol.create global_request disk in - let active_chains = Tezos_crypto.Chain_id.Table.create ~random:true 17 in + let active_chains = Chain_id.Table.create ~random:true 17 in let p2p_readers = P2p_peer.Table.create ~random:true 17 in let db = {p2p; p2p_readers; disk; active_chains; protocol_db} in db @@ -133,7 +132,7 @@ let activate P2p.activate p2p ; let chain_id = Store.Chain.chain_id chain_store in let reader_chain_db = - match Tezos_crypto.Chain_id.Table.find active_chains chain_id with + match Chain_id.Table.find active_chains chain_id with | Some local_db -> local_db | None -> let active_peers = ref P2p_peer.Set.empty in @@ -184,7 +183,7 @@ let activate trace) (fun exc -> Format.eprintf "Uncaught exception: %s\n%!" (Printexc.to_string exc)) ; - Tezos_crypto.Chain_id.Table.add active_chains chain_id local_db ; + Chain_id.Table.add active_chains chain_id local_db ; local_db in {global_db; reader_chain_db} @@ -193,7 +192,7 @@ let deactivate chain_db = let open Lwt_syntax in let {active_chains; p2p; _} = chain_db.global_db in let chain_id = Store.Chain.chain_id chain_db.reader_chain_db.chain_store in - Tezos_crypto.Chain_id.Table.remove active_chains chain_id ; + Chain_id.Table.remove active_chains chain_id ; let sends = P2p_peer.Table.iter_ep (fun gid conn -> @@ -219,9 +218,7 @@ let deactivate chain_db = let get_chain global_db chain_id = let open Option_syntax in - let+ reader_chain_db = - Tezos_crypto.Chain_id.Table.find global_db.active_chains chain_id - in + let+ reader_chain_db = Chain_id.Table.find global_db.active_chains chain_id in {global_db; reader_chain_db} let greylist {global_db = {p2p; _}; _} peer_id = @@ -239,7 +236,7 @@ let shutdown {p2p_readers; active_chains; _} = (fun _peer_id reader -> P2p_reader.shutdown reader) p2p_readers in - Tezos_crypto.Chain_id.Table.iter_p + Chain_id.Table.iter_p (fun _ reader_chain_db -> let* () = Distributed_db_requester.Raw_operation.shutdown diff --git a/src/lib_shell/distributed_db.mli b/src/lib_shell/distributed_db.mli index 060b7f797a33..2046dcb5215f 100644 --- a/src/lib_shell/distributed_db.mli +++ b/src/lib_shell/distributed_db.mli @@ -88,7 +88,7 @@ type chain_db val activate : t -> Store.Chain.t -> P2p_reader.callback -> chain_db (** Look for the database of an active chain. *) -val get_chain : t -> Tezos_crypto.Chain_id.t -> chain_db option +val get_chain : t -> Chain_id.t -> chain_db option (** [deactivate chain_db] sends a [Deactivate chain_id] message to all active neighbors for this chain. This notifies them that this node isn't interested diff --git a/src/lib_shell/distributed_db_message.ml b/src/lib_shell/distributed_db_message.ml index 1913785fc058..765d7b8740dc 100644 --- a/src/lib_shell/distributed_db_message.ml +++ b/src/lib_shell/distributed_db_message.ml @@ -187,11 +187,11 @@ module Bounded_encoding = struct end type t = - | Get_current_branch of Tezos_crypto.Chain_id.t - | Current_branch of Tezos_crypto.Chain_id.t * Block_locator.t - | Deactivate of Tezos_crypto.Chain_id.t - | Get_current_head of Tezos_crypto.Chain_id.t - | Current_head of Tezos_crypto.Chain_id.t * Block_header.t * Mempool.t + | Get_current_branch of Chain_id.t + | Current_branch of Chain_id.t * Block_locator.t + | Deactivate of Chain_id.t + | Get_current_head of Chain_id.t + | Current_head of Chain_id.t * Block_header.t * Mempool.t | Get_block_headers of Block_hash.t list | Block_header of Block_header.t | Get_operations of Operation_hash.t list @@ -201,12 +201,11 @@ type t = | Get_operations_for_blocks of (Block_hash.t * int) list | Operations_for_block of Block_hash.t * int * Operation.t list * Operation_list_list_hash.path - | Get_checkpoint of Tezos_crypto.Chain_id.t - | Checkpoint of Tezos_crypto.Chain_id.t * Block_header.t - | Get_protocol_branch of - Tezos_crypto.Chain_id.t * int (* proto_level: uint8 *) + | Get_checkpoint of Chain_id.t + | Checkpoint of Chain_id.t * Block_header.t + | Get_protocol_branch of Chain_id.t * int (* proto_level: uint8 *) | Protocol_branch of - Tezos_crypto.Chain_id.t * int (* proto_level: uint8 *) * Block_locator.t + Chain_id.t * int (* proto_level: uint8 *) * Block_locator.t | Get_predecessor_header of Block_hash.t * int32 | Predecessor_header of Block_hash.t * int32 * Block_header.t @@ -219,14 +218,14 @@ let encoding = case ~tag:0x10 ~title:"Get_current_branch" - (obj1 (req "get_current_branch" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "get_current_branch" Chain_id.encoding)) (function Get_current_branch chain_id -> Some chain_id | _ -> None) (fun chain_id -> Get_current_branch chain_id); case ~tag:0x11 ~title:"Current_branch" (obj2 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "current_branch" Bounded_encoding.block_locator)) (function | Current_branch (chain_id, locator) -> Some (chain_id, locator) @@ -235,20 +234,20 @@ let encoding = case ~tag:0x12 ~title:"Deactivate" - (obj1 (req "deactivate" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "deactivate" Chain_id.encoding)) (function Deactivate chain_id -> Some chain_id | _ -> None) (fun chain_id -> Deactivate chain_id); case ~tag:0x13 ~title:"Get_current_head" - (obj1 (req "get_current_head" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "get_current_head" Chain_id.encoding)) (function Get_current_head chain_id -> Some chain_id | _ -> None) (fun chain_id -> Get_current_head chain_id); case ~tag:0x14 ~title:"Current_head" (obj3 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "current_block_header" (dynamic_size Bounded_encoding.block_header)) @@ -327,7 +326,7 @@ let encoding = case ~tag:0x70 ~title:"Get_checkpoint" - (obj1 (req "get_checkpoint" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "get_checkpoint" Chain_id.encoding)) (function Get_checkpoint chain -> Some chain | _ -> None) (fun chain -> Get_checkpoint chain); case @@ -337,7 +336,7 @@ let encoding = (req "checkpoint" (obj2 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "header" Bounded_encoding.block_header)))) (function | Checkpoint (chain_id, header) -> Some (chain_id, header) | _ -> None) @@ -348,9 +347,7 @@ let encoding = (obj1 (req "get_protocol_branch" - (obj2 - (req "chain" Tezos_crypto.Chain_id.encoding) - (req "proto_level" uint8)))) + (obj2 (req "chain" Chain_id.encoding) (req "proto_level" uint8)))) (function | Get_protocol_branch (chain, protocol) -> Some (chain, protocol) | _ -> None) @@ -362,7 +359,7 @@ let encoding = (req "protocol_branch" (obj3 - (req "chain" Tezos_crypto.Chain_id.encoding) + (req "chain" Chain_id.encoding) (req "proto_level" uint8) (req "locator" Bounded_encoding.block_locator)))) (function diff --git a/src/lib_shell/distributed_db_message.mli b/src/lib_shell/distributed_db_message.mli index 25dc7d101915..f679bce6ad38 100644 --- a/src/lib_shell/distributed_db_message.mli +++ b/src/lib_shell/distributed_db_message.mli @@ -29,11 +29,11 @@ corresponding request. Thus, we are able to discrimate between expected responses from the unexpected ones. *) type t = - | Get_current_branch of Tezos_crypto.Chain_id.t - | Current_branch of Tezos_crypto.Chain_id.t * Block_locator.t - | Deactivate of Tezos_crypto.Chain_id.t - | Get_current_head of Tezos_crypto.Chain_id.t - | Current_head of Tezos_crypto.Chain_id.t * Block_header.t * Mempool.t + | Get_current_branch of Chain_id.t + | Current_branch of Chain_id.t * Block_locator.t + | Deactivate of Chain_id.t + | Get_current_head of Chain_id.t + | Current_head of Chain_id.t * Block_header.t * Mempool.t | Get_block_headers of Block_hash.t list | Block_header of Block_header.t | Get_operations of Operation_hash.t list @@ -43,10 +43,10 @@ type t = | Get_operations_for_blocks of (Block_hash.t * int) list | Operations_for_block of Block_hash.t * int * Operation.t list * Operation_list_list_hash.path - | Get_checkpoint of Tezos_crypto.Chain_id.t - | Checkpoint of Tezos_crypto.Chain_id.t * Block_header.t - | Get_protocol_branch of Tezos_crypto.Chain_id.t * int - | Protocol_branch of Tezos_crypto.Chain_id.t * int * Block_locator.t + | Get_checkpoint of Chain_id.t + | Checkpoint of Chain_id.t * Block_header.t + | Get_protocol_branch of Chain_id.t * int + | Protocol_branch of Chain_id.t * int * Block_locator.t | Get_predecessor_header of Block_hash.t * int32 | Predecessor_header of Block_hash.t * int32 * Block_header.t diff --git a/src/lib_shell/legacy_prevalidation.ml b/src/lib_shell/legacy_prevalidation.ml index eb366cfa4003..ed2a872ffe9a 100644 --- a/src/lib_shell/legacy_prevalidation.ml +++ b/src/lib_shell/legacy_prevalidation.ml @@ -67,7 +67,7 @@ module type CHAIN_STORE = sig Store.Block.t -> Tezos_protocol_environment.Context.t tzresult Lwt.t - val chain_id : chain_store -> Tezos_crypto.Chain_id.t + val chain_id : chain_store -> Chain_id.t end module type T = sig diff --git a/src/lib_shell/legacy_prevalidation.mli b/src/lib_shell/legacy_prevalidation.mli index e2fd77dafcad..95dd3dd6d844 100644 --- a/src/lib_shell/legacy_prevalidation.mli +++ b/src/lib_shell/legacy_prevalidation.mli @@ -182,7 +182,7 @@ module Internal_for_tests : sig (** [chain_id store] returns the {!Chain_id.t} to which [store] corresponds *) - val chain_id : chain_store -> Tezos_crypto.Chain_id.t + val chain_id : chain_store -> Chain_id.t end (** A variant of [Make] above that is parameterized by {!CHAIN_STORE}, diff --git a/src/lib_shell/legacy_prevalidator_internal.ml b/src/lib_shell/legacy_prevalidator_internal.ml index 9fb6f5473e65..4d62251fd880 100644 --- a/src/lib_shell/legacy_prevalidator_internal.ml +++ b/src/lib_shell/legacy_prevalidator_internal.ml @@ -1027,7 +1027,7 @@ module type ARG = sig val chain_db : Distributed_db.chain_db - val chain_id : Tezos_crypto.Chain_id.t + val chain_id : Chain_id.t end module Name = struct diff --git a/src/lib_shell/legacy_prevalidator_internal.mli b/src/lib_shell/legacy_prevalidator_internal.mli index 0897197ff21e..5243731e5117 100644 --- a/src/lib_shell/legacy_prevalidator_internal.mli +++ b/src/lib_shell/legacy_prevalidator_internal.mli @@ -46,7 +46,7 @@ val make : Shell_limits.prevalidator_limits -> Distributed_db.chain_db -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> (module Legacy_mempool_plugin.FILTER) -> Prevalidator_internal_common.t diff --git a/src/lib_shell/monitor_directory.ml b/src/lib_shell/monitor_directory.ml index b3a3f9312446..1e410538b420 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -75,7 +75,7 @@ let build_rpc_directory validator mainchain_validator = match o with | None -> false | Some this_chain_id -> - Tezos_crypto.Chain_id.equal this_chain_id that_chain_id) + Chain_id.equal this_chain_id that_chain_id) chains in let in_protocols (chain_store, block) = @@ -176,7 +176,7 @@ let build_rpc_directory validator mainchain_validator = let convert (chain_id, b) = if not b then Lwt.return (Monitor_services.Stopping chain_id) else if - Tezos_crypto.Chain_id.equal + Chain_id.equal (Store.Chain.chain_id (Store.main_chain_store store)) chain_id then Lwt.return (Monitor_services.Active_main chain_id) @@ -193,7 +193,7 @@ let build_rpc_directory validator mainchain_validator = (Format.asprintf "Monitor.active_chains: no expiration date for the \ chain %a" - Tezos_crypto.Chain_id.pp + Chain_id.pp chain_id)) (Store.Chain.expiration chain_store) in diff --git a/src/lib_shell/p2p_reader.ml b/src/lib_shell/p2p_reader.ml index dae8bc04613d..945db5b63dcb 100644 --- a/src/lib_shell/p2p_reader.ml +++ b/src/lib_shell/p2p_reader.ml @@ -56,12 +56,12 @@ type t = { p2p : p2p; gid : P2p_peer.Id.t; (** remote peer id *) conn : connection; - peer_active_chains : chain_db Tezos_crypto.Chain_id.Table.t; + peer_active_chains : chain_db Chain_id.Table.t; disk : Store.t; canceler : Lwt_canceler.t; mutable worker : unit Lwt.t; protocol_db : Distributed_db_requester.Raw_protocol.t; - active_chains : chain_db Tezos_crypto.Chain_id.Table.t; + active_chains : chain_db Chain_id.Table.t; (** All chains managed by this peer **) unregister : unit -> unit; } @@ -70,7 +70,7 @@ type t = { and [chain_db] is the chain_db corresponding to this chain id, otherwise does nothing (simply update peer metadata). *) let may_handle state chain_id f = - match Tezos_crypto.Chain_id.Table.find state.peer_active_chains chain_id with + match Chain_id.Table.find state.peer_active_chains chain_id with | None -> let meta = P2p.get_peer_metadata state.p2p state.gid in Peer_metadata.incr meta Inactive_chain ; @@ -80,12 +80,12 @@ let may_handle state chain_id f = (* performs [f chain_db] if [chain_id] is active and [chain_db] is the chain_db corresponding to this chain id. *) let may_handle_global state chain_id f = - match Tezos_crypto.Chain_id.Table.find state.active_chains chain_id with + match Chain_id.Table.find state.active_chains chain_id with | None -> Lwt.return_unit | Some chain_db -> f chain_db let find_pending_operations {peer_active_chains; _} h i = - Tezos_crypto.Chain_id.Table.to_seq_values peer_active_chains + Chain_id.Table.to_seq_values peer_active_chains |> Seq.filter (fun chain_db -> Distributed_db_requester.Raw_operations.pending chain_db.operations_db @@ -93,7 +93,7 @@ let find_pending_operations {peer_active_chains; _} h i = |> Seq.first let find_pending_operation {peer_active_chains; _} h = - Tezos_crypto.Chain_id.Table.to_seq_values peer_active_chains + Chain_id.Table.to_seq_values peer_active_chains |> Seq.filter (fun chain_db -> Distributed_db_requester.Raw_operation.pending chain_db.operation_db h) |> Seq.first @@ -102,7 +102,7 @@ let read_operation state h = (* Remember that seqs are lazy. The table is only traversed until a match is found, the rest is not explored. *) let open Lwt_syntax in - Seq_s.of_seq (Tezos_crypto.Chain_id.Table.to_seq state.active_chains) + Seq_s.of_seq (Chain_id.Table.to_seq state.active_chains) |> Seq_s.filter_map_s (fun (chain_id, chain_db) -> let+ v = Distributed_db_requester.Raw_operation.read_opt @@ -148,7 +148,7 @@ let read_predecessor_header {disk; _} h offset = chain_stores) let find_pending_block_header {peer_active_chains; _} h = - Tezos_crypto.Chain_id.Table.to_seq_values peer_active_chains + Chain_id.Table.to_seq_values peer_active_chains |> Seq.filter (fun chain_db -> Distributed_db_requester.Raw_block_header.pending chain_db.block_header_db @@ -162,13 +162,13 @@ let deactivate gid chain_db = (* Active the chain_id for the remote peer. Is a nop if it is already activated. *) let activate state chain_id chain_db = - match Tezos_crypto.Chain_id.Table.find state.peer_active_chains chain_id with + match Chain_id.Table.find state.peer_active_chains chain_id with | Some _ -> () | None -> chain_db.active_peers := P2p_peer.Set.add state.gid !(chain_db.active_peers) ; P2p_peer.Table.add chain_db.active_connections state.gid state.conn ; - Tezos_crypto.Chain_id.Table.add state.peer_active_chains chain_id chain_db + Chain_id.Table.add state.peer_active_chains chain_id chain_db let my_peer_id state = P2p.peer_id state.p2p @@ -222,7 +222,7 @@ let handle_msg state msg = | Deactivate chain_id -> may_handle state chain_id @@ fun chain_db -> deactivate state.gid chain_db ; - Tezos_crypto.Chain_id.Table.remove state.peer_active_chains chain_id ; + Chain_id.Table.remove state.peer_active_chains chain_id ; Lwt.return_unit | Get_current_head chain_id -> may_handle state chain_id @@ fun chain_db -> @@ -463,7 +463,7 @@ let rec worker_loop state = let* () = handle_msg state msg in worker_loop state | Error _ -> - Tezos_crypto.Chain_id.Table.iter + Chain_id.Table.iter (fun _ -> deactivate state.gid) state.peer_active_chains ; state.unregister () ; @@ -480,12 +480,12 @@ let run ~register ~unregister p2p disk protocol_db active_chains gid conn = conn; gid; canceler; - peer_active_chains = Tezos_crypto.Chain_id.Table.create 17; + peer_active_chains = Chain_id.Table.create 17; worker = Lwt.return_unit; unregister; } in - Tezos_crypto.Chain_id.Table.iter + Chain_id.Table.iter (fun chain_id _chain_db -> Error_monad.dont_wait (fun () -> diff --git a/src/lib_shell/p2p_reader.mli b/src/lib_shell/p2p_reader.mli index 60bea541bff3..c6e9ffd3bce4 100644 --- a/src/lib_shell/p2p_reader.mli +++ b/src/lib_shell/p2p_reader.mli @@ -170,7 +170,7 @@ type chain_db = { (** Lookup for block header in any active chains *) val read_block_header : - t -> Block_hash.t -> (Tezos_crypto.Chain_id.t * Block_header.t) option Lwt.t + t -> Block_hash.t -> (Chain_id.t * Block_header.t) option Lwt.t (** [run ~register ~unregister p2p state protocol_db active_chains peer_id conn] runs an answering worker on a p2p connection [connection]. [peer_id] is @@ -185,7 +185,7 @@ val run : p2p -> Store.t -> Distributed_db_requester.Raw_protocol.t -> - chain_db Tezos_crypto.Chain_id.Table.t -> + chain_db Chain_id.Table.t -> P2p_peer.Id.t -> connection -> unit diff --git a/src/lib_shell/peer_validator.ml b/src/lib_shell/peer_validator.ml index 2f2ebe8f9357..82f1d6e03ee1 100644 --- a/src/lib_shell/peer_validator.ml +++ b/src/lib_shell/peer_validator.ml @@ -29,24 +29,16 @@ open Peer_validator_worker_state module Name = struct - type t = Tezos_crypto.Chain_id.t * P2p_peer.Id.t + type t = Chain_id.t * P2p_peer.Id.t - let encoding = - Data_encoding.tup2 Tezos_crypto.Chain_id.encoding P2p_peer.Id.encoding + let encoding = Data_encoding.tup2 Chain_id.encoding P2p_peer.Id.encoding let base = ["validator"; "peer"] let pp ppf (chain, peer) = - Format.fprintf - ppf - "%a:%a" - Tezos_crypto.Chain_id.pp_short - chain - P2p_peer.Id.pp_short - peer - - let equal (c1, p1) (c2, p2) = - Tezos_crypto.Chain_id.equal c1 c2 && P2p_peer.Id.equal p1 p2 + Format.fprintf ppf "%a:%a" Chain_id.pp_short chain P2p_peer.Id.pp_short peer + + let equal (c1, p1) (c2, p2) = Chain_id.equal c1 c2 && P2p_peer.Id.equal p1 p2 end module Request = struct diff --git a/src/lib_shell/peer_validator.mli b/src/lib_shell/peer_validator.mli index 50a591b5ea10..3b4f42f58fdc 100644 --- a/src/lib_shell/peer_validator.mli +++ b/src/lib_shell/peer_validator.mli @@ -43,8 +43,7 @@ val notify_branch : t -> Block_locator.t -> unit val notify_head : t -> Block_hash.t -> Block_header.t -> unit -val running_workers : - unit -> ((Tezos_crypto.Chain_id.t * P2p_peer.Id.t) * t) list +val running_workers : unit -> ((Chain_id.t * P2p_peer.Id.t) * t) list val status : t -> Worker_types.worker_status diff --git a/src/lib_shell/prevalidation.ml b/src/lib_shell/prevalidation.ml index 38b689170bc2..6bca8cbec751 100644 --- a/src/lib_shell/prevalidation.ml +++ b/src/lib_shell/prevalidation.ml @@ -92,7 +92,7 @@ module type CHAIN_STORE = sig Store.Block.t -> Tezos_protocol_environment.Context.t tzresult Lwt.t - val chain_id : chain_store -> Tezos_crypto.Chain_id.t + val chain_id : chain_store -> Chain_id.t end module type T = sig diff --git a/src/lib_shell/prevalidation.mli b/src/lib_shell/prevalidation.mli index 4234b51a8d97..e46bdba504b2 100644 --- a/src/lib_shell/prevalidation.mli +++ b/src/lib_shell/prevalidation.mli @@ -180,9 +180,9 @@ module Internal_for_tests : sig Store.Block.t -> Tezos_protocol_environment.Context.t tzresult Lwt.t - (** [chain_id store] returns the {!Tezos_crypto.Chain_id.t} to which [store] + (** [chain_id store] returns the {!Chain_id.t} to which [store] corresponds *) - val chain_id : chain_store -> Tezos_crypto.Chain_id.t + val chain_id : chain_store -> Chain_id.t end (** A variant of [Make] above that is parameterized by {!CHAIN_STORE}, diff --git a/src/lib_shell/prevalidator.ml b/src/lib_shell/prevalidator.ml index 2fa096a23823..1995d1d05046 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -28,11 +28,11 @@ include Prevalidator_internal_common open Prevalidator_worker_state module ChainProto_registry = Map.Make (struct - type t = Tezos_crypto.Chain_id.t * Protocol_hash.t + type t = Chain_id.t * Protocol_hash.t let compare (c1, p1) (c2, p2) = let pc = Protocol_hash.compare p1 p2 in - if pc = 0 then Tezos_crypto.Chain_id.compare c1 c2 else pc + if pc = 0 then Chain_id.compare c1 c2 else pc end) let chain_proto_registry : t ChainProto_registry.t ref = diff --git a/src/lib_shell/prevalidator.mli b/src/lib_shell/prevalidator.mli index 3865c4cbb6d3..3c409e7c6401 100644 --- a/src/lib_shell/prevalidator.mli +++ b/src/lib_shell/prevalidator.mli @@ -83,8 +83,7 @@ val flush : (** Returns the list of prevalidation contexts running and their associated chain *) -val running_workers : - unit -> (Tezos_crypto.Chain_id.t * Protocol_hash.t * t) list +val running_workers : unit -> (Chain_id.t * Protocol_hash.t * t) list (** Worker status and events *) diff --git a/src/lib_shell/prevalidator_internal.ml b/src/lib_shell/prevalidator_internal.ml index e9a7cb26e497..c7a86d601de7 100644 --- a/src/lib_shell/prevalidator_internal.ml +++ b/src/lib_shell/prevalidator_internal.ml @@ -858,7 +858,7 @@ module type ARG = sig val chain_db : Distributed_db.chain_db - val chain_id : Tezos_crypto.Chain_id.t + val chain_id : Chain_id.t end module WorkerGroup = Worker.MakeGroup (Name) (Prevalidator_worker_state.Request) diff --git a/src/lib_shell/prevalidator_internal.mli b/src/lib_shell/prevalidator_internal.mli index 4eff4820e004..66395e15b016 100644 --- a/src/lib_shell/prevalidator_internal.mli +++ b/src/lib_shell/prevalidator_internal.mli @@ -45,6 +45,6 @@ val make : Shell_limits.prevalidator_limits -> Distributed_db.chain_db -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> (module Shell_plugin.FILTER) -> Prevalidator_internal_common.t diff --git a/src/lib_shell/prevalidator_internal_common.ml b/src/lib_shell/prevalidator_internal_common.ml index d1d7e0345309..5bec2002a65e 100644 --- a/src/lib_shell/prevalidator_internal_common.ml +++ b/src/lib_shell/prevalidator_internal_common.ml @@ -27,10 +27,9 @@ let advertisement_delay = 0.1 module Name = struct - type t = Tezos_crypto.Chain_id.t * Protocol_hash.t + type t = Chain_id.t * Protocol_hash.t - let encoding = - Data_encoding.tup2 Tezos_crypto.Chain_id.encoding Protocol_hash.encoding + let encoding = Data_encoding.tup2 Chain_id.encoding Protocol_hash.encoding let base = ["prevalidator"] @@ -38,13 +37,13 @@ module Name = struct Format.fprintf fmt "%a:%a" - Tezos_crypto.Chain_id.pp_short + Chain_id.pp_short chain_id Protocol_hash.pp_short proto_hash let equal (c1, p1) (c2, p2) = - Tezos_crypto.Chain_id.equal c1 c2 && Protocol_hash.equal p1 p2 + Chain_id.equal c1 c2 && Protocol_hash.equal p1 p2 end open Prevalidator_worker_state diff --git a/src/lib_shell/prevalidator_internal_common.mli b/src/lib_shell/prevalidator_internal_common.mli index 5f1a82416a94..bc893bd04348 100644 --- a/src/lib_shell/prevalidator_internal_common.mli +++ b/src/lib_shell/prevalidator_internal_common.mli @@ -34,8 +34,7 @@ val advertisement_delay : float (** Argument that will be provided to {!Worker.MakeGroup} to create the prevalidator worker. *) module Name : - Tezos_base.Worker_intf.NAME - with type t = Tezos_crypto.Chain_id.t * Protocol_hash.t + Tezos_base.Worker_intf.NAME with type t = Chain_id.t * Protocol_hash.t open Prevalidator_worker_state diff --git a/src/lib_shell/shell_metrics.ml b/src/lib_shell/shell_metrics.ml index 31f18168a82c..12c97ec0a8dd 100644 --- a/src/lib_shell/shell_metrics.ml +++ b/src/lib_shell/shell_metrics.ml @@ -504,7 +504,7 @@ module Chain_validator = struct Worker.declare_counters ~label_names:[label_name] ~namespace ?subsystem () in fun chain_id -> - let label = Tezos_crypto.Chain_id.to_short_b58check chain_id in + let label = Chain_id.to_short_b58check chain_id in { head_level = head_level label; ignored_head_count = ignored_head_count label; diff --git a/src/lib_shell/shell_metrics.mli b/src/lib_shell/shell_metrics.mli index 4d48caa26fc9..c1766349fefa 100644 --- a/src/lib_shell/shell_metrics.mli +++ b/src/lib_shell/shell_metrics.mli @@ -103,7 +103,7 @@ module Chain_validator : sig val update_sync_status : metrics:t -> Chain_validator_worker_state.synchronisation_status -> unit - val init : string list -> Tezos_crypto.Chain_id.t -> t + val init : string list -> Chain_id.t -> t val update_proto_metrics_callback : metrics:t -> cycle:float -> consumed_gas:float -> round:float -> unit diff --git a/src/lib_shell/test/legacy_test_prevalidation_t.ml b/src/lib_shell/test/legacy_test_prevalidation_t.ml index 113143927aae..986dcf9300de 100644 --- a/src/lib_shell/test/legacy_test_prevalidation_t.ml +++ b/src/lib_shell/test/legacy_test_prevalidation_t.ml @@ -70,7 +70,7 @@ module Init = struct Protocol_hash.of_b58check_exn "ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp" - let chain_id = Tezos_crypto.Chain_id.zero + let chain_id = Chain_id.zero let genesis_time = Time.Protocol.of_seconds 0L diff --git a/src/lib_shell/test/shell_test_helpers.ml b/src/lib_shell/test/shell_test_helpers.ml index 89756920ba02..1771f7ef59b1 100644 --- a/src/lib_shell/test/shell_test_helpers.ml +++ b/src/lib_shell/test/shell_test_helpers.ml @@ -65,7 +65,7 @@ let genesis : Genesis.t = protocol = genesis_protocol_hash; } -let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis_block_hash +let chain_id = Chain_id.of_block_hash genesis_block_hash let patch_context ctxt = let open Lwt_syntax in diff --git a/src/lib_shell/validator.ml b/src/lib_shell/validator.ml index 391a8088bd55..753558b4333c 100644 --- a/src/lib_shell/validator.ml +++ b/src/lib_shell/validator.ml @@ -34,8 +34,8 @@ type t = { prevalidator_limits : Shell_limits.prevalidator_limits; start_testchain : bool; valid_block_input : Store.Block.t Lwt_watcher.input; - chains_input : (Tezos_crypto.Chain_id.t * bool) Lwt_watcher.input; - active_chains : Chain_validator.t Tezos_crypto.Chain_id.Table.t; + chains_input : (Chain_id.t * bool) Lwt_watcher.input; + active_chains : Chain_validator.t Chain_id.Table.t; } let create state db peer_validator_limits block_validator_limits @@ -63,14 +63,14 @@ let create state db peer_validator_limits block_validator_limits chain_validator_limits; valid_block_input; chains_input; - active_chains = Tezos_crypto.Chain_id.Table.create 7; + active_chains = Chain_id.Table.create 7; } let activate v ~start_prevalidator ~validator_process chain_store = let open Lwt_syntax in let chain_id = Store.Chain.chain_id chain_store in let* () = Validator_event.(emit activate_chain) chain_id in - match Tezos_crypto.Chain_id.Table.find v.active_chains chain_id with + match Chain_id.Table.find v.active_chains chain_id with | Some chain -> return_ok chain | None -> Chain_validator.create @@ -89,14 +89,12 @@ let activate v ~start_prevalidator ~validator_process chain_store = let get {active_chains; _} chain_id = let open Result_syntax in - match Tezos_crypto.Chain_id.Table.find active_chains chain_id with + match Chain_id.Table.find active_chains chain_id with | Some nv -> return nv | None -> tzfail (Validation_errors.Inactive_chain chain_id) let get_active_chains {active_chains; _} = - let l = - Tezos_crypto.Chain_id.Table.fold (fun c _ acc -> c :: acc) active_chains [] - in + let l = Chain_id.Table.fold (fun c _ acc -> c :: acc) active_chains [] in List.rev l let read_block store h = @@ -165,7 +163,7 @@ let shutdown {active_chains; block_validator; _} = (fun (id, nv) -> let* () = Validator_event.(emit shutdown_chain_validator) id in Chain_validator.shutdown nv) - (Tezos_crypto.Chain_id.Table.to_seq active_chains) + (Chain_id.Table.to_seq active_chains) in (* Shutdown the chain_validator (peer_validators, prevalidator, etc.) before the block_validator *) @@ -193,7 +191,7 @@ let inject_operation v ?chain_id ~force op = match o with | None -> if force then - Tezos_crypto.Chain_id.Table.iter_es + Chain_id.Table.iter_es (fun _chain_id chain -> inject_operation_on chain diff --git a/src/lib_shell/validator.mli b/src/lib_shell/validator.mli index fd690fe4a310..e1a308e0e59a 100644 --- a/src/lib_shell/validator.mli +++ b/src/lib_shell/validator.mli @@ -49,15 +49,15 @@ val activate : Store.chain_store -> Chain_validator.t tzresult Lwt.t -val get : t -> Tezos_crypto.Chain_id.t -> Chain_validator.t tzresult +val get : t -> Chain_id.t -> Chain_validator.t tzresult -val get_active_chains : t -> Tezos_crypto.Chain_id.t list +val get_active_chains : t -> Chain_id.t list (** Force the validation of a block. *) val validate_block : t -> ?force:bool -> - ?chain_id:Tezos_crypto.Chain_id.t -> + ?chain_id:Chain_id.t -> Bytes.t -> Operation.t list list -> (Block_hash.t * unit tzresult Lwt.t) tzresult Lwt.t @@ -65,8 +65,7 @@ val validate_block : (** Monitor all the valid block (for all activate chains). *) val watcher : t -> Store.Block.t Lwt_stream.t * Lwt_watcher.stopper -val chains_watcher : - t -> (Tezos_crypto.Chain_id.t * bool) Lwt_stream.t * Lwt_watcher.stopper +val chains_watcher : t -> (Chain_id.t * bool) Lwt_stream.t * Lwt_watcher.stopper (** [inject_operation t ?chain_id ~force op] notifies the prevalidator worker associated with the [chain_id] of a new injected operation. @@ -76,10 +75,6 @@ val chains_watcher : in the operation data. Fails if no chain_id can be recovered unless [force] is set. If force is set, notify all the known prevalidator workers. *) val inject_operation : - t -> - ?chain_id:Tezos_crypto.Chain_id.t -> - force:bool -> - Operation.t -> - unit tzresult Lwt.t + t -> ?chain_id:Chain_id.t -> force:bool -> Operation.t -> unit tzresult Lwt.t val distributed_db : t -> Distributed_db.t diff --git a/src/lib_shell/validator_event.ml b/src/lib_shell/validator_event.ml index 4da070bea446..dbf986dc4cee 100644 --- a/src/lib_shell/validator_event.ml +++ b/src/lib_shell/validator_event.ml @@ -35,7 +35,7 @@ let activate_chain = ~name:"activate_chain" ~msg:"activate chain {chain}" ~level:Notice - ("chain", Tezos_crypto.Chain_id.encoding) + ("chain", Chain_id.encoding) let shutdown_block_validator = declare_0 @@ -51,4 +51,4 @@ let shutdown_chain_validator = ~name:"shutdown_chain_validator" ~msg:"shutting down the chain validator {chain}" ~level:Notice - ("chain", Tezos_crypto.Chain_id.encoding) + ("chain", Chain_id.encoding) diff --git a/src/lib_shell/worker_directory.ml b/src/lib_shell/worker_directory.ml index da2abfebabcb..6823c7dc3778 100644 --- a/src/lib_shell/worker_directory.ml +++ b/src/lib_shell/worker_directory.ml @@ -58,9 +58,7 @@ let build_rpc_directory state = * register multiple Prevalidator for a single chain (using distinct * protocols). However, this is never done. *) WithExceptions.Option.to_exn ~none:Not_found - @@ List.find - (fun (c, _, _) -> Tezos_crypto.Chain_id.equal c chain_id) - workers + @@ List.find (fun (c, _, _) -> Chain_id.equal c chain_id) workers in let status = Prevalidator.status t in let pending_requests = Prevalidator.pending_requests t in @@ -81,7 +79,7 @@ let build_rpc_directory state = return_ok (List.filter_map (fun ((id, peer_id), w) -> - if Tezos_crypto.Chain_id.equal id chain_id then + if Chain_id.equal id chain_id then Some ( peer_id, Peer_validator.status w, @@ -92,7 +90,7 @@ let build_rpc_directory state = register2 Worker_services.Peer_validators.S.state (fun chain peer_id () () -> let* chain_id = Chain_directory.get_chain_id state chain in let equal (acid, apid) (bcid, bpid) = - Tezos_crypto.Chain_id.equal acid bcid && P2p_peer.Id.equal apid bpid + Chain_id.equal acid bcid && P2p_peer.Id.equal apid bpid in let w = WithExceptions.Option.to_exn ~none:Not_found @@ -122,7 +120,7 @@ let build_rpc_directory state = let w = WithExceptions.Option.to_exn ~none:Not_found @@ List.assoc - ~equal:Tezos_crypto.Chain_id.equal + ~equal:Chain_id.equal chain_id (Chain_validator.running_workers ()) in @@ -138,7 +136,7 @@ let build_rpc_directory state = let w = WithExceptions.Option.to_exn ~none:Not_found @@ List.assoc - ~equal:Tezos_crypto.Chain_id.equal + ~equal:Chain_id.equal chain_id (Chain_validator.running_workers ()) in diff --git a/src/lib_shell_benchmarks/encoding_benchmarks.ml b/src/lib_shell_benchmarks/encoding_benchmarks.ml index 4888a24d89e7..e18e1709c30d 100644 --- a/src/lib_shell_benchmarks/encoding_benchmarks.ml +++ b/src/lib_shell_benchmarks/encoding_benchmarks.ml @@ -216,9 +216,9 @@ end) let chain_id_encoding = make_encode_fixed_size ~name:"ENCODING_CHAIN_ID" - ~encoding:Tezos_crypto.Chain_id.encoding + ~encoding:Chain_id.encoding ~generator:(fun rng_state -> - Tezos_crypto.Chain_id.hash_bytes + Chain_id.hash_bytes [Base_samplers.bytes ~size:{min = 32; max = 32} rng_state]) () @@ -227,9 +227,9 @@ let () = Registration.register chain_id_encoding let chain_id_decoding = make_encode_fixed_size ~name:"DECODING_CHAIN_ID" - ~encoding:Tezos_crypto.Chain_id.encoding + ~encoding:Chain_id.encoding ~generator:(fun rng_state -> - Tezos_crypto.Chain_id.hash_bytes + Chain_id.hash_bytes [Base_samplers.bytes ~size:{min = 32; max = 32} rng_state]) () @@ -238,9 +238,9 @@ let () = Registration.register chain_id_decoding let chain_id_readable_encoding = make_encode_fixed_size_to_string ~name:"B58CHECK_ENCODING_CHAIN_ID" - ~to_string:Tezos_crypto.Chain_id.to_b58check + ~to_string:Chain_id.to_b58check ~generator:(fun rng_state -> - Tezos_crypto.Chain_id.hash_bytes + Chain_id.hash_bytes [Base_samplers.bytes ~size:{min = 32; max = 32} rng_state]) () @@ -249,10 +249,10 @@ let () = Registration.register chain_id_readable_encoding let chain_id_readable_decoding = make_decode_fixed_size_from_string ~name:"B58CHECK_DECODING_CHAIN_ID" - ~to_string:Tezos_crypto.Chain_id.to_b58check - ~from_string:Tezos_crypto.Chain_id.of_b58check_exn + ~to_string:Chain_id.to_b58check + ~from_string:Chain_id.of_b58check_exn ~generator:(fun rng_state -> - Tezos_crypto.Chain_id.hash_bytes + Chain_id.hash_bytes [Base_samplers.bytes ~size:{min = 32; max = 32} rng_state]) () diff --git a/src/lib_shell_benchmarks/io_helpers.ml b/src/lib_shell_benchmarks/io_helpers.ml index 6e3c8c7e30bb..eebf86966707 100644 --- a/src/lib_shell_benchmarks/io_helpers.ml +++ b/src/lib_shell_benchmarks/io_helpers.ml @@ -43,7 +43,7 @@ let prepare_genesis base_dir = let* context_hash = Tezos_context.Context.commit_genesis index - ~chain_id:(Tezos_crypto.Chain_id.of_block_hash genesis_block) + ~chain_id:(Chain_id.of_block_hash genesis_block) ~time:(Time.Protocol.of_seconds 0L) ~protocol:Protocol_hash.zero in diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 3f1a66cb9b99..9da34320ea38 100644 --- a/src/lib_shell_services/block_services.ml +++ b/src/lib_shell_services/block_services.ml @@ -31,7 +31,7 @@ module Proof = Tezos_context_sigs.Context.Proof_types module Merkle_proof_encoding = Tezos_context_merkle_proof_encoding.Merkle_proof_encoding.V2.Tree32 -type chain = [`Main | `Test | `Hash of Tezos_crypto.Chain_id.t] +type chain = [`Main | `Test | `Hash of Chain_id.t] let metadata_rpc_arg = let construct = function `Always -> "always" | `Never -> "never" in @@ -54,13 +54,13 @@ let parse_chain s = match s with | "main" -> Ok `Main | "test" -> Ok `Test - | h -> Ok (`Hash (Tezos_crypto.Chain_id.of_b58check_exn h)) + | h -> Ok (`Hash (Chain_id.of_b58check_exn h)) with _ -> Error "Cannot parse chain identifier." let chain_to_string = function | `Main -> "main" | `Test -> "test" - | `Hash h -> Tezos_crypto.Chain_id.to_b58check h + | `Hash h -> Chain_id.to_b58check h let chain_arg = let name = "chain_id" in @@ -395,7 +395,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct Proto.block_header_data_encoding) type block_header = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; @@ -411,7 +411,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (merge_objs (obj3 (req "protocol" (constant protocol_hash)) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "hash" Block_hash.encoding)) raw_block_header_encoding) @@ -491,7 +491,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct | Receipt of Proto.operation_receipt type operation = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; @@ -541,14 +541,14 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (merge_objs (obj3 (req "protocol" (constant protocol_hash)) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "hash" Operation_hash.encoding)) (merge_objs (dynamic_size Operation.shell_header_encoding) (dynamic_size operation_data_encoding))) type block_info = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Block_hash.t; header : raw_block_header; metadata : block_metadata option; @@ -563,7 +563,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct {chain_id; hash; header; metadata; operations}) (obj6 (req "protocol" (constant protocol_hash)) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "hash" Block_hash.encoding) (req "header" (dynamic_size raw_block_header_encoding)) (opt "metadata" (dynamic_size block_metadata_encoding)) diff --git a/src/lib_shell_services/block_services.mli b/src/lib_shell_services/block_services.mli index 84af7a80a6b8..5c0273d168ad 100644 --- a/src/lib_shell_services/block_services.mli +++ b/src/lib_shell_services/block_services.mli @@ -26,7 +26,7 @@ module Proof = Tezos_context_sigs.Context.Proof_types -type chain = [`Main | `Test | `Hash of Tezos_crypto.Chain_id.t] +type chain = [`Main | `Test | `Hash of Chain_id.t] type chain_prefix = unit * chain @@ -139,7 +139,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig } type block_header = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; @@ -160,7 +160,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig | Receipt of Proto.operation_receipt type operation = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; @@ -168,7 +168,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig } type block_info = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; hash : Block_hash.t; header : raw_block_header; metadata : block_metadata option; diff --git a/src/lib_shell_services/block_validator_errors.ml b/src/lib_shell_services/block_validator_errors.ml index a789a926a9c3..4a0731054cef 100644 --- a/src/lib_shell_services/block_validator_errors.ml +++ b/src/lib_shell_services/block_validator_errors.ml @@ -37,7 +37,7 @@ type block_error = originating_block : Block_hash.t; } | Expired_chain of { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; expiration : Time.Protocol.t; timestamp : Time.Protocol.t; } @@ -139,7 +139,7 @@ let block_error_encoding = ~title:"Expired_chain" (obj4 (req "error" (constant "expired_chain")) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "expiration" Time.Protocol.encoding) (req "timestamp" Time.Protocol.encoding)) (function @@ -276,7 +276,7 @@ let pp_block_error ppf = function (Time.System.of_protocol_exn timestamp) Time.System.pp_hum (Time.System.of_protocol_exn expiration) - Tezos_crypto.Chain_id.pp_short + Chain_id.pp_short chain_id | Unexpected_number_of_validation_passes n -> Format.fprintf ppf "Invalid number of validation passes (found: %d)" n diff --git a/src/lib_shell_services/block_validator_errors.mli b/src/lib_shell_services/block_validator_errors.mli index e7d32664737b..1a5c333cc901 100644 --- a/src/lib_shell_services/block_validator_errors.mli +++ b/src/lib_shell_services/block_validator_errors.mli @@ -37,7 +37,7 @@ type block_error = originating_block : Block_hash.t; } | Expired_chain of { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; expiration : Time.Protocol.t; timestamp : Time.Protocol.t; } diff --git a/src/lib_shell_services/block_validator_worker_state.ml b/src/lib_shell_services/block_validator_worker_state.ml index 71b9d518f7e2..40a69a775ece 100644 --- a/src/lib_shell_services/block_validator_worker_state.ml +++ b/src/lib_shell_services/block_validator_worker_state.ml @@ -25,7 +25,7 @@ module Request = struct type validation_view = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; block : Block_hash.t; peer : P2p_peer.Id.t option; } @@ -37,17 +37,17 @@ module Request = struct (fun (block, chain_id, peer) -> {block; chain_id; peer}) (obj3 (req "block" Block_hash.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "peer" P2p_peer.Id.encoding)) - type preapplication_view = {chain_id : Tezos_crypto.Chain_id.t; level : int32} + type preapplication_view = {chain_id : Chain_id.t; level : int32} let preapplication_view_encoding = let open Data_encoding in conv (fun {chain_id; level} -> (chain_id, level)) (fun (chain_id, level) -> {chain_id; level}) - (obj2 (req "chain_id" Tezos_crypto.Chain_id.encoding) (req "level" int32)) + (obj2 (req "chain_id" Chain_id.encoding) (req "level" int32)) type view = | Validation of validation_view @@ -82,7 +82,7 @@ module Request = struct "Validation of %a (chain: %a)" Block_hash.pp block - Tezos_crypto.Chain_id.pp_short + Chain_id.pp_short chain_id ; match peer with | None -> () @@ -93,6 +93,6 @@ module Request = struct ppf "Pre-application at level %ld (chain: %a)" level - Tezos_crypto.Chain_id.pp_short + Chain_id.pp_short chain_id end diff --git a/src/lib_shell_services/block_validator_worker_state.mli b/src/lib_shell_services/block_validator_worker_state.mli index b71120813814..fc0cce8985a0 100644 --- a/src/lib_shell_services/block_validator_worker_state.mli +++ b/src/lib_shell_services/block_validator_worker_state.mli @@ -25,12 +25,12 @@ module Request : sig type validation_view = { - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; block : Block_hash.t; peer : P2p_peer.Id.t option; } - type preapplication_view = {chain_id : Tezos_crypto.Chain_id.t; level : int32} + type preapplication_view = {chain_id : Chain_id.t; level : int32} type view = | Validation of validation_view diff --git a/src/lib_shell_services/chain_services.ml b/src/lib_shell_services/chain_services.ml index 397c0c7343c1..b5d11f60eba2 100644 --- a/src/lib_shell_services/chain_services.ml +++ b/src/lib_shell_services/chain_services.ml @@ -26,7 +26,7 @@ open Data_encoding -type chain = [`Main | `Test | `Hash of Tezos_crypto.Chain_id.t] +type chain = [`Main | `Test | `Hash of Chain_id.t] let chain_arg = Block_services.chain_arg @@ -71,7 +71,7 @@ module S = struct Tezos_rpc.Service.get_service ~description:"The chain unique identifier." ~query:Tezos_rpc.Query.empty - ~output:Tezos_crypto.Chain_id.encoding + ~output:Chain_id.encoding Tezos_rpc.Path.(path / "chain_id") (* DEPRECATED: use `chains/<CHAIN_ID>/levels/{checkpoint, savepoint, diff --git a/src/lib_shell_services/chain_services.mli b/src/lib_shell_services/chain_services.mli index bbd3ccee2c0a..365e8dcb3479 100644 --- a/src/lib_shell_services/chain_services.mli +++ b/src/lib_shell_services/chain_services.mli @@ -24,7 +24,7 @@ (* *) (*****************************************************************************) -type chain = [`Main | `Test | `Hash of Tezos_crypto.Chain_id.t] +type chain = [`Main | `Test | `Hash of Chain_id.t] val parse_chain : string -> (chain, string) result @@ -40,8 +40,7 @@ val path : (unit, prefix) Tezos_rpc.Path.path open Tezos_rpc.Context -val chain_id : - #simple -> ?chain:chain -> unit -> Tezos_crypto.Chain_id.t tzresult Lwt.t +val chain_id : #simple -> ?chain:chain -> unit -> Chain_id.t tzresult Lwt.t val checkpoint : #simple -> @@ -99,13 +98,7 @@ end module S : sig val chain_id : - ( [`GET], - prefix, - prefix, - unit, - unit, - Tezos_crypto.Chain_id.t ) - Tezos_rpc.Service.t + ([`GET], prefix, prefix, unit, unit, Chain_id.t) Tezos_rpc.Service.t val checkpoint : ( [`GET], diff --git a/src/lib_shell_services/monitor_services.ml b/src/lib_shell_services/monitor_services.ml index 1d704bee50b8..f409c78c3b52 100644 --- a/src/lib_shell_services/monitor_services.ml +++ b/src/lib_shell_services/monitor_services.ml @@ -24,13 +24,13 @@ (*****************************************************************************) type chain_status = - | Active_main of Tezos_crypto.Chain_id.t + | Active_main of Chain_id.t | Active_test of { - chain : Tezos_crypto.Chain_id.t; + chain : Chain_id.t; protocol : Protocol_hash.t; expiration_date : Time.Protocol.t; } - | Stopping of Tezos_crypto.Chain_id.t + | Stopping of Chain_id.t let chain_status_encoding = let open Data_encoding in @@ -40,14 +40,14 @@ let chain_status_encoding = case (Tag 0) ~title:"Main" - (obj1 (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "chain_id" Chain_id.encoding)) (function Active_main chain_id -> Some chain_id | _ -> None) (fun chain_id -> Active_main chain_id); case (Tag 1) ~title:"Test" (obj3 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "test_protocol" Protocol_hash.encoding) (req "expiration_date" Time.Protocol.encoding)) (function @@ -59,7 +59,7 @@ let chain_status_encoding = case (Tag 2) ~title:"Stopping" - (obj1 (req "stopping" Tezos_crypto.Chain_id.encoding)) + (obj1 (req "stopping" Chain_id.encoding)) (function Stopping chain_id -> Some chain_id | _ -> None) (fun chain_id -> Stopping chain_id); ] @@ -109,7 +109,7 @@ module S = struct ~output: (merge_objs (obj2 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "hash" Block_hash.encoding)) Block_header.encoding) Tezos_rpc.Path.(path / "valid_blocks") diff --git a/src/lib_shell_services/monitor_services.mli b/src/lib_shell_services/monitor_services.mli index 65eaa65013b5..47aee81f5f52 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -26,13 +26,13 @@ open Tezos_rpc.Context type chain_status = - | Active_main of Tezos_crypto.Chain_id.t + | Active_main of Chain_id.t | Active_test of { - chain : Tezos_crypto.Chain_id.t; + chain : Chain_id.t; protocol : Protocol_hash.t; expiration_date : Time.Protocol.t; } - | Stopping of Tezos_crypto.Chain_id.t + | Stopping of Chain_id.t val bootstrapped : #streamed -> @@ -44,8 +44,7 @@ val valid_blocks : ?protocols:Protocol_hash.t list -> ?next_protocols:Protocol_hash.t list -> unit -> - (((Tezos_crypto.Chain_id.t * Block_hash.t) * Block_header.t) Lwt_stream.t - * stopper) + (((Chain_id.t * Block_hash.t) * Block_header.t) Lwt_stream.t * stopper) tzresult Lwt.t @@ -81,7 +80,7 @@ module S : sig ; next_protocols : Protocol_hash.t list ; protocols : Protocol_hash.t list >, unit, - (Tezos_crypto.Chain_id.t * Block_hash.t) * Block_header.t ) + (Chain_id.t * Block_hash.t) * Block_header.t ) Tezos_rpc.Service.t val heads : diff --git a/src/lib_shell_services/state_events.ml b/src/lib_shell_services/state_events.ml index b0249a8becf7..9b68a3e2b096 100644 --- a/src/lib_shell_services/state_events.ml +++ b/src/lib_shell_services/state_events.ml @@ -57,4 +57,4 @@ let destroy_state = ~name:"destroy_state" ~msg:"destroy {chain_id}" ~level:Debug - ("chain_id", Tezos_crypto.Chain_id.encoding) + ("chain_id", Chain_id.encoding) diff --git a/src/lib_shell_services/store_errors.ml b/src/lib_shell_services/store_errors.ml index f3e23d0e843b..f1fc6538f355 100644 --- a/src/lib_shell_services/store_errors.ml +++ b/src/lib_shell_services/store_errors.ml @@ -369,7 +369,7 @@ type error += | Missing_commit_info of string | Inconsistent_chain_store | Fork_testchain_not_allowed - | Cannot_fork_testchain of Tezos_crypto.Chain_id.t + | Cannot_fork_testchain of Chain_id.t | Cannot_load_testchain of string | Missing_activation_block of Block_hash.t * Protocol_hash.t * History_mode.t | Inconsistent_protocol_commit_info of Block_hash.t * Protocol_hash.t @@ -874,9 +874,9 @@ let () = Format.fprintf ppf "Failed to fork the testchain: the testchain %a already exists." - Tezos_crypto.Chain_id.pp + Chain_id.pp chain_id) - Data_encoding.(obj1 (req "chain_id" Tezos_crypto.Chain_id.encoding)) + Data_encoding.(obj1 (req "chain_id" Chain_id.encoding)) (function Cannot_fork_testchain chain_id -> Some chain_id | _ -> None) (fun chain_id -> Cannot_fork_testchain chain_id) ; Error_monad.register_error_kind diff --git a/src/lib_shell_services/validation_errors.ml b/src/lib_shell_services/validation_errors.ml index decb202c402e..596f91b897a1 100644 --- a/src/lib_shell_services/validation_errors.ml +++ b/src/lib_shell_services/validation_errors.ml @@ -117,7 +117,7 @@ let () = (************************* State errors ***********************************) -type error += Unknown_chain of Tezos_crypto.Chain_id.t +type error += Unknown_chain of Chain_id.t type error += Bad_data_dir @@ -131,9 +131,8 @@ let () = ~title:"Unknown chain" ~description: "The chain identifier could not be found in the chain identifiers table." - ~pp:(fun ppf id -> - Format.fprintf ppf "Unknown chain %a" Tezos_crypto.Chain_id.pp id) - Data_encoding.(obj1 (req "chain" Tezos_crypto.Chain_id.encoding)) + ~pp:(fun ppf id -> Format.fprintf ppf "Unknown chain %a" Chain_id.pp id) + Data_encoding.(obj1 (req "chain" Chain_id.encoding)) (function Unknown_chain x -> Some x | _ -> None) (fun x -> Unknown_chain x) ; register_error_kind @@ -376,7 +375,7 @@ let () = (************************ Validator errors ********************************) -type error += Inactive_chain of Tezos_crypto.Chain_id.t +type error += Inactive_chain of Chain_id.t type error += Checkpoint_error of Block_hash.t * P2p_peer.Id.t option @@ -392,9 +391,9 @@ let () = ppf "Tried to validate a block from chain %a, that is not currently \ considered active." - Tezos_crypto.Chain_id.pp + Chain_id.pp chain) - Data_encoding.(obj1 (req "inactive_chain" Tezos_crypto.Chain_id.encoding)) + Data_encoding.(obj1 (req "inactive_chain" Chain_id.encoding)) (function Inactive_chain chain -> Some chain | _ -> None) (fun chain -> Inactive_chain chain) ; register_error_kind diff --git a/src/lib_shell_services/validation_errors.mli b/src/lib_shell_services/validation_errors.mli index d01e8477794b..b182a73cce9c 100644 --- a/src/lib_shell_services/validation_errors.mli +++ b/src/lib_shell_services/validation_errors.mli @@ -43,7 +43,7 @@ type error += Cannot_serialize_operation_metadata (************************* State errors ***********************************) -type error += Unknown_chain of Tezos_crypto.Chain_id.t +type error += Unknown_chain of Chain_id.t type error += Bad_data_dir @@ -78,6 +78,6 @@ type error += Unknown_ancestor | Known_invalid (************************ Validator errors ********************************) -type error += Inactive_chain of Tezos_crypto.Chain_id.t +type error += Inactive_chain of Chain_id.t type error += Checkpoint_error of Block_hash.t * P2p_peer.Id.t option diff --git a/src/lib_shell_services/worker_services.ml b/src/lib_shell_services/worker_services.ml index 3245dfba8354..bf47950fbcba 100644 --- a/src/lib_shell_services/worker_services.ml +++ b/src/lib_shell_services/worker_services.ml @@ -34,7 +34,7 @@ module Prevalidators = struct ~output: (list (obj4 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "status" (Worker_types.worker_status_encoding @@ -137,7 +137,7 @@ module Chain_validators = struct ~output: (list (obj4 - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (req "status" (Worker_types.worker_status_encoding diff --git a/src/lib_shell_services/worker_services.mli b/src/lib_shell_services/worker_services.mli index 4d753030145b..03290b29b86a 100644 --- a/src/lib_shell_services/worker_services.mli +++ b/src/lib_shell_services/worker_services.mli @@ -30,7 +30,7 @@ module Prevalidators : sig val list : #simple -> - (Tezos_crypto.Chain_id.t + (Chain_id.t * Worker_types.worker_status * Worker_types.worker_information * int) @@ -50,7 +50,7 @@ module Prevalidators : sig unit, unit, unit, - (Tezos_crypto.Chain_id.t + (Chain_id.t * Worker_types.worker_status * Worker_types.worker_information * int) @@ -135,7 +135,7 @@ module Chain_validators : sig val list : #simple -> - (Tezos_crypto.Chain_id.t + (Chain_id.t * Worker_types.worker_status * Worker_types.worker_information * int) @@ -158,7 +158,7 @@ module Chain_validators : sig unit, unit, unit, - (Tezos_crypto.Chain_id.t + (Chain_id.t * Worker_types.worker_status * Worker_types.worker_information * int) diff --git a/src/lib_signer_backends/unix/ledger.available.ml b/src/lib_signer_backends/unix/ledger.available.ml index 17c304861090..6f3f3cb0a543 100644 --- a/src/lib_signer_backends/unix/ledger.available.ml +++ b/src/lib_signer_backends/unix/ledger.available.ml @@ -872,12 +872,7 @@ end let pp_ledger_chain_id fmt s = match s with | "\x00\x00\x00\x00" -> Format.fprintf fmt "'Unspecified'" - | other -> - Format.fprintf - fmt - "%a" - Tezos_crypto.Chain_id.pp - (Tezos_crypto.Chain_id.of_string_exn other) + | other -> Format.fprintf fmt "%a" Chain_id.pp (Chain_id.of_string_exn other) (** Commands for both ledger applications. *) let generic_commands group = @@ -1249,9 +1244,7 @@ let baking_commands group = | s -> ( try return (`Int32 (Int32.of_string s)) with _ -> ( - try - return - (`Chain_id (Tezos_crypto.Chain_id.of_b58check_exn s)) + try return (`Chain_id (Chain_id.of_b58check_exn s)) with _ -> failwith "Parameter %S should be a 32-bits integer or a \ @@ -1294,7 +1287,7 @@ let baking_commands group = logand 0xFFl (shift_right i32 (n * 8)) |> Int32.to_int |> char_of_int in - Tezos_crypto.Chain_id.of_string_exn + Chain_id.of_string_exn (Stringext.of_array (Array.init 4 (fun i -> byte (3 - i)))) in let* main_chain_id = @@ -1318,7 +1311,7 @@ let baking_commands group = Watermark: %ld%a -> %ld%a" pp_ledger_chain_id current_ci - Tezos_crypto.Chain_id.pp + Chain_id.pp main_chain_id current_mh pp_round_opt @@ -1336,9 +1329,7 @@ let baking_commands group = let* pk = Ledger_commands.public_key_returning_instruction (`Setup - ( Tezos_crypto.Chain_id.to_string main_chain_id, - main_hwm, - test_hwm )) + (Chain_id.to_string main_chain_id, main_hwm, test_hwm)) hidapi curve path 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 28013b4f34f9..ce6e8aa11bef 100644 --- a/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml +++ b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml @@ -675,11 +675,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -871,9 +867,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = Data_encoding.Binary.of_bytes_exn Contract.encoding contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml b/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml index 8a76ae65af68..f60ae99f51f4 100644 --- a/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml +++ b/src/proto_008_PtEdo2Zk/lib_plugin/plugin.ml @@ -391,7 +391,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (req "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -404,7 +404,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" string) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) diff --git a/src/proto_009_PsFLoren/lib_plugin/plugin.ml b/src/proto_009_PsFLoren/lib_plugin/plugin.ml index e2339ad863de..d90e50d5cb84 100644 --- a/src/proto_009_PsFLoren/lib_plugin/plugin.ml +++ b/src/proto_009_PsFLoren/lib_plugin/plugin.ml @@ -391,7 +391,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (req "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -555,7 +555,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" string) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) diff --git a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml index 5478fce475f5..5d8719d35214 100644 --- a/src/proto_010_PtGRANAD/lib_plugin/plugin.ml +++ b/src/proto_010_PtGRANAD/lib_plugin/plugin.ml @@ -321,7 +321,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (req "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -382,7 +382,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" string) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -520,7 +520,7 @@ module RPC = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") 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 a81da970aa49..957b4ebae6d5 100644 --- a/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml +++ b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml @@ -901,11 +901,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1174,9 +1170,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = Data_encoding.Binary.of_bytes_exn Contract.encoding contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_011_PtHangz2/lib_client/mockup.ml b/src/proto_011_PtHangz2/lib_client/mockup.ml index 1a9efc551fc5..f84ad9f56771 100644 --- a/src/proto_011_PtHangz2/lib_client/mockup.ml +++ b/src/proto_011_PtHangz2/lib_client/mockup.ml @@ -63,7 +63,7 @@ module Protocol_constants_overrides = struct liquidity_baking_sunset_level : int32 option; liquidity_baking_escape_ema_threshold : int32 option; (* Additional, "bastard" parameters (they are not protocol constants but partially treated the same way). *) - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; } @@ -197,7 +197,7 @@ module Protocol_constants_overrides = struct (opt "liquidity_baking_sunset_level" int32) (opt "liquidity_baking_escape_ema_threshold" int32)) (obj2 - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding))))) let default_value (cctxt : Tezos_client_base.Client_context.full) : @@ -477,12 +477,7 @@ module Protocol_constants_overrides = struct override_value = o.liquidity_baking_escape_ema_threshold; pp = pp_print_int32; }; - O - { - name = "chain_id"; - override_value = o.chain_id; - pp = Tezos_crypto.Chain_id.pp; - }; + O {name = "chain_id"; override_value = o.chain_id; pp = Chain_id.pp}; O { name = "timestamp"; 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 83d70508ebab..4deb5cb61f25 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 @@ -61,7 +61,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Alpha_context.Contract.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) let do_unshield cctxt contract src_name stez dst = diff --git a/src/proto_011_PtHangz2/lib_plugin/plugin.ml b/src/proto_011_PtHangz2/lib_plugin/plugin.ml index 620333a40dd7..7ee6543e5c78 100644 --- a/src/proto_011_PtHangz2/lib_plugin/plugin.ml +++ b/src/proto_011_PtHangz2/lib_plugin/plugin.ml @@ -335,7 +335,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (req "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -396,7 +396,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" string) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -529,7 +529,7 @@ module RPC = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") @@ -540,7 +540,7 @@ module RPC = struct ~input: (obj3 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_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 17bb493cf1d6..a684482be2e7 100644 --- a/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml +++ b/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml @@ -901,11 +901,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1174,9 +1170,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = Data_encoding.Binary.of_bytes_exn Contract.encoding contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_012_Psithaca/lib_client/mockup.ml b/src/proto_012_Psithaca/lib_client/mockup.ml index 668d3569b84d..1d3ec2e34a33 100644 --- a/src/proto_012_Psithaca/lib_client/mockup.ml +++ b/src/proto_012_Psithaca/lib_client/mockup.ml @@ -69,7 +69,7 @@ module Protocol_constants_overrides = struct ratio_of_frozen_deposits_slashed_per_double_endorsement : Constants.ratio option; (* Additional, "bastard" parameters (they are not protocol constants but partially treated the same way). *) - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; } @@ -229,7 +229,7 @@ module Protocol_constants_overrides = struct (opt "ratio_of_frozen_deposits_slashed_per_double_endorsement" Constants.ratio_encoding) - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding))))) let default_value (cctxt : Tezos_client_base.Client_context.full) : @@ -544,12 +544,7 @@ module Protocol_constants_overrides = struct o.ratio_of_frozen_deposits_slashed_per_double_endorsement; pp = Constants.pp_ratio; }; - O - { - name = "chain_id"; - override_value = o.chain_id; - pp = Tezos_crypto.Chain_id.pp; - }; + O {name = "chain_id"; override_value = o.chain_id; pp = Chain_id.pp}; O { name = "timestamp"; 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 83d70508ebab..4deb5cb61f25 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 @@ -61,7 +61,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Alpha_context.Contract.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) let do_unshield cctxt contract src_name stez dst = diff --git a/src/proto_012_Psithaca/lib_plugin/plugin.ml b/src/proto_012_Psithaca/lib_plugin/plugin.ml index 40ad48d0d44c..373e64e68f6e 100644 --- a/src/proto_012_Psithaca/lib_plugin/plugin.ml +++ b/src/proto_012_Psithaca/lib_plugin/plugin.ml @@ -1599,7 +1599,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (req "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -1663,7 +1663,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" string) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -1802,7 +1802,7 @@ module RPC = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") @@ -1821,7 +1821,7 @@ module RPC = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_operation") 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 268dabfc214b..3308c632f02a 100644 --- a/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml +++ b/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml @@ -903,11 +903,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1176,9 +1172,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = Data_encoding.Binary.of_bytes_exn Contract.encoding contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_013_PtJakart/lib_client/mockup.ml b/src/proto_013_PtJakart/lib_client/mockup.ml index 043a7d01cf29..b692107b993e 100644 --- a/src/proto_013_PtJakart/lib_client/mockup.ml +++ b/src/proto_013_PtJakart/lib_client/mockup.ml @@ -92,7 +92,7 @@ module Protocol_constants_overrides = struct sc_rollup_challenge_window_in_blocks : int option; sc_rollup_max_available_messages : int option; (* Additional, "bastard" parameters (they are not protocol constants but partially treated the same way). *) - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; initial_seed : State_hash.t option option; } @@ -319,7 +319,7 @@ module Protocol_constants_overrides = struct (opt "ratio_of_frozen_deposits_slashed_per_double_endorsement" Constants.ratio_encoding) - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding) (opt "initial_seed" (option State_hash.encoding))) (merge_objs @@ -740,12 +740,7 @@ module Protocol_constants_overrides = struct override_value = o.sc_rollup_challenge_window_in_blocks; pp = pp_print_int; }; - O - { - name = "chain_id"; - override_value = o.chain_id; - pp = Tezos_crypto.Chain_id.pp; - }; + O {name = "chain_id"; override_value = o.chain_id; pp = Chain_id.pp}; O { name = "timestamp"; 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 a2be98a4ddbe..4ca776280266 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 @@ -61,7 +61,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Alpha_context.Contract.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) (** The shielded tez contract expects the recipient pkh encoded in Micheline diff --git a/src/proto_013_PtJakart/lib_plugin/plugin.ml b/src/proto_013_PtJakart/lib_plugin/plugin.ml index f0c8f84aace6..7f97ae76a323 100644 --- a/src/proto_013_PtJakart/lib_plugin/plugin.ml +++ b/src/proto_013_PtJakart/lib_plugin/plugin.ml @@ -1697,7 +1697,7 @@ module RPC = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (opt "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "self" Contract.encoding) @@ -1746,7 +1746,7 @@ module RPC = struct (req "contract" Contract.encoding) (req "entrypoint" Entrypoint.simple_encoding) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -1762,7 +1762,7 @@ module RPC = struct (req "view" string) (req "input" Script.expr_encoding) (dft "unlimited_gas" bool false) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -1910,7 +1910,7 @@ module RPC = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding Tezos_rpc.Path.(path / "run_operation") @@ -1943,7 +1943,7 @@ module RPC = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding Tezos_rpc.Path.(path / "simulate_operation") @@ -1956,7 +1956,7 @@ module RPC = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding Tezos_rpc.Path.(path / "simulate_tx_rollup_operation") 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 eda34eba7679..6e6d4587ffc8 100644 --- a/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml +++ b/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml @@ -906,11 +906,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1184,9 +1180,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_014_PtKathma/lib_client/mockup.ml b/src/proto_014_PtKathma/lib_client/mockup.ml index 0176bc90d5f5..5c37f9dfef34 100644 --- a/src/proto_014_PtKathma/lib_client/mockup.ml +++ b/src/proto_014_PtKathma/lib_client/mockup.ml @@ -109,7 +109,7 @@ module Protocol_constants_overrides = struct dal : Constants.Parametric.dal option; sc_rollup : sc_rollup; (* Additional, "bastard" parameters (they are not protocol constants but partially treated the same way). *) - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; initial_seed : State_hash.t option option; } @@ -412,7 +412,7 @@ module Protocol_constants_overrides = struct "testnet_dictator" (option Tezos_crypto.Signature.V0.Public_key_hash.encoding)) - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding) (opt "initial_seed" (option State_hash.encoding))) (merge_objs @@ -860,12 +860,7 @@ module Protocol_constants_overrides = struct override_value = o.sc_rollup.challenge_window_in_blocks; pp = pp_print_int; }; - O - { - name = "chain_id"; - override_value = o.chain_id; - pp = Tezos_crypto.Chain_id.pp; - }; + O {name = "chain_id"; override_value = o.chain_id; pp = Chain_id.pp}; O { name = "timestamp"; 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 a3350a3cf189..639238df40f0 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 @@ -62,7 +62,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Contract_hash.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) (** The shielded tez contract expects the recipient pkh encoded in Micheline diff --git a/src/proto_014_PtKathma/lib_plugin/RPC.ml b/src/proto_014_PtKathma/lib_plugin/RPC.ml index 35ec7ce3cbd9..5f1864ff4ef4 100644 --- a/src/proto_014_PtKathma/lib_plugin/RPC.ml +++ b/src/proto_014_PtKathma/lib_plugin/RPC.ml @@ -162,7 +162,7 @@ module Scripts = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (opt "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "self" Contract.originated_encoding) @@ -215,7 +215,7 @@ module Scripts = struct (req "contract" Contract.originated_encoding) (req "entrypoint" Entrypoint.simple_encoding) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -231,7 +231,7 @@ module Scripts = struct (req "view" string) (req "input" Script.expr_encoding) (dft "unlimited_gas" bool false) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -379,7 +379,7 @@ module Scripts = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") @@ -412,7 +412,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_operation") @@ -425,7 +425,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_tx_rollup_operation") diff --git a/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml b/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml index 5671ed744b4b..15cd7024ac31 100644 --- a/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml +++ b/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml @@ -53,7 +53,7 @@ let context_init ~rng_state = context_init_memory ~rng_state let make ~rng_state = context_init_memory ~rng_state >>=? fun context -> let amount = Alpha_context.Tez.one in - let chain_id = Tezos_crypto.Chain_id.zero in + let chain_id = Tezos_crypto.Hashed.Chain_id.zero in let now = Script_timestamp.of_zint Z.zero in let level = Script_int.zero_n in let open Script_interpreter in 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 835e4e2035cd..2757ec3b52b6 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -3081,7 +3081,7 @@ module Registration_section = struct self = Contract_hash.zero; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } diff --git a/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml index 7d35f3d0e19c..61b48a3fa4e0 100644 --- a/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml @@ -66,7 +66,7 @@ let default_raw_context () = >>= fun context -> let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) 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 eda34eba7679..6e6d4587ffc8 100644 --- a/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml +++ b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml @@ -906,11 +906,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1184,9 +1180,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_015_PtLimaPt/lib_client/mockup.ml b/src/proto_015_PtLimaPt/lib_client/mockup.ml index 17a3f352c1e0..bcc326b62f45 100644 --- a/src/proto_015_PtLimaPt/lib_client/mockup.ml +++ b/src/proto_015_PtLimaPt/lib_client/mockup.ml @@ -35,7 +35,7 @@ module Protocol_constants_overrides = struct (** Equivalent of [Constants.parametric] with additionally [chain_id] and [timestamp]. *) type t = { parametric : Constants.Parametric.t; - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; } @@ -49,7 +49,7 @@ module Protocol_constants_overrides = struct (merge_objs Constants.Parametric.encoding (obj2 - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding))) let default_value (cctxt : Tezos_client_base.Client_context.full) : 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 30f0628da78f..ca67d13fc54e 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 @@ -63,7 +63,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Contract_hash.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) (** The shielded tez contract expects the recipient pkh encoded in Micheline diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_files.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_files.ml index 67ef0c7ea0d4..38339e2fe555 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_files.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_files.ml @@ -32,6 +32,6 @@ let resolve_location ~chain_id (kind : 'a) : 'a location = | `State -> "baker_state" | `Nonce -> "nonce" in - Format.asprintf "%a_%s" Tezos_crypto.Chain_id.pp_short chain_id basename + Format.asprintf "%a_%s" Chain_id.pp_short chain_id basename let filename x = x diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_files.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_files.mli index 82940952da05..01146f7d0744 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_files.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_files.mli @@ -26,7 +26,7 @@ type _ location val resolve_location : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> ([< `Highwatermarks | `Nonce | `State] as 'kind) -> 'kind location diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli index 8809adad843e..6e69b009180d 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli @@ -90,7 +90,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -108,7 +108,7 @@ val reveal_potential_nonces : t -> Baking_state.proposal -> unit tzresult Lwt.t val start_revelation_worker : Protocol_client_context.full -> Baking_configuration.nonce_config -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> Constants.t -> Baking_state.proposal Lwt_stream.t -> Lwt_canceler.t Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli index 1643296eb489..0d0c7ac9f4d2 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli @@ -46,7 +46,7 @@ val begin_construction : protocol_data:block_header_data -> Abstract_context_index.t -> Baking_state.block_info -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> incremental tzresult Lwt.t val add_operation : diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml index 42a54e26cd49..673ea58c98a1 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.ml @@ -136,7 +136,7 @@ type global_state = { (* client context *) cctxt : Protocol_client_context.full; (* chain id *) - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; (* baker configuration *) config : Baking_configuration.t; (* protocol constants *) @@ -681,7 +681,7 @@ let pp_global_state fmt {chain_id; config; validation_mode; delegates; _} = fmt "@[<v 2>Global state:@ chain_id: %a@ @[<v 2>config:@ %a@]@ \ validation_mode: %a@ @[<v 2>delegates:@ %a@]@]" - Tezos_crypto.Chain_id.pp + Chain_id.pp chain_id Baking_configuration.pp config diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli index c46132e260e7..d14ca69139a0 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_state.mli @@ -80,7 +80,7 @@ type cache = { type global_state = { cctxt : Protocol_client_context.full; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; config : Baking_configuration.t; constants : Constants.t; round_durations : Round.round_durations; diff --git a/src/proto_015_PtLimaPt/lib_delegate/block_forge.mli b/src/proto_015_PtLimaPt/lib_delegate/block_forge.mli index abf60c86d8f4..b111e27b417c 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/block_forge.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/block_forge.mli @@ -50,7 +50,7 @@ val forge_faked_protocol_data : val forge : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> pred_info:Baking_state.block_info -> timestamp:Time.Protocol.t -> liquidity_baking_toggle_vote:Liquidity_baking.liquidity_baking_toggle_vote -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml index 9be4d3735d52..d7064545b7bd 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml @@ -29,7 +29,7 @@ open Protocol_client_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; @@ -82,7 +82,7 @@ module Block_seen_event = struct type t = { hash : Block_hash.t; header : Tezos_base.Block_header.t; - occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -123,7 +123,7 @@ module Block_seen_event = struct (Tag 1) (obj2 (req "occurrence-kind" (constant "valid-blocks")) - (req "chain-id" Tezos_crypto.Chain_id.encoding)) + (req "chain-id" Chain_id.encoding)) (function | `Valid_blocks ch -> Some ((), ch) | _ -> None) (fun ((), ch) -> `Valid_blocks ch); diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli index e3b8a7621d56..c3358f61f82f 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli @@ -28,7 +28,7 @@ open Alpha_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; 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 b815392b9c65..ec3ca7c5ef94 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_denunciation.ml @@ -31,10 +31,10 @@ module Events = Delegate_events.Denunciator module B_Events = Delegate_events.Baking_scheduling module HLevel = Hashtbl.Make (struct - type t = Tezos_crypto.Chain_id.t * Raw_level.t * Round.t + type t = Chain_id.t * Raw_level.t * Round.t let equal (c, l, r) (c', l', r') = - Tezos_crypto.Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' + Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' let hash (c, lvl, r) = Hashtbl.hash (c, lvl, r) end) diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb0..ededa688a755 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -46,8 +46,8 @@ let log _channel msg = print_endline msg ; Lwt.return_unit -class faked_ctxt (hooks : Faked_services.hooks) - (chain_id : Tezos_crypto.Chain_id.t) : Tezos_rpc.Context.generic = +class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) 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 d068cc59d35c..699b2c666812 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 @@ -76,7 +76,7 @@ type state = { let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts -let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" +let chain_id = Chain_id.of_string_exn "main" let genesis_block_hash = Block_hash.of_b58check_exn 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 c00f911be690..636a08f629c4 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.ml @@ -204,8 +204,7 @@ module Forge = struct in let signature = Tezos_crypto.Signature.V0.sign - ~watermark: - Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) + ~watermark:Block_header.(to_watermark (Block_header Chain_id.zero)) signer_account.sk unsigned_bytes in @@ -404,7 +403,7 @@ let initial_alpha_context ?(commitments = []) constants ~typecheck ~level ~timestamp - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult @@ -445,7 +444,7 @@ let genesis_with_parameters parameters = add empty ["version"] (Bytes.of_string "genesis") >>= fun ctxt -> add ctxt protocol_param_key proto_params) >>= fun ctxt -> - let chain_id = Tezos_crypto.Chain_id.of_block_hash hash in + let chain_id = Chain_id.of_block_hash hash in Main.init chain_id ctxt shell >|= Environment.wrap_tzresult >|=? fun {context; _} -> { @@ -679,7 +678,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum initial_context ?commitments ?bootstrap_contracts - (Tezos_crypto.Chain_id.of_block_hash hash) + (Chain_id.of_block_hash hash) constants shell initial_accounts @@ -724,7 +723,7 @@ let get_application_vstate (pred : t) (operations : Protocol.operation trace) = let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -746,7 +745,7 @@ let get_construction_vstate ?(policy = By_round 0) ?timestamp in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -771,7 +770,7 @@ let apply_with_metadata ?(policy = By_round 0) ?(check_size = true) ~baking_mode | Application -> begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult 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 08d3dba8e0ee..084e3f9193f7 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml @@ -609,7 +609,7 @@ let default_raw_context () = >>= fun context -> let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) 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 46449066c26d..933dedf75c7f 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 @@ -79,7 +79,7 @@ let default_step_constants = self = default_self; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } 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 65abde811ad0..417c950bf2b5 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/incremental.ml @@ -123,7 +123,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> 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 20cc879d3ec7..f1ba80254e61 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.ml @@ -88,8 +88,7 @@ let endorsement ?delegate ?slot ?level ?round ?block_payload_hash Account.find delegate_pkh >>=? fun delegate -> return (sign - ~watermark: - Operation.(to_watermark (Endorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Endorsement Chain_id.zero)) delegate.sk signing_context op) @@ -122,8 +121,7 @@ let preendorsement ?delegate ?slot ?level ?round ?block_payload_hash Account.find delegate_pkh >>=? fun delegate -> return (sign - ~watermark: - Operation.(to_watermark (Preendorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Preendorsement Chain_id.zero)) delegate.sk signing_context op) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/sapling_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0..9bf2f8382fd8 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/sapling_helpers.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/sapling_helpers.ml @@ -353,12 +353,7 @@ module Interpreter_helpers = struct let originate_contract_hash file storage src b baker = originate_contract_hash file storage src b baker >|=? fun (dst, b) -> let anti_replay = - Format.asprintf - "%a%a" - Contract_hash.pp - dst - Tezos_crypto.Chain_id.pp - Tezos_crypto.Chain_id.zero + Format.asprintf "%a%a" Contract_hash.pp dst Chain_id.pp Chain_id.zero in (dst, b, anti_replay) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_levels.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_levels.ml index 76118c5804b3..678a6c79844c 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_levels.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_levels.ml @@ -218,7 +218,7 @@ let apply_with_gas header ?(operations = []) (pred : Block.t) = (let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >>=? fun vstate -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml index 260132a4fcb8..f4d4699d7ccb 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/test_mempool.ml @@ -106,7 +106,7 @@ let test_simple () = let vs, mempool = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -138,7 +138,7 @@ let test_imcompatible_mempool () = let _vs, mempool1 = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -154,7 +154,7 @@ let test_imcompatible_mempool () = let _vs, mempool2 = Mempool.init ctxt2 - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash:predecessor_hash2 @@ -183,7 +183,7 @@ let test_merge () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -275,7 +275,7 @@ let test_add_invalid_operation () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -300,7 +300,7 @@ let test_add_and_replace () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -352,7 +352,7 @@ let test_remove_operation () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash diff --git a/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml b/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml index c6c80fa3bf4e..a7212fc9ee04 100644 --- a/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml +++ b/src/proto_016_PtMumbai/lib_benchmark/execution_context.ml @@ -53,7 +53,7 @@ let context_init ~rng_state = context_init_memory ~rng_state let make ~rng_state = context_init_memory ~rng_state >>=? fun context -> let amount = Alpha_context.Tez.one in - let chain_id = Tezos_crypto.Chain_id.zero in + let chain_id = Tezos_crypto.Hashed.Chain_id.zero in let now = Script_timestamp.of_zint Z.zero in let level = Script_int.zero_n in let open Script_interpreter in diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml index abce296bb5e2..113abba968dd 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -3243,7 +3243,7 @@ module Registration_section = struct self = Contract_hash.zero; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } diff --git a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml index 37f91ab77e95..ff1b31fbb1c6 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml @@ -68,7 +68,7 @@ let default_raw_context () = let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in let*! e = Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) diff --git a/src/proto_016_PtMumbai/lib_client/client_proto_multisig.ml b/src/proto_016_PtMumbai/lib_client/client_proto_multisig.ml index 9d8d9e8e7f7e..891572c2e10e 100644 --- a/src/proto_016_PtMumbai/lib_client/client_proto_multisig.ml +++ b/src/proto_016_PtMumbai/lib_client/client_proto_multisig.ml @@ -908,11 +908,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1189,9 +1185,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_016_PtMumbai/lib_client/mockup.ml b/src/proto_016_PtMumbai/lib_client/mockup.ml index 09e517f76749..93e2c2690c0d 100644 --- a/src/proto_016_PtMumbai/lib_client/mockup.ml +++ b/src/proto_016_PtMumbai/lib_client/mockup.ml @@ -35,7 +35,7 @@ module Protocol_constants_overrides = struct (** Equivalent of [Constants.parametric] with additionally [chain_id] and [timestamp]. *) type t = { parametric : Constants.Parametric.t; - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; } @@ -49,7 +49,7 @@ module Protocol_constants_overrides = struct (merge_objs Constants.Parametric.encoding (obj2 - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding))) let default_value (cctxt : Tezos_client_base.Client_context.full) : diff --git a/src/proto_016_PtMumbai/lib_client_sapling/client_sapling_commands.ml b/src/proto_016_PtMumbai/lib_client_sapling/client_sapling_commands.ml index 4c8cbdab0c9f..f20f36ce75c7 100644 --- a/src/proto_016_PtMumbai/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_016_PtMumbai/lib_client_sapling/client_sapling_commands.ml @@ -61,7 +61,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Contract_hash.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) (** The shielded tez contract expects the recipient pkh encoded in Micheline diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_files.ml b/src/proto_016_PtMumbai/lib_delegate/baking_files.ml index 67ef0c7ea0d4..38339e2fe555 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_files.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_files.ml @@ -32,6 +32,6 @@ let resolve_location ~chain_id (kind : 'a) : 'a location = | `State -> "baker_state" | `Nonce -> "nonce" in - Format.asprintf "%a_%s" Tezos_crypto.Chain_id.pp_short chain_id basename + Format.asprintf "%a_%s" Chain_id.pp_short chain_id basename let filename x = x diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_files.mli b/src/proto_016_PtMumbai/lib_delegate/baking_files.mli index 82940952da05..01146f7d0744 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_files.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_files.mli @@ -26,7 +26,7 @@ type _ location val resolve_location : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> ([< `Highwatermarks | `Nonce | `State] as 'kind) -> 'kind location diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli index 8809adad843e..6e69b009180d 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_nonces.mli @@ -90,7 +90,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -108,7 +108,7 @@ val reveal_potential_nonces : t -> Baking_state.proposal -> unit tzresult Lwt.t val start_revelation_worker : Protocol_client_context.full -> Baking_configuration.nonce_config -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> Constants.t -> Baking_state.proposal Lwt_stream.t -> Lwt_canceler.t Lwt.t diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli index 1643296eb489..0d0c7ac9f4d2 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli @@ -46,7 +46,7 @@ val begin_construction : protocol_data:block_header_data -> Abstract_context_index.t -> Baking_state.block_info -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> incremental tzresult Lwt.t val add_operation : diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_state.ml b/src/proto_016_PtMumbai/lib_delegate/baking_state.ml index ba8632e23bd7..984c2bbbd237 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_state.ml +++ b/src/proto_016_PtMumbai/lib_delegate/baking_state.ml @@ -135,7 +135,7 @@ type global_state = { (* client context *) cctxt : Protocol_client_context.full; (* chain id *) - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; (* baker configuration *) config : Baking_configuration.t; (* protocol constants *) @@ -835,7 +835,7 @@ let pp_global_state fmt {chain_id; config; validation_mode; delegates; _} = fmt "@[<v 2>Global state:@ chain_id: %a@ @[<v 2>config:@ %a@]@ \ validation_mode: %a@ @[<v 2>delegates:@ %a@]@]" - Tezos_crypto.Chain_id.pp + Chain_id.pp chain_id Baking_configuration.pp config diff --git a/src/proto_016_PtMumbai/lib_delegate/baking_state.mli b/src/proto_016_PtMumbai/lib_delegate/baking_state.mli index 3e3c0efe6e37..34ce3743c4ad 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_state.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_state.mli @@ -81,7 +81,7 @@ type cache = { type global_state = { cctxt : Protocol_client_context.full; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; config : Baking_configuration.t; constants : Constants.t; round_durations : Round.round_durations; diff --git a/src/proto_016_PtMumbai/lib_delegate/block_forge.mli b/src/proto_016_PtMumbai/lib_delegate/block_forge.mli index abf60c86d8f4..b111e27b417c 100644 --- a/src/proto_016_PtMumbai/lib_delegate/block_forge.mli +++ b/src/proto_016_PtMumbai/lib_delegate/block_forge.mli @@ -50,7 +50,7 @@ val forge_faked_protocol_data : val forge : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> pred_info:Baking_state.block_info -> timestamp:Time.Protocol.t -> liquidity_baking_toggle_vote:Liquidity_baking.liquidity_baking_toggle_vote -> diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml index 9be4d3735d52..d7064545b7bd 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.ml @@ -29,7 +29,7 @@ open Protocol_client_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; @@ -82,7 +82,7 @@ module Block_seen_event = struct type t = { hash : Block_hash.t; header : Tezos_base.Block_header.t; - occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -123,7 +123,7 @@ module Block_seen_event = struct (Tag 1) (obj2 (req "occurrence-kind" (constant "valid-blocks")) - (req "chain-id" Tezos_crypto.Chain_id.encoding)) + (req "chain-id" Chain_id.encoding)) (function | `Valid_blocks ch -> Some ((), ch) | _ -> None) (fun ((), ch) -> `Valid_blocks ch); diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli index e3b8a7621d56..c3358f61f82f 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_blocks.mli @@ -28,7 +28,7 @@ open Alpha_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; diff --git a/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml b/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml index 19a7712b1698..cb6f6a02e66e 100644 --- a/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_016_PtMumbai/lib_delegate/client_baking_denunciation.ml @@ -31,10 +31,10 @@ module Events = Delegate_events.Denunciator module B_Events = Delegate_events.Baking_scheduling module HLevel = Hashtbl.Make (struct - type t = Tezos_crypto.Chain_id.t * Raw_level.t * Round.t + type t = Chain_id.t * Raw_level.t * Round.t let equal (c, l, r) (c', l', r') = - Tezos_crypto.Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' + Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' let hash (c, lvl, r) = Hashtbl.hash (c, lvl, r) end) diff --git a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb0..ededa688a755 100644 --- a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -46,8 +46,8 @@ let log _channel msg = print_endline msg ; Lwt.return_unit -class faked_ctxt (hooks : Faked_services.hooks) - (chain_id : Tezos_crypto.Chain_id.t) : Tezos_rpc.Context.generic = +class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) diff --git a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml index b391b3b272bd..4cadea890daa 100644 --- a/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -77,7 +77,7 @@ type state = { let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts -let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" +let chain_id = Chain_id.of_string_exn "main" let genesis_block_hash = Block_hash.of_b58check_exn diff --git a/src/proto_016_PtMumbai/lib_plugin/RPC.ml b/src/proto_016_PtMumbai/lib_plugin/RPC.ml index 359c8787ac65..ad6a38ae12b3 100644 --- a/src/proto_016_PtMumbai/lib_plugin/RPC.ml +++ b/src/proto_016_PtMumbai/lib_plugin/RPC.ml @@ -180,7 +180,7 @@ module Scripts = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (opt "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "self" Contract.originated_encoding) @@ -233,7 +233,7 @@ module Scripts = struct (req "contract" Contract.originated_encoding) (req "entrypoint" Entrypoint.simple_encoding) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -249,7 +249,7 @@ module Scripts = struct (req "view" (string Plain)) (req "input" Script.expr_encoding) (dft "unlimited_gas" bool false) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -398,7 +398,7 @@ module Scripts = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") @@ -431,7 +431,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_operation") @@ -444,7 +444,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_tx_rollup_operation") diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml index 1ac9547490fe..32643bf69af4 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.ml @@ -204,8 +204,7 @@ module Forge = struct in let signature = Tezos_crypto.Signature.sign - ~watermark: - Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) + ~watermark:Block_header.(to_watermark (Block_header Chain_id.zero)) signer_account.sk unsigned_bytes in @@ -398,7 +397,7 @@ let initial_alpha_context ?(commitments = []) constants ~level ~timestamp ~predecessor - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult @@ -439,7 +438,7 @@ let genesis_with_parameters parameters = add empty ["version"] (Bytes.of_string "genesis") >>= fun ctxt -> add ctxt protocol_param_key proto_params) >>= fun ctxt -> - let chain_id = Tezos_crypto.Chain_id.of_block_hash hash in + let chain_id = Chain_id.of_block_hash hash in Main.init chain_id ctxt shell >|= Environment.wrap_tzresult >|=? fun {context; _} -> { @@ -650,7 +649,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum initial_context ?commitments ?bootstrap_contracts - (Tezos_crypto.Chain_id.of_block_hash hash) + (Chain_id.of_block_hash hash) constants shell bootstrap_accounts @@ -695,7 +694,7 @@ let get_application_vstate (pred : t) (operations : Protocol.operation trace) = let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -717,7 +716,7 @@ let get_construction_vstate ?(policy = By_round 0) ?timestamp in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -779,7 +778,7 @@ let apply_with_metadata ?(policy = By_round 0) ?(check_size = true) ~baking_mode | Application -> begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml index e0fea8f7640c..a51392069c43 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/context.ml @@ -599,7 +599,7 @@ let default_raw_context () = >>= fun context -> let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/contract_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/contract_helpers.ml index 7385aaecb219..4cd5396caced 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/contract_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/contract_helpers.ml @@ -79,7 +79,7 @@ let default_step_constants = self = default_self; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml index c1c382ffbe86..7260c3ca385a 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/incremental.ml @@ -123,7 +123,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml index 884dbe2171b8..86ef49614131 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/op.ml @@ -111,8 +111,7 @@ let raw_endorsement ?delegate ?slot ?level ?round ?block_payload_hash let op = Single (Endorsement consensus_content) in return (sign - ~watermark: - Operation.(to_watermark (Endorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Endorsement Chain_id.zero)) signer pred_branch op) @@ -148,8 +147,7 @@ let raw_preendorsement ?delegate ?slot ?level ?round ?block_payload_hash let op = Single (Preendorsement consensus_content) in return (sign - ~watermark: - Operation.(to_watermark (Preendorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Preendorsement Chain_id.zero)) signer pred_branch op) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/helpers/sapling_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0..9bf2f8382fd8 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/helpers/sapling_helpers.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sapling_helpers.ml @@ -353,12 +353,7 @@ module Interpreter_helpers = struct let originate_contract_hash file storage src b baker = originate_contract_hash file storage src b baker >|=? fun (dst, b) -> let anti_replay = - Format.asprintf - "%a%a" - Contract_hash.pp - dst - Tezos_crypto.Chain_id.pp - Tezos_crypto.Chain_id.zero + Format.asprintf "%a%a" Contract_hash.pp dst Chain_id.pp Chain_id.zero in (dst, b, anti_replay) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/gas/test_gas_levels.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/gas/test_gas_levels.ml index a6e799c846db..5e0848b43e1b 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/gas/test_gas_levels.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/gas/test_gas_levels.ml @@ -218,7 +218,7 @@ let apply_with_gas header ?(operations = []) (pred : Block.t) = (let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >>=? fun vstate -> diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml index 7a6ce4bc8b21..4fb1ecd70617 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/test_mempool.ml @@ -106,7 +106,7 @@ let test_simple () = let vs, mempool = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -138,7 +138,7 @@ let test_imcompatible_mempool () = let (_vs : Mempool.validation_info), mempool1 = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -154,7 +154,7 @@ let test_imcompatible_mempool () = let (_vs : Mempool.validation_info), mempool2 = Mempool.init ctxt2 - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash:predecessor_hash2 @@ -183,7 +183,7 @@ let test_merge () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -275,7 +275,7 @@ let test_add_invalid_operation () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -300,7 +300,7 @@ let test_add_and_replace () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -352,7 +352,7 @@ let test_remove_operation () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash diff --git a/src/proto_alpha/lib_benchmark/execution_context.ml b/src/proto_alpha/lib_benchmark/execution_context.ml index c6c80fa3bf4e..a7212fc9ee04 100644 --- a/src/proto_alpha/lib_benchmark/execution_context.ml +++ b/src/proto_alpha/lib_benchmark/execution_context.ml @@ -53,7 +53,7 @@ let context_init ~rng_state = context_init_memory ~rng_state let make ~rng_state = context_init_memory ~rng_state >>=? fun context -> let amount = Alpha_context.Tez.one in - let chain_id = Tezos_crypto.Chain_id.zero in + let chain_id = Tezos_crypto.Hashed.Chain_id.zero in let now = Script_timestamp.of_zint Z.zero in let level = Script_int.zero_n in let open Script_interpreter in diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index a2c4fb252d27..678264070052 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -3264,7 +3264,7 @@ module Registration_section = struct self = Contract_hash.zero; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } diff --git a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml index 37f91ab77e95..ff1b31fbb1c6 100644 --- a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml @@ -68,7 +68,7 @@ let default_raw_context () = let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in let*! e = Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) diff --git a/src/proto_alpha/lib_client/client_proto_multisig.ml b/src/proto_alpha/lib_client/client_proto_multisig.ml index cf5eda9d6fd0..108233e7b2ab 100644 --- a/src/proto_alpha/lib_client/client_proto_multisig.ml +++ b/src/proto_alpha/lib_client/client_proto_multisig.ml @@ -897,11 +897,7 @@ let get_contract_address_maybe_chain_id ~descr ~loc ~chain_id contract = in if descr.requires_chain_id then let chain_id_bytes = - bytes - ~loc - (Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id) + bytes ~loc (Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id) in pair ~loc chain_id_bytes address else address @@ -1178,9 +1174,7 @@ let action_of_bytes ~multisig_contract ~stored_counter ~descr ~chain_id bytes = contract_bytes in let cid = - Data_encoding.Binary.of_bytes_exn - Tezos_crypto.Chain_id.encoding - chain_id_bytes + Data_encoding.Binary.of_bytes_exn Chain_id.encoding chain_id_bytes in if counter = stored_counter then if multisig_contract = contract && chain_id = cid then diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index 7ba34abb0722..62ed51f59076 100644 --- a/src/proto_alpha/lib_client/mockup.ml +++ b/src/proto_alpha/lib_client/mockup.ml @@ -35,7 +35,7 @@ module Protocol_constants_overrides = struct (** Equivalent of [Constants.parametric] with additionally [chain_id] and [timestamp]. *) type t = { parametric : Constants.Parametric.t; - chain_id : Tezos_crypto.Chain_id.t option; + chain_id : Chain_id.t option; timestamp : Time.Protocol.t option; } @@ -49,7 +49,7 @@ module Protocol_constants_overrides = struct (merge_objs Constants.Parametric.encoding (obj2 - (opt "chain_id" Tezos_crypto.Chain_id.encoding) + (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding))) let default_value (cctxt : Tezos_client_base.Client_context.full) : diff --git a/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml b/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml index 7e9c38702551..42a511e9d720 100644 --- a/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml +++ b/src/proto_alpha/lib_client_sapling/client_sapling_commands.ml @@ -61,7 +61,7 @@ let anti_replay cctxt contract = Tezos_shell_services.Chain_services.chain_id cctxt ~chain:cctxt#chain () >>=? fun chain_id -> let address = Protocol.Contract_hash.to_b58check contract in - let chain_id = Tezos_crypto.Chain_id.to_b58check chain_id in + let chain_id = Chain_id.to_b58check chain_id in return (address ^ chain_id) (** The shielded tez contract expects the recipient pkh encoded in Micheline diff --git a/src/proto_alpha/lib_delegate/baking_files.ml b/src/proto_alpha/lib_delegate/baking_files.ml index 67ef0c7ea0d4..38339e2fe555 100644 --- a/src/proto_alpha/lib_delegate/baking_files.ml +++ b/src/proto_alpha/lib_delegate/baking_files.ml @@ -32,6 +32,6 @@ let resolve_location ~chain_id (kind : 'a) : 'a location = | `State -> "baker_state" | `Nonce -> "nonce" in - Format.asprintf "%a_%s" Tezos_crypto.Chain_id.pp_short chain_id basename + Format.asprintf "%a_%s" Chain_id.pp_short chain_id basename let filename x = x diff --git a/src/proto_alpha/lib_delegate/baking_files.mli b/src/proto_alpha/lib_delegate/baking_files.mli index 82940952da05..01146f7d0744 100644 --- a/src/proto_alpha/lib_delegate/baking_files.mli +++ b/src/proto_alpha/lib_delegate/baking_files.mli @@ -26,7 +26,7 @@ type _ location val resolve_location : - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> ([< `Highwatermarks | `Nonce | `State] as 'kind) -> 'kind location diff --git a/src/proto_alpha/lib_delegate/baking_nonces.mli b/src/proto_alpha/lib_delegate/baking_nonces.mli index 8809adad843e..6e69b009180d 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.mli +++ b/src/proto_alpha/lib_delegate/baking_nonces.mli @@ -90,7 +90,7 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> Block_hash.t -> Nonce.t -> unit tzresult Lwt.t @@ -108,7 +108,7 @@ val reveal_potential_nonces : t -> Baking_state.proposal -> unit tzresult Lwt.t val start_revelation_worker : Protocol_client_context.full -> Baking_configuration.nonce_config -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> Constants.t -> Baking_state.proposal Lwt_stream.t -> Lwt_canceler.t Lwt.t diff --git a/src/proto_alpha/lib_delegate/baking_simulator.mli b/src/proto_alpha/lib_delegate/baking_simulator.mli index 1643296eb489..0d0c7ac9f4d2 100644 --- a/src/proto_alpha/lib_delegate/baking_simulator.mli +++ b/src/proto_alpha/lib_delegate/baking_simulator.mli @@ -46,7 +46,7 @@ val begin_construction : protocol_data:block_header_data -> Abstract_context_index.t -> Baking_state.block_info -> - Tezos_crypto.Chain_id.t -> + Chain_id.t -> incremental tzresult Lwt.t val add_operation : diff --git a/src/proto_alpha/lib_delegate/baking_state.ml b/src/proto_alpha/lib_delegate/baking_state.ml index 74c047bf1437..0130ec952817 100644 --- a/src/proto_alpha/lib_delegate/baking_state.ml +++ b/src/proto_alpha/lib_delegate/baking_state.ml @@ -126,7 +126,7 @@ type global_state = { (* client context *) cctxt : Protocol_client_context.full; (* chain id *) - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; (* baker configuration *) config : Baking_configuration.t; (* protocol constants *) @@ -829,7 +829,7 @@ let pp_global_state fmt {chain_id; config; validation_mode; delegates; _} = fmt "@[<v 2>Global state:@ chain_id: %a@ @[<v 2>config:@ %a@]@ \ validation_mode: %a@ @[<v 2>delegates:@ %a@]@]" - Tezos_crypto.Chain_id.pp + Chain_id.pp chain_id Baking_configuration.pp config diff --git a/src/proto_alpha/lib_delegate/baking_state.mli b/src/proto_alpha/lib_delegate/baking_state.mli index c636037f3e92..198cde1a9f96 100644 --- a/src/proto_alpha/lib_delegate/baking_state.mli +++ b/src/proto_alpha/lib_delegate/baking_state.mli @@ -80,7 +80,7 @@ type cache = { type global_state = { cctxt : Protocol_client_context.full; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; config : Baking_configuration.t; constants : Constants.t; round_durations : Round.round_durations; diff --git a/src/proto_alpha/lib_delegate/block_forge.mli b/src/proto_alpha/lib_delegate/block_forge.mli index abf60c86d8f4..b111e27b417c 100644 --- a/src/proto_alpha/lib_delegate/block_forge.mli +++ b/src/proto_alpha/lib_delegate/block_forge.mli @@ -50,7 +50,7 @@ val forge_faked_protocol_data : val forge : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> + chain_id:Chain_id.t -> pred_info:Baking_state.block_info -> timestamp:Time.Protocol.t -> liquidity_baking_toggle_vote:Liquidity_baking.liquidity_baking_toggle_vote -> diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.ml b/src/proto_alpha/lib_delegate/client_baking_blocks.ml index 9be4d3735d52..d7064545b7bd 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.ml +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.ml @@ -29,7 +29,7 @@ open Protocol_client_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; @@ -82,7 +82,7 @@ module Block_seen_event = struct type t = { hash : Block_hash.t; header : Tezos_base.Block_header.t; - occurrence : [`Valid_blocks of Tezos_crypto.Chain_id.t | `Heads]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -123,7 +123,7 @@ module Block_seen_event = struct (Tag 1) (obj2 (req "occurrence-kind" (constant "valid-blocks")) - (req "chain-id" Tezos_crypto.Chain_id.encoding)) + (req "chain-id" Chain_id.encoding)) (function | `Valid_blocks ch -> Some ((), ch) | _ -> None) (fun ((), ch) -> `Valid_blocks ch); diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.mli b/src/proto_alpha/lib_delegate/client_baking_blocks.mli index e3b8a7621d56..c3358f61f82f 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.mli +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.mli @@ -28,7 +28,7 @@ open Alpha_context type block_info = { hash : Block_hash.t; - chain_id : Tezos_crypto.Chain_id.t; + chain_id : Chain_id.t; predecessor : Block_hash.t; fitness : Bytes.t list; timestamp : Time.Protocol.t; diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index 69a0f7c23ef0..2ebc4af5961e 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -31,10 +31,10 @@ module Events = Delegate_events.Denunciator module B_Events = Delegate_events.Baking_scheduling module HLevel = Hashtbl.Make (struct - type t = Tezos_crypto.Chain_id.t * Raw_level.t * Round.t + type t = Chain_id.t * Raw_level.t * Round.t let equal (c, l, r) (c', l', r') = - Tezos_crypto.Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' + Chain_id.equal c c' && Raw_level.equal l l' && Round.equal r r' let hash (c, lvl, r) = Hashtbl.hash (c, lvl, r) end) diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb0..ededa688a755 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -46,8 +46,8 @@ let log _channel msg = print_endline msg ; Lwt.return_unit -class faked_ctxt (hooks : Faked_services.hooks) - (chain_id : Tezos_crypto.Chain_id.t) : Tezos_rpc.Context.generic = +class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index 0bc82a0ef97a..346cea3ee712 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -77,7 +77,7 @@ type state = { let accounts = Mockup.Protocol_parameters.default_value.bootstrap_accounts -let chain_id = Tezos_crypto.Chain_id.of_string_exn "main" +let chain_id = Chain_id.of_string_exn "main" let genesis_block_hash = Block_hash.of_b58check_exn diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 6281adc2d03c..bb798eeaead4 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -180,7 +180,7 @@ module Scripts = struct (req "input" Script.expr_encoding) (req "amount" Tez.encoding) (opt "balance" Tez.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "self" Contract.originated_encoding) @@ -233,7 +233,7 @@ module Scripts = struct (req "contract" Contract.originated_encoding) (req "entrypoint" Entrypoint.simple_encoding) (req "input" Script.expr_encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -249,7 +249,7 @@ module Scripts = struct (req "view" (string Plain)) (req "input" Script.expr_encoding) (dft "unlimited_gas" bool false) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (opt "source" Contract.encoding) (opt "payer" Contract.implicit_encoding) (opt "gas" Gas.Arith.z_integral_encoding) @@ -398,7 +398,7 @@ module Scripts = struct ~input: (obj2 (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding)) + (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") @@ -431,7 +431,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_operation") @@ -444,7 +444,7 @@ module Scripts = struct (obj4 (opt "blocks_before_activation" int32) (req "operation" Operation.encoding) - (req "chain_id" Tezos_crypto.Chain_id.encoding) + (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "simulate_tx_rollup_operation") diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 76202df1e2c2..575ee5ea732f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -200,8 +200,7 @@ module Forge = struct in let signature = Signature.sign - ~watermark: - Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) + ~watermark:Block_header.(to_watermark (Block_header Chain_id.zero)) signer_account.sk unsigned_bytes in @@ -394,7 +393,7 @@ let initial_alpha_context ?(commitments = []) constants ~level ~timestamp ~predecessor - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult @@ -435,7 +434,7 @@ let genesis_with_parameters parameters = add empty ["version"] (Bytes.of_string "genesis") >>= fun ctxt -> add ctxt protocol_param_key proto_params) >>= fun ctxt -> - let chain_id = Tezos_crypto.Chain_id.of_block_hash hash in + let chain_id = Chain_id.of_block_hash hash in Main.init chain_id ctxt shell >|= Environment.wrap_tzresult >|=? fun {context; _} -> { @@ -618,7 +617,7 @@ let genesis ?commitments ?consensus_threshold ?min_proposal_quorum initial_context ?commitments ?bootstrap_contracts - (Tezos_crypto.Chain_id.of_block_hash hash) + (Chain_id.of_block_hash hash) constants shell bootstrap_accounts @@ -659,7 +658,7 @@ let get_application_vstate (pred : t) (operations : Protocol.operation trace) = let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -681,7 +680,7 @@ let get_construction_vstate ?(policy = By_round 0) ?timestamp in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:pred.header.shell >|= Environment.wrap_tzresult @@ -743,7 +742,7 @@ let apply_with_metadata ?(policy = By_round 0) ?(check_size = true) ~baking_mode | Application -> begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >|= Environment.wrap_tzresult diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 7a5ececff0e7..c11f17a55521 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -582,7 +582,7 @@ let default_raw_context () = >>= fun context -> let typecheck ctxt script_repr = return ((script_repr, None), ctxt) in Init_storage.prepare_first_block - Tezos_crypto.Chain_id.zero + Chain_id.zero context ~level:0l ~timestamp:(Time.Protocol.of_seconds 1643125688L) diff --git a/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml index d3dffd21c749..3c3a8e44880f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/contract_helpers.ml @@ -79,7 +79,7 @@ let default_step_constants = self = default_self; amount = Tez.zero; balance = Tez.zero; - chain_id = Tezos_crypto.Chain_id.zero; + chain_id = Chain_id.zero; now = Script_timestamp.of_zint Z.zero; level = Script_int.zero_n; } diff --git a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml index 1559d909017e..196396137e34 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/incremental.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/incremental.ml @@ -123,7 +123,7 @@ let begin_construction ?timestamp ?seed_nonce_hash ?(mempool_mode = false) in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index bd0cfa8fbe42..8dea4ac8421a 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -110,8 +110,7 @@ let raw_endorsement ?delegate ?slot ?level ?round ?block_payload_hash let op = Single (Endorsement consensus_content) in return (sign - ~watermark: - Operation.(to_watermark (Endorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Endorsement Chain_id.zero)) signer pred_branch op) @@ -147,8 +146,7 @@ let raw_preendorsement ?delegate ?slot ?level ?round ?block_payload_hash let op = Single (Preendorsement consensus_content) in return (sign - ~watermark: - Operation.(to_watermark (Preendorsement Tezos_crypto.Chain_id.zero)) + ~watermark:Operation.(to_watermark (Preendorsement Chain_id.zero)) signer pred_branch op) diff --git a/src/proto_alpha/lib_protocol/test/helpers/sapling_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0..9bf2f8382fd8 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/sapling_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/sapling_helpers.ml @@ -353,12 +353,7 @@ module Interpreter_helpers = struct let originate_contract_hash file storage src b baker = originate_contract_hash file storage src b baker >|=? fun (dst, b) -> let anti_replay = - Format.asprintf - "%a%a" - Contract_hash.pp - dst - Tezos_crypto.Chain_id.pp - Tezos_crypto.Chain_id.zero + Format.asprintf "%a%a" Contract_hash.pp dst Chain_id.pp Chain_id.zero in (dst, b, anti_replay) diff --git a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml index a6e799c846db..5e0848b43e1b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml +++ b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml @@ -218,7 +218,7 @@ let apply_with_gas header ?(operations = []) (pred : Block.t) = (let open Environment.Error_monad in begin_validation_and_application pred.context - Tezos_crypto.Chain_id.zero + Chain_id.zero (Application header) ~predecessor:pred.header.shell >>=? fun vstate -> diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml index 7a6ce4bc8b21..4fb1ecd70617 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml @@ -106,7 +106,7 @@ let test_simple () = let vs, mempool = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -138,7 +138,7 @@ let test_imcompatible_mempool () = let (_vs : Mempool.validation_info), mempool1 = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -154,7 +154,7 @@ let test_imcompatible_mempool () = let (_vs : Mempool.validation_info), mempool2 = Mempool.init ctxt2 - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash:predecessor_hash2 @@ -183,7 +183,7 @@ let test_merge () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -275,7 +275,7 @@ let test_add_invalid_operation () = let vs, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -300,7 +300,7 @@ let test_add_and_replace () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash @@ -352,7 +352,7 @@ let test_remove_operation () = let info, mempool_i = Mempool.init ctxt - Tezos_crypto.Chain_id.zero + Chain_id.zero ~predecessor_level ~predecessor_round ~predecessor_hash diff --git a/tezt/lib_tezos/operation_core.ml b/tezt/lib_tezos/operation_core.ml index 1266d352b88a..e90efe0af68d 100644 --- a/tezt/lib_tezos/operation_core.ml +++ b/tezt/lib_tezos/operation_core.ml @@ -88,7 +88,7 @@ let sign ?protocol ({kind; signer; _} as t) client = match kind with | Consensus {chain_id} -> Tezos_crypto.Signature.Endorsement - (Tezos_crypto.Chain_id.of_b58check_exn chain_id) + (Tezos_crypto.Hashed.Chain_id.of_b58check_exn chain_id) | Voting | Manager -> Tezos_crypto.Signature.Generic_operation in let* hex = hex ?protocol t client in diff --git a/tezt/long_tests/qcheck_rpc.ml b/tezt/long_tests/qcheck_rpc.ml index 742c076d7b33..086f70a41112 100644 --- a/tezt/long_tests/qcheck_rpc.ml +++ b/tezt/long_tests/qcheck_rpc.ml @@ -306,7 +306,7 @@ module Gen = struct let chain_id_gen : string t = let open QCheck2.Gen in - let open Tezos_crypto in + let open Tezos_crypto.Hashed in let non_alias = list string >|= Chain_id.hash_string >|= Chain_id.to_string in -- GitLab