diff --git a/src/proto_alpha/lib_protocol/src/seed_repr.ml b/src/proto_alpha/lib_protocol/src/seed_repr.ml index 9011a5812..4c433d6d5 100644 --- a/src/proto_alpha/lib_protocol/src/seed_repr.ml +++ b/src/proto_alpha/lib_protocol/src/seed_repr.ml @@ -99,7 +99,7 @@ let initial_nonce_hash_0 = let initial_seeds n = let rec loop acc elt i = - if Compare.Int.(i = 0) then + if Compare.Int.(i = 1) then List.rev (elt :: acc) else loop diff --git a/src/proto_alpha/lib_protocol/src/seed_repr.mli b/src/proto_alpha/lib_protocol/src/seed_repr.mli index 99958ea06..4d7b8e91b 100644 --- a/src/proto_alpha/lib_protocol/src/seed_repr.mli +++ b/src/proto_alpha/lib_protocol/src/seed_repr.mli @@ -43,6 +43,10 @@ val take_int32 : sequence -> int32 -> int32 * sequence (** {2 Predefined seeds} *****************************************************) val empty : seed + +(** [intial_seeds n] generates the first [n] seeds for which there are no nonces. + The first seed is a constant value. The kth seed is the hash of seed (k-1) + concatenated with a constant. *) val initial_seeds : int -> seed list (** {2 Entropy} **************************************************************) diff --git a/src/proto_alpha/lib_protocol/src/seed_storage.ml b/src/proto_alpha/lib_protocol/src/seed_storage.ml index d6a8b501f..0819b32bd 100644 --- a/src/proto_alpha/lib_protocol/src/seed_storage.ml +++ b/src/proto_alpha/lib_protocol/src/seed_storage.ml @@ -90,7 +90,7 @@ let init ctxt = Storage.Seed.For_cycle.init ctxt cycle seed) (return ctxt) (0 --> (preserved+1)) - (Seed_repr.initial_seeds (preserved+1)) + (Seed_repr.initial_seeds (preserved+2)) let cycle_end ctxt last_cycle = let preserved = Constants_storage.preserved_cycles ctxt in @@ -105,4 +105,3 @@ let cycle_end ctxt last_cycle = | Some revealed -> let inited_seed_cycle = Cycle_repr.add last_cycle (preserved+1) in compute_for_cycle ctxt ~revealed inited_seed_cycle -