Skip to content

Commit

Permalink
Add Delay Option for Genesis to Prysmctl (#12878)
Browse files Browse the repository at this point in the history
* add delay option to prysmctl for genesis time

* revert bazel
  • Loading branch information
rauljordan authored Sep 8, 2023
1 parent ec954ec commit af16c71
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/prysmctl/testnet/generate_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
ConfigName string
NumValidators uint64
GenesisTime uint64
GenesisTimeDelay uint64
OutputSSZ string
OutputJSON string
OutputYaml string
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af16c71

Please sign in to comment.