Skip to content

Commit

Permalink
Revert "Replace no-genesis-delay with custom-genesis-delay (#4678)"
Browse files Browse the repository at this point in the history
This reverts commit 9149c2e.
  • Loading branch information
rauljordan committed Jan 29, 2020
1 parent f6b4637 commit 3629f53
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/powchain/BUILD.bazel
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/powchain/log_processing.go
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions beacon-chain/powchain/log_processing_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions endtoend/beacon_node.go
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion endtoend/demo_e2e_test.go
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion endtoend/minimal_e2e_test.go
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion shared/featureconfig/BUILD.bazel
Expand Up @@ -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",
],
Expand Down
10 changes: 4 additions & 6 deletions shared/featureconfig/config.go
Expand Up @@ -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"
)
Expand All @@ -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.
Expand Down Expand Up @@ -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")
Expand Down
13 changes: 6 additions & 7 deletions shared/featureconfig/flags.go
@@ -1,7 +1,6 @@
package featureconfig

import (
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/urfave/cli"
)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion validator/db/attestation_history_test.go
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion validator/db/proposal_history_test.go
Expand Up @@ -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)

Expand Down

0 comments on commit 3629f53

Please sign in to comment.