remove more old RANDAO vestiges

This commit is contained in:
Dustin Brody 2019-02-14 14:03:45 -08:00
parent 8fbf87aa8c
commit 6bef36d418

View File

@ -1,7 +1,7 @@
import import
os, ospaths, strutils, strformat, os, ospaths, strutils, strformat,
chronos, nimcrypto, json_serialization, confutils, chronos, nimcrypto, json_serialization, confutils,
spec/[datatypes, digest, crypto], conf, randao, time, ssz, spec/[datatypes, digest, crypto], conf, time, ssz,
../tests/testutil ../tests/testutil
proc writeFile(filename: string, value: auto) = proc writeFile(filename: string, value: auto) =
@ -9,17 +9,13 @@ proc writeFile(filename: string, value: auto) =
echo "Wrote ", filename echo "Wrote ", filename
proc genSingleValidator(path: string): (ValidatorPubKey, proc genSingleValidator(path: string): (ValidatorPubKey,
ValidatorPrivKey, ValidatorPrivKey) =
Eth2Digest) =
var v: PrivateValidatorData var v: PrivateValidatorData
v.privKey = newPrivKey() v.privKey = newPrivKey()
if randomBytes(v.randao.seed.data) != sizeof(v.randao.seed.data):
raise newException(Exception, "Could not generate randao seed")
writeFile(path, v) writeFile(path, v)
assert v.privKey != ValidatorPrivKey(), "Private key shouldn't be zero" assert v.privKey != ValidatorPrivKey(), "Private key shouldn't be zero"
return (v.privKey.pubKey(), v.privKey, v.randao.initialCommitment) return (v.privKey.pubKey(), v.privKey)
# TODO: Make these more comprehensive and find them a new home # TODO: Make these more comprehensive and find them a new home
type type
@ -41,7 +37,7 @@ cli do (validators: int,
var startupData: ChainStartupData var startupData: ChainStartupData
for i in 1 .. validators: for i in 1 .. validators:
let (pubKey, privKey, randaoCommitment) = let (pubKey, privKey) =
genSingleValidator(outputDir / &"validator-{i:02}.json") genSingleValidator(outputDir / &"validator-{i:02}.json")
let let