diff --git a/README.md b/README.md index 1eb15a85d02b..6ee6b1a3aef3 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Open up two terminal windows. In the first, issue the command: ```text bazel run //beacon-chain -- \ ---custom-genesis-delay=0 \ +--no-genesis-delay \ --bootstrap-node= \ --deposit-contract $(curl https://prylabs.net/contract) \ --clear-db \ diff --git a/beacon-chain/powchain/BUILD.bazel b/beacon-chain/powchain/BUILD.bazel index 40b17b75e9f4..71da91bd7b09 100644 --- a/beacon-chain/powchain/BUILD.bazel +++ b/beacon-chain/powchain/BUILD.bazel @@ -76,7 +76,6 @@ go_test( "//shared/bls:go_default_library", "//shared/bytesutil:go_default_library", "//shared/event:go_default_library", - "//shared/featureconfig:go_default_library", "//shared/params:go_default_library", "//shared/testutil:go_default_library", "//shared/trieutil:go_default_library", diff --git a/beacon-chain/powchain/log_processing.go b/beacon-chain/powchain/log_processing.go index f973ad7aa535..275e9d406e82 100644 --- a/beacon-chain/powchain/log_processing.go +++ b/beacon-chain/powchain/log_processing.go @@ -240,12 +240,12 @@ func (s *Service) ProcessChainStart(genesisTime uint64, eth1BlockHash [32]byte, } func (s *Service) createGenesisTime(timeStamp uint64) uint64 { - if featureconfig.Get().CustomGenesisDelay == 0 { + if featureconfig.Get().NoGenesisDelay { return timeStamp } - timeStampRdDown := timeStamp - timeStamp%featureconfig.Get().CustomGenesisDelay + timeStampRdDown := timeStamp - timeStamp%params.BeaconConfig().MinGenesisDelay // genesisTime will be set to the first second of the day, two days after it was triggered. - return timeStampRdDown + 2*featureconfig.Get().CustomGenesisDelay + return timeStampRdDown + 2*params.BeaconConfig().MinGenesisDelay } // processPastLogs processes all the past logs from the deposit contract and diff --git a/beacon-chain/powchain/log_processing_test.go b/beacon-chain/powchain/log_processing_test.go index b13724927f55..7a00dcbd0577 100644 --- a/beacon-chain/powchain/log_processing_test.go +++ b/beacon-chain/powchain/log_processing_test.go @@ -22,7 +22,6 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/flags" mockPOW "github.com/prysmaticlabs/prysm/beacon-chain/powchain/testing" contracts "github.com/prysmaticlabs/prysm/contracts/deposit-contract" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/trieutil" @@ -323,10 +322,6 @@ func TestProcessETH2GenesisLog_8DuplicatePubkeys(t *testing.T) { } func TestProcessETH2GenesisLog(t *testing.T) { - config := &featureconfig.Flags{ - CustomGenesisDelay: 0, - } - featureconfig.Init(config) hook := logTest.NewGlobal() testAcc, err := contracts.Setup() if err != nil { diff --git a/endtoend/beacon_node.go b/endtoend/beacon_node.go index e83bc752b88f..61b379b5b0de 100644 --- a/endtoend/beacon_node.go +++ b/endtoend/beacon_node.go @@ -56,6 +56,7 @@ func startNewBeaconNode(t *testing.T, config *end2EndConfig, beaconNodes []*ev.B } args := []string{ + "--no-genesis-delay", "--force-clear-db", "--no-discovery", "--http-web3provider=http://127.0.0.1:8745", diff --git a/endtoend/demo_e2e_test.go b/endtoend/demo_e2e_test.go index 6fd34e8fc8da..6e8ba0045cdf 100644 --- a/endtoend/demo_e2e_test.go +++ b/endtoend/demo_e2e_test.go @@ -15,7 +15,7 @@ func TestEndToEnd_DemoConfig(t *testing.T) { params.UseDemoBeaconConfig() demoConfig := &end2EndConfig{ - beaconFlags: append(featureconfig.E2EBeaconChainFlags, "--custom-genesis-delay=60"), + beaconFlags: featureconfig.E2EBeaconChainFlags, validatorFlags: featureconfig.E2EValidatorFlags, epochsToRun: 5, numBeaconNodes: 2, diff --git a/endtoend/minimal_e2e_test.go b/endtoend/minimal_e2e_test.go index 7fbd6d2dda76..dd9b5548facf 100644 --- a/endtoend/minimal_e2e_test.go +++ b/endtoend/minimal_e2e_test.go @@ -14,7 +14,7 @@ func TestEndToEnd_MinimalConfig(t *testing.T) { params.UseMinimalConfig() minimalConfig := &end2EndConfig{ - beaconFlags: append(featureconfig.E2EBeaconChainFlags, "--minimal-config", "--custom-genesis-delay=15"), + beaconFlags: append(featureconfig.E2EBeaconChainFlags, "--minimal-config"), validatorFlags: append(featureconfig.E2EValidatorFlags, "--minimal-config"), epochsToRun: 6, numBeaconNodes: 4, diff --git a/shared/featureconfig/BUILD.bazel b/shared/featureconfig/BUILD.bazel index 1ffcd0ff7b76..7e5a7fccc329 100644 --- a/shared/featureconfig/BUILD.bazel +++ b/shared/featureconfig/BUILD.bazel @@ -9,7 +9,6 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/shared/featureconfig", visibility = ["//visibility:public"], deps = [ - "//shared/params:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_urfave_cli//:go_default_library", ], diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index fb59c7a2184e..8ae3a5d1b3c8 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -19,7 +19,6 @@ The process for implementing new features using this package is as follows: package featureconfig import ( - "github.com/prysmaticlabs/prysm/shared/params" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -28,7 +27,7 @@ var log = logrus.WithField("prefix", "flags") // Flags is a struct to represent which features the client will perform on runtime. type Flags struct { - CustomGenesisDelay uint64 // CustomGenesisDelay signals how long of a delay to set to start the chain. + NoGenesisDelay bool // NoGenesisDelay signals to start the chain as quickly as possible. MinimalConfig bool // MinimalConfig as defined in the spec. WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents. @@ -77,10 +76,9 @@ func Init(c *Flags) { func ConfigureBeaconChain(ctx *cli.Context) { complainOnDeprecatedFlags(ctx) cfg := &Flags{} - if ctx.GlobalUint64(customGenesisDelayFlag.Name) != params.BeaconConfig().MinGenesisDelay { - delay := ctx.GlobalUint64(customGenesisDelayFlag.Name) - log.Warnf("Starting ETH2 with genesis delay of %d seconds", delay) - cfg.CustomGenesisDelay = delay + if ctx.GlobalBool(noGenesisDelayFlag.Name) { + log.Warn("Starting ETH2 with no genesis delay") + cfg.NoGenesisDelay = true } if ctx.GlobalBool(minimalConfigFlag.Name) { log.Warn("Using minimal config") diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index 92ae449e1ffb..030dee0b9dcd 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -1,7 +1,6 @@ package featureconfig import ( - "github.com/prysmaticlabs/prysm/shared/params" "github.com/urfave/cli" ) @@ -69,11 +68,11 @@ var ( Usage: "Enables connection to a slasher service in order to retrieve slashable events. Slasher is connected to the beacon node using gRPC and " + "the slasher-provider flag can be used to pass its address.", } - customGenesisDelayFlag = cli.Uint64Flag{ - Name: "custom-genesis-delay", - Usage: "Start the genesis event with the configured genesis delay in seconds. " + - "This flag should be used for local development and testing only.", - Value: params.BeaconConfig().MinGenesisDelay, + noGenesisDelayFlag = cli.BoolFlag{ + Name: "no-genesis-delay", + Usage: "Start the genesis event right away using the eth1 block timestamp which " + + "triggered the genesis as the genesis time. This flag should be used for local " + + "development and testing only.", } cacheFilteredBlockTreeFlag = cli.BoolFlag{ Name: "cache-filtered-block-tree", @@ -221,7 +220,7 @@ var E2EValidatorFlags = []string{ // BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client. var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ - customGenesisDelayFlag, + noGenesisDelayFlag, minimalConfigFlag, writeSSZStateTransitionsFlag, disableForkChoiceUnsafeFlag, diff --git a/validator/db/attestation_history_test.go b/validator/db/attestation_history_test.go index 9747edbf71ac..9bc5ec7ebc06 100644 --- a/validator/db/attestation_history_test.go +++ b/validator/db/attestation_history_test.go @@ -10,7 +10,7 @@ import ( ) func TestAttestationHistory_InitializesNewPubKeys(t *testing.T) { - pubkeys := [][48]byte{{30}, {25}, {20}} + pubkeys := [][48]byte{[48]byte{30}, [48]byte{25}, [48]byte{20}} db := SetupDB(t, pubkeys) defer TeardownDB(t, db) diff --git a/validator/db/proposal_history_test.go b/validator/db/proposal_history_test.go index f5d08c7846a7..126829a582a4 100644 --- a/validator/db/proposal_history_test.go +++ b/validator/db/proposal_history_test.go @@ -11,7 +11,7 @@ import ( ) func TestProposalHistory_InitializesNewPubKeys(t *testing.T) { - pubkeys := [][48]byte{{30}, {25}, {20}} + pubkeys := [][48]byte{[48]byte{30}, [48]byte{25}, [48]byte{20}} db := SetupDB(t, pubkeys) defer TeardownDB(t, db)