Skip to content

Add --mainnet no-op flag for easier tooling #21795

Closed
@yorickdowne

Description

@yorickdowne

System information

Geth version: 1.9.23
OS & Version: Linux

Suggested change

I'd like to offer a PR to add a --mainnet no-op flag to geth, similar to Nethermind and Besu options. This would be a true no-op boolean, specifying it or leaving it out would have the same effect. To be clear, running geth without that parameter will still start it on main net.

My main ask is for geth; I am happy to add this to other tools in the same PR if desired.

Rationale

I have created docker tooling for eth2. The same tooling handles testnet and main net. Currently, I need to special case geth in .env like this:

# Network to use for eth1. If using Nethermind or Besu and main net, set to mainnet.
ETH1_NETWORK=goerli
# If using Geth as the eth1 node and main net, comment out.
GETH1_NETWORK=--goerli

With a --mainnet no-op flag, I can remove GETH1_NETWORK, instruct users to set ETH1_NETWORK to mainnet when on main, and it will work for Geth as well as other clients. The Geth docker-compose entrypoint could then simply use --${ETH1_NETWORK} for both test and main net.

Impact

Low for either project.

On the Geth side, having the no-op will not be a change that needs a lot of maintenance. If there's code that currently checks that only one network flag has been specified, please point me at where that is, and I can adjust it as part of the proposed PR.

On the eth2-docker side, not having the no-op is slightly inconvenient for the user, but not breaking by any means.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions