From af16c71d6ec5bf9ce73a9e42c4db19f9e0d050e4 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 8 Sep 2023 16:44:09 -0400 Subject: [PATCH] Add Delay Option for Genesis to Prysmctl (#12878) * add delay option to prysmctl for genesis time * revert bazel --- cmd/prysmctl/testnet/generate_genesis.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/prysmctl/testnet/generate_genesis.go b/cmd/prysmctl/testnet/generate_genesis.go index 82b4be265575..d2ec900585a8 100644 --- a/cmd/prysmctl/testnet/generate_genesis.go +++ b/cmd/prysmctl/testnet/generate_genesis.go @@ -34,6 +34,7 @@ var ( ConfigName string NumValidators uint64 GenesisTime uint64 + GenesisTimeDelay uint64 OutputSSZ string OutputJSON string OutputYaml string @@ -99,6 +100,11 @@ var ( Destination: &generateGenesisStateFlags.GenesisTime, Usage: "Unix timestamp seconds used as the genesis time in the genesis state. If unset, defaults to now()", }, + &cli.Uint64Flag{ + Name: "genesis-time-delay", + Destination: &generateGenesisStateFlags.GenesisTimeDelay, + Usage: "Delay genesis time by N seconds", + }, &cli.BoolFlag{ Name: "override-eth1data", Destination: &generateGenesisStateFlags.OverrideEth1Data, @@ -223,6 +229,9 @@ func generateGenesis(ctx context.Context) (state.BeaconState, error) { f.GenesisTime = uint64(time.Now().Unix()) log.Info("No genesis time specified, defaulting to now()") } + log.Infof("Delaying genesis %v by %v seconds", f.GenesisTime, f.GenesisTimeDelay) + f.GenesisTime += f.GenesisTimeDelay + log.Infof("Genesis is now %v", f.GenesisTime) v, err := version.FromString(f.ForkName) if err != nil { @@ -266,8 +275,8 @@ func generateGenesis(ctx context.Context) (state.BeaconState, error) { //gen.Config.CancunTime = interop.GethCancunTime(f.GenesisTime, params.BeaconConfig()) gen.Config.CancunTime = interop.GethCancunTime(f.GenesisTime, params.BeaconConfig()) log. - WithField("shanghai", gen.Config.ShanghaiTime). - WithField("cancun", gen.Config.CancunTime). + WithField("shanghai", fmt.Sprintf("%d", *gen.Config.ShanghaiTime)). + WithField("cancun", fmt.Sprintf("%d", *gen.Config.CancunTime)). Info("setting fork geth times") if v > version.Altair { // set ttd to zero so EL goes post-merge immediately