From b82ad19806d8ffd87e1d6895753651dd8e987bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 14 Nov 2016 15:54:21 +0100 Subject: [PATCH] Shell: Consistently use `Ed25519.Public_key_hash` --- src/client/client_keys.mli | 3 ++- .../bootstrap/client_proto_contracts.ml | 2 +- src/proto/bootstrap/asset_repr.ml | 6 ++--- src/proto/bootstrap/asset_repr.mli | 2 +- src/proto/bootstrap/bootstrap_storage.ml | 4 +-- src/proto/bootstrap/bootstrap_storage.mli | 2 +- src/proto/bootstrap/contract_repr.ml | 26 +++++++++---------- src/proto/bootstrap/contract_repr.mli | 14 +++++----- src/proto/bootstrap/contract_storage.mli | 14 +++++----- src/proto/bootstrap/nonce_storage.ml | 2 +- src/proto/bootstrap/nonce_storage.mli | 6 ++--- src/proto/bootstrap/operation_repr.ml | 16 ++++++------ src/proto/bootstrap/operation_repr.mli | 8 +++--- src/proto/bootstrap/reward_storage.mli | 4 +-- src/proto/bootstrap/roll_storage.mli | 6 ++--- src/proto/bootstrap/services.ml | 22 ++++++++-------- src/proto/bootstrap/storage.ml | 18 ++++++------- src/proto/bootstrap/storage.mli | 18 ++++++------- src/proto/bootstrap/tezos_context.ml | 2 +- src/proto/bootstrap/tezos_context.mli | 2 +- src/proto/bootstrap/vote_storage.mli | 6 ++--- src/proto/environment/ed25519.mli | 16 +----------- src/utils/ed25519.mli | 18 ++----------- 23 files changed, 94 insertions(+), 123 deletions(-) diff --git a/src/client/client_keys.mli b/src/client/client_keys.mli index e88391533..989458f21 100644 --- a/src/client/client_keys.mli +++ b/src/client/client_keys.mli @@ -8,7 +8,8 @@ (**************************************************************************) -module Public_key_hash : Client_aliases.Alias with type t = Ed25519.public_key_hash +module Public_key_hash : + Client_aliases.Alias with type t = Ed25519.Public_key_hash.t module Public_key : Client_aliases.Alias with type t = Ed25519.public_key module Secret_key : Client_aliases.Alias with type t = Ed25519.secret_key diff --git a/src/client/embedded/bootstrap/client_proto_contracts.ml b/src/client/embedded/bootstrap/client_proto_contracts.ml index 05aa8b817..2ad6b6fb1 100644 --- a/src/client/embedded/bootstrap/client_proto_contracts.ml +++ b/src/client/embedded/bootstrap/client_proto_contracts.ml @@ -101,7 +101,7 @@ let get_delegate block source = let may_check_key sourcePubKey sourcePubKeyHash = match sourcePubKey with | Some sourcePubKey -> - if not (Ed25519.equal_hash (Ed25519.hash sourcePubKey) sourcePubKeyHash) + if not (Ed25519.Public_key_hash.equal (Ed25519.hash sourcePubKey) sourcePubKeyHash) then failwith "Invalid public key in `client_proto_endorsement`" else diff --git a/src/proto/bootstrap/asset_repr.ml b/src/proto/bootstrap/asset_repr.ml index 8148a11d9..ac288a660 100644 --- a/src/proto/bootstrap/asset_repr.ml +++ b/src/proto/bootstrap/asset_repr.ml @@ -22,10 +22,10 @@ let encoding = module Map = struct module Raw = Map.Make(struct - type t = asset * Ed25519.public_key_hash + type t = asset * Ed25519.Public_key_hash.t let compare (a1, pk1) (a2, pk2) = if Compare.Int32.(a1 = a2) then - Ed25519.compare_hash pk1 pk2 + Ed25519.Public_key_hash.compare pk1 pk2 else Compare.Int32.compare a1 a2 end) @@ -54,7 +54,7 @@ let encoding = (Json.wrap_error of_tuple_list_exn) (list (tup2 - (tup2 encoding Ed25519.public_key_hash_encoding) + (tup2 encoding Ed25519.Public_key_hash.encoding) Tez_repr.encoding))) end diff --git a/src/proto/bootstrap/asset_repr.mli b/src/proto/bootstrap/asset_repr.mli index b0f8fb033..6bdd30efc 100644 --- a/src/proto/bootstrap/asset_repr.mli +++ b/src/proto/bootstrap/asset_repr.mli @@ -17,6 +17,6 @@ module Map : sig type t val empty: t val add: - t -> asset -> Ed25519.public_key_hash -> Tez_repr.tez -> t tzresult + t -> asset -> Ed25519.Public_key_hash.t -> Tez_repr.tez -> t tzresult val encoding: t Data_encoding.t end diff --git a/src/proto/bootstrap/bootstrap_storage.ml b/src/proto/bootstrap/bootstrap_storage.ml index d73438a58..9555ae33d 100644 --- a/src/proto/bootstrap/bootstrap_storage.ml +++ b/src/proto/bootstrap/bootstrap_storage.ml @@ -8,7 +8,7 @@ (**************************************************************************) type account = { - public_key_hash : Ed25519.public_key_hash ; + public_key_hash : Ed25519.Public_key_hash.t ; public_key : Ed25519.public_key ; secret_key : Ed25519.secret_key ; } @@ -94,7 +94,7 @@ let account_encoding = (fun (public_key_hash, public_key, secret_key) -> { public_key_hash ; public_key ; secret_key }) (obj3 - (req "publicKeyHash" Ed25519.public_key_hash_encoding) + (req "publicKeyHash" Ed25519.Public_key_hash.encoding) (req "publicKey" Ed25519.public_key_encoding) (req "secretKey" Ed25519.secret_key_encoding)) diff --git a/src/proto/bootstrap/bootstrap_storage.mli b/src/proto/bootstrap/bootstrap_storage.mli index 40eedc5d8..f578bb61e 100644 --- a/src/proto/bootstrap/bootstrap_storage.mli +++ b/src/proto/bootstrap/bootstrap_storage.mli @@ -8,7 +8,7 @@ (**************************************************************************) type account = { - public_key_hash : Ed25519.public_key_hash ; + public_key_hash : Ed25519.Public_key_hash.t ; public_key : Ed25519.public_key ; secret_key : Ed25519.secret_key ; } diff --git a/src/proto/bootstrap/contract_repr.ml b/src/proto/bootstrap/contract_repr.ml index cf0ab4db9..136fc03ea 100644 --- a/src/proto/bootstrap/contract_repr.ml +++ b/src/proto/bootstrap/contract_repr.ml @@ -10,15 +10,15 @@ open Tezos_hash type descr = { - manager: Ed25519.public_key_hash ; - delegate: Ed25519.public_key_hash option ; + manager: Ed25519.Public_key_hash.t ; + delegate: Ed25519.Public_key_hash.t option ; spendable: bool ; delegatable: bool ; script: Script_repr.t ; } type t = - | Default of Ed25519.public_key_hash + | Default of Ed25519.Public_key_hash.t | Hash of Contract_hash.t type contract = t @@ -29,12 +29,10 @@ let to_b48check = function | Hash h -> Contract_hash.to_b48check h let of_b48check s = - try - match Base48.decode s with - | Ed25519.Public_key_hash.Hash h -> ok (Default h) - | Contract_hash.Hash h -> ok (Hash h) - | _ -> error (Invalid_contract_notation s) - with _ -> error (Invalid_contract_notation s) + match Base48.decode s with + | Some (Ed25519.Public_key_hash.Hash h) -> ok (Default h) + | Some (Contract_hash.Hash h) -> ok (Hash h) + | _ -> error (Invalid_contract_notation s) let encoding = let open Data_encoding in @@ -50,7 +48,7 @@ let encoding = splitted ~binary: (union ~tag_size:`Uint8 [ - case ~tag:0 Ed25519.public_key_hash_encoding + case ~tag:0 Ed25519.Public_key_hash.encoding (function Default k -> Some k | _ -> None) (fun k -> Default k) ; case ~tag:1 Contract_hash.encoding @@ -96,8 +94,8 @@ let descr_encoding = (fun (manager, delegate, spendable, delegatable, script) -> { manager; delegate; spendable; delegatable; script }) (obj5 - (req "manager" Ed25519.public_key_hash_encoding) - (opt "delegate" Ed25519.public_key_hash_encoding) + (req "manager" Ed25519.Public_key_hash.encoding) + (opt "delegate" Ed25519.Public_key_hash.encoding) (dft "spendable" bool false) (dft "delegatable" bool false) (req "script" Script_repr.encoding)) @@ -105,7 +103,7 @@ let descr_encoding = let generic_contract ~manager ~delegate ~spendable ~delegatable ~script = match delegate, spendable, delegatable, script with | Some delegate, true, false, Script_repr.No_script - when Ed25519.equal_hash manager delegate -> + when Ed25519.Public_key_hash.equal manager delegate -> default_contract manager | _ -> let data = @@ -130,7 +128,7 @@ let arg = let compare l1 l2 = match l1, l2 with | Default pkh1, Default pkh2 -> - Ed25519.compare_hash pkh1 pkh2 + Ed25519.Public_key_hash.compare pkh1 pkh2 | Hash h1, Hash h2 -> Contract_hash.compare h1 h2 | Default _, Hash _ -> -1 diff --git a/src/proto/bootstrap/contract_repr.mli b/src/proto/bootstrap/contract_repr.mli index 86047b798..2422f268e 100644 --- a/src/proto/bootstrap/contract_repr.mli +++ b/src/proto/bootstrap/contract_repr.mli @@ -10,13 +10,13 @@ open Tezos_hash type t = private - | Default of Ed25519.public_key_hash + | Default of Ed25519.Public_key_hash.t | Hash of Contract_hash.t type contract = t type descr = { - manager: Ed25519.public_key_hash ; - delegate: Ed25519.public_key_hash option ; + manager: Ed25519.Public_key_hash.t ; + delegate: Ed25519.Public_key_hash.t option ; spendable: bool ; delegatable: bool ; script: Script_repr.t ; @@ -24,13 +24,13 @@ type descr = { include Compare.S with type t := contract -val default_contract : Ed25519.public_key_hash -> contract +val default_contract : Ed25519.Public_key_hash.t -> contract -val is_default : contract -> Ed25519.public_key_hash option +val is_default : contract -> Ed25519.Public_key_hash.t option val generic_contract : - manager:Ed25519.public_key_hash -> - delegate:Ed25519.public_key_hash option -> + manager:Ed25519.Public_key_hash.t -> + delegate:Ed25519.Public_key_hash.t option -> spendable:bool -> delegatable:bool -> script:Script_repr.t -> diff --git a/src/proto/bootstrap/contract_storage.mli b/src/proto/bootstrap/contract_storage.mli index b62812b91..589fb2b03 100644 --- a/src/proto/bootstrap/contract_storage.mli +++ b/src/proto/bootstrap/contract_storage.mli @@ -33,9 +33,9 @@ val is_delegatable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t val is_spendable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t val get_descr: Storage.t -> Contract_repr.t -> Contract_repr.descr tzresult Lwt.t -val get_manager: Storage.t -> Contract_repr.t -> Ed25519.public_key_hash tzresult Lwt.t -val get_delegate: Storage.t -> Contract_repr.t -> Ed25519.public_key_hash tzresult Lwt.t -val get_delegate_opt: Storage.t -> Contract_repr.t -> Ed25519.public_key_hash option tzresult Lwt.t +val get_manager: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t +val get_delegate: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t +val get_delegate_opt: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t val get_balance: Storage.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t val get_assets: Storage.t -> Contract_repr.t -> Asset_repr.Map.t tzresult Lwt.t val get_counter: Storage.t -> Contract_repr.t -> int32 tzresult Lwt.t @@ -49,7 +49,7 @@ val update_script_storage: Storage.t -> Contract_repr.t -> Script_repr.expr -> Storage.t tzresult Lwt.t (** fails if the contract is not delegatable *) -val set_delegate : Storage.t -> Contract_repr.t -> Ed25519.public_key_hash option -> Storage.t tzresult Lwt.t +val set_delegate : Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option -> Storage.t tzresult Lwt.t val credit : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t @@ -60,14 +60,14 @@ val spend : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt val unconditional_spend : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t val issue : - Storage.t -> Contract_repr.t -> Asset_repr.t -> Ed25519.public_key_hash -> Tez_repr.t -> Storage.t tzresult Lwt.t + Storage.t -> Contract_repr.t -> Asset_repr.t -> Ed25519.Public_key_hash.t -> Tez_repr.t -> Storage.t tzresult Lwt.t val originate : Storage.t -> balance:Tez_repr.t -> - manager:Ed25519.public_key_hash -> + manager:Ed25519.Public_key_hash.t -> script:Script_repr.t -> - delegate:Ed25519.public_key_hash option -> + delegate:Ed25519.Public_key_hash.t option -> spendable:bool -> delegatable:bool -> (Storage.t * Contract_repr.t) tzresult Lwt.t diff --git a/src/proto/bootstrap/nonce_storage.ml b/src/proto/bootstrap/nonce_storage.ml index df2b2d3ba..b1acbd0e8 100644 --- a/src/proto/bootstrap/nonce_storage.ml +++ b/src/proto/bootstrap/nonce_storage.ml @@ -55,7 +55,7 @@ let reveal c level nonce = type status = Storage.Seed.nonce_status = | Unrevealed of { nonce_hash: Tezos_hash.Nonce_hash.t ; - delegate_to_reward: Ed25519.public_key_hash ; + delegate_to_reward: Ed25519.Public_key_hash.t ; reward_amount: Tez_repr.t ; } | Revealed of nonce diff --git a/src/proto/bootstrap/nonce_storage.mli b/src/proto/bootstrap/nonce_storage.mli index 1f996ad54..2c0ab5a53 100644 --- a/src/proto/bootstrap/nonce_storage.mli +++ b/src/proto/bootstrap/nonce_storage.mli @@ -21,17 +21,17 @@ val encoding: nonce Data_encoding.t val record_hash: Storage.t -> - Ed25519.public_key_hash -> Tez_repr.t -> + Ed25519.Public_key_hash.t -> Tez_repr.t -> Nonce_hash.t -> Storage.t tzresult Lwt.t val reveal: Storage.t -> Level_repr.t -> nonce -> - (Storage.t * Ed25519.public_key_hash * Tez_repr.t) tzresult Lwt.t + (Storage.t * Ed25519.Public_key_hash.t * Tez_repr.t) tzresult Lwt.t type status = | Unrevealed of { nonce_hash: Tezos_hash.Nonce_hash.t ; - delegate_to_reward: Ed25519.public_key_hash ; + delegate_to_reward: Ed25519.Public_key_hash.t ; reward_amount: Tez_repr.t ; } | Revealed of nonce diff --git a/src/proto/bootstrap/operation_repr.ml b/src/proto/bootstrap/operation_repr.ml index 9b0559940..9fead8956 100644 --- a/src/proto/bootstrap/operation_repr.ml +++ b/src/proto/bootstrap/operation_repr.ml @@ -46,18 +46,18 @@ and manager_operation = destination: Contract_repr.contract ; } | Origination of { - manager: Ed25519.public_key_hash ; - delegate: Ed25519.public_key_hash option ; + manager: Ed25519.Public_key_hash.t ; + delegate: Ed25519.Public_key_hash.t option ; script: Script_repr.t ; spendable: bool ; delegatable: bool ; credit: Tez_repr.tez ; } | Issuance of { - asset: Asset_repr.asset * Ed25519.public_key_hash ; + asset: Asset_repr.asset * Ed25519.Public_key_hash.t ; amount: Tez_repr.tez ; } - | Delegation of Ed25519.public_key_hash option + | Delegation of Ed25519.Public_key_hash.t option and delegate_operation = | Endorsement of { @@ -99,11 +99,11 @@ module Encoding = struct let origination_encoding = (obj7 (req "kind" (constant "origination")) - (req "managerPubkey" Ed25519.public_key_hash_encoding) + (req "managerPubkey" Ed25519.Public_key_hash.encoding) (req "balance" Tez_repr.encoding) (opt "spendable" bool) (opt "delegatable" bool) - (opt "delegate" Ed25519.public_key_hash_encoding) + (opt "delegate" Ed25519.Public_key_hash.encoding) (req "script" Script_repr.encoding)) let origination_case tag = @@ -125,7 +125,7 @@ module Encoding = struct let issuance_encoding = (obj3 (req "kind" (constant "issuance")) - (req "asset" (tup2 Asset_repr.encoding Ed25519.public_key_hash_encoding)) + (req "asset" (tup2 Asset_repr.encoding Ed25519.Public_key_hash.encoding)) (req "quantity" Tez_repr.encoding)) let issuance_case tag = @@ -138,7 +138,7 @@ module Encoding = struct let delegation_encoding = (obj2 (req "kind" (constant "delegation")) - (opt "delegate" Ed25519.public_key_hash_encoding)) + (opt "delegate" Ed25519.Public_key_hash.encoding)) let delegation_case tag = case ~tag delegation_encoding diff --git a/src/proto/bootstrap/operation_repr.mli b/src/proto/bootstrap/operation_repr.mli index 7d6abc0a7..089325228 100644 --- a/src/proto/bootstrap/operation_repr.mli +++ b/src/proto/bootstrap/operation_repr.mli @@ -46,18 +46,18 @@ and manager_operation = destination: Contract_repr.contract ; } | Origination of { - manager: Ed25519.public_key_hash ; - delegate: Ed25519.public_key_hash option ; + manager: Ed25519.Public_key_hash.t ; + delegate: Ed25519.Public_key_hash.t option ; script: Script_repr.t ; spendable: bool ; delegatable: bool ; credit: Tez_repr.tez ; } | Issuance of { - asset: Asset_repr.t * Ed25519.public_key_hash ; + asset: Asset_repr.t * Ed25519.Public_key_hash.t ; amount: Tez_repr.tez ; } - | Delegation of Ed25519.public_key_hash option + | Delegation of Ed25519.Public_key_hash.t option and delegate_operation = | Endorsement of { diff --git a/src/proto/bootstrap/reward_storage.mli b/src/proto/bootstrap/reward_storage.mli index 8ba49d14a..f337ec1da 100644 --- a/src/proto/bootstrap/reward_storage.mli +++ b/src/proto/bootstrap/reward_storage.mli @@ -8,10 +8,10 @@ (**************************************************************************) val record: - Storage.t -> Ed25519.public_key_hash -> Cycle_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t + Storage.t -> Ed25519.Public_key_hash.t -> Cycle_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t val discard: - Storage.t -> Ed25519.public_key_hash -> Cycle_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t + Storage.t -> Ed25519.Public_key_hash.t -> Cycle_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t val pay_due_rewards: Storage.t -> Storage.t tzresult Lwt.t diff --git a/src/proto/bootstrap/roll_storage.mli b/src/proto/bootstrap/roll_storage.mli index 5141c9b79..066d55117 100644 --- a/src/proto/bootstrap/roll_storage.mli +++ b/src/proto/bootstrap/roll_storage.mli @@ -36,11 +36,11 @@ val clear_cycle : val mining_rights_owner : Storage.t -> Level_repr.t -> priority:int32 -> - Ed25519.public_key_hash tzresult Lwt.t + Ed25519.Public_key_hash.t tzresult Lwt.t val endorsement_rights_owner : Storage.t -> Level_repr.t -> slot:int -> - Ed25519.public_key_hash tzresult Lwt.t + Ed25519.Public_key_hash.t tzresult Lwt.t module Contract : sig @@ -60,4 +60,4 @@ end (**/**) val get_contract_delegate: - Storage.t -> Contract_repr.t -> Ed25519.public_key_hash option tzresult Lwt.t + Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t diff --git a/src/proto/bootstrap/services.ml b/src/proto/bootstrap/services.ml index 721d099c9..7054f08d8 100644 --- a/src/proto/bootstrap/services.ml +++ b/src/proto/bootstrap/services.ml @@ -191,7 +191,7 @@ module Context = struct let pk_encoding = (obj2 - (req "hash" Ed25519.public_key_hash_encoding) + (req "hash" Ed25519.Public_key_hash.encoding) (req "public_key" Ed25519.public_key_encoding)) let list custom_root = @@ -225,14 +225,14 @@ module Context = struct RPC.service ~description: "Access the manager of a contract." ~input: empty - ~output: (wrap_tzerror Ed25519.public_key_hash_encoding) + ~output: (wrap_tzerror Ed25519.Public_key_hash.encoding) RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "manager") let delegate custom_root = RPC.service ~description: "Access the delegate of a contract, if any." ~input: empty - ~output: (wrap_tzerror (option Ed25519.public_key_hash_encoding)) + ~output: (wrap_tzerror (option Ed25519.Public_key_hash.encoding)) RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "delegate") let counter custom_root = @@ -292,12 +292,12 @@ module Context = struct (fun (manager,balance,spendable,delegate,script,assets,counter) -> {manager;balance;spendable;delegate;script;assets;counter}) @@ obj7 - (req "manager" Ed25519.public_key_hash_encoding) + (req "manager" Ed25519.Public_key_hash.encoding) (req "balance" Tez.encoding) (req "spendable" bool) (req "delegate" @@ obj2 (req "setable" bool) - (opt "value" Ed25519.public_key_hash_encoding)) + (opt "value" Ed25519.Public_key_hash.encoding)) (dft "script" Script.encoding No_script) (req "assets" Asset.Map.encoding) (req "counter" int32)) @@ -404,7 +404,7 @@ module Helpers = struct (req "mining_rights" (list (obj2 - (req "delegate" Ed25519.public_key_hash_encoding) + (req "delegate" Ed25519.Public_key_hash.encoding) (req "timestamp" Timestamp.encoding))))) RPC.Path.(custom_root / "helpers" / "rights" / "mining") @@ -418,7 +418,7 @@ module Helpers = struct obj2 (req "level" Raw_level.encoding) (req "delegates" - (list Ed25519.public_key_hash_encoding))) + (list Ed25519.Public_key_hash.encoding))) RPC.Path.(custom_root / "helpers" / "rights" / "mining" / "level" /: Raw_level.arg ) @@ -447,7 +447,7 @@ module Helpers = struct ~input: empty ~output: (wrap_tzerror @@ obj1 (req "delegates" - (list Ed25519.public_key_hash_encoding))) + (list Ed25519.Public_key_hash.encoding))) RPC.Path.(custom_root / "helpers" / "rights" / "mining" / "delegate" ) @@ -460,7 +460,7 @@ module Helpers = struct obj2 (req "level" Raw_level.encoding) (req "delegates" - (list Ed25519.public_key_hash_encoding))) + (list Ed25519.Public_key_hash.encoding))) RPC.Path.(custom_root / "helpers" / "rights" / "endorsement") let endorsement_rights_for_level custom_root = @@ -472,7 +472,7 @@ module Helpers = struct obj2 (req "level" Raw_level.encoding) (req "delegates" - (list Ed25519.public_key_hash_encoding))) + (list Ed25519.Public_key_hash.encoding))) RPC.Path.(custom_root / "helpers" / "rights" / "endorsement" / "level" /: Raw_level.arg ) @@ -501,7 +501,7 @@ module Helpers = struct ~input: empty ~output: (wrap_tzerror @@ obj1 (req "delegates" - (list Ed25519.public_key_hash_encoding))) + (list Ed25519.Public_key_hash.encoding))) RPC.Path.(custom_root / "helpers" / "rights" / "endorsement" / "delegate" ) diff --git a/src/proto/bootstrap/storage.ml b/src/proto/bootstrap/storage.ml index 9dfed0a9a..74183b50a 100644 --- a/src/proto/bootstrap/storage.ml +++ b/src/proto/bootstrap/storage.ml @@ -197,10 +197,10 @@ module Roll = struct module Owner_for_cycle = Make_indexed_data_storage(struct type key = Cycle_repr.t * Roll_repr.t - type value = Ed25519.public_key_hash + type value = Ed25519.Public_key_hash.t let name = "roll owner for current cycle" let key = Key.Cycle.roll_owner - let encoding = Ed25519.public_key_hash_encoding + let encoding = Ed25519.Public_key_hash.encoding end) module Contract_roll_list = @@ -266,10 +266,10 @@ module Contract = struct module Manager = Make_indexed_data_storage(struct type key = Contract_repr.t - type value = Ed25519.public_key_hash + type value = Ed25519.Public_key_hash.t let name = "contract manager" let key = Key.Contract.manager - let encoding = Ed25519.public_key_hash_encoding + let encoding = Ed25519.Public_key_hash.encoding end) module Spendable = @@ -293,10 +293,10 @@ module Contract = struct module Delegate = Make_indexed_data_storage(struct type key = Contract_repr.t - type value = Ed25519.public_key_hash + type value = Ed25519.Public_key_hash.t let name = "contract delegate" let key = Key.Contract.delegate - let encoding = Ed25519.public_key_hash_encoding + let encoding = Ed25519.Public_key_hash.encoding end) module Counter = @@ -376,7 +376,7 @@ module Vote = struct module Proposals = Make_data_set_storage (struct - type value = Protocol_hash.t * Ed25519.public_key_hash + type value = Protocol_hash.t * Ed25519.Public_key_hash.t let name = "proposals" let encoding = Data_encoding.tup2 @@ -413,7 +413,7 @@ module Seed = struct type nonce_status = | Unrevealed of { nonce_hash: Tezos_hash.Nonce_hash.t ; - delegate_to_reward: Ed25519.public_key_hash ; + delegate_to_reward: Ed25519.Public_key_hash.t ; reward_amount: Tez_repr.t ; } | Revealed of Seed_repr.nonce @@ -482,7 +482,7 @@ module Rewards = struct module Amount = Raw_make_iterable_data_storage(struct - type t = Ed25519.public_key_hash * Cycle_repr.t + type t = Ed25519.Public_key_hash.t * Cycle_repr.t let prefix = Key.rewards let length = Ed25519.Public_key_hash.path_len + 1 let to_path (pkh, c) = diff --git a/src/proto/bootstrap/storage.mli b/src/proto/bootstrap/storage.mli index a49173e4a..6c20b856e 100644 --- a/src/proto/bootstrap/storage.mli +++ b/src/proto/bootstrap/storage.mli @@ -109,7 +109,7 @@ module Roll : sig module Owner_for_cycle : Indexed_data_storage with type key = Cycle_repr.t * Roll_repr.t - and type value = Ed25519.public_key_hash + and type value = Ed25519.Public_key_hash.t and type context := t end @@ -144,13 +144,13 @@ module Contract : sig (** The manager of a contract *) module Manager : Indexed_data_storage with type key = Contract_repr.t - and type value = Ed25519.public_key_hash + and type value = Ed25519.Public_key_hash.t and type context := t (** The delegate of a contract, if any. *) module Delegate : Indexed_data_storage with type key = Contract_repr.t - and type value = Ed25519.public_key_hash + and type value = Ed25519.Public_key_hash.t and type context := t module Spendable : Indexed_data_storage @@ -201,16 +201,16 @@ module Vote : sig and type context := t module Listings : Iterable_data_storage - with type key = Ed25519.public_key_hash + with type key = Ed25519.Public_key_hash.t and type value = int32 (* number of rolls for the key. *) and type context := t module Proposals : Data_set_storage - with type value = Protocol_hash.t * Ed25519.public_key_hash + with type value = Protocol_hash.t * Ed25519.Public_key_hash.t and type context := t module Ballots : Iterable_data_storage - with type key = Ed25519.public_key_hash + with type key = Ed25519.Public_key_hash.t and type value = Vote_repr.ballot and type context := t @@ -220,7 +220,7 @@ end (** Keys *) module Public_key : Iterable_data_storage - with type key = Ed25519.public_key_hash + with type key = Ed25519.Public_key_hash.t and type value = Ed25519.public_key and type context := t @@ -234,7 +234,7 @@ module Seed : sig type nonce_status = | Unrevealed of { nonce_hash: Tezos_hash.Nonce_hash.t ; - delegate_to_reward: Ed25519.public_key_hash ; + delegate_to_reward: Ed25519.Public_key_hash.t ; reward_amount: Tez_repr.t ; } | Revealed of Seed_repr.nonce @@ -266,7 +266,7 @@ module Rewards : sig and type context := t module Amount : Iterable_data_storage - with type key = Ed25519.public_key_hash * Cycle_repr.t + with type key = Ed25519.Public_key_hash.t * Cycle_repr.t and type value = Tez_repr.t and type context := t diff --git a/src/proto/bootstrap/tezos_context.ml b/src/proto/bootstrap/tezos_context.ml index d387a0819..d1c9287fd 100644 --- a/src/proto/bootstrap/tezos_context.ml +++ b/src/proto/bootstrap/tezos_context.ml @@ -39,7 +39,7 @@ module Script_int = Script_int_repr module Script = Script_repr type public_key = Ed25519.public_key -type public_key_hash = Ed25519.public_key_hash +type public_key_hash = Ed25519.Public_key_hash.t type secret_key = Ed25519.secret_key type signature = Ed25519.signature diff --git a/src/proto/bootstrap/tezos_context.mli b/src/proto/bootstrap/tezos_context.mli index 15a935db7..2da485bf6 100644 --- a/src/proto/bootstrap/tezos_context.mli +++ b/src/proto/bootstrap/tezos_context.mli @@ -26,7 +26,7 @@ module Nonce_hash_set = Tezos_hash.Nonce_hash_set module Nonce_hash_map = Tezos_hash.Nonce_hash_map type public_key = Ed25519.public_key -type public_key_hash = Ed25519.public_key_hash +type public_key_hash = Ed25519.Public_key_hash.t type secret_key = Ed25519.secret_key type signature = Ed25519.signature diff --git a/src/proto/bootstrap/vote_storage.mli b/src/proto/bootstrap/vote_storage.mli index 010a822fd..c94386dfe 100644 --- a/src/proto/bootstrap/vote_storage.mli +++ b/src/proto/bootstrap/vote_storage.mli @@ -8,7 +8,7 @@ (**************************************************************************) val record_proposal: - Storage.t -> Protocol_hash.t -> Ed25519.public_key_hash -> + Storage.t -> Protocol_hash.t -> Ed25519.Public_key_hash.t -> Storage.t tzresult Lwt.t val get_proposals: @@ -23,7 +23,7 @@ type ballots = { } val record_ballot: - Storage.t -> Ed25519.public_key_hash -> Vote_repr.ballot -> + Storage.t -> Ed25519.Public_key_hash.t -> Vote_repr.ballot -> Storage.t tzresult Lwt.t val get_ballots: Storage.t -> ballots tzresult Lwt.t val clear_ballots: Storage.t -> Storage.t Lwt.t @@ -33,7 +33,7 @@ val clear_listings: Storage.t -> Storage.t tzresult Lwt.t val listing_size: Storage.t -> int32 tzresult Lwt.t val in_listings: - Storage.t -> Ed25519.public_key_hash -> bool Lwt.t + Storage.t -> Ed25519.Public_key_hash.t -> bool Lwt.t val get_current_quorum: Storage.t -> int32 tzresult Lwt.t val set_current_quorum: Storage.t -> int32 -> Storage.t tzresult Lwt.t diff --git a/src/proto/environment/ed25519.mli b/src/proto/environment/ed25519.mli index 3dc1fa5d0..588d318e2 100644 --- a/src/proto/environment/ed25519.mli +++ b/src/proto/environment/ed25519.mli @@ -22,25 +22,11 @@ val check_signature : public_key -> signature -> MBytes.t -> bool module Public_key_hash : Hash.HASH -(** A Sha256 hash of an Ed25519 public key for use as an ID *) -type public_key_hash = Public_key_hash.t - (** Hashes an Ed25519 public key *) -val hash : public_key -> public_key_hash - -(** For using IDs as keys in the database *) -val hash_path : public_key_hash -> string list - -(** ID comparison *) -val equal_hash : public_key_hash -> public_key_hash -> bool - -(** ID comparison *) -val compare_hash : public_key_hash -> public_key_hash -> int +val hash : public_key -> Public_key_hash.t (** {2 Serializers} **********************************************************) -val public_key_hash_encoding : public_key_hash Data_encoding.t - val public_key_encoding : public_key Data_encoding.t val secret_key_encoding : secret_key Data_encoding.t diff --git a/src/utils/ed25519.mli b/src/utils/ed25519.mli index 4e4b7d560..5a9c367b5 100644 --- a/src/utils/ed25519.mli +++ b/src/utils/ed25519.mli @@ -33,25 +33,11 @@ val check_signature : public_key -> signature -> MBytes.t -> bool module Public_key_hash : Hash.HASH -(** A Sha256 hash of an Ed25519 public key for use as an ID *) -type public_key_hash = Public_key_hash.t - (** Hashes an Ed25519 public key *) -val hash : public_key -> public_key_hash - -(** For using IDs as keys in the database *) -val hash_path : public_key_hash -> string list - -(** ID comparison *) -val equal_hash : public_key_hash -> public_key_hash -> bool - -(** ID comparison *) -val compare_hash : public_key_hash -> public_key_hash -> int +val hash : public_key -> Public_key_hash.t (** {2 Serializers} **********************************************************) -val public_key_hash_encoding : public_key_hash Data_encoding.t - val public_key_encoding : public_key Data_encoding.t val secret_key_encoding : secret_key Data_encoding.t @@ -60,4 +46,4 @@ val signature_encoding : signature Data_encoding.t (** {2 Key pairs generation} *************************************************) -val generate_key : unit -> public_key_hash * public_key * secret_key +val generate_key : unit -> Public_key_hash.t * public_key * secret_key