Config registry (#10683)

* test coverage and updates to config twiddlers

* LoadChainConfigFile error if SetActive conflicts

* lint

* wip working around test issues

* more fixes, mass test updates

* lint

* linting

* thanks deepsource!

* fix undeclared vars

* fixing more undefined

* fix a bug, make a bug, repeat

* gaz

* use stock mainnet in case fork schedule matters

* remove unused KnownConfigs

* post-merge cleanup

* eliminating OverrideBeaconConfig outside tests

* more cleanup of OverrideBeaconConfig outside tests

* config for interop w/ genesis gen support

* improve var name

* API on package instead of exported value

* cleanup remainders of "registry" naming

* Nishant feedback

* add ropstein to configset

* lint

* lint #2

* ✂️

* revert accidental commented line

* check if active is nil (replace called on empty)

* Nishant feedback

* replace OverrideBeaconConfig call

* update interop instructions w/ new flag

* don't let interop replace config set via cli flags

Co-authored-by: kasey <kasey@users.noreply.github.com>
This commit is contained in:
kasey
2022-05-20 02:16:53 -05:00
committed by GitHub
parent 1012ec1915
commit 588dea83b7
109 changed files with 1121 additions and 487 deletions

View File

@@ -51,6 +51,11 @@ func main() {
log.Fatal(err)
}
undo, err := benchmark.SetBenchmarkConfig()
if err != nil {
log.Fatal(err)
}
defer undo()
log.Printf("Output dir is: %s", *outputDir)
log.Println("Generating genesis state")
// Generating this for the 2 following states.
@@ -84,7 +89,6 @@ func generateGenesisBeaconState() error {
}
func generateMarshalledFullStateAndBlock() error {
benchmark.SetBenchmarkConfig()
beaconState, err := genesisBeaconState()
if err != nil {
return err
@@ -184,7 +188,6 @@ func generateMarshalledFullStateAndBlock() error {
}
func generate2FullEpochState() error {
benchmark.SetBenchmarkConfig()
beaconState, err := genesisBeaconState()
if err != nil {
return err

View File

@@ -39,6 +39,7 @@ var (
sszOutputFile = flag.String("output-ssz", "", "Output filename of the SSZ marshaling of the generated genesis state")
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")
)
func main() {
@@ -50,8 +51,18 @@ func main() {
log.Println("Expected --output-ssz, --output-yaml, or --output-json to have been provided, received nil")
return
}
if !*useMainnetConfig {
params.OverrideBeaconConfig(params.MinimalSpecConfig())
if *useMainnetConfig {
if err := params.SetActive(params.MainnetConfig().Copy()); err != nil {
log.Fatalf("unable to set mainnet config active, err=%s", err.Error())
}
} else {
cfg, err := params.ByName(*configName)
if err != nil {
log.Fatalf("unable to find config using name %s, err=%s", *configName, err.Error())
}
if err := params.SetActive(cfg.Copy()); err != nil {
log.Fatalf("unable to set %s config active, err=%s", cfg.ConfigName, err.Error())
}
}
var genesisState *ethpb.BeaconState
var err error