diff --git a/devtools/get_contracts/config.ml b/devtools/get_contracts/config.ml index 5cc0564a541aba94d19586d37fb6f19a7c00a8cc..640771aab63f4fc70bca3ecb13b6a357b57d17dd 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 a530eb42b972edbd275e958bf836734ed2336e7f..e874667c402d000da3d377c537478e550107a64b 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 @@ -782,19 +778,16 @@ 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%!" - 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 3e91b2b9d9c78f677ca554ffd35aff1870831e2f..77773763d21d5cbc262e189d6d48459a4e969844 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 928383effb73dd975304cf2cbbfcc6d9bbc7bd25..afbbdac14e069e0c0b6276d7df7f905b415bf8bb 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 026d5717a4136837c368fa8ea12bd1cbf90f8ff7..3429824041d14136a811548ac6e8788e8e8eb0a8 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 94e1fc9f22778b4c57ee74058e853e21bd57d4c2..642144700ca1e95cdccd7201f6663e08c5bf2db9 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 4c74aee579489b4895597640c4014b63852842a1..dbe39a52365fbe40fdd24b1a54a1693261aa6108 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 b532b05f305c191a8e47000b892e1a8562e006e0..6c10d89e5beb4438fb03f283af57edba8c6d528a 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 6150545ca4da850bfe89e24b36082224df090aa6..e0fd02bd9b0cd68738c8111ce89f9226164d2b9a 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 54f20a0d55184c59e2dc4cd196b4d7d286c62044..e5e9676259627b05c19ace07ece76e977763a57d 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 8574f3481d61638c0d1f522d1e63fc74ed884b3e..6f02d400f1e16f098a0b53dfd38369eab9dd57d8 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 3fe5312294273a6acb5cd3fd37a6228242f1d7ba..e8e02d990259155ad3f068d593d90fa9b4d74b4f 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/main_dal.ml b/src/bin_dal_node/main_dal.ml index 243984d324693a29290382460a728b3c79b4d3a9..95988c36e2f3930bc97f85a7ca61e0a9c0bdc2cf 100644 --- a/src/bin_dal_node/main_dal.ml +++ b/src/bin_dal_node/main_dal.ml @@ -128,7 +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.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/bin_dal_node/slot_manager.mli b/src/bin_dal_node/slot_manager.mli index 4f5a70d52d3ea8877a2d5f17f581caf1e3627b91..f47e4ad751d1f85eda50215083b99e272f48e7ad 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 84303040b8deb1a80485d5d394f03d2ba52ab55a..89e9224baf874c994ec11fd3bd4d874e976c5d65 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 05c9ac7dde6793eb55a79d8d2ed0e67aea6eba0d..27bacc9c5e51f82eb14f2aa75fefbec8757c0ca4 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 87d83891dbc62b66fbf8b52f08b87f5f39b728bd..f14b9e4773b2411c190e12713f6f31e80e267ba6 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 6f1e7245f6ec4dc32c72937b31402a9ea5e8d29b..06a9e4e7237d10808bc44736de45881e36dd7973 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 38d65d9e8187816eeb82b0fede989e71c73ba1c8..f023759afaaf78ac216268b4293dbd1c1f3f1fca 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 () = @@ -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. *) @@ -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 @@ -255,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. *) @@ -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_signer/handler.ml b/src/bin_signer/handler.ml index 30cb791bb114758f65a3d6f79f01bb3df7c73376..840e04905e9c89af0b49c34ff92ca3059f928322 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/bin_wasm_debugger/messages.ml b/src/bin_wasm_debugger/messages.ml index 071a1cb5c6c9e60715e58d4f3c3d4e38020c02bd..b31dc0e954607b273699b1ed90ab1d2f12770c0d 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_base/block_header.ml b/src/lib_base/block_header.ml index 792ba7381d8ef267aef7a73f97e3162cebd9add4..bbf734b9223020fc9cbe275d19ffd74aaa248cfd 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 5bdd779fb84c1eed53d22c927917f3c19bca3706..cd6c31bd4dc3ee2f4d97e48f4ebfae54bfec2b06 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 0cc57d2eacc5eb79514b9c3553615c0727194cac..3cc3895845e0fa766ebc39258c501604340d400e 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 7ace8b3296b721c0b3e65679af20fe359a29b7c4..2d059ccc7a850efd2be7d79bdf9ec210e29494e5 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 dfaf5f5ac71f0d0d03fea47d195a8c569f70c815..09a41f1aa42980f54755edd36269877ac422cc1e 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 ed3d911a3670a3cebb82a1f0518bc8ea749b6d60..a80c4fc182ef20e2f1c83f3ce1e9607fd2322304 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 5aec011c52c1572ca4d7a2ecaca04b9d8dd13b8b..4669249692ff57b512d74c8d33247edfe2ce7c03 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 7eecaec229644427b8dfb22c997de54d823a9926..6281182b5394188a747a8c5b8d4064204e905bd1 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 7654a800dc99e9ba978e82f2f05a85c880102909..bac36a5b65d3bcedbf8880d0187879e6f2e7a612 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 54b75685215bb3b64a4e554be9d54c85937636fa..58e4ae9db15f0753acff0bc60d8b77afe193968d 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 47d585ba83fe504e2113f1edbc03590ea8cbfab5..5a8238404427e90e06df36b323228a927b243429 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 08e9fe2787daa1a77528c60a226096726c665a22..6cbd8d4fed3b7162a5d3fec0a839bfb20c7dc780 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 842c831793400e8a3fe266cd0382486d5d382034..e1a05b6d4f2d2fbb818989ce0a066ef63276f13d 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 ff3620bb8ae1859b6d97d21b282333979e4b18e8..96ca0ef65aba0f4e2fedfb2e350e8e701fac582f 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; + 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; } @@ -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) @@ -68,9 +68,9 @@ let encoding = ~title:"Running" (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 "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)) (function | Running {chain_id; genesis; protocol; expiration} -> @@ -86,7 +86,7 @@ let pp ppf = function Format.fprintf ppf "@[<v 2>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,11 +94,11 @@ let pp ppf = function Format.fprintf ppf "@[<v 2>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 + 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 d01bfe8baa2bae98d487bfa15de9af01c5b0d55f..172d3d083ff1a1e27262765187b8e9dc0bdf8533 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; + 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.ml b/src/lib_base/tzPervasives.ml index 405520cc91b5d304f0cb5504c1532855f418af2a..0f8194b6bcac9e07d919263514584b2caeedc260 100644 --- a/src/lib_base/tzPervasives.ml +++ b/src/lib_base/tzPervasives.ml @@ -90,6 +90,8 @@ 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 +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 a8b7fb8427c8638b90c7b9f9dd3a62265d0817bf..16e8f507989d2d426e65046e54424b9ce8ba7ea4 100644 --- a/src/lib_base/tzPervasives.mli +++ b/src/lib_base/tzPervasives.mli @@ -92,6 +92,20 @@ 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 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 +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 +module Signature = Tezos_crypto.Signature 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 91ae5a57a959fcc117a157d00cfe5bd2aafecdf3..3c0384b62ae01d9fdfdf33f885904614206f5538 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 bfdbd1f4df8363e6aa32f63fc386246750f58d0b..faf737ddf2be1e2c6a8f8029da08668743a1189f 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 8daffbdcdba13717f279eb6aee16fb67221dfd34..56e0d23b7dd39148224720f9f98d15021aa26612 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 diff --git a/src/lib_benchmark/crypto_samplers.ml b/src/lib_benchmark/crypto_samplers.ml index c48149f5b83dc8ba0fdfc9a8548e3dfbc4db5a8c..305e41b93ce0e793cb3a027fe1f163c5f9d67d45 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 abca8ba1ed6a1446a998f926cd7c7280de2a817e..3eecb9fabe73e0b2dc020d7005172e65c95bf084 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 76f60ebb13c77cc87f0a5f4c62704c5c52169eca..725f2288c44a35be89f698a30bb20476e396c0a1 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 4be72df4c2ef6106d21dae123420e345269f6015..38be6d62cfa75eb165bf7219a5d0e1afc5e77700 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 a7a4a6e577459dda32607a408a15bb4d5e9f159a..4cb6406aa77e0defab6a42ab8e4c94fd9c6ca2b8 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 757c01523709f08abfe01ee9293c7920978f179f..425e10c42189f48ed75a6e8b3dc7f9b8ae7ddb12 100644 --- a/src/lib_client_base_unix/client_context_unix.mli +++ b/src/lib_client_base_unix/client_context_unix.mli @@ -50,14 +50,14 @@ 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 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 86db94288c891f0deb2e2fc63f448d583d2d3402..989de57b3389bf14c1ad5f1fe014fc644e0c2615 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 a93c18501a28dbff7db1c0cce95291645b1038eb..004f6d9391aa2494fe6c541c911334947063891c 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 18c2d4f29deb0810523abd3678faf1872203a9d8..c7bc47d017df82878738e95d7184265633767074 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 4bc970b47c8237a72d7c04c2112f1613338ccc34..650b9ab101b21c4c44f247b2a052aa404838705f 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 82a865c1203ab78b503791399ff1ce6736b208fb..149e462b433a9be8448374b4d43ed85f70df923a 100644 --- a/src/lib_client_commands/client_helpers_commands.ml +++ b/src/lib_client_commands/client_helpers_commands.ml @@ -72,11 +72,9 @@ 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 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* block_hash = Lwt.return (Block_hash.of_b58check block_hash_str) 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" @@ -87,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_client_commands/client_keys_commands.ml b/src/lib_client_commands/client_keys_commands.ml index 653d7ebcc2b89931f607bcac2c2f3b020af00d8e..d34da200c9bf2197d22ba1c2a352be0086940bc0 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.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.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_client_commands/client_report_commands.ml b/src/lib_client_commands/client_report_commands.ml index 950c30bc1cd4c3071c70b09ae27dee2957463922..b9330a41890333dafb6883531cc55cd784319cd1 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 f69d5b864eb1407229449920847a26c001e772de..c3ae143352d97a8ccd3f640632b7501e9b003f85 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 @@ -806,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} @@ -828,17 +814,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 - Tezos_crypto.Chain_id.of_block_hash genesis_hash + let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in + 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 +835,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 +893,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 +934,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 +945,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 +956,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 +971,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 +1114,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 afb28cd97605bfbb0eee1c903f07bbb16317c35c..0abd034ad2ef8ac307d11ab3cce78207104f478a 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 aae455d198c78d1cd0e327a80514b86be42b8403..9463ecf42874e4d837c1ef95c67f5a863e21f95e 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 bb28ea240ac1fe227257448354d763250e7ec75f..68cfe1ff6babafeb5cd9121b866c1a49788bd1e0 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 aec343981c4103e2dbde932cb6be52b3e4f46145..73125bd95b0bed6c60b969ebd64d57d5039a4434 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 2f86bb92384952eb4dd586182a52a0ad3b7849ba..5fc7e5951cfb046638a021da71b7e15e5ad87dcc 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 b05fd333f8600a5dae841be742de2856283d0a97..703f7a1c85c9f75f338ea514f0dadc5ad369d7c1 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 @@ -536,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 @@ -598,17 +593,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 - Tezos_crypto.Chain_id.of_block_hash genesis_hash + let genesis_hash = Block_hash.hash_bytes [Block_hash.to_bytes genesis] in + 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 +614,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 6be42e538ad7329c95e8c5c574bd9738767e1adf..f7bf64f66eab6aef3b7283b445d55bfe7919ccd7 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 30ba771aa7146cbf09a658bf6352db72dbb1e037..1b15b7a4d746b7e365ac52a3b699f864c0504f72 100644 --- a/src/lib_context/memory/test/test.ml +++ b/src/lib_context/memory/test/test.ml @@ -30,16 +30,16 @@ 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 - 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 *) @@ -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 eb4a800746c35c9f6e688e557c6e64f4bed7b211..42bdc6d940e67b6c79b41d24b24f19c7587d9c7b 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 4821514fe5d8761bce87e6abe4bec8cec17c45e4..d05cb41f2a756e51b1599f7c9e998b9319d42f69 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 -> 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. *) @@ -691,10 +689,10 @@ 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: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.Hashed.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 clear_test_chain : index -> 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 1dbbbd341338c3fda787d4a69d0eca5e0861820b..43b0f2ebebe903922de726e4f9ea6d00d88e9166 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,16 +54,16 @@ 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 -let chain_id = Tezos_crypto.Chain_id.of_block_hash genesis_block +let chain_id = Chain_id.of_block_hash genesis_block (** Test functors *) @@ -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 f60e32b109578e31a0726f4cc0bdf46944291485..8a468a19e7a8f97a498d7269515f287a7fa7d745 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_context_hash.ml b/src/lib_crypto/test/test_context_hash.ml index 778fce1af147999ab961aeb6e21945e359095e59..38188985a05aa8bcf67ef610e9f1bb6774074d6f 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 5c78ac3df2652d37fbdd0e5da897230fb19eed9b..b71c9fac59eec127bf536773f2d52dc2c078402c 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 Signature.Ed25519 : Intfs.SIGNATURE) -let p256 = (module P256 : S.SIGNATURE) +let p256 = (module Signature.P256 : Intfs.SIGNATURE) -let secp256k1 = (module Secp256k1 : S.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 36caf2b964d8c7c41b2b0d1258b66522fbc0d079..09285cbdad59d437478ad649567bfc52845cefba 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 @@ -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 934a0bb3716d3b5a6d5ba467fc1c45d6d932f151..4616df06ecca44296fb436a589faaf9c2597ab67 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 dc7568ec6ceb42bfc34db28832119e56f94903f5..d9a531ac05f4318e8df76fca17262a7b932c6228 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 @@ -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 1aec237a92371a7a910f92082edd68e58f6d864d..f26cd64bdb9545c969da8208c67a9d47485ff57d 100644 --- a/src/lib_crypto/tezos_crypto.ml +++ b/src/lib_crypto/tezos_crypto.ml @@ -23,28 +23,35 @@ (* *) (*****************************************************************************) +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 + 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 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 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 diff --git a/src/lib_dal_node/dac_plugin.ml b/src/lib_dal_node/dac_plugin.ml index 7b298b3f8a2ac1ac35ee48d46982b032696d5d30..7855f44b86f748b122eb24d339bf2512d5f28267 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 4de3ee0faeb5381da07568df1b12106a720760b9..ae40fb0169ea25de7542ab315e5163a2120c1e2b 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 8319ceca61a13315b6b5c922405f120190cc17c4..bd9d755b99f020918b02973fe2cc6a9fac7850e8 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 31b430af3f00f5917aebecee58a5bff39f74e068..7d74966f45ca48a5e088a1189efca2d89b59a511 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/RPC_client.ml b/src/lib_mockup/RPC_client.ml index 8c945f8d712d59cf6c575997769e83e1c8738a1c..0cd8f8a81bb66cc60911659349956864d6356cbf 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 bdd3ac4ad09263aea759374b7e615c7a147bc958..9a6889d19a0ce645fe1701c54fb4012134da7621 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 @@ -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 @@ -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) @@ -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) @@ -1009,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/migration.mli b/src/lib_mockup/migration.mli index 0fc4656831af36bee1d5ec641d296dce2398e057..c646dc91848e2ef897269309623d2b827616dc63 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_args.ml b/src/lib_mockup/mockup_args.ml index ecc425edd405b8f34c21abacaadeae06fbe8a3a6..17f2bfefdc09530301a2ba9ae26343c5f3c0c7d2 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 4c8c25bafbb17bf3020d7b1a5ed849638cff8912..9ef4a1789acd81f5cfb1be1f3fb10436d9d0dae1 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/mockup_commands.ml b/src/lib_mockup/mockup_commands.ml index 1cd06cf40a732dbc49e2045d493297d66c9b1106..7e3ae309494dd6a1075be009bdd30e88a2124a26 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 83845c1c926a60628aaf1efa0d881f49c37a7a36..8d0b7dde126d2e040a436d6383cfbead1e4e7922 100644 --- a/src/lib_mockup/persistence.ml +++ b/src/lib_mockup/persistence.ml @@ -46,14 +46,14 @@ 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; - chain_id : Tezos_crypto.Chain_id.t; + protocol_hash : Protocol_hash.t; + chain_id : Chain_id.t; rpc_context : Tezos_protocol_environment.rpc_context; protocol_data : bytes; } @@ -66,8 +66,8 @@ 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 "chain_id" Tezos_crypto.Chain_id.encoding) + (req "protocol_hash" Protocol_hash.encoding) + (req "chain_id" 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 c5bbabc97f03325fa290b90f104fe57944ee5a35..f523a7239dc61c0d1e5e20976d7a1753e3807b3d 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,8 +67,8 @@ module type S = sig (** Overwrites an on-disk mockup environment. *) val overwrite_mockup : - protocol_hash:Tezos_crypto.Protocol_hash.t -> - chain_id:Tezos_crypto.Chain_id.t -> + protocol_hash:Protocol_hash.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 6efe791a34d4a2a23601fe528684e1c0aec0fda7..76a693b7a73db0b4f160685334b0b64aaae4633c 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; } @@ -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_fuzzing_mockup_args.ml b/src/lib_mockup/test/test_fuzzing_mockup_args.ml index 053a679aa9d1af5ad948327bf99214604fa75eab..306244f4a124f1602c18012cbe5c4f607ce1df92 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 55f5a33333a6fbe3dced7889f13ca867dfefb256..60abecb32d4ecf4977b00ca4b8c539f0b920abc5 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_mockup/test/test_persistence.ml b/src/lib_mockup/test/test_persistence.ml index 54dc35bb87da997c19c70d11bba38cc3697fbc33..7b96c9446fe843c41b4c181d274433462ddf300e 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 84bc685e7907f77fc3914f37e58a2d83c13fe4a9..1bf7c2cf503938fa2b69fff28a1f0f911c4a0217 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 7cbea77a3fac0866d95452a575334ed8c7368901..c07a8166d91f1379536db25eaf4209acaf95f4ef 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 effc538ec0feb742776bd88478fe23a16e8fc6e6..48e1750510039ae1f286ccc720cb3411047b2908 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 e7e257bd23d60eee50d2e7448d47ec75e93086c5..5b5fbf4dab01ae65cf991029e71e1f4fdeaf7ec6 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 bdc40c1cb8fcd3c44f35548fb7d678cf9bbe5669..b7e7fef7e2ce6153f0d69c58d0c54a4761106b73 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 515bb2052f89b694a9b2e1cd80e972689d9d45c7..d606156c0942f3e9db73c334ab74a084c4e816ee 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 2fe279833e4600f04a217c578efc95e1c8c676cb..552dbec1f7b83b216464936f37619724bf93ec88 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 83818e77f3ca642f9a72d33380eab61004711557..421565c695a23a82f6dcaa90c1c80756f8c7a194 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 537935fb43e1d4478f89f4f5ddfa10e82f949bd4..f58d8bed4c42dfc717184f20267a18d1ed92d0b4 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 3e9ccc13e77db269f39fe5c5c26dc2e0feb97ede..5eb3a307a5d011bff02dafaec7e2d17e30ec16e2 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 cf82f789c24bf4fdc9fa1e24a05f6d2257008b2e..dd7852177506eb03566f2f3b9f1866fe3f79738f 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -35,15 +35,16 @@ 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 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 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 = + 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 @@ -51,22 +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.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 + 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.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 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 @@ -185,7 +184,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 2d66950b8e1b15306ea3620f28c7e750d5563084..16aca09f9c6d6dcd80a23aa0cb506e7fbf8be42c 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -35,15 +35,16 @@ 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 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 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 = + 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 @@ -51,22 +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.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 + 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.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 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 7fb677cebec6627f65146fa7cbcd79898e356170..6a04507f9cd22162f7be0be69dd476be0b6eacd8 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -36,37 +36,36 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -171,7 +170,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 715250ce08a5e45ba1739a3a4569487a1b56e473..8520815a2f34b8d1812fe9c38de48940a01b8c2a 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -35,37 +35,36 @@ 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 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 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 = + 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 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.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 + 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.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 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 d73776da6daac634dc070752133d63addb858019..4586a6e800d425f95fe6b8b864d06007a17f2a94 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -36,37 +36,36 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -177,7 +176,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 5607402867b64aaa266992eede6d8198c1970f11..ae13045d843733639c84779b3bc38959327a4ffe 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -35,37 +35,36 @@ 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 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 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 = + 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 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.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 + 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.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 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 8f3263cd232f79aa14ff90365061745858b0fc4b..54b5f67104b0b651304102a9724c5880ea2089b4 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -36,40 +36,40 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -271,10 +271,10 @@ 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 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 @@ -282,7 +282,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 @@ -680,13 +680,13 @@ 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 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 + 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 ef96e8b967a120a8f222c90d4c98d27026917724..31003957ccf3c9a44c0d01e437b01f7e8d71642d 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -35,40 +35,40 @@ 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 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 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 = + 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 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.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 + 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.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 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 d6edac7bcf8f31122cc90017ff68ddcf22b6e310..1f321b26b945c0159ad3f4ce59a9924f7b369038 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -40,40 +40,40 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -305,10 +305,10 @@ 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 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 @@ -316,7 +316,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 @@ -711,13 +711,13 @@ 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 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 + 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 482b7d7dff37ac5dc75f3531bf592b84b996b4c4..f83be6ac1911f6068517a7e5a684467d42f9a804 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -35,40 +35,40 @@ 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 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 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 = + 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 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.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 + 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.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 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 f09cefb20bd86ddeece40cc44638eae849853f9f..e597863021af618aee2daf4c018a9ce5d9451480 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -43,42 +43,42 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -270,10 +270,10 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.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 @@ -281,7 +281,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 @@ -684,13 +684,13 @@ 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 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 + 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 2e6239a7b24b647467911bd84be42633c007f8c0..9996bb4dfc6ab3a633b27d7438b31de4cac24ce5 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -44,42 +44,42 @@ 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 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 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 = + 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 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.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 + 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.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 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 2b98d4089d000a276d21e92e9cc40ac7b24ff125..26a31281ca74ec327d8fef13927a1d1554d03bb1 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -43,42 +43,42 @@ 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 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 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 = + 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 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.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 + 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.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 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 @@ -271,10 +271,10 @@ struct let aggregate_verify = Aug.aggregate_verify end - module Ed25519 = Tezos_crypto.Ed25519 - module Secp256k1 = Tezos_crypto.Secp256k1 - module P256 = Tezos_crypto.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 @@ -283,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 @@ -686,13 +686,13 @@ 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 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 + 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 4ab46ce7473f7ee81d3b92f25577b19beddbffe9..7b1b244048bf9c122f6270c8d61c9b168c9dc49e 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -44,42 +44,42 @@ 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 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 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 = + 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 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.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 + 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.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 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 53da5215fd6750ddd5857002181e0892f64a371f..6bbed8714e8bba0c5b63ddb7513b2ca0cfc8a0d0 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -43,45 +43,45 @@ 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 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 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 = + 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 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.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 + 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.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 - 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 @@ -270,11 +270,11 @@ 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 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 @@ -283,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 @@ -695,13 +695,13 @@ 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 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 + 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 c966ad82461184321394241202704d5c086596b8..9c04bdf8b65401d98d6e6197fd20f22d1c024c91 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -43,45 +43,45 @@ 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 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 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 = + 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 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.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 + 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.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 - 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 ded7c6a081a16985a96f67bbae4773ed00600a93..5642c848880ec7804eef3064c8953d497ad32362 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -43,46 +43,46 @@ 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 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 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 = + 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 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.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 + 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.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 - 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 @@ -299,11 +299,11 @@ 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 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 @@ -312,7 +312,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 @@ -736,13 +736,13 @@ 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 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 + 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 6ef25c44fc1b4d2f2704083326647fc0e8192133..aff6d261564f118c5664ac820ef8e084f3e9fca7 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -43,46 +43,46 @@ 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 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 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 = + 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 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.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 + 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.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 - 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_protocol_environment/environment_V9.ml b/src/lib_protocol_environment/environment_V9.ml index 0f4d85a56776e32e340bd933a64cdb1f7db97550..8f226f400616cd26007790d966d3131f802e5c24 100644 --- a/src/lib_protocol_environment/environment_V9.ml +++ b/src/lib_protocol_environment/environment_V9.ml @@ -43,20 +43,19 @@ 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 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 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 + 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 @@ -64,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 @@ -299,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 @@ -312,7 +315,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 @@ -736,13 +739,13 @@ 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 Chain_id = Chain_id + 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 87620c30a99cef2c51dfc8982b40f27f8e587966..6426410d4b4dc895e5e05d8bceff22de309c5e02 100644 --- a/src/lib_protocol_environment/environment_V9.mli +++ b/src/lib_protocol_environment/environment_V9.mli @@ -43,20 +43,19 @@ 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 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 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 + 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 @@ -64,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/environment_context.ml b/src/lib_protocol_environment/environment_context.ml index fc9e7600659597fd02cceb45b8b1ef5a3decec6b..36384c99160680bbcf19e33b6a5e00c960dd4ac8 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 8d5c46031880f0d9ad2c723d984902707d04b916..1974fd024bac68be8a61b18a17f5c675f9ddae98 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 bf8838c75bb81b125fdc3779fe339c72e513bab7..9c907feabc53cba7c6cc82bd1145798204b943ae 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 d5bdb4c8706040d527e716d6d353fe5dad4bff5b..f8b81badf9e232a7928990d07306d93688669158 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 @@ -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,8 +272,8 @@ module type PROTOCOL = sig val init : Context.t -> - Tezos_crypto.Chain_id.t -> - head_hash:Tezos_crypto.Block_hash.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 -> (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 2fbe1c6ab1b97b0f4bf16e87256904f0b5a6ad0b..f2ab9c6d91df9b0dfdec81b70ab43458d9d58d30 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,12 +97,12 @@ 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 -> 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 2757418214d2b777dc89f837051182a50e4c4767..2cfff72e978d1c6b809f1a5c96bf0d78162ce3af 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,12 +96,12 @@ 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 -> 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 -> @@ -127,12 +127,12 @@ 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 -> 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 100cdee8acb261230875efb62ce233b0706e07ea..314a8f18278ba685ceda785c14c5b80eba8aef9a 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,12 +96,12 @@ 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 -> 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 -> @@ -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,12 +130,12 @@ 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 -> 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 2d419e84041786e0f5524afe8cf04bf2f5bdbb75..128654e89cfb58bef3bb48ff4553fbd4fecf41c6 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,18 +90,18 @@ 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; } 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 @@ -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 @@ -117,14 +117,14 @@ 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 val apply_operation : application_state -> - Tezos_crypto.Operation_hash.t -> + Tezos_crypto.Hashed.Operation_hash.t -> operation -> (application_state * operation_receipt) 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,12 +146,12 @@ 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 -> 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 = @@ -186,8 +186,8 @@ module type T = sig val init : context -> - Tezos_crypto.Chain_id.t -> - head_hash:Tezos_crypto.Block_hash.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 @@ -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 da6bc2b21caef0d68e5b25312e48528b4a39f113..a26360ef8c2a9c586e79fccc710ee9f469da7002 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 3934e5be404005afefc91c865af0167397270ebf..eb06335539121c0941627c40be8785880f4b5ed5 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 00abaf304edb9b7ef39d18b1b3454f002668134f..5a6345741ac4c4e5ada7be44ec5cab03ac3a24a8 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 647a7688b9fe18e329a9c011ada71c331fa3dd61..8f10c51b192fd5b478f33f09118199128b063747 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 cfe1d6b6d163b4c32399ffa00bd221d64232398b..0cd39ee80fae9f29923eab22024fa39fd9e5cd20 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_chain_id.ml b/src/lib_protocol_environment/structs/v0_chain_id.ml index d4eb3d1a62cc848781ae962300863d7063606547..c800e12bbdccb40f13e364e39c0f51efdea0c455 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_protocol_environment/structs/v0_context_hash.ml b/src/lib_protocol_environment/structs/v0_context_hash.ml index e93c7706ab9ee24d38d4e788f4577bece3cb9f4c..b81cefe4eede9ac57c5abed37651baaa01f537ab 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_ed25519.ml b/src/lib_protocol_environment/structs/v0_ed25519.ml index 96e5dfef29068a50b520fde1f5e548e0714a1b90..1cd685b87cf9606df09f9116f93854f8a139a704 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_operation_hash.ml b/src/lib_protocol_environment/structs/v0_operation_hash.ml index e5a16df1094c0dd6c838faa5a4a3abb712bd2f51..d98cb3f526a51e14ba4d5fab660549d12cdeccbd 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 8e024fd908dbe771a4066c5e32712313858bc553..3ebcff9a9326f618b213103aaa71a8eef96afac0 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 4536de3cf428f450b9e3ae8b00b16c0e23caa0dc..8b2cdaf26ad114de0513f0158f3d36f85b21e949 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_p256.ml b/src/lib_protocol_environment/structs/v0_p256.ml index 4a2b7551ceb82d6fe25dc5d30445cd6088916b78..980657d613b2868d525a0811a91913fcededb062 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_protocol_hash.ml b/src/lib_protocol_environment/structs/v0_protocol_hash.ml index 7bd35801d702b10a13f712060da1f1e105b56b13..dc8dc749e2ab58ea73ffaf38b778293b3fb82de6 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/structs/v0_secp256k1.ml b/src/lib_protocol_environment/structs/v0_secp256k1.ml index 93427a3b5f0667ecffe66afba5faf4799cdfb715..86cc861334e97ffc480832eda02bee7ee2e9e17f 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_protocol_environment/test/test_cache.ml b/src/lib_protocol_environment/test/test_cache.ml index b9e74553db042607fcad14f569dba884236c4b93..dcaa13569ca18e4602e21ce0732af8357ae29144 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 bc4bc8192c3795ceeada70d2ac5ad1dd97aece28..5f4212723b57fbf14180e2d852e723b116120312 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 c67b6a856694aee0b8f5a7a9d6118a0e2a3baa07..8b37445ccbe7396f696a83d1df184d659d1a8918 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 eb4b1bf0b81e03bec79828bc4db600a1fbc3a1c2..a16794a30e4abb70699f054da1d53436371be23e 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 a4c03e7a70d325d9fb2dc190009939e3075e2eaa..68beed662058d85b4bea78805c2cd9848225e2ef 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 73e8998bd594e20298ebe7920a696dcff329be4b..d0cb5d5f5d4dbe2d70f0815c5774950c885ccd27 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 5849472ab69481c7b1fe776ca51c443d9b39c274..2db933671b274d004cf49aed8ad5bb7a33a50ef2 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 927b904d7f9c6d7355b58a0c5cec29d4bcbe7189..1d8f4ad409c0e0b160d139d3478c17a28f2abfcc 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 49acf6166caa973c1a76e4c3551a219922333367..e604659cb653c65d180306feb7fb94d215002109 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 94c3ffc9baea4f1f11aba7576de6ec79b35ee0bb..00b55961229328ffb28a1bd8fe5e771df926dcbd 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 fd784fe2350ae20a4766d3140276cbdf98163f83..e23914b5ce7e6c25563605156b281792817ba923 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 04494cfa7801a57169eedb83c2bccd9e94f4e4d0..dc12bab56cc66ceb4cc76ee696bdbed6c8de868f 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 21536ea420ac4de2b896ef1b3740eb94c30acad1..3ac4fba51aefd3c1508b14d6c8c02ec68413ad64 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 149f67a596812994b755e96a1b8ee02e166b41e0..8f5307c1cdc001c60535257bd543b185fd0c641e 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 a039c8aa67822309432b376b77475ae351c61045..aeabe2b0c5cc67c3bb022642b9c0d8be7d192d42 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 c6abf652f1b984f3dbc38e4c5596f3cfa53b8a84..96493398b91823ec0a4b15eb2f326df89ddd1330 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 2c1178c2bb852ef971b6a24ad81fee653415e2a7..4e47edf417f8ee361eec86fcf6fc4e68a7c7ddba 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 b61c98da72077de5485409c770c690f2dd8c2455..822679362a186ecdb8485e2d196f6b44fe227a56 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 b964dde92d4268e4b123ebe509af5d5f9bdaf4fc..77d5a705984cbf3de595ccd17848d759713788d0 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 b20b50589d3c974f42a5a4a0f4b46abf3be2a00d..704d72bf218693074a8d5d87ee5302b8e7350c2b 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 6a65604fa70806c551ccababe4c884bb63c8df28..21878d41a338c6ff196e61318e75097f665cfd35 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 0261e92caaa1d1b26be2e0d88bd5e31d3083da81..594269d1b1214925d5e08fa9fbf7d529f79c64f8 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 36f1b117393ba4153bfd52200fdfdd524831aebb..fe461ac2a13ecd2c9142516fa33a9f5e57f5fac3 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 3a733510788e4db5e78c7c3da9ddc0f215927b3f..271660fc559e9a82a7567d0572e73f399478207a 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 38f8dd604e6b4528f27ca38b8b4209dd5e67547a..a5a5506051f472930815fc5f4cc7ef759188907e 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 3975836503ff25c5f2ea9eb0566e14506efe8aae..b06cbcbcf5f879881dd126d816461d4f6eeeb997 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 2bd367064c2a07daea7472d7788d06ce567751cd..e64dd16e4bd9f94e0269c73d328250c921937325 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 5ac3cfcec45e96cb62bcedb701002550880c8030..2f08bd7c732ba30b8ed4a6a114f3cd0adf910eac 100644 --- a/src/lib_shell/block_validator_process.ml +++ b/src/lib_shell/block_validator_process.ml @@ -68,18 +68,17 @@ 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: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,30 +87,24 @@ 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 + 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 @@ -146,10 +139,10 @@ 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) - ~pp2:Tezos_crypto.Chain_id.pp - ("chain", Tezos_crypto.Chain_id.encoding) + ~pp1:Block_hash.pp + ("block", Block_hash.encoding) + ~pp2:Chain_id.pp + ("chain", Chain_id.encoding) let validation_success = declare_2 @@ -157,8 +150,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 +891,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 4042cff30bddcb3217eda6a618c4ffbe6acbd377..0d98198bc55604bab57ed0241d57ff06eb7f07a7 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 @@ -129,11 +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 -> - Tezos_crypto.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/bootstrap_pipeline.ml b/src/lib_shell/bootstrap_pipeline.ml index 79d4d3fa82479b403f39637c1c7c808c08d68b9b..bf2dbc627fe9ec3c9258cf033b64a05aded52c7d 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 b75565607d6003e24b5b6f073c344c0ec5ef4e5f..d2383901e429ea529e7ef6be6b8a78ea9527b1b8 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 0e3ee53ba38ed5c7aa4b4bc3e488411e7890b21b..1d1748dbe7197bfba42fa98e923200cf888ad992 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 20b82984748c5488d49850b4169cda6bf9c82553..4e15fa460529dab7a3ab7feb2705779cd53d2adf 100644 --- a/src/lib_shell/chain_directory.mli +++ b/src/lib_shell/chain_directory.mli @@ -24,17 +24,15 @@ (* *) (*****************************************************************************) -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 -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 cd473150b59ace5f8158c4879ead646362ca5f1f..a19236da00a3f31f59d010ca66785b85112ff8d5 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 @@ -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 @@ -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)) @@ -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* () = @@ -919,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) ; @@ -970,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 94e05ce5aa7c2410a43a570e7151526b47922e2b..c01122f1b79121367b6282eb7486bd15a3b104f7 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 @@ -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 @@ -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/chain_validator_events.ml b/src/lib_shell/chain_validator_events.ml index 20f9c4df2d26d487c40a85c298c327fe4995bb89..cb4e08dd1074ceeb77077827410f397ee23c39d6 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 2eff16335b517d418ba24b7e9ffc208b62c6b070..7ca276f20c0a267e564b0054585bcfbf270bf611 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 @@ -260,7 +257,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 +272,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 +284,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 +352,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 +379,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 +397,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 53f3ef35591f2954ae615f841203e04fe405642a..2046dcb5215f9fdfd73c67459aab4407c328f74e 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 @@ -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 6d6aea5a87391a3b15990195617544e4439d256b..5574d3d6af80004e7a91e2095506f3ca863555e8 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 18f29c13b60ede6766c3360f5f48ce3d8de9ebf6..765d7b8740dc2630e0428154c6546fc10566de2f 100644 --- a/src/lib_shell/distributed_db_message.ml +++ b/src/lib_shell/distributed_db_message.ml @@ -187,31 +187,27 @@ 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_block_headers of Tezos_crypto.Block_hash.t list + | 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 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 - | 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 *) + Block_hash.t * int * Operation.t list * Operation_list_list_hash.path + | 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 - | Get_predecessor_header of Tezos_crypto.Block_hash.t * int32 - | Predecessor_header of Tezos_crypto.Block_hash.t * int32 * Block_header.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 let encoding = let open Data_encoding in @@ -222,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) @@ -238,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)) @@ -263,10 +259,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 +272,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 +284,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 +302,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 +314,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 @@ -338,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 @@ -348,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) @@ -359,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) @@ -373,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 @@ -388,9 +374,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 +386,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 07b4c768075c91536a8d5f343a42be45eb2aa505..f679bce6ad384a1b212c20a688914633b1dc526b 100644 --- a/src/lib_shell/distributed_db_message.mli +++ b/src/lib_shell/distributed_db_message.mli @@ -29,29 +29,26 @@ 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_block_headers of Tezos_crypto.Block_hash.t list + | 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 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 - | 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 + Block_hash.t * int * Operation.t list * Operation_list_list_hash.path + | 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 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 b9e112f8c7b3c05c3f5ae7ea66caa8eaa9d948f6..b62ad7ba3d2e0398a7c14a656d2357cc707a21bc 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 15bea043d1e5784500005f701fc7d90362443267..e653561cb67a18ffd456a0ad02a8796842aea17b 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 2b8e49f49de3e059157de87a79d48c763d1e3896..eae255426ae5569bb6d7eaa89639740505580f26 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 cabf30d120a89cf6ac683a0ae88d50bae1ea2cef..aa0e0357555c9456d0d325cc81379f55a1dddab8 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 8c85ccf598080a0766114f70d6e865af8a12becb..6cd83a08f0f662b65c347a3b42fce7ad105e2d2e 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 e2262a80025a6c1e8e61904216e7b20cbd9dc389..ed2a872ffe9aaa16ff6fa4240bb0d769c7576e5e 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; @@ -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 @@ -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 4e7758a2b04f939eb7592a8c993763432401ce81..95dd3dd6d844c580d5da83c882a72a03784e0ac5 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}. @@ -185,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_classification.ml b/src/lib_shell/legacy_prevalidator_classification.ml index a250d3393a0fc8b987764a25b6e35f7087bb43a2..73235679b8e65c6a1ba55fce8b79348d93b07acf 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 12b3142f74c004dd5899a57242bfc20c2f4857a7..de4b005df959bb23d89937f26a5fe212e011d2b8 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 c439968208a7a4f958d6ad8d09aed40e3a8f0ef6..4d62251fd880f0c493be22d054b0616b36929f30 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 @@ -1035,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 @@ -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 e00d725e958010f1bb844d01e8d563284d66d5b4..5243731e51174341fd425f261727761eb695f272 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 @@ -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 25d72bd1556eb80976d5419c2d3c34b0a5be2ccc..86939ff274e0235820232c3a799119d08d24ccc9 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 c56838f5718db2c1435d648fb63002929f412ee7..e1b2504cb2d04a64075a5e9ca03a6e4246e65e97 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 21d44f8e3dbfc2ed85ab04fc8552e3dfae52d0a0..1e410538b420952d6ea491191ad874ed0edbad7c 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) = @@ -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 @@ -182,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) @@ -199,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/node.ml b/src/lib_shell/node.ml index 47fd7afdb32fe206e4e0ac5c09c2acdf46f74474..f3bba45bf45494d7d64f864ccf3da84e42a8b8f0 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 c89c8e468b20e91d2bdc17aba0e04a25924730f3..007859051178f3329fe279f784ca636e96a2e5d3 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 a94acccbb97274071295bc36d1db978116fd2892..74b4f0f0fe8da144eb04adfb71a288e4fd345112 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 4d5243d35d19a659b495109a3b06dcc0be82ba5a..945db5b63dcb518845d7935def7e8589f3d95f80 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; @@ -62,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; } @@ -76,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 ; @@ -86,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 @@ -99,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 @@ -108,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 @@ -154,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 @@ -168,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 @@ -228,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 -> @@ -469,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 () ; @@ -486,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 8fa92c9c13ec173af2e659554b9dccbd40e7a25a..c6e9ffd3bce42ece1213b3b723ef45bd4dcbe392 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 -> (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 @@ -192,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 19667230c90752e9ee8960d8d88f52b6bb39abdc..82f1d6e03ee145611f06bb04b7797c601bcb9042 100644 --- a/src/lib_shell/peer_validator.ml +++ b/src/lib_shell/peer_validator.ml @@ -29,33 +29,23 @@ 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 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 +394,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 409d2d93c0ed88196e829d9fc21759a14c8975a8..3b4f42f58fdceead88bba95dbf337a48c5e0a436 100644 --- a/src/lib_shell/peer_validator.mli +++ b/src/lib_shell/peer_validator.mli @@ -41,10 +41,9 @@ 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 +val running_workers : unit -> ((Chain_id.t * P2p_peer.Id.t) * t) list val status : t -> Worker_types.worker_status @@ -59,8 +58,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 e5200973e7bdc4b1f68338aa5f758eea10ebc55e..c117976d37c89433f5619857c534b75598b118d2 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 1801fd33dd366502c81f6219eb778b3fe3fa1026..6bca8cbec751afa7de971e05cdcf537da4016432 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}) @@ -93,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 @@ -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 cd598a32e0d690a52c3d21e37c3a35a8c7d7f924..e46bdba504b2784e0472db2f81c6f8c196514479 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 @@ -183,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 fb3e77128312408eb2a685b438bf8761efb6913a..1995d1d05046b7bed6a907f678367fa091c1e11c 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 * Tezos_crypto.Protocol_hash.t + type t = Chain_id.t * Protocol_hash.t let compare (c1, p1) (c2, p2) = - let pc = Tezos_crypto.Protocol_hash.compare p1 p2 in - if pc = 0 then Tezos_crypto.Chain_id.compare c1 c2 else pc + let pc = Protocol_hash.compare p1 p2 in + if pc = 0 then Chain_id.compare c1 c2 else pc end) let chain_proto_registry : t ChainProto_registry.t ref = @@ -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 c6003e74a54af2e3ed8a5bb20a6b0392532f6a4d..48aa4d24cd075683ab05c928903bbcc746d13fa9 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 68756c2aabde6cb98d255639e314a3a63741edaa..3c409e7c6401105dc78b79781a090dd5d3424ace 100644 --- a/src/lib_shell/prevalidator.mli +++ b/src/lib_shell/prevalidator.mli @@ -76,15 +76,14 @@ 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 +val running_workers : unit -> (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 580c26d9a634d4c0339a6305680c575e3ab42a39..f37f674482fad9084a8ffd4202264d393ea4020f 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 59e98c2fcb045bf8ce84114712ea47b4e8b7077c..c678bbddd11dd1c96cdb8f08c4b206361b1dcf31 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 29a0f78f438b7859ff4fd17c9a05e8da4bd2992d..fde31b78c5b54a054fa9e056a41b81811cb5052b 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 662e9451d4f7529c58447989469cf326a448ab0c..c7a86d601de7143eeac19af9650030b710459cd6 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 @@ -866,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) @@ -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.mli b/src/lib_shell/prevalidator_internal.mli index 4eff4820e004f37c52465d34ff4bfba0e56ca5e7..66395e15b016b3ecd990d2ec3c8b822f89f59e86 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 44af56d356a95530cc7f729fdd169a9ddcf7a63a..5bec2002a65e3499001c67880b5ab536ed777fff 100644 --- a/src/lib_shell/prevalidator_internal_common.ml +++ b/src/lib_shell/prevalidator_internal_common.ml @@ -27,12 +27,9 @@ let advertisement_delay = 0.1 module Name = struct - type t = Tezos_crypto.Chain_id.t * Tezos_crypto.Protocol_hash.t + type t = Chain_id.t * Protocol_hash.t - let encoding = - Data_encoding.tup2 - Tezos_crypto.Chain_id.encoding - Tezos_crypto.Protocol_hash.encoding + let encoding = Data_encoding.tup2 Chain_id.encoding Protocol_hash.encoding let base = ["prevalidator"] @@ -40,13 +37,13 @@ module Name = struct Format.fprintf fmt "%a:%a" - Tezos_crypto.Chain_id.pp_short + 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 + 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 e58326b0a475e3547ea8e1ef56657fffb3ffdd15..bc893bd043482e1de167a0b869ab1db010ce4df0 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 * Tezos_crypto.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/prevalidator_pending_operations.ml b/src/lib_shell/prevalidator_pending_operations.ml index 9f6762fec385b4bdba6682efdebb02268b700796..63fc079f482dac61bb7b11ea095817c10db28d5d 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 0e2d9f7b3589d2cf93e64397f9078bda7bda23b0..6edc03352a50c89ffbdd6e63fdc3926490aee0cd 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 d1701b112c752f1671d1d96a439d7ef4d302154c..c9b241850362b38fbea38643adae07ce22d4ac09 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 a2c08b701d8d68c39d493328ea661444a95da97f..2297222eeb248da844666cec287608de9da76f38 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 33281e37d040a3327fa9c3a289b7ccfda2f29a9b..ca1e65baabc6cb12e14d3ac4efc9eb1821644339 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 e080d62858e8c7e0b90a4a3984835e920482327a..5858320264a30a0495073ba8b321be34ff96a5b0 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_metrics.ml b/src/lib_shell/shell_metrics.ml index 31f18168a82c2c9351e4e88c1dcf95437b173ea5..12c97ec0a8dd243318f7e65f83d21d6c0f2a8427 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 4d48caa26fc9d19d3950f62fb59272a70cd65a70..c1766349fefa203e986965169bbb884319869c68 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/shell_operation.ml b/src/lib_shell/shell_operation.ml index 39f03f9705725b58b149637ba581c8194e07cd22..03bab55f3477e5a61770cb2ad6e03a543952ca9d 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 d24888df62836ca2b48c0cba45c0da343330f64c..9fbea1aded360599cc11ec35303d53e56266a7c3 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 a6ccbc7f0bb413965c9e24b9151efcfb03c711a5..3d6cda2ec5bfb5f5dff0e7c2e01f965222f054aa 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 d0b38cba6667ec8a56ee13caa8aa12d66ec51aad..5543fd201de1d85a1ef7fbe01e3d192eb9facdfd 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 5363f282bf130909e41a40d39afa3bfe2f918a35..4d8fe2f36c718546f94cb2ae27402e42e9d2459c 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 2cb2f9e91e339aeb78a9fa1b5391ab514b988645..e5aa008f59f61edbbdc64bd842770b6ff1806982 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 92c655daa2b7f6b733847e0e0518a0487ec362cd..2605aed41ff3a78c15ea8fe4ea40c6f48a918749 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 3073ad0abb6746b6468b3f70335592606b54b70b..b2e9993d21be2b80eea23f327bc73496f2e67cec 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 1b80851d16fc437ce05615dd99b8693c953afdca..e21e1315f80e80cd7cf646183928e30c8b92c8a8 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 f0e6b16237c381e7562820144d378b8fc578746a..986dcf9300de47d7ec61d2cc526fcb76715ada74 100644 --- a/src/lib_shell/test/legacy_test_prevalidation_t.ml +++ b/src/lib_shell/test/legacy_test_prevalidation_t.ml @@ -67,10 +67,10 @@ 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 + let chain_id = Chain_id.zero let genesis_time = Time.Protocol.of_seconds 0L @@ -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 dfd4134ef4c967473a79683f24d0c108fc722e5e..52b54d170e0e6c0bb7192beea24854b4cef0c262 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 4d6dda41ea73cbe1a2d53ad200623216531966cb..b6ac4681a727d0982b0a0be2d5b7c0d871876396 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 51bf868e6ea80e7847ded9e1e3eea11a12eaa4b9..654ac4c0ec31f3e8c03c5a935cf8e8e919883d70 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 4a397ac7e9dc61bbce84f71adfe0b8ae7628c699..1771f7ef59b10a887dc9d06cb3bd4e29c6a38a8b 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 @@ -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/test/test_consensus_heuristic.ml b/src/lib_shell/test/test_consensus_heuristic.ml index 5a042e6c3c4478168c39ddd7707580c383d2c90c..f4d814ef7eed8b0bf30ed8b37593d0ccf08190e4 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 cf30321e9540f444d96bd0e357cf317bb042043f..1f032341bc1c81046b706b47e43cd598a7cb9de4 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 bc4dc67da1147e217ce39afd53018bf98e9f6cf1..7731c4a3022e55df6f2ff92e7430d6b59f373f61 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 5cb75702e1cb936316cd125bb164ac82f1c2b2c4..113d8f1ba8b8d17af5bdb7370be68736d61a949b 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 b4928d749b63562563e963fb7f9bbdafcdba86b3..77fb127dc71e11836e29815cce4a407caccbf7f0 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 b3f47b968caba4ce75370d74cc8f95ba635ea8f2..9a368eb8a5edf0201d965b1cb9b73b2eb3ad88be 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 0f491e4cacdb417838674fd47a486f1a3a0bb731..33dcfdc49c7d18aac1d054815f51fc9638274ad1 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 1dce02e0e9fbc260898a5c77ca0a074574228d94..dc1f4df190543aa9d6b947ff79c3f5204c59a3e1 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 2381a3865dc31d596ef794b32015442bc4ecf48d..753558b4333ceeb9f79f40aa7ec957dfbca3f59e 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 = @@ -117,7 +115,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 +130,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 +147,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 = @@ -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 @@ -202,7 +200,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 cbcc8420e8c8750a9d0b443d3b35e6918fef1e02..e1a308e0e59ad3954a9125446fc0b1d7fb275a0d 100644 --- a/src/lib_shell/validator.mli +++ b/src/lib_shell/validator.mli @@ -49,24 +49,23 @@ 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 -> - (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 -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 4da070bea4462ef1d0790e5540b7d831dbaf5489..dbf986dc4ceec2d01b2eaa2963326d00580e14de 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 da2abfebabcb292445bf13650600fe6c2ab025c6..6823c7dc3778d2a6d87c1ba664fdf9b81208fdd8 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 4888a24d89e750394beb4cb0c2401d31a19c7a84..e18e1709c30dcc602d1d9044d8f2d88474c04ef0 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_benchmarks.ml b/src/lib_shell_benchmarks/io_benchmarks.ml index fab45ee1e149877e93d67c50c7f1e26ad2f55f84..cb17ae2daa4037d0dca33ee32bad0903133645d4 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 ee13463f7673900c6f41cc89bffb02b29815ccf8..eebf86966707be0fe97ac3433501d285e350b89d 100644 --- a/src/lib_shell_benchmarks/io_helpers.ml +++ b/src/lib_shell_benchmarks/io_helpers.ml @@ -37,15 +37,15 @@ 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 = 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: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 616a831aac873f2c1b4cc6105d7227d24ebb4e2d..9da34320ea382e927cf6257e03b980d502b2215d 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 @@ -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; @@ -397,8 +395,8 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct Proto.block_header_data_encoding) type block_header = { - chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + chain_id : Chain_id.t; + hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; } @@ -413,8 +411,8 @@ 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 "hash" Tezos_crypto.Block_hash.encoding)) + (req "chain_id" Chain_id.encoding) + (req "hash" Block_hash.encoding)) raw_block_header_encoding) type block_metadata = { @@ -493,8 +491,8 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct | Receipt of Proto.operation_receipt type operation = { - chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Operation_hash.t; + chain_id : Chain_id.t; + hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; receipt : operation_receipt; @@ -543,15 +541,15 @@ 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 "hash" Tezos_crypto.Operation_hash.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; - hash : Tezos_crypto.Block_hash.t; + chain_id : Chain_id.t; + hash : Block_hash.t; header : raw_block_header; metadata : block_metadata option; operations : operation list list; @@ -565,8 +563,8 @@ 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 "hash" Tezos_crypto.Block_hash.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)) (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 64eedb5cdb17c4f6ee9ae96609d3979e86868e30..5c0273d168ad3f575cc405f54c03c7f56a0f083d 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 @@ -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 : @@ -139,8 +139,8 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig } type block_header = { - chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + chain_id : Chain_id.t; + hash : Block_hash.t; shell : Block_header.shell_header; protocol_data : Proto.block_header_data; } @@ -160,16 +160,16 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig | Receipt of Proto.operation_receipt type operation = { - chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Operation_hash.t; + chain_id : Chain_id.t; + hash : Operation_hash.t; shell : Operation.shell_header; protocol_data : Proto.operation_data; receipt : operation_receipt; } type block_info = { - chain_id : Tezos_crypto.Chain_id.t; - hash : Tezos_crypto.Block_hash.t; + chain_id : Chain_id.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 9431af68deb4dc85a7b9061c59b54d8f5eff2148..4a0731054cefdee713318c2f45b3dbc8062e4aad 100644 --- a/src/lib_shell_services/block_validator_errors.ml +++ b/src/lib_shell_services/block_validator_errors.ml @@ -25,31 +25,27 @@ (*****************************************************************************) 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; + chain_id : Chain_id.t; expiration : Time.Protocol.t; timestamp : Time.Protocol.t; } | 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) @@ -143,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 @@ -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 @@ -280,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 @@ -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 c9d0a555012d899aa351570f7161ddbcdc4916ab..1a5c333cc9010a62837dea789da3e0ebec212c46 100644 --- a/src/lib_shell_services/block_validator_errors.mli +++ b/src/lib_shell_services/block_validator_errors.mli @@ -25,31 +25,27 @@ (*****************************************************************************) 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; + chain_id : Chain_id.t; expiration : Time.Protocol.t; timestamp : Time.Protocol.t; } | 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 f1da6c91eb5f988f9bcb4a55de0b6a6bde40d26c..40a69a775ece5086b2df823fb869af2b16fa21d7 100644 --- a/src/lib_shell_services/block_validator_worker_state.ml +++ b/src/lib_shell_services/block_validator_worker_state.ml @@ -25,8 +25,8 @@ module Request = struct type validation_view = { - chain_id : Tezos_crypto.Chain_id.t; - block : Tezos_crypto.Block_hash.t; + chain_id : Chain_id.t; + block : Block_hash.t; peer : P2p_peer.Id.t option; } @@ -36,18 +36,18 @@ 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 "chain_id" Tezos_crypto.Chain_id.encoding) + (req "block" Block_hash.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 @@ -80,9 +80,9 @@ 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.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 16b2e8ac749b6b1df83947b44a6279ffdc12676d..fc0cce8985a0d4cf5544100145ee8a43556cb9c2 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; - block : Tezos_crypto.Block_hash.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 72e205ee42e2ba08b16e7e648596e55ab1f302f1..b5d11f60eba26d17df9fdd390b92dcbbfcf73e9e 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 @@ -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)) @@ -75,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, @@ -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 c114b9c98d6b9ec5167397cd7df266129012d4e8..365e8dcb347967527275e922ecf5eb404f9e03df 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 @@ -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 @@ -44,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 -> @@ -57,39 +52,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,24 +91,14 @@ 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 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], @@ -152,7 +128,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 +137,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 +146,7 @@ module S : sig prefix, unit, unit, - Tezos_crypto.Block_hash.t * int32 ) + Block_hash.t * int32 ) Tezos_rpc.Service.t end @@ -181,11 +157,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 +178,7 @@ module S : sig val get : ( [`GET], prefix, - prefix * Tezos_crypto.Block_hash.t, + prefix * Block_hash.t, unit, unit, invalid_block ) @@ -211,7 +187,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 63edc1a4e5a7ced6e353ea37680f8d7f1e6d75a6..c0b8c5a7a0480bf4fc7af0022bf272cca4e10a20 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 98ef6d6a724f16a53a48d17345e58c00b7db4d88..77467fa78565348decb05c766baf63b588d77af1 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 95fbc16adab3f5e66e7baa1c11bd71a4b3321a1c..9b451c8a6945c6d857acab38c47a2bb88736d705 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 de2eca18ec9c6c9e44b99744405af90c8af796cd..532acb97fe6eed5fc9947eedd9edeed14f153a78 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 e6d5bbdc79d51b4eef8723a073fd73ba074311de..f409c78c3b5275e3ecaf9fc9eac8277917db60b7 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; - protocol : Tezos_crypto.Protocol_hash.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,15 +40,15 @@ 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 "test_protocol" Tezos_crypto.Protocol_hash.encoding) + (req "chain_id" Chain_id.encoding) + (req "test_protocol" Protocol_hash.encoding) (req "expiration_date" Time.Protocol.encoding)) (function | Active_test {chain; protocol; expiration_date} -> @@ -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); ] @@ -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 @@ -110,8 +109,8 @@ module S = struct ~output: (merge_objs (obj2 - (req "chain_id" Tezos_crypto.Chain_id.encoding) - (req "hash" Tezos_crypto.Block_hash.encoding)) + (req "chain_id" Chain_id.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 b74609efb1aba15f9d29992dff7c04b36a8e1ead..47aee81f5f52cd542385249e7a80d459e75cd789 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -26,42 +26,36 @@ 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; - protocol : Tezos_crypto.Protocol_hash.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 -> - ((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 - * stopper) + (((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 +69,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 +77,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 ) + (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 e7d112d50c6652cf41671eb41bffbbc21c7c28a7..099d11dc11ba0776e995c07530f1230d0d7c4ba8 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 36f870f80406be6b4a8a581d5829c83bda720642..71b0593df9fc037969eb77ed3b2d15586f19c5d2 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 df8f2e405e3678fe0b9d98946969136d5743905c..04d0f350196475b19020ed098c49d858ca4b9e56 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 ef2ae2f536f3b0072053f0a95a6da3fe4c3de1e0..0ae05104776bb8d45c2565b55da0fdd7155ed9c8 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 9d3ab0a5a172826d15aab02da3cf6c48d2f20b01..05ed0d89168f890adeae76d39ead05fee3b9efcc 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 45a1dbd103043f4b6cb0df132cc98672effd3789..b29de7ccd9ca85ed812c6062bc602218c0b03cd0 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 92e7e2ad8ed2bac42ff76504a23b54159fb1ad78..3420784d0c67b6119b5d11f613b66a10840e65d1 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 40e6e010b4c94be5e6c6d7f6da97ed7f2d356a0b..eaaed856b5afc25f829070273640fcbed59c03b6 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 c0e6d9db95319b437c35dbd9fc991803b9674165..9b68a3e2b0964ff500e231501a0e93ce5d1a088e 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 @@ -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 4f78fd9458cb645949c01f9f18dbf10516baf733..f1fc6538f3553b21efd69b994e067590555c1b81 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_fork_testchain of 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 @@ -887,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 @@ -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 c4b605a405ca3b5510d37f684b7393de9ded1261..596f91b897a1c1834f7b69842d8f8f0c26d67645 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 @@ -117,11 +117,11 @@ 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 -type error += Block_not_invalid of Tezos_crypto.Block_hash.t +type error += Block_not_invalid of Block_hash.t let () = (* Unknown network *) @@ -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 @@ -158,21 +157,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 +184,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 +205,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 +221,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 +281,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 +316,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 +341,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) @@ -381,10 +375,9 @@ 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 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 *) @@ -398,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 @@ -416,7 +409,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 +418,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 df095c309ee2b89f74ab27cb1c8c155697a575c9..b182a73cce9c9bebf928e4c9aa0ed279fe335cce 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; } @@ -43,21 +43,19 @@ 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 -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 ******************************) @@ -83,7 +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 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 fb9e03d5ecfb8e8c0ec4f2c3ab6e1d7be102ad04..338aa75336947f3bd31189c7275bc0d71d9c5853 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_shell_services/worker_services.ml b/src/lib_shell_services/worker_services.ml index 3245dfba835492e8faf377efe06639e5a2e1c2c8..bf47950fbcba007eaab06aa4c0cdd43c5578569d 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 4d753030145b78d664a03a6671425655cf0c06b0..03290b29b86aac4c5da670be2ca1586b480e692d 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/encrypted.ml b/src/lib_signer_backends/encrypted.ml index efbcd0e7f6f0e652c431a94beb725f328417f879..45de1d2275b377a43fc3b752d3bb0505e2000fc1 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.Ed25519.Secret_key.encoding + Signature.Ed25519.Secret_key.encoding sk | Decrypted_sk (Secp256k1 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.Secp256k1.Secret_key.encoding + Signature.Secp256k1.Secret_key.encoding sk | Decrypted_sk (P256 sk) -> Data_encoding.Binary.to_bytes_exn - Tezos_crypto.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.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.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.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.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.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/unencrypted.ml b/src/lib_signer_backends/unencrypted.ml index b91d3656545af0092e6c43cb8c4a5b65627d1ae4..93f6a324d862b805380b94cee1f3d25d1f3ba484 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_signer_backends/unix/ledger.available.ml b/src/lib_signer_backends/unix/ledger.available.ml index dde868147fbd605aebdc1bcb1ff57d1bf5afd4a9..6f3f3cb0a543b36584eb1836a679b541385b775a 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,9 +327,9 @@ module Ledger_commands = struct match curve with | Ed25519 | Bip32_ed25519 -> let signature = - Tezos_crypto.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)) ; @@ -344,9 +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.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)) ; @@ -355,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.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 @@ -382,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 @@ -460,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 @@ -766,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 @@ -815,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) = @@ -892,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 = @@ -1044,19 +1019,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*! () = @@ -1076,7 +1051,7 @@ let generic_commands group = pkh_bytes in match - Tezos_crypto.Signature.check + Signature.check ~watermark:Generic_operation pk signature @@ -1085,13 +1060,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) @@ -1224,14 +1199,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 ())); @@ -1269,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 \ @@ -1314,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 = @@ -1338,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 @@ -1356,21 +1329,19 @@ 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 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/lib_store/unix/snapshots.ml b/src/lib_store/unix/snapshots.ml index 73123a2157ac9e9f0d97c4fee178cc63cf2e9758..a597a9f2797c017de395076f70b11e2fbc7f1c68 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 5da6fff72a1d26ae022af9024d9c2a77337dfebe..e6fefc7a00ffe540a3f2ea4209f0ddf9d329d05a 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 c5f451c58e3f7a85873f554efb151dc9d1fae5e4..703486ac17700dc429d15073e0bfbe8bb820d5db 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 f579ead3459456a25e1632814b2daaf10c5086b0..6a08fd53bc5dae93414c09e9ce21afb9ff5147bf 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 94a9d85396945eb95cd17c47b8be67ee7165e2d0..297c7c02b8d91d7b914c8da15bd7b41c1e44d93a 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 8dc408a5dffd193bf835fad3676fa5cf6d06d21a..48873f112af472d1ba7f0a4ea589f7ef61261791 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 d65c64bf9f139f0f9529e86442fc6952eb2a3e0c..eb2b3dc003aa961a3ff1083e80b41ced344fe438 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 1b70305c8faa00df1c968f38dd8f1a333f36464e..9e8d3ba7cfcf7ac7426bef9cf5de99784dc00a5a 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 f919ddc635ae7bfc4652362268e76e660d7f2673..75bf9108a83132bddce9397d084d11f18ee53fa3 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 d2a08cabec07563b29b0e126fa7ab0f2bb556530..21b0b3ce6a67beea9f543720fcecebd2487d5193 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 2b1de34c283ab2284e729460cd742c8d6db67af3..f20ae1bb7b04f45a20bcea2b1e5b08591affe665 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 afe05faed866da0059103374f7b9e69564a49671..f99e55d74c8b7c1584ffa6064f3714c400d68236 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 @@ -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 @@ -416,7 +416,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +443,22 @@ 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 - (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) -> 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 - 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 4e260b6ac2b65409b3ebc7ad5f23c1aecfa9a1eb..0ccc7d54b04f5d6a286f8bd2800f07447616dc0f 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 41581ac0d854e584ba8b8a426806c69f101c10ec..3f3da27cd5b5a3ec099ee55bb0c81ebaa21882cb 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 e751b37023ae0473d897caac00828d9dedac4f05..b9f204f06001b057bfe1cfb4d00288e783c91342 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 237e6b7892ea7d5872e2c7e87866ed8145d2dccf..1600023430f5b8b548e9cf52143e1aa5464ad3cf 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 @@ -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 @@ -420,7 +420,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +447,22 @@ 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 - (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) -> 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 - 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 3d30e237fb6e00640a49c73d57525f7fa7d6140f..ae7a815ae8b75b579be4cca3515d0b5dd6dd6b44 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 f5c75cb5c99ae9cf3dc5e7af0ca236d671cd3a10..3f652ff48fe3b97cdd6c273c6094dfc7f3610bb1 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 6d62e5b5dafc473e2bb3b4a3ba77e3b599d2803b..a7a63b7b8358d6bd1083288d0158958d4a59b2d7 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 604e83f4438325d4c64b47df03f1f620ce0cf5c3..fb21d6c53a6e9878b4c58a7687c3177d5e4b52c7 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 1bcf19505aa25904351dd527f77e1282a4c31949..6db37dbdebc2370179312dc6afc44c76563e601d 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 @@ -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 @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +458,22 @@ 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 - (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) -> 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 - 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 81393dd717c2166cbafffab301a10187059b5969..23bb9a2dbb2adddf80ab9fbd9ed87f338f76369d 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 15b99695466532d842204bc48a13db5539afc953..2ea0586e11644d04288ef6e9d333aff29a91f2f1 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 dbacb43060eb4928ab2eeed61456d30cc979b5ed..6c80ff7576b718a9c6617022c646d90cc97d8b60 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 73fd63e7fb3b3e3c8138f007bbf522c51f5090c4..db294df5861a678ad7fba70a671ba7e5bf1a0ab8 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 1bcf19505aa25904351dd527f77e1282a4c31949..6db37dbdebc2370179312dc6afc44c76563e601d 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 @@ -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 @@ -431,7 +431,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +458,22 @@ 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 - (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) -> 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 - 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 81393dd717c2166cbafffab301a10187059b5969..23bb9a2dbb2adddf80ab9fbd9ed87f338f76369d 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 4755d6e0a58226a4e509e4cd5b8c9c4368fdf94e..d94e5f48906adcccdcc50b2b099cb6c4130d42e1 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 f72ebca96287f9afbb6b504a29e18b8c7720cb0c..a4133965562a759960a50d07642995be77b1ceb1 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 70a862de2a5cf015fc6d3bff7fdfa4c5aa3958c2..4b01089a4cd5836760ae5ae75d3ca1defc82d073 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 17878cb4e928b2d5b437ce95b5fd121c610978a0..0fa6d4b862bb4589673d91bbbbc75cbebef81d76 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 9a773c603ca2fa63b9b2b1e60042122080c67623..ac43d32265cef097e455f1aaf650fe0e14a2d8c7 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 73cb9d7b4e7276f4526c88a2738dcfc2796fd1a0..3ae8af786db4ae4db05ca8e83ebcd5d4d157b0c6 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 cdedc77f8c1f9327482ac4b484111a42fc75acd8..46c3d69989cb3469b72d38b4bcb0194119590525 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 @@ -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 @@ -436,7 +436,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +463,22 @@ 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 - (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) -> 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 - 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 443f6f27b3fa3f0922998a2919f0f72d4a38f038..6548da803750eb9fd67d00deac7d16f6126bc414 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 b2c47a58ee82680907c100f7590d046d072845cf..e36889788ac246ad27c075a0a1adfd7735f4cce4 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 2f45b33b519c151f5d906402ba44e5e0640fc74a..d83fe226c32aef9eb1d19d4a3787fcf7120cce41 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.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.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,7 +301,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -323,14 +323,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -356,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -371,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.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 @@ -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 1b18732eac64ef1535786b8e1eafd1f20ecbbbdc..92adcff6c987feb4569779ee3fd6368aee66df60 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 : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -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/client_proto_multisig.ml b/src/proto_006_PsCARTHA/lib_client/client_proto_multisig.ml index 28013b4f34f96e80caf2935ebb74c08263151ac0..ce6e8aa11bef1e891fbf00de7b9da2e908137377 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_006_PsCARTHA/lib_client/injection.ml b/src/proto_006_PsCARTHA/lib_client/injection.ml index 9a773c603ca2fa63b9b2b1e60042122080c67623..ac43d32265cef097e455f1aaf650fe0e14a2d8c7 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 73cb9d7b4e7276f4526c88a2738dcfc2796fd1a0..3ae8af786db4ae4db05ca8e83ebcd5d4d157b0c6 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 6edf2fc4ab3e03e7b635fdb199988689ae23121c..c9c85f2645f60619caebc5a2e48677d5fe1e2835 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 @@ -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 @@ -432,7 +432,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +459,22 @@ 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 - (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) -> 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 - 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 1bee6defcd5e86f4cb7eb8274949c73a31937173..a115b2734a16ebb0540920ffc2e34120925e56a1 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 f2b988f94741ba68017a4ecc1f24fcf5205ca614..b7f0befc854ffde21f3372829c20d139d6eea7c6 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 fe730a5950f3e7f0275e4835f8d4fbfe2bb1265e..1f9125eb2c817617d2d5b76670b16fbb234faaf2 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 b4fb066bb904e3844fc17112241775b99b8aa5bf..ade19b02248ab433ba77adc143a030bec1385aa6 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 e55afc20088a4aa479a2e2234a5d7338d0e5709f..93b83f017b7bbc5698258fd32577ce5f26b29a6c 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 @@ -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 @@ -428,7 +428,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,22 +455,22 @@ 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 - (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) -> 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 - 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 beb4c7a2461b3b3bc15099a1b6a4e15e662ec326..bad6e90f5d0548089556c3c731359240f1ac8408 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 9a3db57e93a4979759861e25d57b07eb8e8b06aa..2b72065887b574a7d957db89ffba6c0baecaf480 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 37b6d9c4913a4c05cbccf6b034f010673cdfbcd5..ac9266343c64b33b99abf4bced5638edfa27c6e4 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.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.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,7 +350,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -398,14 +398,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -431,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -446,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.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 @@ -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 9563d549881770517818438f29e5c31913428c62..fc717f724f73af857b791157f3983ed1d0ab67f5 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 : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -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 15bd3a52a821b1874e05bc78661773b6859cce13..c7ecbb59e25d5ab8153cf1476f3540cf4be98292 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 70f5dc785fbc20af585b44c9c3e39c75fba88bed..6f3cae1e82e1763935998f4513c8b45fd111d092 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 aa3387c18cbcb555a719083ecda08b85e1e94ab2..d2d74bbde99045d3545e71780cb4ce02c37604c3 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 @@ -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 @@ -435,7 +435,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,20 +462,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 81f3851ec0f2b45f80b13c12549cdd20e0df0830..ae70157175c10afc5e619efa2e30d3879fd29d30 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 0336400af17d8beb213ec9168a52d1e9f57635e1..f60ae99f51f4ae774a556259a579f531e72b2628 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) @@ -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 65e91e0d2b8cd13eab2a71bd880676d9180b1e94..b5be2a22e48c745d89588f42269a29842f48742a 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 ec934aa60b147647ef43a8d829057cba743b326e..95304a6d38649971dfa083c783bf5c2e101fe3b8 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 5b3e70e8593c81785ca8ff37ecd9a0c38ec51869..61064f3c23e40f5c43cf486d23dfa46da271cad1 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.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.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,7 +360,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -408,14 +408,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -441,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -456,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.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 @@ -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 c0119412a5e9a66907a113258dc6c3cc1716c112..215ff3b60060c9e703bc1161237167c8d1aa7c02 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 : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -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 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 71e263a0c28bab818c2f5e099d1f1aff01b7dadd..8280da1a2bb4c8085035b248119011e8c33aeb35 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 721a0cec81bb7ddb6271cddda92b1c2b523b7c07..61d6b9eec6ca48950e11f4754ef5dfbf620f39f5 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 53793a4626904e0f0fd44d027c92161d898f3330..b56c51b4b88551e6beb3c28dc9e66086420b443b 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 @@ -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 @@ -440,7 +440,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,20 +476,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 99d65369a1f33e3e24b7e1f35122d7c182d45261..7836774dd2ca231723fb032dbf68b2dcfa3cf4f7 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 dcccb7d3022bacd100ee0b89c8856375c338786a..d90e50d5cb844fa30a70412000f4f099e6ce94b8 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) @@ -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 16b4036fd0099c27b6f5399544ff07a52ce4c2e7..815936a4808c70f337b54f40bb6e6293aa9b6e7e 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 d0c9373f64915e40f709362de0e600d387c25344..5a683c4cf432087a217d3dd36848b3a441bcd7fe 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.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.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,7 +387,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -435,14 +435,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -468,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -483,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.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 @@ -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 eb5f6b84f688c120df65240250eb9efe35903146..85cf93811f68c1f5c3d700f5b6702ff9b3a9face 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 : Signature.Ed25519.Public_key_hash.t; amount : Tez.t; activation_code : Blinded_public_key_hash.activation_code; mnemonic : string list; @@ -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 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 1acf3ac2cee55ad33593466fc88f4d208326c197..f64047a1a11a5cbf84a99e7c1b092a913959e423 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 721a0cec81bb7ddb6271cddda92b1c2b523b7c07..61d6b9eec6ca48950e11f4754ef5dfbf620f39f5 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 d523d820b06d3cc72d505df9f4cd05f487899d12..813e4dc0801fc5dbd348b68d53aa968791d75434 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 @@ -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 @@ -441,7 +441,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,20 +477,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 73e71ce22ba85067db24002164904268aef9d88d..e1879de4a41bab42cd1cd926bd391868eb841e04 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 8156bd8acae5844abe5573b9cab330a6173b62c5..5d8719d35214b186bf766f6a32056ef8ff58f9d0 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") @@ -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 3f1fa76ad299eb08e32b2f0f7c4c71d17bbc828c..ca2bf2bc0c2f2ba227a0a62b2f812e1f2562415d 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 27b93db0aaa65f75bd700b15486f1d6d6a3b2fac..a8d917d02bdb7916052dd24f258dd648c3170635 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.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.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,7 +431,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -479,14 +479,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -512,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -527,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.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 @@ -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 d69f8508bae74e539b1551534de499a9ee31283d..19f564a0e5cc471e64229b924746d7d86245094c 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.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; @@ -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_multisig.ml b/src/proto_011_PtHangz2/lib_client/client_proto_multisig.ml index a81da970aa4946f338469cb1a23595e41e93a50d..957b4ebae6d5e931ede2fd1d807173e8da189a50 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/client_proto_utils.mli b/src/proto_011_PtHangz2/lib_client/client_proto_utils.mli index 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 a908d99be6b79edb9df0837573528b68a8374d7f..eb67f8adc79a7f1c8495e6fb6c9579dcbe686433 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 c2d4543ad3f17cbb152a3db31eca2d1f13beb47f..5f751ea5f3c9ff413e28d4f91a68bc5c4bc0fddb 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 4f50d6bf929530a4f54bace10ba502c4847d4186..f84ad9f56771a43f05f6c51a7d714af7d293d5d7 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"; @@ -772,7 +767,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 +787,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 +866,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 +894,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 a12e60c070fbf24b1c467472f412bf7985b1f064..92dcf24f9f1fd143bc30fa889c1fbfdd4e91d1d2 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 @@ -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 @@ -483,7 +483,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.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,20 +519,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 abd459fa2f3bd650fef5f6848fc9bb6e9158fb84..3e1068d9ae59d3f824c968b4f3f1708a568ab8fb 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 1d391b6ea0e025d989e4ca257c9002355f964258..d3b1dab83e8d3b3181ebda4eef03c057064744d8 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 f3f792dcd88d41ace000de4d80e980826f73964b..652a15fa25196cb248e6a75541a047a70e189509 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_client_sapling/client_sapling_commands.ml b/src/proto_011_PtHangz2/lib_client_sapling/client_sapling_commands.ml index 83d70508ebab99a106b3588a926c37d9849e850d..4deb5cb61f2568eacf75f13afcd0a76c59208da4 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 2aff412d886fd50b62a751858fcc6003369db2fb..7ee6543e5c78f149675ce860406bf84dde9e7054 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") @@ -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 5546ab737eaf4234fc9624e0b17487857f89280b..1bf60b667fcae5190b224a869c4cae18e65022f4 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 3521d905700b3a230a0a8573bd9dc52005d83726..f1c29fc9773902e5dab53390cc27f2fbfa647b2a 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.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.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,7 +467,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -515,14 +515,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -548,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -563,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.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 @@ -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 9a7f82db020c06fbe4cf65cf878518c8c7cd348b..3aed4fae594374447484a66d8d585389bc435f59 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.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; @@ -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_multisig.ml b/src/proto_012_Psithaca/lib_client/client_proto_multisig.ml index 17bb493cf1d6a67b0a6a4a3b287941b8cc2ad6a8..a684482be2e7caf3e679db36d6a5e718ec3e1bca 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/client_proto_utils.mli b/src/proto_012_Psithaca/lib_client/client_proto_utils.mli index 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 bb6ecffd90e819597d2d8176778600121117ef40..b0735485a7d2335f9bbff0f270b0a9488816f8ea 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 c2d4543ad3f17cbb152a3db31eca2d1f13beb47f..5f751ea5f3c9ff413e28d4f91a68bc5c4bc0fddb 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 aa36f7fcf0e8506ba6b13c7100100d2cebbbf752..1d3ec2e34a33fb2f42ebe4dce561cf50b10a4f6c 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"; @@ -862,7 +857,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 +877,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 +893,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 +1002,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 +1059,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 287e33a26296a3b9fedf8748ce07246b68dd19c9..f9d94f94ef5866fe0cd6fa66ddc0ed52f851ab95 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 @@ -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 @@ -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 @@ -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 @@ -609,7 +609,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -618,20 +618,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 18efe19fa6bf4fe8bc81eff889254b98b9ef8f5a..db20cd916ebffeca9646f7f26d4ef78f526e3a02 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 455b51c5a548cc628791719b91ef42b0ee33fed5..61116e10efbce7d92804e1c61333754a381626de 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 5ac220ef57280aad81bf39191fdafc933a07a941..91437eaa2c9549637de3fb3410035ee060130c72 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_client_sapling/client_sapling_commands.ml b/src/proto_012_Psithaca/lib_client_sapling/client_sapling_commands.ml index 83d70508ebab99a106b3588a926c37d9849e850d..4deb5cb61f2568eacf75f13afcd0a76c59208da4 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_delegate/baking_events.ml b/src/proto_012_Psithaca/lib_delegate/baking_events.ml index bba61a50f803ea7f5b328b45fb1a032bbe705aaa..8ed73cd0eb3bb2c7e56642556422de886534277d 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 011f0e04eee13448263e2e76c463ae77bdbbd2b4..c53a64c397334368b5a75ef0387b495ccf1f7ebe 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 486e104b4fe32e2da63323eedca2f069efbb3d01..373e64e68f6e31a586ce06c5a65d4ad1957d1232 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 = @@ -1614,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) @@ -1678,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) @@ -1817,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") @@ -1836,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") @@ -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 558578b8fa239442462e973f980b8dd180f0353c..8286540fe1a79482555a7f0d9470935dc9c5c0ae 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 cde3d18f0432f9ac2852d23c1d00d7565e211b52..c7f8abc9532657a48ebd825479d371ae4a0b45b8 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 8834918aa8ec5f942eaa44241061ebfdf6f4ae57..79f5183822674b213dc287884d69a0fe0b8a543b 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 3f8c2eb0741dc9fbc96784be106a2451dfd68f43..b0c48d592ae23d5ee838dd9ff31944ddd1355bb7 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.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.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,7 +514,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -562,14 +562,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -595,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Client_proto_args.tez_sym Tez.pp @@ -610,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.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 @@ -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 5f86e0f29fd073546dd761609a6a3674de4daf02..76df19dc2eb6bd08d5abdd6a95000081fe45d967 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.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; @@ -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 : @@ -432,12 +432,12 @@ 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 -> - (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 @@ -456,14 +456,14 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -509,13 +509,13 @@ 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 -> 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) @@ -534,13 +534,13 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -592,13 +592,13 @@ 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 -> 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 @@ -616,18 +616,18 @@ 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 -> - 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 @@ -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 -> @@ -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_multisig.ml b/src/proto_013_PtJakart/lib_client/client_proto_multisig.ml index 268dabfc214b26c4e654c4cff828ede2d55d45c1..3308c632f02a58892fb71d72dd683160c5639537 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/client_proto_utils.mli b/src/proto_013_PtJakart/lib_client/client_proto_utils.mli index 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 ae3b812b3e49fa8341e246fa00f122354b53b388..6589bd23a66ac57e57eef692a80df7273d313d94 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 0aee0eef507f8131654297e679ce06bb968a29a3..251f2f2ecb672f5feaef7a2fcb77b0dd6f2d110e 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 fc7086309623ee99db24606fb59b372652fb2a61..b692107b993eb5d76b6810c04558df4380b94e48 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"; @@ -1187,7 +1182,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 +1202,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 +1218,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 +1327,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 +1384,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 1f9e41f109037c771e429f52e1bdce81c22c2b91..52aa931c23eb2d0fc4eb77ec0f733d9eb63c5cd8 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 @@ -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 @@ -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 @@ -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 @@ -1035,7 +1035,7 @@ let rec pp_contents_and_result_list : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1044,20 +1044,20 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Single_and_result (Ballot {source; period; proposal; ballot}, Ballot_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 - 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 4fcf55f896284e022228a87e7e3736c1203ac18f..1bc8a5bb8f40422ba19c197a6cfb33128d03a7e8 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 2e2d806d72ffecb6b4067c8ad22713e19d6b1b23..69b88110dbcd02013084b058c6314cd487dfa123 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 ddbb4a024c97ff6019efd552d86f6f352a4c745e..113942e6804178bc56be5bb86848aed728448d69 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_client_sapling/client_sapling_commands.ml b/src/proto_013_PtJakart/lib_client_sapling/client_sapling_commands.ml index a2be98a4ddbe1ab7c0bb39541823b27e92a10adc..4ca7762802666b59d616161de493ec27e8ad6ff2 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_delegate/baking_events.ml b/src/proto_013_PtJakart/lib_delegate/baking_events.ml index ee28698ff8094ec0d3d5fbc5163600023b928c9b..8a148aefb8e7a612cfcef1a99871cae28a7bde0a 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 274e77d9c8f65f95bc7b13bf9ac555e16cd37319..5774869900d59c72c83f9561bda423e57bfe0ca2 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 69c4376cd88d904ea99de9f74aa0ab4321c28e65..162a9278ed1140542c2c545e54cecc3b77cc9547 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 6e9cbff0c20db099af25f65cf15d2c2500846250..081dc1e98615049dff6dba26215160e8c5fb2d75 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 120fde84cff8e91b59af0e4e7f63eb4e5c71623d..9941a6928cdd8e28074e520b222d65cb3e701a95 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 6e37f06fe5077d42b7b31d3d905936e1a36c9435..d55c04db2f11122f1b168b3f69f4de352acc481d 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 7789fe3352a6f366237925e0d21f99d82d5579c7..b22dbdd7d6a574709dcdd23e398f9168425eeadf 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 dbb2eb77887a54a78fa141d435f41d698049fe7b..c3200598c92c0f9f3379bf16fde3ae70007486c6 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 3633c6397c61ea58f3091815bb1012ae63c63a8f..f64be4e54cf5a5e9403727f30a8eb6bf8b02ef9d 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 21b13fbf32ffc1b49c608ee0c2d8652c341ee792..6dc5bdeb9cd85f191a23eafe80a7fc403ee888a1 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 886bea1d5f55e18e76b6876f138a8439d21ec34b..7f97ae76a32346e420320ea8f27c5a9656b6da8f 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 = @@ -1712,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) @@ -1761,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) @@ -1777,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) @@ -1925,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") @@ -1958,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") @@ -1971,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") @@ -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 d8954ce3578bc13ddfbb0856f036e43abd22a5be..760873a95274138ddb975542ec1d92e7f7ee2648 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 e4d4fbf4183e2b4891d2765241fdfc4a4800f5fb..bc871b0523d4f8fc2bec4e9813a601f5b508e5cb 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 a8140d2b736f6c01cb49f3ac2d0eab586ec2f854..0e63ef373052ab457780838d3ce77a392fa68f11 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 2435305cc82030d3a8df1d8d00934f0b5b454447..be4359ebe5118369b9cfee870461a47c67d69731 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.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.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,7 +548,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -596,14 +596,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -628,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -643,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.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 @@ -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 ce1afbf2f68711c36890da4eeee9835340af0261..533b8b0368103ff1ebb896f883ec9070ae13f414 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.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; @@ -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 : @@ -456,12 +456,12 @@ 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 -> - (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 @@ -480,14 +480,14 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -533,13 +533,13 @@ 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 -> 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) @@ -558,13 +558,13 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -616,13 +616,13 @@ 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 -> 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 @@ -640,18 +640,18 @@ 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 -> - 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 @@ -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 -> @@ -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, @@ -831,13 +831,13 @@ 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 -> 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_multisig.ml b/src/proto_014_PtKathma/lib_client/client_proto_multisig.ml index eda34eba7679cf4e9fc0c19822b21a9a18aca210..6e6d4587ffc815bfc9711c35d9ca30bc86dbf94f 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/client_proto_utils.mli b/src/proto_014_PtKathma/lib_client/client_proto_utils.mli index 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 575fa92eed8cdb229ed74f51176255444e5c4f74..8311605b0a12b66f9032d5aebb3d5710f65d0c22 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 1ab767fb6bf210130f397e279ca3c85f3c05e917..8b07fba5f375803768ef7d38d98c2c04c60571f5 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 82ee7b04c5fe8a7afd66ec82d6864207bb7d5d28..5c37f9dfef34be4c9fe52431f6921d22406b76dd 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"; @@ -1372,7 +1367,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 +1387,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 +1403,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 +1512,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 +1569,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 394f9e9a3411d0947ff58ec2263f970f4f80f158..515d02156faebed8fcf12931e0641d33d3b8bcff 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 ; @@ -926,9 +918,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 @@ -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 ) -> @@ -980,9 +972,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 +987,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 @@ -1008,7 +1000,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1016,19 +1008,19 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_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 - 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 4df92d400a6d735ef03d10b25ec020a8681d5af0..0954933c0a34ea303a65ddd2e6e9ed1eec8a13c4 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 1e230706ce4e92d26492b2da3f8617064a83c0d4..2c9f83d1c52e69c54f74cd92d9f68eead2dc7010 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 4b2bce49ed42c2231ae45eefadce6a99f25ba2d3..bf3a395b27528f1dadecae5a6c0f4f4b78f5d478 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_client_sapling/client_sapling_commands.ml b/src/proto_014_PtKathma/lib_client_sapling/client_sapling_commands.ml index a3350a3cf1893c463341eacf0e2406ac70cdf2a6..639238df40f01fd34a3746cf9ddbb3357a4c354d 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_injector/common.ml b/src/proto_014_PtKathma/lib_injector/common.ml index 69c4376cd88d904ea99de9f74aa0ab4321c28e65..162a9278ed1140542c2c545e54cecc3b77cc9547 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 6e9cbff0c20db099af25f65cf15d2c2500846250..081dc1e98615049dff6dba26215160e8c5fb2d75 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 120fde84cff8e91b59af0e4e7f63eb4e5c71623d..9941a6928cdd8e28074e520b222d65cb3e701a95 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 6e37f06fe5077d42b7b31d3d905936e1a36c9435..d55c04db2f11122f1b168b3f69f4de352acc481d 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 7789fe3352a6f366237925e0d21f99d82d5579c7..b22dbdd7d6a574709dcdd23e398f9168425eeadf 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 dbb2eb77887a54a78fa141d435f41d698049fe7b..c3200598c92c0f9f3379bf16fde3ae70007486c6 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 3633c6397c61ea58f3091815bb1012ae63c63a8f..f64be4e54cf5a5e9403727f30a8eb6bf8b02ef9d 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 21b13fbf32ffc1b49c608ee0c2d8652c341ee792..6dc5bdeb9cd85f191a23eafe80a7fc403ee888a1 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 408b715712e48af44518bebe7b1d834213831602..5f1864ff4ef430efa3b03534da6076f9ab713082 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") @@ -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 307e259b2803c705fb020a28843aeea5bd19e7f6..b2289ead86d8bfdd1f3254cb2587a9294b2c4f9d 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/bin_tx_rollup_client/commands.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml index 1456382e394b7866d9c223f1262f1bbbe9464a62..387373af5c6a5d0e98f28149ea38f207ff526da8 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.Bls.Public_key_hash.t; - public_key : Tezos_crypto.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.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.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.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.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.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.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.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,7 +825,7 @@ let sign_transaction () = let*? aggregated_signature = aggregate_signature signatures in let*! () = - cctxt#message "@[%a@]" Tezos_crypto.Bls.pp aggregated_signature + cctxt#message "@[%a@]" Signature.Bls.pp aggregated_signature in return_unit else @@ -834,7 +834,7 @@ let sign_transaction () = "@[%a@]" (Format.pp_print_list ~pp_sep:(fun ppf () -> Format.pp_print_string ppf ";") - Tezos_crypto.Bls.pp) + Signature.Bls.pp) signatures in return_unit) diff --git a/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml b/src/proto_015_PtLimaPt/lib_benchmark/execution_context.ml index 4770923fbc71e275f0dcf2c529a7cb17fa7cbb65..15cd7024ac313e47742ff52d6c14865ef35f470c 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 @@ -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/michelson_samplers.ml b/src/proto_015_PtLimaPt/lib_benchmark/michelson_samplers.ml index ed701eca32ce877e173731330465261a4fb7360e..ab56005225f5d9a68f28bc7a5b1d8e9f9aca9eca 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 847b8406a4a3c80fb2a9329b80064e2a9ba33b11..0cdffc62d93c14fbbe1e2f872c61774d3ead9b40 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_benchmark/test/test_helpers.ml b/src/proto_015_PtLimaPt/lib_benchmark/test/test_helpers.ml index dfb174654cb1078763e12e23f04305b91c9a703f..7c818134d2ac14e89f39ce11c8d39342bd4902dc 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/interpreter_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_benchmarks.ml index 835e4e2035cda8a908990b1c9db499fb1c5d1946..2757ec3b52b63e53dfda3e00e4c5ab4aa17c4817 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/interpreter_workload.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/interpreter_workload.ml index 032f8fb857bc5468b127cfdb1ac50f6a3f4e0cf9..41e2f1e35d78f4e8a150fa0c35095d48411423d1 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.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.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.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/sc_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/sc_rollup_benchmarks.ml index d843da786e4af4fa4fc9b983d04eccfc2b66b0f9..d635611cad20978933f308280ae61435c5e3a381 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/storage_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/storage_benchmarks.ml index 7d35f3d0e19c685b1db7d3a0b920c0a3a67f542a..61b48a3fa4e0192c17bea8a914eef8cb6e2cb21b 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_benchmarks_proto/ticket_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/ticket_benchmarks.ml index 57f93ff31797983afea55554b0fb8cf8ced4c14a..41ec36327341aebfec604382951c3053679517ff 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_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_015_PtLimaPt/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 079352eb2f917fafb73583e86cf7b617afea079b..d9823c555b37d543b555853aaa6dd880296c5ec3 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 () + 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_args.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_args.ml index 2d13cc8e3ca51a3a1feb5446328c9bcdd79b5eca..f8ae1a374598dc937412148b52df567f5f815e4a 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 39946abf4a069bb9dfad05cf0353197c3407c347..7b6e3abf965e9cf881c422428e681492d1936c1b 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 5f3ddb053db59868d0a5fbb8070c38c8e2b71d6b..d0af983ca345aaab68e3b60f77b536e3dbbabb93 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.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.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,7 +655,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -703,14 +703,14 @@ let read_key key = in let sk = Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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 @@ -735,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -750,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.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 @@ -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 37b0b362034fa798d2530fac9c89b66dfc84805c..4d97f637c14aa516ea0a0623c25031de9f88b542 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.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; @@ -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} *) @@ -572,12 +572,12 @@ 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 -> - (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 @@ -596,14 +596,14 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -649,13 +649,13 @@ 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 -> 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) @@ -674,13 +674,13 @@ 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 -> 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 @@ -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 -> @@ -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 @@ -732,13 +732,13 @@ 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 -> 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 @@ -756,18 +756,18 @@ 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 -> - 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 @@ -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 -> @@ -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, @@ -944,13 +944,13 @@ 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 -> 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_multisig.ml b/src/proto_015_PtLimaPt/lib_client/client_proto_multisig.ml index eda34eba7679cf4e9fc0c19822b21a9a18aca210..6e6d4587ffc815bfc9711c35d9ca30bc86dbf94f 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/client_proto_utils.mli b/src/proto_015_PtLimaPt/lib_client/client_proto_utils.mli index 7393491c2dac9550055db52cb79be105e06691a7..a229531b1cc381d4a3cd240ea75036930efc0de4 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 6d6f8e519526b8293e2a19bb5215659595b3bcbf..0839fc53fc7847ccf857348bc82c2b7489ec2114 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 1ab767fb6bf210130f397e279ca3c85f3c05e917..8b07fba5f375803768ef7d38d98c2c04c60571f5 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 c1a05a03d092badcf43affcfda9ae9474b276ab3..bcc326b62f450d52e29781cee4add09a0dffa36b 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) : @@ -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 aa12c1b8024fa65426711752f0a70cd572c800a5..052d4e863585d60596591696a65e25f41d0b916a 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 ; @@ -1057,9 +1049,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 @@ -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 ) -> @@ -1112,9 +1104,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 +1119,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 @@ -1140,7 +1132,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1148,19 +1140,19 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_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 - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) @@ -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_client/proxy.ml b/src/proto_015_PtLimaPt/lib_client/proxy.ml index 7fc6fc607b08cfd8e8868fabcd005dfc254c8bbb..d1ee80868ae57438a3e7ebda2d60f8f65b12f98a 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 208eba2140d4a2423ce06251f22135d4c1479a91..39c075d4fb7762ffc9f6652ae490fc3ee4bb576b 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 30b70b3765bdb6b6c901eb202a4a5bc2bb94cf45..2c1f6e4b871b8776308c7849016b919651b7ed18 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_client_sapling/client_sapling_commands.ml b/src/proto_015_PtLimaPt/lib_client_sapling/client_sapling_commands.ml index 30f0628da78f9f1497ea9864a6da223e088fa461..ca67d13fc54eef35c5897d2bb224700d5c88f0a1 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/abstract_context_index.ml b/src/proto_015_PtLimaPt/lib_delegate/abstract_context_index.ml index 54b73da7c42ff4d25f837acdb62d38d7bf089bd6..2e54f32fdc1398787ea5bb20ca04aefeee2427b3 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 9a825a14362099d57c4145deca6f7a72d7581ccd..5a280d04ac579a0d7f27272693335772133ed201 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 1d5ffa81cdd21f3a4a0b97b259da211ef2fdafc8..2af2842c77778f69f2d414b629c5867765945214 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 db13c684bf3ca974c707445bd17b31e110f9cc8f..2b8dca57b0f677def353758a78797b583054f4b6 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 cd5b5a445f410f06e2252e2c3cfc181b9b4483d1..a1908d29dd229c880ddde6d955c552046951b30c 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 30ff8ba7911dd3cad17f3a6beede6a9398591c5d..110ce38543661f136f9202b40e5da2ac07b776e2 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_files.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_files.ml index 67ef0c7ea0d41ac6183d073f8141d1ef0c1e8732..38339e2fe5554dcfaa7e5140ad6c95acbd5568a0 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 82940952da0594ad680d177bc2b8858034d6ee15..01146f7d0744cc8501dcf8766cf5308a4a29652b 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_lib.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_lib.ml index f1b23c4582c1ebc49679863c706a9030f6bf8f89..7ec3ae000cd5f97e8fc8281126379232137dee2a 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 6ec9597c9ff936baa23f14371e779cf7ffe9a7cf..c9e0f6bc17c71c644bcc47a86cd330927912fbec 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 df34657eb90184427a210ee60998691268a81075..6e69b009180d71e8d723a457918adb678644abd4 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 -> @@ -101,8 +90,8 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + chain_id:Chain_id.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 @@ -119,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_scheduling.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_scheduling.ml index bca851f697d8fc61c6ef1551a21ed7bc4712c503..38d42a06cc3df5e395c0c4bea0b847273fc490a0 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 39b641175d4584f7b068e40f37bb588af06d8cf4..957768d1b412cecb857d1ed8198d34a5ac496cf4 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 d6d45255028ec1557e21091bda50a299b53484cd..0d0c7ac9f4d2fee3a7036c81a7ea04ba7a581ca5 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_simulator.mli @@ -39,14 +39,14 @@ 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 -> 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 387055676d98dda7b3850e4bca9cd5a2c329690d..673ea58c98a1252240741aa1b8c02e938c801b98 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 = { @@ -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 *) @@ -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 @@ -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 @@ -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 19437bc5b7b770af30666a22634b2fecd38d0c34..d14ca69139a0a3e8568ca30b3c04cdf7b59e59d5 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. *) } @@ -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/baking_vdf.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml index 23f95c9075e6426d2f4f7518c3c5caaec945385b..621daa8e402241e5b267ff0188439e843b312e08 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 3301fe0c874362509ac91abf085bb7b922ea3472..ffb4fb142e8af4dc1f1f569010f6c02dced0b8d5 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/block_forge.mli b/src/proto_015_PtLimaPt/lib_delegate/block_forge.mli index abf60c86d8f48481ddca29d943bf8b1dc712610e..b111e27b417c4a67c69c1b2160ee019ae9620e34 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 e192aa649a72321f3bc1937a07d74f566703b7aa..d7064545b7bd8efa0e0006d20db6ef7d0312f553 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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,9 +80,9 @@ 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]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -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 @@ -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); @@ -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 07d582b6ed9b751676c7f047c5699e322f1aace9..c3358f61f82fe49b043dd42ef343bff002a3e3e6 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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 45a81bf1421b4c06da1d7f2ad7c1d4bbeb38819a..ec3ca7c5ef9429e8d1a3ea4e8fac37a7b1dc0141 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) @@ -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 836c95f1ad9a653f4a88e02cfae280dd59d0f762..ba2cfdac03b3b0acbefcc66990a0cca6383e5a8b 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 ca4361b2dc9690eced2bdb72c8d47085b85c650e..20f5d091dd9c3a155dff1c91a0ba02cdf3ad6efb 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 6756e73e07e693e640fea915e1af95a0a774798c..ed9cb18c9db3b27cb86a0f8b5f5f4bcc9c855936 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 96749ae7c4de311741f6eb465e8c8d04f87460e8..badb4fc204d42364219001818f351c7c8daa0cb2 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 55694e129b5509a33863c7c97c50f0bc0e211b32..2dd0468ef6f1855bc275498e55222843081afc95 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 16ec9eda7cdb9c441a75fa1daed8f52fd07944e9..7e0a7612054e446b008c291c4546fbb377c8ed99 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 4ce38666a3a084f3d5b43355781db896ed4e7889..9ffe7c25d8b7574db37daa636010b8c5ebbc3d07 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 3ab72a91347c760ed185a55c0b4810b4fe91c93d..78caab5c158c3d401e4c0f6d260c19a6e7621340 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 5589f585649f0354cf4417cfd995c743b4c0a50d..66cec572347651296554b8d4e8e3903d5c979027 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 ab66270bfd916453e2a80837b510ffc70f5d9921..eecbc990f2d1cac38bad3dc7d603d2304f255015 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 71c79251fe67847c25b2d33b7e93b7bedee7e19b..6e8dd27e628468da9c64a5493c1d137d5a965e28 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_client_context.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb02c44758ee75789b7d49aadfcb3f2..ededa688a755bef410018cb3c96f8e08f2959627 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/faked_services.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml index ee21b96b07c2271922b2e8f7b6d4947f663ab0f0..907d280256fc455bdd29ab87ae25099c3526f7d4 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 f8bfae831a30e150faf5323bfd09371b75d759ca..699b2c666812aeb31e57110c8e97205e31bfc7c2 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. *) @@ -82,13 +76,13 @@ 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 = - 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 2c6652a1ec2e9219607f366e5012b686b8124c7d..93ad9eb1c1bd74b594e500220c083dfb1a0bcadd 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 120fde84cff8e91b59af0e4e7f63eb4e5c71623d..9941a6928cdd8e28074e520b222d65cb3e701a95 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 6e37f06fe5077d42b7b31d3d905936e1a36c9435..d55c04db2f11122f1b168b3f69f4de352acc481d 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 d742edb00e33c143aaed13a7f0aa153e2193b97e..21624cbabb24497cc1309caba03df0de5c201fa0 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 83dd948534f94892d5f9ac4bffafada12cc42cca..92bfa39debeb1b9fdbd8a3677ad9545c308f53ad 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 4f897439cce8391c9cab9a8da069f0cf9509b4a5..a43177e316f39bc6dc048163fc8e9e78045c84a6 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 e7d81d0a117191977e19c71962dad425f70ecadb..3c9fbfd829f90b7a35ff7488ee9b5dbeab28e971 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 102fe5188ce76f150769b4fb19e2cc9318ae7888..dbcd78388ab5144302eb2ab14a049c90676ea239 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 21b13fbf32ffc1b49c608ee0c2d8652c341ee792..6dc5bdeb9cd85f191a23eafe80a7fc403ee888a1 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 71b53d5f8dd92e241573e5a8884c66dd9cb3b414..81d0532d27df189fd6dc4ceec2d41d090f356fc0 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 c63c5a825ac0c07bdfec5eb59efb46392394ee06..1c7775bca0d9620b8a52c0f9fb607d9a060c5338 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 d84714a3b984ec0fea9b10b03d881f866537bbfb..1b5d344cd38bfdb6aec3115b1bd1d667de70ec2e 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 82868acd43f26e88e1177d956ac755b173a09fcc..bb48f3b41809b171da774f103be4651ce66172df 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 0b92f1f4ca4cf986ac61b3b139239e8ae5d495b6..57402233a49e2a128e60f1bc831509bef25e12d0 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 877e1a528f8a8a4b998dd1e171f3fdf4259fc28e..2e69c4ff73d312c0eed3ccbc7bb730d6af0d2619 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 f96f148c96165b7f26de8b098dabe1b3f9fac8cc..2fbfdaee89314fe893963135d034e88cb2f8c070 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 ccb3d64f6c9ebcfcc2e5aa741758e29ee7e548a4..636a08f629c401cb96d6f67473980b6ca5ec6c41 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 @@ -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 @@ -247,8 +246,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 +261,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 @@ -407,13 +403,13 @@ let initial_alpha_context ?(commitments = []) constants ~typecheck ~level ~timestamp - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult 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 +425,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 @@ -448,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; _} -> { @@ -620,7 +616,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 +633,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 *) @@ -682,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 @@ -727,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 @@ -749,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 @@ -774,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/block.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/block.mli index ace3a64907cefe87cb0cfe67f78a4a633dd931bc..419c1c7f413fbf17b1e9c21b8d7ba29f5df3ef19 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 ec12b5ee131b4f8af685cefb1c41aa3b1c8967e4..084e3f9193f709bbb83d48485f14ccdb4d028ab5 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; } @@ -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/context.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.mli index 7e24aa16026b78bae80754f1c5d518446dec3d4f..9ab8d2d67e771c404333b5186a523af734865d49 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/contract_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/contract_helpers.ml index 46449066c26d0fd96470b8d8ebf9ba9102e318d5..933dedf75c7fddedc7e609ef0c039e6ed8dc6509 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 1d7ecf55267bc9fb715c18d072c8e64a73b6ea13..417c950bf2b53bc6b2ac14ff7659695f7cf4f66c 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,15 +115,15 @@ 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}; } in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> @@ -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 d16ef42873da5ac493728a7dd6704312de047388..f1ba80254e61f6bad2dd80b3589f7bf9e08c6b4a 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 @@ -90,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) @@ -124,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) @@ -201,7 +197,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 = @@ -519,7 +515,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/op.mli b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/op.mli index 81f688cb95c97f2fdb91491523925502bcb64d6e..a87292d3c40f7248653af0caad1471a3b422e5a1 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 06b2c0f01df6d439ffc3783161886d433ce8f289..e949b07ae1b5a088cf3ed4f7dec68956595b7c43 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/helpers/sapling_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0116d8d90ae4c54c6bb902a7b5c8c..9bf2f8382fd8428422e08e572d177d15f237630e 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/helpers/tx_rollup_l2_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index b8b174bbfe49659422f5f83809079f0ab50355ba..fae2e10c21b1e3aec6306efc46a1b185c698d387 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,11 +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.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 @@ -154,7 +153,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 -> + 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 +165,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 -> 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/consensus/test_double_baking.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_double_baking.ml index 54b91e324963f1bd3b5948c0e93119ad38b094b1..38feb23f0c56d71e751048dd3442a270d6037ebb 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 fe6b64532d72c61ef4a6dfe7687d44873ca20976..c850d1ab41268fba32f7b3135008fc8014c9902b 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 367d7638c59c704a82f947e920e95a7a4bf3c64e..f8fd3b785bc8cc649f1695bc1618301296cb1cc1 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/gas/test_gas_levels.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/test_gas_levels.ml index 76118c5804b3851659daf6700a2711b06142c822..678a6c79844c8eb5b3f2b51a04c2284eb8779d9b 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/operations/test_activation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_activation.ml index e3e1c1de743aaa912d89512aab83d016555274b8..eb61f0dd7c42e6491df371099a1245798a1cc1dd 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.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_sc_rollup.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/operations/test_sc_rollup.ml index 7fc6ef508ec058c85c0adf76839e2544e9324c12..0df656f6fef49da917a1fe7d688b16f2ab96f7ae 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 dcfd3149f7e54cd65fc19611ae140d7f0d0fbeaa..f7ae246ea29aee65500a3fef7692236e1801c424 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,7 +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.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 @@ -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; } @@ -2503,7 +2501,7 @@ 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 @@ Signature.Bls.aggregate_signature_opt signatures in let batch = Tx_rollup_l2_batch.V1. @@ -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 1562c0e6557503ce86c1d731f226f9ac62eea49f..564da54a3ddd6594f7ee882e0940206dd6c55af1 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 1ccd4bb94fbc44f3fee5cc494c525632200bc26f..45caf4c30d470b3184f070b06072c65a8365bf01 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 3ac42bda8082b70e3523387f93cee5f72cfba0af..74fbac6c983eb2befd0a4d6e13ae8c506501ae72 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 52f4307726297c53c84a416cd7d31e7eb711dc9f..d33e29fc18684022e5b680dd07d024f922260409 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 1b9add80bfa633d4a52f066a9dd8f43e0fe5367c..df118ca15c6fb6e5a64abcce45f16d6898f19341 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 2644cd2788d35d4375307f608ecec3adee9eda0f..c3a847e2529347112ead65a043bfc3e8467bae61 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 3630b43d19184c5c386dee46d5286dba45598846..f4d4699d7ccb0011241c2d747f0a072705d9b52b 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 @@ -108,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 @@ -140,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 @@ -156,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 @@ -185,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 @@ -277,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 @@ -302,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 @@ -354,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_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/validate_helpers.ml index 375fdcc756657dd21a93b83dc5c4529bf2e68345..cfbb750ccd664e76ad0b8dc79b9c6aef27080383 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"; @@ -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 : Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -103,21 +103,21 @@ let secrets = let passphrase = Bytes.(cat (of_string email) (of_string password)) in let sk = Tezos_client_base.Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.V0.Secret_key.t = + let sk : Signature.V0.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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.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 a2db3fb5b46bd2a50d66162ecf8b268f2384b089..cef46fea7eebce31cfd0e82b971b7488bdb4e914 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.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/regression/test_logging.ml b/src/proto_015_PtLimaPt/lib_protocol/test/regression/test_logging.ml index 7a72864cc718d13af927540b897cacc6edc9108b..6ab68e63171fca74a5eddab6160729a7a6539f86 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 d60870eaed669e5f77b4d5e811104b8e5340d09a..db3f0dbc5c7951364b0434818c3971f8efff6899 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 fa610715c7c639c4c62f6a3f686e64f5629606ae..830251241aecf68704369a74aecc79cfc2f7bac7 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 bb41400a8ba208f3ca1f09c6cda6c198df64e070..243679fc39509af5836fbbb7fbb7d03c2c8fb8ad 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 19cbc3fe4bdbcd820c048614b06724e679710302..6e828799992d7b0879b4fe5148966b998cf18387 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 3c414d957337ea3d041c84065dcbc4113f515828..e210c85abae55baded6b6931de6fbd3b8e81182a 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_tx_rollup_l2_apply.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index c5c000e6de9b751f8df328d4ca45b6abb4eeaa5c..66b65558e3d09fca65005e1382c818f9fc98eeb2 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.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.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,7 +280,7 @@ 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:Signature.Bls.Secret_key.equal sk acc then acc else sk :: acc) [] input 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 d3d748ce1b3414a8906c7886cad76d1e4b15eaf2..8b833c33f33457455537c4886f3786d5e755e17e 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 7b683e61678bc5648784c41e2606bed3f745e151..18cae2c014ea28ad6aeb6aff2cc74be524887110 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*? () = @@ -418,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 : Signature.Bls.Public_key.t; } let address_metadata_encoding = @@ -429,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" Signature.Bls.Public_key.encoding)) let balance = Tezos_rpc.Service.get_service @@ -501,7 +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.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/RPC.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli index e3062f64be6b9077bda2ec1a78f0f5ae93d4ae9e..f15657a1fca119cd907f8545e410765bb988e5c4 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/batcher.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/batcher.ml index 35f152099d46cf1d8c616b1020e132922a90bbd4..4241399ae2f03623cd1afe53388bc0490cc46882 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.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/context.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/context.ml index bf3f172fc419570f860e81d7054184bc6ca0a4ec..d34031bfb9ac4737d8f3d73daca0244aeb683cb9 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 154f5818a38617b66aa90dfb7055eade9300645e..5c781082268dc228ba4a9c607d287a3c79c45e7b 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 5e95ec3c32f225d993536c3c7646270a03273656..13277743addf7ee0a6ede59d810875e5dbf7d947 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 2d2f7286b60ffdbea2735b4d0fbb1106a3029902..5c396b5a3671ec1510d545e304ad3eef74365ff6 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 9a64f9f157349caba5cea4e1537dcfd6d9ad1ebb..e97224f42dfcfd589d3d7226fc5c1705913a60ee 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/fancy_l2block.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/fancy_l2block.ml index 196a618b57d65929d3d19671a6975e23f9fe971c..d72cb447004ec01733a7705009f76af53fc11278 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 = 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" 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" 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/inbox.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/inbox.ml index 40bdec5a250ab02a4a96cfa201ac9625f7eaa565..0129b636d6651833f17136e4a157cb8ac407e63b 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 9b874b09d8669a50bbda615b7ce310536b868845..58798b6a839fcb29ea5c5932c85e8b07680c93da 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.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/l2_transaction.ml index 15aa8a7e9041b3449d69cff85c9c5101e4086016..1f2b690b7dbbe08300be4adc48915949cb257319 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 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 + |> Signature.Bls.aggregate_signature_opt in match aggregated_signature with | None -> error_with "Cannot aggregate signatures" 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 d431b65218d69191720e36f07f036429b3ad9a8a..0fc583712472c53f9ea674fa8a75cede3f4a30f9 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 aa1f6ff01081dfcd7a2a7ac1aaca8d0065f78d2a..4bdac8ceef4fcd7820caffbf94094821305a0ebd 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 a5176b6a5db65f0133c863d88f0afb0dfe2c3acd..b4cacf8ba1b99425e5951c85c66bca6ba2aa9139 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 21895ff640dd757e40b0cbe5acf69eed49159094..8c34ba3d8740dcca5d27c67b3654464a9b91a69f 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 dd73a1ce51f600a3e80e5ac7affd5841be2c9a5c..34affe284b618793020b8caf0672164c06706d7d 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 7687f5fbf55221399b9773735c18d04a762a742a..0fa2bb8ff6901743e63befbe5d35ecb90a1655d2 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 cae8329b01091ce71c4108f4d7152b45b55056a6..287ab3861d7c8065138fa80d9118d504a1444d95 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 4fe448e05fb55e8840d14ae6c2588177a08094bd..ca55fb24a41b8500354054b1dca712103bfa90f6 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 ac2201e49d44a17fbce6d205e11405d00625ecc6..63afd1221a6d1ae3d50f9817e382cab7229aeafa 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 0c9c6fa822915743afa259caa738a0c1cc239053..b1a5c83952f212f13e1a43a9b1d03cf7d448d225 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 0b5faa4c6cf25ba7c986befaa630c912ec858fab..b8527a2833910a9558dd5fa3ff3f76c5a811bea1 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 8444a987b87c44152bcdb8c10a5ca0a01c905ce5..92e338776b9c05665a19addc927214542f4cd78b 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 0df91a965c46de08830287dea19dc6b3141a4f7d..f3d0059b22e4521b9c53cd008dcd2c3f65274ccd 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 76a0f70c2924f459c71591a70118b672d621d814..ce4cfc1769bbccc3adece9669a6ba90d381219a6 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 262676f62d4c80e4435e004f369584076f61c3ec..236149238d40c6cacd006e21eac31c2ebab2fe66 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 8b99312a3dce16f2209d81d961af2df4530a8149..61958297e722bb7d4de13475ad244361e43683ed 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 6f6004363c7a8711995964b7500b7cce22fb43b5..67e85d657b02f3da6fb5e041e0de4d847b8e7fe6 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 3a1af0ef89506a416ccdac1f1be7fc14bfb4eb54..66accb28c14f0d15b1b71994a113584c384fb450 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 0e77b548a6011761faed07145439b3d2b8cc2aac..458d3735649f52a2329da5a84d25daf87b330334 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 c66573018673ae56a7f194123b2a2585a49bbb5e..84ed4506c47f31ccd7ce935589470a5057a2ff8c 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 07aa6a1facb4fcf116aebbfc59ac1d31716566fa..8080b46c2a9463dab8ebdb70d4e077f7809a3671 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 4765aceb02d15b53ccc68c08dea340b3caff0eed..7323c3b5197693b11dacc4c72778ce29703442d4 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 b3e57760ef6b40cf88e0a51a23de423b38f1d2d5..18d83fc56dcdd5113fdf528aa536bbcb4fe3aef7 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 c56ea8ad6ae722b792198320e04787f5dcd72478..72a3b8200880eadedfe867fec3747d53a9e7d5be 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 e3952b6503d4a58dbe6305825b1eb6b857aa75de..6b51421e12864f70a00ef6056d7154c845097f80 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 95fc601d3ee6fbc8c49fd9e4235bbc9b7411921f..b47052ff448da78c91c85397d916e47ae7cd1d0d 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 94457c0091f0e6f4c320015c2bf3dfa52ee219ba..ab5c194a6212972e7af2d8e572d702ff889780e5 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 31aae66ddb528f96e9113f2a5641806f8f90b307..6e9773d48ec283c97c84cddab6fbdbe083b59434 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 467da2e23f72a256a50e0f6173978ecaa6e53151..5b8ff83a660c8f47c23e8596b35c9ee19b2aba44 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 3611b0e41cca26bacd35af34e8be9fa6c7758a65..fc1769ceff9d8faffe243813396365e37b798a2c 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 ceabd95165019890c2df93aa02a6a9762dc55f07..e4fec530e84dbc7269a647a56ea5c3da94e5c385 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 25d2ec2c39239878a5c2d2eb9ddc71d81293d66e..9072a881472507a9a8fb1786b4630982f5a6e361 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 49e0da506df7f1723f4ed14ebd11283ae6ec1f50..ad4faaedfd0e23577009ad9b78da288bf4302897 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 7c189136e987b644e2a77a6534563b990525ba0d..9c71b60c501714b678da0663d7aa6ed4a2b13322 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 3481f831c419a3e189af5c62ef37fc82b2ee6ded..a5c7335a19bd270b14d1934065ca6013bac6e96b 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 3889830f6dd263a050cd0ef2ae2cb6996a370f13..2c7b9924c0fb88c097fb495fef5aa60680dabc40 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 c30861a40e78f86ff6558fc773af6516ae6ec816..05766389c95a9c899d88151ab37cab50fe08e1b3 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 2003cedff97d98038ca168247be2ebdf818dd6c3..a7212fc9ee040ac08b24b19e12797e17dc801a6c 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 @@ -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 c9a9d36e0612a490fd85b527b7b57a077acd082e..acb279a10a407a44406e103432a37c35f3826ba8 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,16 +101,15 @@ 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 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 + ~nbytes:Tezos_crypto.Signature.Ed25519.size rng_state in Unknown bytes 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 5677355b0bb90c5a4a4b4f3222ddcf73e66bc5c0..8d5db86cc9ed35d7ec3d61b65cfe1fe4d0febe7f 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/interpreter_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_benchmarks.ml index abce296bb5e266c24b0e03a5acd9c34442bb49c5..113abba968ddf332029454ec9090d2f7031428fd 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/interpreter_workload.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/interpreter_workload.ml index 90b96546a05288b3aaf9cc3aedcf9343beb0bd85..efab9da028b3c7413e199e7677d1f00c758f1d26 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/storage_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml index cffa19ba6874793e0628dfef84832e3febe9d0db..ff1b31fbb1c6fb821966f522741ac8bd407d5c0b 100644 --- a/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_016_PtMumbai/lib_benchmarks_proto/storage_benchmarks.ml @@ -68,11 +68,11 @@ 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) - ~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 1e05cabccde144325185b1f91b11a7b593e1ea78..237da10839e002aa28c50af02faadc5160086bf7 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_benchmarks_proto/tx_rollup_benchmarks.ml b/src/proto_016_PtMumbai/lib_benchmarks_proto/tx_rollup_benchmarks.ml index 093ace757effae0e15f8997d05a9b048b7565a61..a3034da86548dff32e3ece38e75cefc7aaac35a1 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_args.ml b/src/proto_016_PtMumbai/lib_client/client_proto_args.ml index be80dbb4b9fbab5e55772259a59dc0ccecdb9f61..330e5aab280ce66e894d1fee2e88244860a1d969 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 bf35ce4dae9c1ce9a2a0a717f1934bf073ce92b0..5b600ccc4d50c86c88581a9ae0064892ec530977 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 d3baa40fd962fbebb8f26c5ffad078511bf3ae89..2db3f6c84b83e12ff861f09d9b20d771efbb12e2 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 @@ -808,7 +810,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 +918,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 b078fc504922c7e40f0acefdcb7243845d46d262..5bdaa5d75cf9a1e818e7d51265b1030da8a0725c 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; @@ -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_multisig.ml b/src/proto_016_PtMumbai/lib_client/client_proto_multisig.ml index 9d8d9e8e7f7ea7c7d7548f173390204b3cfa6ab1..891572c2e10e7a67c66dbf2f39faa75cb7d478b2 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/client_proto_utils.mli b/src/proto_016_PtMumbai/lib_client/client_proto_utils.mli index e222f1745aff227c3f3449ee6678d70836377e6c..3c06f0108ea85c46b2af7b685991fd5b36961059 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 307aea3af98e6a788ba912750d3742b2954701e2..1ae1dbcef8e9c548df976d5890fbc0ea406dc537 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 @@ -635,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) @@ -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 c9d649eeb41b72fd09bb0a90463262e01042d6f1..18d87a3c0ba72190f5cde6f07513865b0897bd37 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 ad1b10ea3158871b82c7eb0e2e4e6a1555e6b5aa..93e2c2690c0dd107cf95d1254db3d4a50f9dd834 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) : @@ -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 eeb1cd6def28ffd71c6b2f618ffbf2fb541d26a2..5d64fa5459374d2d8fbc0a858d1129b42f3f31b4 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 @@ -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 @@ -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 b499c4fc1233c03c28655e564655fe96de6bb59b..2f1445844d70fd5525f0d0e16d19bd061fc9169d 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 10cd36208859d398a84e0b0b1cf9162014e8688a..632bda85d7c6a838bc18ad7fbceae5d5a1e6a5c9 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 c98cd68feaa383bf1154c30f115d710f96a4697c..62dcac500b99a338659e8267e1c7e516e6b39b0b 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_client_sapling/client_sapling_commands.ml b/src/proto_016_PtMumbai/lib_client_sapling/client_sapling_commands.ml index 4c8cbdab0c9f325cf6c5f75ddb9b0e33a91b7db4..f20f36ce75c70a920a1c4e4878e915cbe4eea743 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/abstract_context_index.ml b/src/proto_016_PtMumbai/lib_delegate/abstract_context_index.ml index 54b73da7c42ff4d25f837acdb62d38d7bf089bd6..2e54f32fdc1398787ea5bb20ca04aefeee2427b3 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 9a825a14362099d57c4145deca6f7a72d7581ccd..5a280d04ac579a0d7f27272693335772133ed201 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 1d5ffa81cdd21f3a4a0b97b259da211ef2fdafc8..2af2842c77778f69f2d414b629c5867765945214 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 db13c684bf3ca974c707445bd17b31e110f9cc8f..2b8dca57b0f677def353758a78797b583054f4b6 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 cd5b5a445f410f06e2252e2c3cfc181b9b4483d1..a1908d29dd229c880ddde6d955c552046951b30c 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 2f1383b089513b7098055acbaaafd41850c5e394..0dd45ce85c65a102ba6a231bcfbfa6c89f621a4b 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_files.ml b/src/proto_016_PtMumbai/lib_delegate/baking_files.ml index 67ef0c7ea0d41ac6183d073f8141d1ef0c1e8732..38339e2fe5554dcfaa7e5140ad6c95acbd5568a0 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 82940952da0594ad680d177bc2b8858034d6ee15..01146f7d0744cc8501dcf8766cf5308a4a29652b 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_lib.ml b/src/proto_016_PtMumbai/lib_delegate/baking_lib.ml index f1b23c4582c1ebc49679863c706a9030f6bf8f89..7ec3ae000cd5f97e8fc8281126379232137dee2a 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 3acc87f16377153ccf76449d6b79c29c68dee393..5af73f61735e63a47f20d9c57afe2e750ac24ed9 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 df34657eb90184427a210ee60998691268a81075..6e69b009180d71e8d723a457918adb678644abd4 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 -> @@ -101,8 +90,8 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + chain_id:Chain_id.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 @@ -119,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_scheduling.ml b/src/proto_016_PtMumbai/lib_delegate/baking_scheduling.ml index bca851f697d8fc61c6ef1551a21ed7bc4712c503..38d42a06cc3df5e395c0c4bea0b847273fc490a0 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 c4bcd1aa80dc1cb8c1062a7a8215b843beaf40c5..2d09542279ad4c42e06dfe92dc237cf67fece7f5 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 d6d45255028ec1557e21091bda50a299b53484cd..0d0c7ac9f4d2fee3a7036c81a7ea04ba7a581ca5 100644 --- a/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli +++ b/src/proto_016_PtMumbai/lib_delegate/baking_simulator.mli @@ -39,14 +39,14 @@ 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 -> 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 a5cb4ae6715934e467a09650b6a37b035a2b2b79..984c2bbbd2378d30dc3db42766bad0f93706ce4f 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 = { @@ -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 *) @@ -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; @@ -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 @@ -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 bf7caa0ff186df723ad5037b7cecb9c182010027..34ce3743c4ade8c291590038ccbfaa90cfcde50e 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. *) } @@ -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/baking_vdf.ml b/src/proto_016_PtMumbai/lib_delegate/baking_vdf.ml index 6dc6d5e9abb11155f89c728d8bc002a41d6d98ab..8d2caefb709b75a58f4d4e47246114fe3fcd2537 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 0df28bfea484bc8eb362cd0fd70f78b4486a04cd..917133e0e5534b6efb4ea169c29e83d87ca2fcca 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/block_forge.mli b/src/proto_016_PtMumbai/lib_delegate/block_forge.mli index abf60c86d8f48481ddca29d943bf8b1dc712610e..b111e27b417c4a67c69c1b2160ee019ae9620e34 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 e192aa649a72321f3bc1937a07d74f566703b7aa..d7064545b7bd8efa0e0006d20db6ef7d0312f553 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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,9 +80,9 @@ 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]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -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 @@ -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); @@ -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 07d582b6ed9b751676c7f047c5699e322f1aace9..c3358f61f82fe49b043dd42ef343bff002a3e3e6 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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 21b58428d339f4e495eb9f39bac6d1016d0acd62..cb6f6a02e66edb3399c16c5d855153516148a66d 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) @@ -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 836c95f1ad9a653f4a88e02cfae280dd59d0f762..ba2cfdac03b3b0acbefcc66990a0cca6383e5a8b 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 ca4361b2dc9690eced2bdb72c8d47085b85c650e..20f5d091dd9c3a155dff1c91a0ba02cdf3ad6efb 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 6756e73e07e693e640fea915e1af95a0a774798c..ed9cb18c9db3b27cb86a0f8b5f5f4bcc9c855936 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 94be468c039b729048c9ce8f675c5bf15ffa1c62..a6d3d71cc15ec16686488a5c21f501cf94e9b302 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 55694e129b5509a33863c7c97c50f0bc0e211b32..2dd0468ef6f1855bc275498e55222843081afc95 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 16ec9eda7cdb9c441a75fa1daed8f52fd07944e9..7e0a7612054e446b008c291c4546fbb377c8ed99 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 83543149b0566ed1f363b448c26b32a30b96c797..089f4b439a9309eb74babbc42dd5f7ea9282ebb4 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 3ab72a91347c760ed185a55c0b4810b4fe91c93d..78caab5c158c3d401e4c0f6d260c19a6e7621340 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 5589f585649f0354cf4417cfd995c743b4c0a50d..66cec572347651296554b8d4e8e3903d5c979027 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 ab66270bfd916453e2a80837b510ffc70f5d9921..eecbc990f2d1cac38bad3dc7d603d2304f255015 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 71c79251fe67847c25b2d33b7e93b7bedee7e19b..6e8dd27e628468da9c64a5493c1d137d5a965e28 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_client_context.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb02c44758ee75789b7d49aadfcb3f2..ededa688a755bef410018cb3c96f8e08f2959627 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/faked_services.ml b/src/proto_016_PtMumbai/lib_delegate/test/mockup_simulator/faked_services.ml index ff2b7871d7523d029886259274aff8e51252cde6..624565b408891e04860482f83d58c6491d13b362 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 b97417ed1807a9002190cca15b28ed9ac541020f..4cadea890daaf394e6626e5b8b88280c6d4a1151 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. *) @@ -83,13 +77,13 @@ 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 = - 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 ef4db4d8b7cbe422c94f25b5d64f9181d328061d..2fc5f544597ab405192ac9fbdbbe698fd555af76 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 f8585e929ff4b03a6a78b37455c83fa90647c64b..e31f9ca0b66db2a59cebba43176a24c830e0f5c2 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 048ec2a1309f1b2aa1d014801f7e900e3cb3456b..b79cc251fb93368f6ae04a2406b70060cc7e1a2e 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 e6db79b793451b8bf583c192289153122cbacb1c..ad6336e2a24ce8a1e2ac192da40aa123305529eb 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 7d4dd86089eefea3e70a40db694d0d6ce0afd013..c5bfb943322f1a22457fe138b3a1baabc691f059 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 256903f6a5e9ba14ea3b6bab6c712f8ec7b6260d..b1a4cedb3371658db03f34f74e799076a5cf56fe 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 1af48370900ace9dae4c3a988cdc7f2a61cd73dd..898aeb1f96e1618d3bd8e694ec33083c58604349 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 1f19298c37038fa7b3bd5df650929fe7afeb9b62..3b77944a98251bd91f3063cd3358c3e7a279fd0b 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 7f86e158a7751d7cb5aedc4f153986d3efa52092..8ea98a4b4871dc8134a1c50e9dd3820d9ab9c0f9 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 21b13fbf32ffc1b49c608ee0c2d8652c341ee792..6dc5bdeb9cd85f191a23eafe80a7fc403ee888a1 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 7f8742082e1c36aed21313cd55d4b0dee3520033..64f23841d3306097b08d01349b6bcfb3a20b7be8 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 1255d70b764e28ea88c6794ec2d1e0e199294360..4cb30e48b0a57cf7d1050c0887330701cc969c63 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 91183c254b4ca3aba98fb72a4c7d7ee5bb7748cf..ad6a38ae12b3745b80f295fda20b1d02f1939d3d 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") @@ -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 c4131028861d8a8f5e1c46e1fb7729d530c1535e..bdec72bfb9389890b39273f9046c351029107f38 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 426dadd7093978363f8fd25f6f2acd86e93317bb..affc95dd5a7729d204895fe86b9b44a1e4e2ebdb 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 d84714a3b984ec0fea9b10b03d881f866537bbfb..1b5d344cd38bfdb6aec3115b1bd1d667de70ec2e 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 82868acd43f26e88e1177d956ac755b173a09fcc..bb48f3b41809b171da774f103be4651ce66172df 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 0b92f1f4ca4cf986ac61b3b139239e8ae5d495b6..57402233a49e2a128e60f1bc831509bef25e12d0 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 250322901123492f038286976bdd916136f01c05..f77c31538d77655a14b149db80193fe2f266a7f1 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 24d1953a35e3c3e245d5ca1106398ee9e2ea960a..983cc13fc8e9c7459bb56be55bc6d3cb637707e6 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 47c571e7df234dfbd233abef520c54dc2f7ea296..32643bf69af4ee36b6347139d02c0f4c503267bf 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 @@ -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 @@ -247,8 +246,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 @@ -399,13 +397,13 @@ let initial_alpha_context ?(commitments = []) constants ~level ~timestamp ~predecessor - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult 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 +419,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 @@ -440,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; _} -> { @@ -591,7 +589,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 +606,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) @@ -651,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 @@ -696,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 @@ -718,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 @@ -780,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/block.mli b/src/proto_016_PtMumbai/lib_protocol/test/helpers/block.mli index 80bd8fe6ad3585984b70b744872e3b0a5f2fda81..86da06f1bef290651d4f1a247cd2ca045a3b3619 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 8bb697a7917e44f20390782479ad6ce71327cb5a..a51392069c43d99a2f2e1b0a53d8ca0d84e4e441 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; } @@ -599,10 +599,10 @@ 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) - ~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 f73c78a98ec4e234a8efe882dbdba6b63e3e707b..4f66815856669edbba914d4e428840be5023e4a5 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/contract_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/contract_helpers.ml index 7385aaecb219c599c46f961a2e5770bbdd9d1f38..4cd5396caced3ad7cb33406c17debeb86c23091c 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 1cf523719e416fd625e8d2a4683749e39329d7ca..7260c3ca385abe7a48a1c798a5155aad983fa869 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,15 +115,15 @@ 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}; } in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> @@ -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 429a4f52c4cd20731fa26f62ed74310e6e818a86..86ef49614131e67b090de49428bfbf15f9d17037 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) @@ -241,7 +239,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 +553,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 c24b7551d5d5d3122565954690c944de08f6b2d5..24a03b9eb4080d75a5f091368884b79e54e3074a 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 63e0b62bf26e5b047b381f134a1364c01d4353f2..06f477c7a18c6575c361bbf43e82b2b9bd130961 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 = @@ -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'); ] () @@ -253,7 +265,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,12 +275,14 @@ 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 = 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__ @@ -581,7 +595,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 +633,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/sapling_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0116d8d90ae4c54c6bb902a7b5c8c..9bf2f8382fd8428422e08e572d177d15f237630e 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/helpers/sc_rollup_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/sc_rollup_helpers.ml index eadb4e700224f74d4199a303f71c60e2209d2e38..9831d1fafba0087df4eadb8cb19d385e5197da5f 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/helpers/tx_rollup_l2_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/helpers/tx_rollup_l2_helpers.ml index 22acc5dfcb67740ccd1b268a22dd119231fb8065..bd1bea034cd7e67ef910287173ae86a04286c4ec 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 336097c14e35f7da8e9dcef8644afa4a49bc95ca..227e19498598091b6b51b2c61a2d16c30e5306eb 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 2aa32630dd84f29ded4fa6fe5e746f1bfae59115..527ad98cd70d3670186623cf07e9b379e8cfbc95 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/consensus/test_double_baking.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_double_baking.ml index 5b5ce979ae4da4acdb1c03e0020c0a039d63febf..cd7b92e17e21165b5418734def3f4508bf80bcdb 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 38d190702a4311ae1672deadea66c0381678fa4f..8417f6911f0f479379fb2edf2a0c65b70910f14b 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 199f1d679b5a8bf78606dcd435824d2dd5841a0d..81dbcd956388564c10264af47e0cef67bb952bd6 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/gas/test_gas_levels.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/gas/test_gas_levels.ml index a6e799c846db0c4afdc75c8da84a3c715abfb012..5e0848b43e1bab0588e1ae3cc4cea207204a095b 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/operations/test_activation.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_activation.ml index 778544462e33cb779bc7c5844a6311dcbff653ea..0bbf9e283fb070680ea6a8b3c6c2545aeaaa4113 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_sc_rollup.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/operations/test_sc_rollup.ml index a49b4cc6c66a3d2f37c1fcb042d09b6dc041a0d7..edb20463f550607d0ebcef12edfbd1b595267083 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 26f764d3196ba5a83881f448b0e4636207eda1a2..6b05f9fd4bc9af2ac5c08c7e5a5995cfdedc535a 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 @@ -413,7 +415,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 +426,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 +1607,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 +2275,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 +2345,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 +2373,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; } @@ -2508,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. @@ -2751,7 +2752,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 +2988,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 +3533,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 +4568,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 951fa00e12d7b46da1f2f232362f55afca4c3975..83a5ce913c84e0cc805bcc52210ad2460b24e9eb 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 789422bbbfa1928bd069db4c258a7d5764975830..15f1f092c59e576e99b145805fc311f0498e89b1 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 b971b3a70cd956f5b4fe3149f59f2d7b05e44f1b..320df83e780163298e059cf2a3c298409317efde 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 7b5a33155ed23a80ace43da8cf0a1c861233bc9c..b2b5f7ae82618e88361704feb0338204748c4e45 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 170f0435c8da45468e937bacab956238f5ca8571..39c29f6d42b64fd455f9c2e0e3de7f5b4f41442e 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 b0870b34a5be46be93588cd5bc0138a8a0d59ac4..515df860cfa42d1811b170453edd4eefe8875de9 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 d0b1d04397f7267775c842932172459a9c3ba5c5..c3110e25dcc56c10e0ed6d92c2ff49ad612d726b 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 4547bed9fa28094a416fe8edb48d2a449f2c62bb..4fb1ecd70617fce9dfed6d773d5aa8680e502802 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 @@ -108,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 @@ -140,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 @@ -156,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 @@ -185,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 @@ -277,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 @@ -302,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 @@ -354,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_protocol/test/integration/validate/validate_helpers.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/validate/validate_helpers.ml index 715b19a4d705ba4c8654ffaf36e56f5aa9f1dd90..2a752d8f0a52bde0b45fa68e920f7b2adc082e57 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"; @@ -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_refutation_game.ml b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_refutation_game.ml index 96d237dbe44d73f8784cfa90acd744ce36a8bf99..17467ee33b83760a226a185f090dfb38bc340c36 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 6bf0c0d5008a9f4111ebd65a570b1544ec5d95eb..869db23667e2c2e8f547c6483e9884efdba3985c 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/pbt/test_tx_rollup_l2_encoding.ml b/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_tx_rollup_l2_encoding.ml index b43c3b31c430efdb3b921e345dda7eaf9cb69a5c..408504364c5d831df51faaad82e4838d8197724f 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/regression/test_logging.ml b/src/proto_016_PtMumbai/lib_protocol/test/regression/test_logging.ml index 5fb8465c249c449daaedeaf9bce59275da550441..a123f6d311ba9499e1c7a13b3a982ad0ec49f446 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 9a758c030b675cd8e7c817456298f224c4e46e0b..a372d293904ee3271356c81973723e8e03c2703b 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 1fafdba8ce999341cb51626cb7ec1fdcf3b00f1c..f4cb1a04fcf633617fb07e302be9a5804d7b1733 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 40eabf7d344b4c9a9d89e59b0f6423723a40fe51..d620a1618398ba7ddc1d550843327e01632bb25d 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 419f430090de6878cc8a039a19686c893e793fad..a34eb06d4e69f3441cd9b81050a70ba13d065c59 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_receipt.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_receipt.ml index 245ae17b0a5407f099f99efa4519a5423f162525..866259712837db175419537f27b1af44abcfb79a 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 b4b99941bd2e235d908578fbca1a2416b92d2c8d..85ad7450d3186f1e7ab7b9a49408b8b3f8e2ba89 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 7559f0fb68a3c3e0e8ef697abe99abdf870b4c92..e3e292de954ab96aa89e95753c465143ec5435bf 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 81396aa1bffb307d7e2aa02a3d13995bad353825..78441046d0584dd794cf3b7f1aa5fb44538c26ed 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 0b5ad6934674133265ad6a42e5bbe386c4b93fd8..8c02831d36f1e85e39a93a0e54a9710c3e2c9b1f 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 31a5e619c99722ae464b335c2ab6d9f891b2cc46..c5e59ffed172fd2b7eab47d2aae587b5076dc693 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 06a74827a1581f56b1dd1f8a8f536d17f6e86dce..544e03dd212ce0aaf36ade50843aacdb2ce73a55 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_tx_rollup_l2_apply.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_tx_rollup_l2_apply.ml index 767190f5ba0eca65db173f2924c90af07675dbf5..c29e711fbdacbed628bc58d1024b89cb7c5e56c2 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_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 894f361439b03effb8fba4a34db80faeeed1e0a9..cd548d97699135e21aca822a1cd6e009fa7bdbeb 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 456950222651c44d18b9206bd110474a7baff788..5f8f8ee52a907507d561c4b9241335c4d5fb444a 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 4715b8408387e3a070212960b7742dab106cde56..4f832b00e6fb3e9518fbf1f47ddc02e27455daa8 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 7d79a246d3e61ceb95984026ca913a3cc86e1dcd..1f0f8c7b4bbd75dcc5c3f500c51b5f5c3adbf6d6 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 000536a07aa55fea3f79d2ce6506e8b777dab8bb..4538fec721c6effdca82c16e79d28a1f449f9beb 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 b8abde35922ae94993464853ef4e790436d18dbb..d7acec7ff0ea7c661607780ead88138dc5f2de91 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 fd89e090352904866e51ac80b18095a9ee4dd0a0..b96c04e1f558d1d887d394924a19809b00161c66 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 4fe448e05fb55e8840d14ae6c2588177a08094bd..ca55fb24a41b8500354054b1dca712103bfa90f6 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.ml b/src/proto_alpha/bin_sc_rollup_node/batcher.ml index 71cbb62d919f33fd93b5ba04b17cbd2446e13b75..0460e4733c5e734bf746693f34d84c7a30bcf3d7 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/batcher_worker_types.ml b/src/proto_alpha/bin_sc_rollup_node/batcher_worker_types.ml index ac2201e49d44a17fbce6d205e11405d00625ecc6..63afd1221a6d1ae3d50f9817e382cab7229aeafa 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 0c9c6fa822915743afa259caa738a0c1cc239053..b1a5c83952f212f13e1a43a9b1d03cf7d448d225 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 0b5faa4c6cf25ba7c986befaa630c912ec858fab..b8527a2833910a9558dd5fa3ff3f76c5a811bea1 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 8444a987b87c44152bcdb8c10a5ca0a01c905ce5..a599a2cf6f92640c002ad746a6832a8da9874569 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 @@ -185,15 +185,15 @@ 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; + 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 22058666b750f46b7375f46f928c349869d8b2fb..73237ec9044be23f36637730d43802bf5a57e7d1 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/context.ml b/src/proto_alpha/bin_sc_rollup_node/context.ml index 0df91a965c46de08830287dea19dc6b3141a4f7d..f3d0059b22e4521b9c53cd008dcd2c3f65274ccd 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 76a0f70c2924f459c71591a70118b672d621d814..ce4cfc1769bbccc3adece9669a6ba90d381219a6 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 034b3d0f5081b8ef56d53e611cde788ae8199363..9cb48ef7bb8fd2fefabcbf20921fe71bd9210144 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) @@ -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/daemon_event.ml b/src/proto_alpha/bin_sc_rollup_node/daemon_event.ml index 8b99312a3dce16f2209d81d961af2df4530a8149..61958297e722bb7d4de13475ad244361e43683ed 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 6f6004363c7a8711995964b7500b7cce22fb43b5..67e85d657b02f3da6fb5e041e0de4d847b8e7fe6 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 fdf50dc71a1693c9e9208c112e8587afbfa67e95..db274826cb33d7d4967de0801f83bebc9c6bddf5 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 0e77b548a6011761faed07145439b3d2b8cc2aac..458d3735649f52a2329da5a84d25daf87b330334 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 c66573018673ae56a7f194123b2a2585a49bbb5e..84ed4506c47f31ccd7ce935589470a5057a2ff8c 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 07aa6a1facb4fcf116aebbfc59ac1d31716566fa..8080b46c2a9463dab8ebdb70d4e077f7809a3671 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 4765aceb02d15b53ccc68c08dea340b3caff0eed..7323c3b5197693b11dacc4c72778ce29703442d4 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 b3e57760ef6b40cf88e0a51a23de423b38f1d2d5..18d83fc56dcdd5113fdf528aa536bbcb4fe3aef7 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 c56ea8ad6ae722b792198320e04787f5dcd72478..72a3b8200880eadedfe867fec3747d53a9e7d5be 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 e3952b6503d4a58dbe6305825b1eb6b857aa75de..6b51421e12864f70a00ef6056d7154c845097f80 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 95fc601d3ee6fbc8c49fd9e4235bbc9b7411921f..b47052ff448da78c91c85397d916e47ae7cd1d0d 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 94457c0091f0e6f4c320015c2bf3dfa52ee219ba..ab5c194a6212972e7af2d8e572d702ff889780e5 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 31aae66ddb528f96e9113f2a5641806f8f90b307..6e9773d48ec283c97c84cddab6fbdbe083b59434 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 467da2e23f72a256a50e0f6173978ecaa6e53151..5b8ff83a660c8f47c23e8596b35c9ee19b2aba44 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/main_sc_rollup_node_alpha.ml b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml index 5f3f62aea8a20d3f8e909657035516a4c474e49d..73630aba5c0263373ca592e9f74e7bcda8f98d9f 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 d05a41ceac5549802df864f44a4e67940cc2fd1a..70d8d58886bba1da308e400703ca2992676c7df9 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 3611b0e41cca26bacd35af34e8be9fa6c7758a65..bed9f201fb975ade46e88334bd69b0ec97686847 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 @@ -111,8 +109,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 +128,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/refutation_game.ml b/src/proto_alpha/bin_sc_rollup_node/refutation_game.ml index 4178c1117dc43da9f7be312a02cf6864c31da357..e97eb8c2975ec36286d0ca82aab7b3b4c968e09b 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 996b63ed080abf7e305aaa683bf1b482fb2fa8e4..b7b96030d0135b8978f8582e8be6bdf75ec08648 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 ceabd95165019890c2df93aa02a6a9762dc55f07..6a02cd2565d3de90ec7260d57950ca888594c841 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) @@ -214,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 @@ -223,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/bin_sc_rollup_node/simulation.ml b/src/proto_alpha/bin_sc_rollup_node/simulation.ml index 25d2ec2c39239878a5c2d2eb9ddc71d81293d66e..9072a881472507a9a8fb1786b4630982f5a6e361 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 49e0da506df7f1723f4ed14ebd11283ae6ec1f50..ad4faaedfd0e23577009ad9b78da288bf4302897 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 7c189136e987b644e2a77a6534563b990525ba0d..9c71b60c501714b678da0663d7aa6ed4a2b13322 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 3481f831c419a3e189af5c62ef37fc82b2ee6ded..a5c7335a19bd270b14d1934065ca6013bac6e96b 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 3889830f6dd263a050cd0ef2ae2cb6996a370f13..2c7b9924c0fb88c097fb495fef5aa60680dabc40 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 c30861a40e78f86ff6558fc773af6516ae6ec816..05766389c95a9c899d88151ab37cab50fe08e1b3 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 2003cedff97d98038ca168247be2ebdf818dd6c3..a7212fc9ee040ac08b24b19e12797e17dc801a6c 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 @@ -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/michelson_samplers_base.ml b/src/proto_alpha/lib_benchmark/michelson_samplers_base.ml index c9a9d36e0612a490fd85b527b7b57a077acd082e..837374f56709070badface6ef66338f4d0f77e13 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_benchmark/test/test_helpers.ml b/src/proto_alpha/lib_benchmark/test/test_helpers.ml index 5677355b0bb90c5a4a4b4f3222ddcf73e66bc5c0..8d5db86cc9ed35d7ec3d61b65cfe1fe4d0febe7f 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/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index 64667ddc577fa645bee5f1c30ea7f32c2ea7e369..6782640700521ce7fadb7baa12731f2eb9029e0e 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,13 +3259,12 @@ 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; - 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/interpreter_workload.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml index 90b96546a05288b3aaf9cc3aedcf9343beb0bd85..8e16ffabbda7e9dceafee3f7b54d89a1f697502d 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_workload.ml @@ -1407,24 +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.Ed25519.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.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.Secp256k1.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.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.P256.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.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.Bls.Public_key.size pk) in - let signature = Size.of_int Tezos_crypto.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/storage_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml index cffa19ba6874793e0628dfef84832e3febe9d0db..ff1b31fbb1c6fb821966f522741ac8bd407d5c0b 100644 --- a/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/storage_benchmarks.ml @@ -68,11 +68,11 @@ 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) - ~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 1e05cabccde144325185b1f91b11a7b593e1ea78..b59efb8a5106d313d3f6b26b5158d136a1eb0f14 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 @@ -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 093ace757effae0e15f8997d05a9b048b7565a61..2275a1c067a406b82ffa0f9796e6f825eef76b60 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 () + 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 fbdb7fc71f6b79c366237dd55a88e9b075f23a71..ffbecef28e71d869edbbd24d23c7ad8c39076622 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 c6fe4627c5150043d4eec83564f472ce2c45b086..065a52870b35c9b5ef642e5d131a2ae132d1a4fc 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 d8e7524e5d8a611f61a350f3efa67661a76076e3..ea7acee0935b5b406aa700b2af8ab3b8be781a5a 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.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.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,7 +665,7 @@ let activation_key_encoding = ~title:"Deprecated_activation" Json_only (obj6 - (req "pkh" Tezos_crypto.Ed25519.Public_key_hash.encoding) + (req "pkh" Signature.Ed25519.Public_key_hash.encoding) (req "amount" Tez.encoding) (req "secret" @@ -713,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.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 @@ -745,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.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp pkh Operation_result.tez_sym Tez.pp @@ -760,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.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 @@ -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 f29f5c2404f5bb3965a8b94e4397389084a08e2e..36b01a3388bf9654647f866ae824fcf710921fe6 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.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 -> @@ -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} *) @@ -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 -> @@ -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) @@ -790,14 +790,14 @@ 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 -> 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_fa12.mli b/src/proto_alpha/lib_client/client_proto_fa12.mli index 8dccc6bbca640796d6f2abb3e064b803b6a512ab..cfd100f44a46010c0ae3f41c03fd67493bec7ed4 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 9d8d9e8e7f7ea7c7d7548f173390204b3cfa6ab1..108233e7b2ab905c7c7814ecafe7092d4076480f 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 -> @@ -908,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 @@ -1060,7 +1045,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 @@ -1189,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/client_proto_multisig.mli b/src/proto_alpha/lib_client/client_proto_multisig.mli index cb82be9493a1a4a692b8dadf450ca2d774e07e38..5ebfd1448d0fe6c47ff0f8fc30c943acc51e2c5a 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 3f944c498f9fe2161b2fc15747c29e0fba93a9f0..4412d16c001cfa50d1f5e337291dff3aec789fce 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 8e5c87d2ef5e59579801ec49473e3be1faaf0047..383d2116b10b99715efff23e87098ecd22c4b7cc 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 5f98e3c9228609825d851deb977c117ec234a4c7..be6844cc5cf7a8fbbe36d7c56415db8784587f10 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 e222f1745aff227c3f3449ee6678d70836377e6c..c535e4b24ecb9e4eb1eb02cb16b454b9f6647112 100644 --- a/src/proto_alpha/lib_client/client_proto_utils.mli +++ b/src/proto_alpha/lib_client/client_proto_utils.mli @@ -26,15 +26,15 @@ 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 + 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 -> - 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 307aea3af98e6a788ba912750d3742b2954701e2..70a00096eaa87a9c7ae34e85aaa50de5776a7256 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,15 +184,14 @@ 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 "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: *) @@ -218,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 @@ -244,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 @@ -634,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.Ed25519.size - | Secp256k1 -> Tezos_crypto.Secp256k1.size - | P256 -> Tezos_crypto.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.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) @@ -1068,12 +1064,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 +1080,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 +1092,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 +1156,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) @@ -1227,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) [] @@ -1353,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 @@ -1385,7 +1380,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) @@ -1411,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 c9d649eeb41b72fd09bb0a90463262e01042d6f1..d66775157c80a34c0ea1bc2469c28e4d062a5ef5 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 -> @@ -106,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 -> @@ -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/managed_contract.ml b/src/proto_alpha/lib_client/managed_contract.ml index 3edbaae334159dc0f533115188b17f4067da403f..5d406c1276484f09886e9aa0085023eb0b6364cd 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 ad1b10ea3158871b82c7eb0e2e4e6a1555e6b5aa..62ed51f5907664396af9dfcb818e6c1acd4d3b0c 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) : @@ -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 @@ -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,13 +495,10 @@ 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 + let _, _, sk = Signature.generate_key () in let proof_of_work_nonce = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -521,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 7d564fc94f6f97ff1eb77e5925f81ec679f20afe..fa879aaf834f125de662f445928c921fe948af3f 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 ; @@ -1029,9 +1022,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 @@ -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 ) -> @@ -1084,9 +1077,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 +1092,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 @@ -1112,7 +1105,7 @@ let pp_contents_and_result : Account: %a@,\ Balance updates:@,\ \ %a@]" - Tezos_crypto.Ed25519.Public_key_hash.pp + Signature.Ed25519.Public_key_hash.pp id pp_balance_updates bus @@ -1120,19 +1113,19 @@ 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 Tezos_crypto.Protocol_hash.pp) + (Format.pp_print_list Protocol_hash.pp) proposals | Ballot {source; period; proposal; ballot}, Ballot_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 - Tezos_crypto.Protocol_hash.pp + Protocol_hash.pp proposal Data_encoding.Json.pp (Data_encoding.Json.construct Vote.ballot_encoding ballot) @@ -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/proxy.ml b/src/proto_alpha/lib_client/proxy.ml index 26a2ebb2204d9b67e3f0e7b20e421ae2ed718f6e..ba6d01b6a7c5a217573e56fd910a34e1243e575b 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 774636b393a986ba1bba988d4aa1dfd391b23744..9070a0e6d51bdb9c93711226f14d8314ccc75964 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,25 +2208,22 @@ 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 "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 @@ -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 @@ -2396,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 @@ -2996,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 20a9b367fa0620f2d0abf1d9dc95403856a60a97..3072a31c76abf9bb5d0eee98d1acd6d36a485050 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 a5d6b4fdba5fa407d71f1185f4913dba4b51c640..f8b6ede352ad971873e5c67374920da497b39d6c 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 2a578de2345585ab12e4e1e155280a2f4add71e9..75ab5c0170021644f7c8cebe4f5a791ca59e421e 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 d1920589f114355632cc31f79433d36c23599888..d5e33b91cb58993252b1d29daac2963d84b600ce 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 = { @@ -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 revealed : Signature.Public_key_hash.Set.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. @@ -162,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 @@ -176,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); ] @@ -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 @@ -240,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 = @@ -282,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 = @@ -299,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 @@ -345,7 +342,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 +350,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 @@ -364,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 ; @@ -375,9 +372,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 +387,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 +396,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 +405,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 +419,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) @@ -460,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 @@ -506,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}} @@ -563,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 @@ -609,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 @@ -635,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 @@ -651,18 +634,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 +659,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 +682,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 +717,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 +731,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 +827,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 +841,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 <- @@ -1170,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 @@ -1185,7 +1161,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 @@ -1203,12 +1179,12 @@ 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; 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 = @@ -1488,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 @@ -1508,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 -> @@ -1793,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 @@ -1860,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*! () = @@ -1869,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 798304e22f3012c2c37e1c4cfd5594e0b918d18a..b2978ba30b814deee6bf4e8ea58de4acca7c1d80 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 4c8cbdab0c9f325cf6c5f75ddb9b0e33a91b7db4..42a511e9d720804c1282af19f32418f1d12fff62 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 @@ -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 935a70af0325e29707a5bf202dc4546ad3b46f3c..d61429958960a36e2fc8344c64461770ebbe6628 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/abstract_context_index.ml b/src/proto_alpha/lib_delegate/abstract_context_index.ml index 54b73da7c42ff4d25f837acdb62d38d7bf089bd6..2e54f32fdc1398787ea5bb20ca04aefeee2427b3 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 9a825a14362099d57c4145deca6f7a72d7581ccd..5a280d04ac579a0d7f27272693335772133ed201 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 1d5ffa81cdd21f3a4a0b97b259da211ef2fdafc8..2af2842c77778f69f2d414b629c5867765945214 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_commands.ml b/src/proto_alpha/lib_delegate/baking_commands.ml index 9d76b8745fff52ab03b1a5827649bc4656ee242f..b827d5b7caddb32dd1275d63b705b5f83824f6f3 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_configuration.ml b/src/proto_alpha/lib_delegate/baking_configuration.ml index db13c684bf3ca974c707445bd17b31e110f9cc8f..2b8dca57b0f677def353758a78797b583054f4b6 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 cd5b5a445f410f06e2252e2c3cfc181b9b4483d1..a1908d29dd229c880ddde6d955c552046951b30c 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 30ff8ba7911dd3cad17f3a6beede6a9398591c5d..110ce38543661f136f9202b40e5da2ac07b776e2 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_files.ml b/src/proto_alpha/lib_delegate/baking_files.ml index 67ef0c7ea0d41ac6183d073f8141d1ef0c1e8732..38339e2fe5554dcfaa7e5140ad6c95acbd5568a0 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 82940952da0594ad680d177bc2b8858034d6ee15..01146f7d0744cc8501dcf8766cf5308a4a29652b 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_highwatermarks.ml b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml index 4af172f183fe5e13807314564a2a72cc1c1de5b5..91b56b3e50b1fc062f054f1dcc89668a8c75a03a 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 30d4d6f4ea3ea04f27408ebd410cbb49bf72ede8..757b667c58bb68d5628623b9a234c2ab12ae669d 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_lib.ml b/src/proto_alpha/lib_delegate/baking_lib.ml index 1f86ff2c9bac3b02e5e1f0f9a7fc16a3ff881d5f..bb2cb7b3f4ec7e05d4ccbb5b18bbfa0c9aa2fd45 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 3acc87f16377153ccf76449d6b79c29c68dee393..fc1c9ada635ac59fc205b047b43e9a5b0f06aee3 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")) @@ -246,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.( @@ -263,9 +254,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 +306,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 df34657eb90184427a210ee60998691268a81075..6e69b009180d71e8d723a457918adb678644abd4 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 -> @@ -101,8 +90,8 @@ val generate_seed_nonce : val register_nonce : #Protocol_client_context.full -> - chain_id:Tezos_crypto.Chain_id.t -> - Tezos_crypto.Block_hash.t -> + chain_id:Chain_id.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 @@ -119,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_scheduling.ml b/src/proto_alpha/lib_delegate/baking_scheduling.ml index bca851f697d8fc61c6ef1551a21ed7bc4712c503..38d42a06cc3df5e395c0c4bea0b847273fc490a0 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 c4bcd1aa80dc1cb8c1062a7a8215b843beaf40c5..2d09542279ad4c42e06dfe92dc237cf67fece7f5 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 d6d45255028ec1557e21091bda50a299b53484cd..0d0c7ac9f4d2fee3a7036c81a7ea04ba7a581ca5 100644 --- a/src/proto_alpha/lib_delegate/baking_simulator.mli +++ b/src/proto_alpha/lib_delegate/baking_simulator.mli @@ -39,14 +39,14 @@ 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 -> 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 78e113a2ebd5bc04e8cdbacc95f031cd440e71a3..0130ec9528176cf3bcfe0bcb983f151197bffc6f 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 @@ -110,18 +101,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 = { @@ -135,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 *) @@ -225,19 +216,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 +441,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 +509,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; @@ -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 @@ -838,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 @@ -880,16 +871,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 +903,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 +1020,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 +1030,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 b1ea6622eb77472cd4261d98701f7e67f0cc7d29..198cde1a9f96419b04f00ed54734f2b418fe560e 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 @@ -56,18 +55,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. *) } @@ -81,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/baking_vdf.ml b/src/proto_alpha/lib_delegate/baking_vdf.ml index 6dc6d5e9abb11155f89c728d8bc002a41d6d98ab..b08fd5ebea7bc3862b785ec864703cf70a8a78ef 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 @@ -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 0df28bfea484bc8eb362cd0fd70f78b4486a04cd..062306d6367d7a0c503a6dfa2f283a45716dc282 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 = @@ -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 @@ -390,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/block_forge.mli b/src/proto_alpha/lib_delegate/block_forge.mli index abf60c86d8f48481ddca29d943bf8b1dc712610e..b111e27b417c4a67c69c1b2160ee019ae9620e34 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 e192aa649a72321f3bc1937a07d74f566703b7aa..d7064545b7bd8efa0e0006d20db6ef7d0312f553 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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,9 +80,9 @@ 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]; + occurrence : [`Valid_blocks of Chain_id.t | `Heads]; } let make hash header occurrence = {hash; header; occurrence} @@ -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 @@ -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); @@ -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 07d582b6ed9b751676c7f047c5699e322f1aace9..c3358f61f82fe49b043dd42ef343bff002a3e3e6 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; - chain_id : Tezos_crypto.Chain_id.t; - predecessor : Tezos_crypto.Block_hash.t; + hash : Block_hash.t; + chain_id : Chain_id.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 21b58428d339f4e495eb9f39bac6d1016d0acd62..2ebc4af5961ebbaaaca22a8a95d8ebd310d291f0 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -31,16 +31,16 @@ 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) (* 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 @@ -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 @@ -176,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 @@ -274,8 +271,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 +287,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 -> @@ -306,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 -> @@ -353,7 +346,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 836c95f1ad9a653f4a88e02cfae280dd59d0f762..ba2cfdac03b3b0acbefcc66990a0cca6383e5a8b 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 ca4361b2dc9690eced2bdb72c8d47085b85c650e..20f5d091dd9c3a155dff1c91a0ba02cdf3ad6efb 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 6756e73e07e693e640fea915e1af95a0a774798c..ed9cb18c9db3b27cb86a0f8b5f5f4bcc9c855936 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 94be468c039b729048c9ce8f675c5bf15ffa1c62..a6d3d71cc15ec16686488a5c21f501cf94e9b302 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 55694e129b5509a33863c7c97c50f0bc0e211b32..2dd0468ef6f1855bc275498e55222843081afc95 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 16ec9eda7cdb9c441a75fa1daed8f52fd07944e9..7e0a7612054e446b008c291c4546fbb377c8ed99 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 83543149b0566ed1f363b448c26b32a30b96c797..9a4fbf4d0b92ed64ffd2016bea743c8cebfca75b 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 @@ -165,7 +163,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 +248,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 3ab72a91347c760ed185a55c0b4810b4fe91c93d..78caab5c158c3d401e4c0f6d260c19a6e7621340 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 5589f585649f0354cf4417cfd995c743b4c0a50d..66cec572347651296554b8d4e8e3903d5c979027 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 ab66270bfd916453e2a80837b510ffc70f5d9921..eecbc990f2d1cac38bad3dc7d603d2304f255015 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 dfe009f4387aec4ee993e201c8a8236f1207a147..196d248f553e30ac1198995321b34055973f95d8 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_client_context.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml index cc090580cdb02c44758ee75789b7d49aadfcb3f2..ededa688a755bef410018cb3c96f8e08f2959627 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/faked_services.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml index ff2b7871d7523d029886259274aff8e51252cde6..624565b408891e04860482f83d58c6491d13b362 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 b97417ed1807a9002190cca15b28ed9ac541020f..346cea3ee712a470aa51077536cdf5a9cc642167 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. *) @@ -83,13 +77,13 @@ 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 = - 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; @@ -870,9 +842,9 @@ 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) - (predecessor_hash : Tezos_crypto.Block_hash.t) - (block_header : Block_header.shell_header) : Bytes.t = +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 = Bytes.create Protocol.Alpha_context.Constants.proof_of_work_nonce_size in @@ -899,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 @@ -915,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 *) | _ -> @@ -930,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 @@ -1106,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; @@ -1168,7 +1138,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 = @@ -1243,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 @@ -1253,15 +1223,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 + 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 +1248,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 -> ( @@ -1292,18 +1260,14 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) Alpha_context.Operation.to_watermark (Endorsement chain_id) | Preendorsement _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) - | _ -> Tezos_crypto.Signature.Generic_operation) - | _ -> - failwith - "unexpected contents in %a@." - Tezos_crypto.Operation_hash.pp - op_hash) + | _ -> Signature.Generic_operation) + | _ -> 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 = @@ -1312,13 +1276,13 @@ let op_is_signed_by ~public_key (op_hash : Tezos_crypto.Operation_hash.t) (op.shell, Contents_list d.contents) in return - (Tezos_crypto.Signature.check + (Signature.check ~watermark public_key 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 +1308,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 +1336,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 ef4db4d8b7cbe422c94f25b5d64f9181d328061d..c01782653bdff6cf45ea010cf9df23ed1bd58741 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. @@ -145,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) *) @@ -178,54 +171,51 @@ 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:Tezos_crypto.Block_hash.t -> + 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. *) 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 (** 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 fdc0a6dc5abb8041ee537196f2761b845287073b..ce3f8bba638032e0e0d5ca935d40cf774956ea05 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 c13cc23edb6002253f31f4d91e524a6833584dfd..7b6915d2cfd283a3fed1b2dd55a2e2be4b3194fb 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 123db4e59248226fa738d75b7e6225a6cac5e88d..f3558b1a198548993524bde2373b0a8f531d48ed 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 14371ce474be872365129985381604accf9dec34..cb34cc8d3d63e0d5f1f31c8ebfff437194229259 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/disk_persistence.ml b/src/proto_alpha/lib_injector/disk_persistence.ml index f8585e929ff4b03a6a78b37455c83fa90647c64b..e31f9ca0b66db2a59cebba43176a24c830e0f5c2 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 048ec2a1309f1b2aa1d014801f7e900e3cb3456b..b79cc251fb93368f6ae04a2406b70060cc7e1a2e 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 e6db79b793451b8bf583c192289153122cbacb1c..9ceb0f772172ff3515f92c2436d1b6c7ce32503f 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; } @@ -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 7d4dd86089eefea3e70a40db694d0d6ce0afd013..9f7d6956fbe05e48dc2e01a4aa920ab5a405c718 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 @@ -63,11 +61,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 +75,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_errors.ml b/src/proto_alpha/lib_injector/injector_errors.ml index b2e5b98bebc3859edeace13a3be59f6a56bed10c..c6c9f590ef93555483d4aa94069c72a99392db29 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 1c39b4ffc53ab88fe47b98ba7347bb3b48a16fbe..e3e0f56666c9ed0c52f85f0500177d371086d9b4 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 256903f6a5e9ba14ea3b6bab6c712f8ec7b6260d..5a5236975eefc6442943c81d5b43886a194c7637 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 @@ -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 1af48370900ace9dae4c3a988cdc7f2a61cd73dd..408b7717d5ec9e3b583a824ca5fdfe7e7bf37c91 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 @@ -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,8 +634,8 @@ module Make (Rollup : PARAMETERS) = struct assert false | Ok packed_contents_list -> packed_contents_list in - let signature = Tezos_crypto.Signature.zero in - let branch = Tezos_crypto.Block_hash.zero in + let signature = Signature.zero in + let branch = Block_hash.zero in let operation = { shell = {branch}; @@ -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_sigs.ml b/src/proto_alpha/lib_injector/injector_sigs.ml index 1f19298c37038fa7b3bd5df650929fe7afeb9b62..3b77944a98251bd91f3063cd3358c3e7a279fd0b 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 7f86e158a7751d7cb5aedc4f153986d3efa52092..fca7eed3f8ff04c4a3161802165c763b79c1a9ef 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 @@ -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 c140f9901087be938a6ecbed636c7145bda2c14a..59438c487992297e449eda58f6e469a338a4e9af 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_injector/l1_operation.mli b/src/proto_alpha/lib_injector/l1_operation.mli index 21b13fbf32ffc1b49c608ee0c2d8652c341ee792..6dc5bdeb9cd85f191a23eafe80a7fc403ee888a1 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 7f8742082e1c36aed21313cd55d4b0dee3520033..64f23841d3306097b08d01349b6bcfb3a20b7be8 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 1255d70b764e28ea88c6794ec2d1e0e199294360..4cb30e48b0a57cf7d1050c0887330701cc969c63 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_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 873392b094523935a7aa4be38c300f4e42a216ad..f665437ecbe2d3e1de62d98b0d825e7ff94ae34b 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 f930bc38fd87d9098a4fb08164c0be69758be90f..eff7da67497223993fdcca88bfbf31ac7066a7a4 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 9c45e8d33cffc8c5daaeb8b9240643aba5bd9e83..bb798eeaead4e47da563195b8ff82c76fc956fac 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") @@ -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; } @@ -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 @@ -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/mempool.ml b/src/proto_alpha/lib_plugin/mempool.ml index c4131028861d8a8f5e1c46e1fb7729d530c1535e..bdec72bfb9389890b39273f9046c351029107f38 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 426dadd7093978363f8fd25f6f2acd86e93317bb..2987fab6c3ca28554e002b1f78dd7259421c7e39 100644 --- a/src/proto_alpha/lib_plugin/test/generators.ml +++ b/src/proto_alpha/lib_plugin/test/generators.ml @@ -28,28 +28,26 @@ 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? *) -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 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,10 +56,8 @@ 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 branch = Tezos_crypto.Block_hash.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 Mempool.{manager_op; fee; gas_limit; weight = Q.zero} @@ -77,8 +73,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 +89,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 +101,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 +125,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 d84714a3b984ec0fea9b10b03d881f866537bbfb..1b5d344cd38bfdb6aec3115b1bd1d667de70ec2e 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 82868acd43f26e88e1177d956ac755b173a09fcc..bb48f3b41809b171da774f103be4651ce66172df 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 0b92f1f4ca4cf986ac61b3b139239e8ae5d495b6..57402233a49e2a128e60f1bc831509bef25e12d0 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 3bb05e69e6d1d37ca4af3108276663c4a64eaadd..e157f146f8b57ea4c773c9ec6adcebb8d6ce3d02 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/account.ml b/src/proto_alpha/lib_protocol/test/helpers/account.ml index 3e7d428897e5961cfee0976c9b617a522bf95064..7f0144c194548826e89204ea7e84f75aabfb7d96 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 f97b60d4d88393e17c21a704bff66143e20442ab..62ae056b2e6ab784dd512b3edd9598f14b09662c 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 24d1953a35e3c3e245d5ca1106398ee9e2ea960a..4e491c3b294741829e0c40583ddcc4c50954858c 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/assert.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/assert.ml @@ -163,34 +163,32 @@ 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 *) -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 446ccb5cd0eb47b012e49f9df69b80602a9210d8..575ee5ea732f39a437e8496fc69ab063381ea6a5 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; @@ -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 @@ -185,7 +181,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 @@ -203,9 +199,8 @@ module Forge = struct (shell, contents) in let signature = - Tezos_crypto.Signature.sign - ~watermark: - Block_header.(to_watermark (Block_header Tezos_crypto.Chain_id.zero)) + Signature.sign + ~watermark:Block_header.(to_watermark (Block_header Chain_id.zero)) signer_account.sk unsigned_bytes in @@ -247,8 +242,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 @@ -399,13 +393,13 @@ let initial_alpha_context ?(commitments = []) constants ~level ~timestamp ~predecessor - Tezos_crypto.Chain_id.zero + Chain_id.zero ctxt >|= Environment.wrap_tzresult 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 +415,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 @@ -440,16 +434,12 @@ 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; _} -> { hash; - header = - { - shell; - protocol_data = {contents; signature = Tezos_crypto.Signature.zero}; - }; + header = {shell; protocol_data = {contents; signature = Signature.zero}}; operations = []; context; } @@ -571,7 +561,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 +578,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) @@ -627,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 @@ -641,11 +631,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; } @@ -672,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 @@ -694,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 @@ -756,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/block.mli b/src/proto_alpha/lib_protocol/test/helpers/block.mli index 4c23ea45be94e23bf32e3b32e7e6f4894dea24b2..f89a68a844a2e9de13ee142c439c2fe0f2317a95 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 *) @@ -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 @@ -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 1e0b1e4ee30d8a73798e6eabca36a3482ed44cef..c11f17a55521c620f1a2742e6f01cd8c36da8c96 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 = @@ -276,7 +274,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; } @@ -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 @@ -585,10 +582,10 @@ 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) - ~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 8681d9c66e4c96e7af4f8aa2473ed488c2537a0d..87c3415b8e4421c764d8ec27c89b66bf1f4be6a9 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 @@ -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,21 +125,20 @@ 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 - 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; } @@ -196,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 @@ -244,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 7385aaecb219c599c46f961a2e5770bbdd9d1f38..3c3a8e44880f915d52afadf75f30b9b7185ae38b 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 @@ -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/dummy_zk_rollup.ml b/src/proto_alpha/lib_protocol/test/helpers/dummy_zk_rollup.ml index 71407dfdd7aa69be0e43a69e2d6674e624cb07ad..86cd66d7cf3ed85b0b5589732937660ff88b0f5f 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 e6444892c6008c3ce5a41cd5b61b1c050495ba1e..554bba47ce079e32b883e183899f58eee56b702f 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 1cf523719e416fd625e8d2a4683749e39329d7ca..196396137e3423399e260aa0e295668815503a1e 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; } @@ -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} @@ -115,15 +115,15 @@ 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}; + protocol_data = {contents; signature = Signature.zero}; } in begin_validation_and_application predecessor.context - Tezos_crypto.Chain_id.zero + Chain_id.zero mode ~predecessor:predecessor.header.shell >|= fun state -> @@ -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/liquidity_baking_machine.ml b/src/proto_alpha/lib_protocol/test/helpers/liquidity_baking_machine.ml index 5ee590fa6812cfaa1e3f8594014d7f2623d265be..c0feb9d7e5ab1514bb61e17efea8befb44e67ab2 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 168bbb43dac674352ea7598a7517b6262f4fcd17..af27ec2e2e93a1d7600c6f979e3d8f0592156643 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 be7100071831aa2b4221b4984fe84a691fa43668..8dea4ac8421af5192873c527502b7b621d41e561 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 @@ -111,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) @@ -148,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) @@ -241,7 +238,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 = @@ -270,7 +267,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 +337,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 +353,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 +364,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 +383,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 +545,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 10581d765da337e425b8963ebdab8e39286fcc18..dc4c645b43cf6d0f822612d604b482c8c86ef178 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/op.mli @@ -45,9 +45,9 @@ val pack_operation : Context.t -> signature option -> 'a contents_list -> packed_operation val sign : - ?watermark:Tezos_crypto.Signature.watermark -> - Tezos_crypto.Signature.secret_key -> - Tezos_crypto.Block_hash.t -> + ?watermark:Signature.watermark -> + Signature.secret_key -> + 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 @@ -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 @@ -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 @@ -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 16e6222c5332065adce126ad7ec849cbc76b7047..adb9886f708902d4a3d61a2d0444ec63242b43c3 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -126,14 +126,14 @@ 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 = 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,29 +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.Ed25519.Public_key_hash.size) in - (Ed25519 (Tezos_crypto.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.Secp256k1.Public_key_hash.size) in - (Secp256k1 (Tezos_crypto.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.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 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.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 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 @@ -187,34 +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.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.Ed25519.size) in - (Ed25519 (Tezos_crypto.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.Secp256k1.size) in - (Secp256k1 (Tezos_crypto.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.P256.size) in - (P256 (Tezos_crypto.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.Ed25519.zero; - of_secp256k1 Tezos_crypto.Secp256k1.zero; - of_p256 Tezos_crypto.P256.zero; - of_bls Tezos_crypto.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'); ] () @@ -248,12 +246,12 @@ 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 = let open QCheck2.Gen in - let+ str = string_size (pure Tezos_crypto.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__ @@ -428,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/helpers/sapling_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/sapling_helpers.ml index 0f256cd31ce0116d8d90ae4c54c6bb902a7b5c8c..9bf2f8382fd8428422e08e572d177d15f237630e 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/helpers/sc_rollup_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/sc_rollup_helpers.ml index eadb4e700224f74d4199a303f71c60e2209d2e38..9831d1fafba0087df4eadb8cb19d385e5197da5f 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_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_baking.ml index 7b53651b5635b7df0dda6b9b8b50ce00f64434a7..8dd765e5fcab0db11a9886ffce29448ca9011a7d 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 336097c14e35f7da8e9dcef8644afa4a49bc95ca..912d7b5e758c558a2f442d02d235c8c8425726f7 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 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 a8fa7b8e547b55b63be9dc0f91184fa90e907cf7..393330708fea05b8c7d259d47413258dfdc852f1 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 2aa32630dd84f29ded4fa6fe5e746f1bfae59115..995ff2d40c9d56b1b50cc9034d91f9a2267494f0 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 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 5b5ce979ae4da4acdb1c03e0020c0a039d63febf..ce777f8cbf1774594f65796c8dff48a7a2cdec38 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) @@ -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 38d190702a4311ae1672deadea66c0381678fa4f..4db83c0171ad4bd548722735b9b0abe83c690934 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) @@ -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 199f1d679b5a8bf78606dcd435824d2dd5841a0d..f1c8be80ebb2a32d547d0a3c8e2b064663725988 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 @@ -177,7 +176,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/consensus/test_participation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_participation.ml index edfa1f50b6356cd58b7d7248991c5bb4eed54c5a..d8e845126282b4dead96ea61b7143c5a801bdb1e 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 9fe85ead49c5c0e6a09708c00e9c28a8be27a191..c7c7f2ed772953dddb8c0a5905db0168d3ca7bd8 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/gas/test_gas_levels.ml b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml index a6e799c846db0c4afdc75c8da84a3c715abfb012..5e0848b43e1bab0588e1ae3cc4cea207204a095b 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/michelson/test_interpretation.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_interpretation.ml index ebb8358c3f496a2e3f7494d4e521c274f9222668..302eb4dcac7b63b32233cecea58622860170cc38 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 18d132b7f79e2364b48b6802431c2a2d1612db4f..cd93f3f74078c9cd62ae1535ea616df20c8ebc88 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 631e8753e7a41879cb1d2c5d629b53413e5437d8..b04b89a1884be7cd02c2e4041a71852b91204c48 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 d5fd22a2eca250e29a02b12fdb3150d441a316ff..d30cacf107b0b371cf7afffb796598e1ffaea1ce 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 778544462e33cb779bc7c5844a6311dcbff653ea..5f6e34a3046ef35519022764154b9e391336ba9d 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.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 d8f5ef94b4aa2bc68a0243c176934699af51e0d6..c4179f275bda7848ef65ed3152bd2275145a8c17 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 832eabdeacb2a7664aa2b76a87d74a636144cfdb..f8b72c195c9017f96ad994f1ce14ab3aca0c10bf 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 = @@ -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 | _ -> @@ -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 @@ -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 @@ -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 951fa00e12d7b46da1f2f232362f55afca4c3975..46f377155405b6449a0885d1018cc909313f8651 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 @@ -1262,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 @@ -1281,7 +1276,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 +1336,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. *) @@ -1695,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 @@ -1919,7 +1912,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 b808cdf3a3cc02117e4173dbe9eea202a2de458d..5a8bde97f52744f260aa9c676b251912db16acb6 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, @@ -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_sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/test/integration/test_sc_rollup_wasm.ml index b971b3a70cd956f5b4fe3149f59f2d7b05e44f1b..320df83e780163298e059cf2a3c298409317efde 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 f8650e2e9d1ceacd65665f5ec3dc2b7e0aa39e44..89d9389517ca6bd23c69f8743fdfae7a4ded7760 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 @@ -59,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', _) -> @@ -79,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) @@ -129,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 @@ -185,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 @@ -204,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 @@ -214,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 @@ -257,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) @@ -283,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 @@ -387,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 @@ -406,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 @@ -416,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 @@ -433,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 @@ -505,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 ())) @@ -718,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/generator_descriptors.ml b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml index 9dd33155cee41cd7f43f0f278eb3782029c2f730..a57507ee8c97d17ebdd78efac5968f3f661890ce 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 b0870b34a5be46be93588cd5bc0138a8a0d59ac4..515df860cfa42d1811b170453edd4eefe8875de9 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/manager_operation_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/manager_operation_helpers.ml index 38356be68bfa8b40d7dde9288a4f395d216a2b77..6a38df40f559b790b0f36609c4977a75e2556f7b 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/test_mempool.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_mempool.ml index 4547bed9fa28094a416fe8edb48d2a449f2c62bb..4fb1ecd70617fce9dfed6d773d5aa8680e502802 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 @@ -108,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 @@ -140,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 @@ -156,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 @@ -185,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 @@ -277,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 @@ -302,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 @@ -354,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_protocol/test/integration/validate/validate_helpers.ml b/src/proto_alpha/lib_protocol/test/integration/validate/validate_helpers.ml index ebf3c18cdd72517d6328a6c8bc73bafdb8484fd5..6091e4730daadd16e15594a7322f1e8e0cca43f3 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"; @@ -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 : Signature.Ed25519.Public_key_hash.t; activation_code : Blinded_public_key_hash.activation_code; amount : Tez.t; } @@ -103,21 +103,21 @@ let secrets = let passphrase = Bytes.(cat (of_string email) (of_string password)) in let sk = Tezos_client_base.Bip39.to_seed ~passphrase t in let sk = Bytes.sub sk 0 32 in - let sk : Tezos_crypto.Signature.Secret_key.t = + let sk : Signature.Secret_key.t = Ed25519 (Data_encoding.Binary.of_bytes_exn - Tezos_crypto.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.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 2033061546f68fb7a253bb0185286216f83a31e3..767bbd4a4a52ee3d13a9ce496eaa7cfab52652e2 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 @@ -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 @@ -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 53afa3890ec3bb990df01c41bf9039972b9a6de8..52cb5f3977327b565cc74baf172f175b0f3d22dd 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 = @@ -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 3b5a68bff87bb33517b2e4c8148af153ac8b5df7..cd36907a6e4ccd2ec503ac685fd0c1f049a293f1 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 df5be1fb0d9da8ffd71650f42bcc7d826bb9fe72..af73f250bd46481f9a41e10923b93f6a6845ee39 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/regression/test_logging.ml b/src/proto_alpha/lib_protocol/test/regression/test_logging.ml index 5fb8465c249c449daaedeaf9bce59275da550441..a123f6d311ba9499e1c7a13b3a982ad0ec49f446 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_consensus_key.ml b/src/proto_alpha/lib_protocol/test/unit/test_consensus_key.ml index f985e4cea1e1707514c7bc213d334a4dcd4f08a8..1b3c2b7cdbbcb5a036150b2dc5292fe9d3e6b5fd 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 9a758c030b675cd8e7c817456298f224c4e46e0b..1f7f33a7cfa609e5be2ec9b038457fc4d51d4398 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 @@ -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_destination_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_destination_repr.ml index 1fafdba8ce999341cb51626cb7ec1fdcf3b00f1c..f4cb1a04fcf633617fb07e302be9a5804d7b1733 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 40eabf7d344b4c9a9d89e59b0f6423723a40fe51..d620a1618398ba7ddc1d550843327e01632bb25d 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_operation_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_operation_repr.ml index 419f430090de6878cc8a039a19686c893e793fad..6d24160ecf3a2e8ff0fccdb45945a1f8c0d624ae 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,15 +93,11 @@ module Test_operation_repr = struct | Error _ -> return_unit let zero_bls = - match - Tezos_crypto.Signature.(split_signature (Bls Tezos_crypto.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 f080b4539b405028dd21e77ff6c8055bc7574f04..77290a3fd080919848c0db20268575d7a74998b7 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 b4b99941bd2e235d908578fbca1a2416b92d2c8d..228f0cbd9c5174d8208878a989295cda56cec707 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 @@ -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_game.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_game.ml index c2894eabaaccd476b7b4eae4df8628ecfb9683b1..621dd364b6a54da5d254859bacbe6f632cea4cee 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 aabb38b8495cac92d046a7fc0fb972cde60cdf1a..a50278fb92c89e9d1c88cfd01e3c44ac6954fa72 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 ee352577340bb4b0e5ac7dfa45a66108faf99394..1ecd4abbbd42e6e3c0cbbf5d2e592748c4a346e0 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_management_protocol.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_management_protocol.ml index 708cd2c3aea185a7ec48af97e12db4994e5c50dd..f3d69d1b50d0dcd134834937d73fce0d768368a1 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_sc_rollup_storage.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_storage.ml index 2ca875b7103fd2fd3a23c6b9f51c03ebb37c99f4..1cc17e39b053228a1395cc47d34d39561effb988 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 06a74827a1581f56b1dd1f8a8f536d17f6e86dce..544e03dd212ce0aaf36ade50843aacdb2ce73a55 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 894f361439b03effb8fba4a34db80faeeed1e0a9..c90cbb95bfb81778f5706b08f6adcf21f80a54e9 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 @@ -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 *) @@ -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. diff --git a/src/proto_alpha/lib_sc_rollup/l2_message.mli b/src/proto_alpha/lib_sc_rollup/l2_message.mli index 456950222651c44d18b9206bd110474a7baff788..5f8f8ee52a907507d561c4b9241335c4d5fb444a 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 4715b8408387e3a070212960b7742dab106cde56..4f832b00e6fb3e9518fbf1f47ddc02e27455daa8 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 7d79a246d3e61ceb95984026ca913a3cc86e1dcd..1f0f8c7b4bbd75dcc5c3f500c51b5f5c3adbf6d6 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 b8abde35922ae94993464853ef4e790436d18dbb..d7acec7ff0ea7c661607780ead88138dc5f2de91 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 e9d32952a1d5c94004bf85de522677c92a1eefc3..fccaf23df7c60ce43cfe94063fd3e82ef19d2ca2 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 162b65edaa1318f877819fe8d8d6a538444f2c73..1ddfebc381ab6af24c0541f3e9a927441b2ee921 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 932fb2491968d4ae2a6ee6402ef92e9e72336670..669686885a3c9021c6516536fbe7de695c7a2318 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 2aae2dcdf794ba6a03f36dd254e798edceeb4817..d3469e983b58ffa258ac0a1b8125debaa1ff23f2 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 ac9a4a21d33f1be4d0e5e9f9294009243faeee23..3468ec081822a34f52b59e0ce153599220a81b90 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 d2a08cabec07563b29b0e126fa7ab0f2bb556530..21b0b3ce6a67beea9f543720fcecebd2487d5193 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 1a7f6779feed0b612d92de891fe62e74698c93ae..2649b7df95934b6fe26dd62d1c36ed5629fb41e1 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 fb4e27fa1f83b058d968777f0a36aea0896213fd..7c79a4039fd24748685e10f0af122fc8d4220fd7 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 4530b8e583ec70d8c5538917c3cc55c52db05825..e90efe0af68d1ba2d9b90c5c5181b2a5df62a537 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 @@ -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 6f47742127e7de04de9a29d5af287ed5570dea18..086f70a4111262241935313cf4c859bb077284fe 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 @@ -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 ac5cc2d0df3831ea6c5614db5de6845f810b5314..7d099b7af055b67013f178beeca911d555e4aa9b 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 3e7d0eeb2da0bd17f82f2505e806847e4c89aa85..bce5f67abe9f5e81255ff5faafcbad1ac9df3469 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 )