Proto: Initialize a nonce for the genesis block

This commit is contained in:
Pierre Chambart 2017-02-13 22:08:51 +01:00 committed by Grégoire Henry
parent c8376198c8
commit 90c5314c4f
5 changed files with 13 additions and 3 deletions

View File

@ -21,6 +21,7 @@ let initialize (ctxt:Context.t) =
Fitness_storage.init store >>=? fun store ->
Level_storage.init store >>=? fun store ->
Roll_storage.init store >>=? fun store ->
Nonce_storage.init store >>=? fun store ->
Seed_storage.init store >>=? fun store ->
Contract_storage.init store >>=? fun store ->
Reward_storage.init store >>=? fun store ->

View File

@ -65,3 +65,6 @@ let get c level = Storage.Seed.Nonce.get c level
let of_bytes = Seed_repr.make_nonce
let hash = Seed_repr.hash
let check_hash = Seed_repr.check_hash
let init c =
Storage.Seed.Nonce.init c Level_repr.root (Revealed Seed_repr.initial_nonce_0)

View File

@ -41,3 +41,6 @@ val get: Storage.t -> Level_repr.t -> status tzresult Lwt.t
val of_bytes: MBytes.t -> nonce tzresult
val hash: nonce -> Nonce_hash.t
val check_hash: nonce -> Nonce_hash.t -> bool
val init:
Storage.t -> Storage.t tzresult Lwt.t

View File

@ -94,8 +94,10 @@ let check_hash nonce hash =
let nonce_hash_key_part = Nonce_hash.to_path
let initial_nonce_0 =
hash
(MBytes.of_string (String.make Constants_repr.nonce_length '\000'))
MBytes.of_string (String.make Constants_repr.nonce_length '\000')
let initial_nonce_hash_0 =
hash initial_nonce_0
let initial_seed_0 = B (State_hash.hash_bytes [])
let initial_seed_1 =

View File

@ -71,7 +71,8 @@ val nonce_hash_key_part : Nonce_hash.t -> string list
(** {2 Predefined nonce} *****************************************************)
val initial_nonce_0 : Nonce_hash.t
val initial_nonce_0 : nonce
val initial_nonce_hash_0 : Nonce_hash.t
(** {2 Serializers} **********************************************************)