Skip to content

Commit

Permalink
Removing flags and data related to Ethereum testnets (#1024)
Browse files Browse the repository at this point in the history
* working

* lint

* review changes

* fixes

* why is it running out of memory

* lint
  • Loading branch information
mrsmkl authored May 6, 2020
1 parent 98bf322 commit 2add2fa
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 374 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- geth
build-geth:
executor: golang
resource_class: medium+
steps:
- attach_workspace:
at: ~/repos
Expand Down
2 changes: 1 addition & 1 deletion cmd/clef/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var (
chainIdFlag = cli.Int64Flag{
Name: "chainid",
Value: params.MainnetChainConfig.ChainID.Int64(),
Usage: "Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli)",
Usage: fmt.Sprintf("Chain id to use for signing (%s)", params.NetworkIdHelp),
}
rpcPortFlag = cli.IntFlag{
Name: "rpcport",
Expand Down
4 changes: 2 additions & 2 deletions cmd/devp2p/discv4cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"strings"
"time"

"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/params"

"gopkg.in/urfave/cli.v1"
)
Expand Down Expand Up @@ -181,7 +181,7 @@ func discv4Crawl(ctx *cli.Context) error {
}

func parseBootnodes(ctx *cli.Context) ([]*enode.Node, error) {
s := params.RinkebyBootnodes
s := utils.GetBootstrapNodes(ctx)
if ctx.IsSet(bootnodesFlag.Name) {
s = strings.Split(ctx.String(bootnodesFlag.Name), ",")
}
Expand Down
10 changes: 4 additions & 6 deletions cmd/devp2p/nodesetcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ func ethFilter(args []string) (nodeFilter, error) {
switch args[0] {
case "mainnet":
filter = forkid.NewStaticFilter(params.MainnetChainConfig, params.MainnetGenesisHash)
case "rinkeby":
filter = forkid.NewStaticFilter(params.RinkebyChainConfig, params.RinkebyGenesisHash)
case "goerli":
filter = forkid.NewStaticFilter(params.GoerliChainConfig, params.GoerliGenesisHash)
case "ropsten":
filter = forkid.NewStaticFilter(params.TestnetChainConfig, params.TestnetGenesisHash)
case "baklava":
filter = forkid.NewStaticFilter(params.BaklavaChainConfig, params.BaklavaGenesisHash)
case "alfajores":
filter = forkid.NewStaticFilter(params.AlfajoresChainConfig, params.AlfajoresGenesisHash)
default:
return nil, fmt.Errorf("unknown network %q", args[0])
}
Expand Down
19 changes: 14 additions & 5 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ It expects the genesis file as argument.`,
ArgsUsage: "<filename> (<filename 2> ... <filename N>) ",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
utils.GCModeFlag,
Expand All @@ -85,6 +87,8 @@ processing will proceed even if an individual RLP-file import failure occurs.`,
ArgsUsage: "<filename> [<blockNumFirst> <blockNumLast>]",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
},
Expand All @@ -103,6 +107,8 @@ be gzipped.`,
ArgsUsage: "<datafile>",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
},
Expand All @@ -117,6 +123,8 @@ be gzipped.`,
ArgsUsage: "<dumpfile>",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
},
Expand All @@ -131,11 +139,11 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
ArgsUsage: "<sourceChaindataDir>",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
utils.FakePoWFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand All @@ -148,6 +156,8 @@ The first argument must be the directory containing the blockchain to download f
ArgsUsage: " ",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand All @@ -160,6 +170,8 @@ Remove blockchain and state databases`,
ArgsUsage: "[<blockHash> | <blockNum>]...",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.CacheFlag,
utils.SyncModeFlag,
utils.IterativeOutputFlag,
Expand All @@ -181,9 +193,6 @@ Use "ethereum dump 0" to dump the genesis block.`,
utils.DataDirFlag,
utils.AncientFlag,
utils.CacheFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.AlfajoresFlag,
utils.BaklavaFlag,
utils.SyncModeFlag,
Expand Down
6 changes: 1 addition & 5 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ func remoteConsole(ctx *cli.Context) error {
path = ctx.GlobalString(utils.DataDirFlag.Name)
}
if path != "" {
if ctx.GlobalBool(utils.TestnetFlag.Name) {
path = filepath.Join(path, "testnet")
} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
path = filepath.Join(path, "rinkeby")
} else if ctx.GlobalBool(utils.BaklavaFlag.Name) {
if ctx.GlobalBool(utils.BaklavaFlag.Name) {
path = filepath.Join(path, "baklava")
} else if ctx.GlobalBool(utils.AlfajoresFlag.Name) {
path = filepath.Join(path, "alfajores")
Expand Down
6 changes: 1 addition & 5 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,8 @@ var (
utils.NodeKeyHexFlag,
utils.DeveloperFlag,
utils.DeveloperPeriodFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.BaklavaFlag,
utils.AlfajoresFlag,
utils.OttomanFlag,
utils.VMEnableDebugFlag,
utils.NetworkIdFlag,
utils.EthStatsURLFlag,
Expand Down Expand Up @@ -261,7 +257,7 @@ func prepare(ctx *cli.Context) {
// If we're a full node on mainnet without --cache specified, bump default cache allowance
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
// Make sure we're not on any supported preconfigured testnet either
if !ctx.GlobalIsSet(utils.TestnetFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) && !ctx.GlobalIsSet(utils.AlfajoresFlag.Name) && !ctx.GlobalIsSet(utils.BaklavaFlag.Name) {
if !ctx.GlobalIsSet(utils.DeveloperFlag.Name) && !ctx.GlobalIsSet(utils.AlfajoresFlag.Name) && !ctx.GlobalIsSet(utils.BaklavaFlag.Name) {
// Nope, we're really on mainnet. Bump that cache up!
log.Info("Bumping default cache on mainnet", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 4096)
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))
Expand Down
4 changes: 0 additions & 4 deletions cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,8 @@ var AppHelpFlagGroups = []flagGroup{
utils.NoUSBFlag,
utils.SmartCardDaemonPathFlag,
utils.NetworkIdFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.BaklavaFlag,
utils.AlfajoresFlag,
utils.OttomanFlag,
utils.SyncModeFlag,
utils.ExitWhenSyncedFlag,
utils.GCModeFlag,
Expand Down
Loading

0 comments on commit 2add2fa

Please sign in to comment.