Alpha: Seed_repr.initial_seeds n generates n seeds rather than n+1

This commit is contained in:
Marco Stronati 2018-06-11 15:50:05 +02:00 committed by Grégoire Henry
parent 9f1c703991
commit 0ad4f8f6e6
3 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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} **************************************************************)

View File

@ -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