Support Chain Config File Loading in Genesis State Tool (#11249)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2022-08-17 19:44:29 +00:00 committed by GitHub
parent 9b3a834437
commit e70fe1c9fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,7 @@ var (
yamlOutputFile = flag.String("output-yaml", "", "Output filename of the YAML marshaling of the generated genesis state")
jsonOutputFile = flag.String("output-json", "", "Output filename of the JSON marshaling of the generated genesis state")
configName = flag.String("config-name", params.MinimalName, "ConfigName for the BeaconChainConfig that will be used for interop, inc GenesisForkVersion of generated genesis state")
configFile = flag.String("chain-config-file", "", "Path to a chain config file for setting global params")
)
func main() {
@ -55,6 +56,11 @@ func main() {
if err := params.SetActive(params.MainnetConfig().Copy()); err != nil {
log.Fatalf("unable to set mainnet config active, err=%s", err.Error())
}
} else {
if *configFile != "" {
if err := params.LoadChainConfigFile(*configFile, nil); err != nil {
log.Fatal(err)
}
} else {
cfg, err := params.ByName(*configName)
if err != nil {
@ -64,6 +70,7 @@ func main() {
log.Fatalf("unable to set %s config active, err=%s", cfg.ConfigName, err.Error())
}
}
}
var genesisState *ethpb.BeaconState
var err error
if *depositJSONFile != "" {