Skip to content

Conversation

@lightclient
Copy link
Member

This PR is an alternative to #32556.

Instead of trying to be smart and reuse geth init, we can introduce a new flag --genesis that loads the genesis.json from file into the Genesis object in the same path that the other network flags currently work in.

Question: is something like --genesis enough to start deprecating geth init?

--

$ geth --datadir data --hoodi
..
INFO [10-06|22:37:11.202]  - BPO2:                        @1762955544
..
$ geth --datadir data --genesis genesis.json
..
INFO [10-06|22:37:27.988]  - BPO2:                       @1862955544
..

Pull the genesis from the specs and modify one of the BPO timestamps to simulate a shadow fork.

@lightclient lightclient force-pushed the cmd-geth-genesis-flag branch from 9dcc734 to b02b46d Compare October 8, 2025 14:28
if err := json.NewDecoder(f).Decode(genesis); err != nil {
Fatalf("Invalid genesis file: %v", err)
}
cfg.Genesis = genesis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to highlight that, in this case, the ChainID will be used as the NetworkID.

I guess it's expected behavior

@barnabasbusa
Copy link
Member

LGTM

Removed the period at the end of the usage description for the GenesisFlag.
rjl493456442
rjl493456442 previously approved these changes Oct 21, 2025
@rjl493456442 rjl493456442 added this to the 1.16.6 milestone Oct 21, 2025
rjl493456442
rjl493456442 previously approved these changes Oct 21, 2025
@lightclient
Copy link
Member Author

Reverting last commit as it causes an issue with automatically upgrading the mainnet config since no network flag is typically passed.

rjl493456442
rjl493456442 previously approved these changes Oct 21, 2025
@lightclient
Copy link
Member Author

Renamed flag to override.genesis as we discussed on triage.

@rjl493456442 rjl493456442 merged commit 407d9fa into ethereum:master Oct 21, 2025
5 of 6 checks passed
barnabasbusa added a commit to ethpandaops/template-devnets that referenced this pull request Oct 24, 2025
following: ethereum/go-ethereum#32844

---------

Signed-off-by: Barnabas Busa <busa.barnabas@gmail.com>
rjl493456442 added a commit to rjl493456442/go-ethereum that referenced this pull request Oct 28, 2025
This PR is an alternative to ethereum#32556.

Instead of trying to be smart and reuse `geth init`, we can introduce a
new flag `--genesis` that loads the `genesis.json` from file into the
`Genesis` object in the same path that the other network flags currently
work in.

Question: is something like `--genesis` enough to start deprecating
`geth init`?

--

```console
$ geth --datadir data --hoodi
..
INFO [10-06|22:37:11.202]  - BPO2:                        @1762955544
..
$ geth --datadir data --genesis genesis.json
..
INFO [10-06|22:37:27.988]  - BPO2:                       @1862955544
..
```

Pull the genesis [from the
specs](https://raw.githubusercontent.com/eth-clients/hoodi/refs/heads/main/metadata/genesis.json)
and modify one of the BPO timestamps to simulate a shadow fork.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants