Alpha: split Tezos_hash
multiple source files
This commit is contained in:
parent
5fff7b3c1b
commit
3b95f77225
@ -2,7 +2,10 @@
|
||||
"hash": "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",
|
||||
"modules": [
|
||||
"Misc",
|
||||
"Tezos_hash",
|
||||
"State_hash",
|
||||
"Nonce_hash",
|
||||
"Script_expr_hash",
|
||||
"Contract_hash",
|
||||
|
||||
"Qty_repr",
|
||||
"Tez_repr",
|
||||
|
@ -54,8 +54,6 @@ type public_key_hash = Ed25519.Public_key_hash.t
|
||||
type secret_key = Ed25519.Secret_key.t
|
||||
type signature = Ed25519.Signature.t
|
||||
|
||||
include Tezos_hash
|
||||
|
||||
module Constants = struct
|
||||
include Constants_repr
|
||||
let cycle_length c =
|
||||
|
@ -17,10 +17,6 @@ end
|
||||
type t
|
||||
type context = t
|
||||
|
||||
module Contract_hash = Tezos_hash.Contract_hash
|
||||
|
||||
module Nonce_hash = Tezos_hash.Nonce_hash
|
||||
|
||||
type public_key = Ed25519.Public_key.t
|
||||
type public_key_hash = Ed25519.Public_key_hash.t
|
||||
type secret_key = Ed25519.Secret_key.t
|
||||
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
(** Block header *)
|
||||
|
||||
(** Exported type *)
|
||||
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
(** Exported type *)
|
||||
type t = {
|
||||
shell: Block_header.shell_header ;
|
||||
|
21
src/proto_alpha/lib_protocol/src/contract_hash.ml
Normal file
21
src/proto_alpha/lib_protocol/src/contract_hash.ml
Normal file
@ -0,0 +1,21 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2018. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
(* 20 *)
|
||||
let contract_hash = "\003\099\029" (* TZ(36) *)
|
||||
|
||||
include Blake2B.Make(Base58)(struct
|
||||
let name = "Contract_hash"
|
||||
let title = "A contract ID"
|
||||
let b58check_prefix = contract_hash
|
||||
let size = Some 20
|
||||
end)
|
||||
|
||||
let () =
|
||||
Base58.check_encoded_prefix b58check_encoding "TZ1" 36
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
type t =
|
||||
| Default of Ed25519.Public_key_hash.t
|
||||
| Originated of Contract_hash.t
|
||||
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
type t = private
|
||||
| Default of Ed25519.Public_key_hash.t
|
||||
| Originated of Contract_hash.t
|
||||
|
21
src/proto_alpha/lib_protocol/src/nonce_hash.ml
Normal file
21
src/proto_alpha/lib_protocol/src/nonce_hash.ml
Normal file
@ -0,0 +1,21 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2018. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
(* 32 *)
|
||||
let nonce_hash = "\069\220\169" (* nce(53) *)
|
||||
|
||||
include Blake2B.Make(Base58)(struct
|
||||
let name = "cycle_nonce"
|
||||
let title = "A nonce hash"
|
||||
let b58check_prefix = nonce_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
let () =
|
||||
Base58.check_encoded_prefix b58check_encoding "nce" 53
|
@ -54,7 +54,7 @@ let reveal c level nonce =
|
||||
|
||||
type status = Storage.Seed.nonce_status =
|
||||
| Unrevealed of {
|
||||
nonce_hash: Tezos_hash.Nonce_hash.t ;
|
||||
nonce_hash: Nonce_hash.t ;
|
||||
delegate_to_reward: Ed25519.Public_key_hash.t ;
|
||||
reward_amount: Tez_repr.t ;
|
||||
}
|
||||
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
type error +=
|
||||
| Too_late_revelation
|
||||
| Too_early_revelation
|
||||
@ -30,7 +28,7 @@ val reveal:
|
||||
|
||||
type status =
|
||||
| Unrevealed of {
|
||||
nonce_hash: Tezos_hash.Nonce_hash.t ;
|
||||
nonce_hash: Nonce_hash.t ;
|
||||
delegate_to_reward: Ed25519.Public_key_hash.t ;
|
||||
reward_amount: Tez_repr.t ;
|
||||
}
|
||||
|
20
src/proto_alpha/lib_protocol/src/script_expr_hash.ml
Normal file
20
src/proto_alpha/lib_protocol/src/script_expr_hash.ml
Normal file
@ -0,0 +1,20 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2018. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
let script_expr_hash = "\013\044\064\027" (* expr(54) *)
|
||||
|
||||
include Blake2B.Make(Base58)(struct
|
||||
let name = "script_expr"
|
||||
let title = "A script expression ID"
|
||||
let b58check_prefix = script_expr_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
let () =
|
||||
Base58.check_encoded_prefix b58check_encoding "expr" 54
|
@ -2130,7 +2130,7 @@ let typecheck_data
|
||||
let hash_data typ data =
|
||||
let unparsed = strip_annotations @@ unparse_data typ data in
|
||||
let bytes = Data_encoding.Binary.to_bytes expr_encoding (Micheline.strip_locations unparsed) in
|
||||
Tezos_hash.Script_expr_hash.(hash_bytes [ bytes ] |> to_b58check)
|
||||
Script_expr_hash.(hash_bytes [ bytes ] |> to_b58check)
|
||||
|
||||
(* ---------------- Big map -------------------------------------------------*)
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
(* Tezos Protocol Implementation - Random number generation *)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
type seed = B of State_hash.t
|
||||
type t = T of State_hash.t
|
||||
type sequence = S of State_hash.t
|
||||
|
@ -7,8 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
|
||||
(** Tezos Protocol Implementation - Random number generation
|
||||
|
||||
This is not expected to be a good cryptographic random number
|
||||
|
21
src/proto_alpha/lib_protocol/src/state_hash.ml
Normal file
21
src/proto_alpha/lib_protocol/src/state_hash.ml
Normal file
@ -0,0 +1,21 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2018. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
let random_state_hash = "\076\064\204" (* rng(53): never used... *)
|
||||
|
||||
include Blake2B.Make(Base58)(struct
|
||||
let name = "random"
|
||||
let title = "A random generation state"
|
||||
let b58check_prefix = random_state_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
let () =
|
||||
Base58.check_encoded_prefix b58check_encoding "rng" 53
|
||||
|
@ -7,7 +7,6 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Tezos_hash
|
||||
open Storage_functors
|
||||
|
||||
module Int32 = struct
|
||||
|
@ -209,7 +209,7 @@ module Seed : sig
|
||||
|
||||
type nonce_status =
|
||||
| Unrevealed of {
|
||||
nonce_hash: Tezos_hash.Nonce_hash.t ;
|
||||
nonce_hash: Nonce_hash.t ;
|
||||
delegate_to_reward: Ed25519.Public_key_hash.t ;
|
||||
reward_amount: Tez_repr.t ;
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
(**************************************************************************)
|
||||
(* *)
|
||||
(* Copyright (c) 2014 - 2018. *)
|
||||
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
||||
(* *)
|
||||
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
module Prefix = struct
|
||||
|
||||
(* 20 *)
|
||||
let contract_hash = "\003\099\029" (* TZ(36) *)
|
||||
|
||||
(* 32 *)
|
||||
let nonce_hash = "\069\220\169" (* nce(53) *)
|
||||
let script_expr_hash = "\013\044\064\027" (* expr(54) *)
|
||||
let random_state_hash = "\076\064\204" (* rng(53): never used... *)
|
||||
|
||||
end
|
||||
|
||||
module State_hash = Blake2B.Make(Base58)(struct
|
||||
let name = "random"
|
||||
let title = "A random generation state"
|
||||
let b58check_prefix = Prefix.random_state_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
module Nonce_hash = Blake2B.Make(Base58)(struct
|
||||
let name = "cycle_nonce"
|
||||
let title = "A nonce hash"
|
||||
let b58check_prefix = Prefix.nonce_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
module Script_expr_hash = Blake2B.Make(Base58)(struct
|
||||
let name = "script_expr"
|
||||
let title = "A script expression ID"
|
||||
let b58check_prefix = Prefix.script_expr_hash
|
||||
let size = None
|
||||
end)
|
||||
|
||||
module Contract_hash = Blake2B.Make(Base58)(struct
|
||||
let name = "Contract_hash"
|
||||
let title = "A contract ID"
|
||||
let b58check_prefix = Prefix.contract_hash
|
||||
let size = Some 20
|
||||
end)
|
||||
|
||||
let () =
|
||||
Base58.check_encoded_prefix Contract_hash.b58check_encoding "TZ1" 36 ;
|
||||
Base58.check_encoded_prefix Script_expr_hash.b58check_encoding "expr" 54 ;
|
||||
Base58.check_encoded_prefix Nonce_hash.b58check_encoding "nce" 53 ;
|
||||
Base58.check_encoded_prefix State_hash.b58check_encoding "rng" 53
|
Loading…
Reference in New Issue
Block a user