mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Use Start Index Flag in Unencrypted Key Gen (#3506)
* use start idx * fix tests
This commit is contained in:
committed by
Preston Van Loon
parent
b919429801
commit
6f25e4ce81
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
var (
|
||||
numKeys = flag.Int("num-keys", 0, "Number of validator private/withdrawal keys to generate")
|
||||
startIndex = flag.Uint64("start-index", 0, "Start index for the determinstic keygen algorithm")
|
||||
outputJSON = flag.String("output-json", "", "JSON file to write output to")
|
||||
overwrite = flag.Bool("overwrite", false, "If the key file exists, it will be overwritten")
|
||||
)
|
||||
@@ -53,18 +54,18 @@ func main() {
|
||||
}
|
||||
}()
|
||||
|
||||
ctnr := generateUnencryptedKeys()
|
||||
ctnr := generateUnencryptedKeys(*startIndex)
|
||||
if err := SaveUnencryptedKeysToFile(file, ctnr); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func generateUnencryptedKeys() *UnencryptedKeysContainer {
|
||||
func generateUnencryptedKeys(startIndex uint64) *UnencryptedKeysContainer {
|
||||
ctnr := &UnencryptedKeysContainer{
|
||||
Keys: make([]*UnencryptedKeys, *numKeys),
|
||||
}
|
||||
|
||||
sks, _, err := interop.DeterministicallyGenerateKeys(0 /*startIndex*/, uint64(*numKeys))
|
||||
sks, _, err := interop.DeterministicallyGenerateKeys(startIndex, uint64(*numKeys))
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSavesUnencryptedKeys(t *testing.T) {
|
||||
ctnr := generateUnencryptedKeys()
|
||||
ctnr := generateUnencryptedKeys(0 /* start index */)
|
||||
buf := new(bytes.Buffer)
|
||||
if err := SaveUnencryptedKeysToFile(buf, ctnr); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user