From 6f54d66cacf199ab08a0d63d85cf1f84cec5f46f Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya <krishnau1604@gmail.com> Date: Thu, 2 Sep 2021 19:55:04 +0530 Subject: [PATCH] add: mumbai geth config updated --- cmd/geth/config.go | 29 +++++++++++++++++++++++++++++ cmd/geth/consolecmd.go | 3 ++- cmd/geth/main.go | 2 +- cmd/utils/flags.go | 6 ++++-- internal/debug/flags.go | 3 +++ params/bootnodes.go | 1 + 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 04b41b348..bec896aa8 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -23,6 +23,7 @@ import ( "math/big" "os" "reflect" + "time" "unicode" "gopkg.in/urfave/cli.v1" @@ -33,6 +34,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/usbwallet" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth/catalyst" + "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/log" @@ -133,6 +135,10 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) { } } + if ctx.GlobalIsSet(utils.MumbaiFlag.Name) { + setDefaultMumbaiGethConfig(ctx, &cfg) + } + // Apply flags. utils.SetNodeConfig(ctx, &cfg.Node) stack, err := node.New(&cfg.Node) @@ -328,3 +334,26 @@ func setAccountManagerBackends(stack *node.Node) error { return nil } + +func setDefaultMumbaiGethConfig(ctx *cli.Context, config *gethConfig) { + config.Node.P2P.ListenAddr = fmt.Sprintf(":%d", 30303) + config.Node.HTTPHost = "0.0.0.0" + config.Node.HTTPVirtualHosts = []string{"*"} + config.Node.HTTPCors = []string{"*"} + config.Node.HTTPPort = 8545 + config.Node.IPCPath = utils.MakeDataDir(ctx) + "/bor.ipc" + config.Node.HTTPModules = []string{"eth", "net", "web3", "txpool", "bor"} + config.Eth.SyncMode = downloader.FullSync + config.Eth.NetworkId = 80001 + config.Eth.Miner.GasCeil = 20000000 + //--miner.gastarget is depreceated, No longed used + config.Eth.TxPool.NoLocals = true + config.Eth.TxPool.AccountSlots = 16 + config.Eth.TxPool.GlobalSlots = 131072 + config.Eth.TxPool.AccountQueue = 64 + config.Eth.TxPool.GlobalQueue = 131072 + config.Eth.TxPool.Lifetime = 90 * time.Minute + config.Node.P2P.MaxPeers = 200 + config.Metrics.Enabled = true + // --pprof is enabled in 'internal/debug/flags.go' +} diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go index e508bc079..c719639d9 100644 --- a/cmd/geth/consolecmd.go +++ b/cmd/geth/consolecmd.go @@ -135,7 +135,8 @@ func remoteConsole(ctx *cli.Context) error { } else if ctx.GlobalBool(utils.GoerliFlag.Name) { path = filepath.Join(path, "goerli") } else if ctx.GlobalBool(utils.MumbaiFlag.Name) { - path = filepath.Join(path, "mumbai") + homeDir, _ := os.UserHomeDir() + path = filepath.Join(homeDir, "/.bor/data") } } endpoint = fmt.Sprintf("%s/geth.ipc", path) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 4b0d8835e..5cd21a98a 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -284,7 +284,7 @@ func prepare(ctx *cli.Context) { log.Info("Starting Geth on Görli testnet...") case ctx.GlobalIsSet(utils.MumbaiFlag.Name): - log.Info("Starting Geth on Mumbai testnet...") + log.Info("Starting Bor on Mumbai testnet...") case ctx.GlobalIsSet(utils.DeveloperFlag.Name): log.Info("Starting Geth in ephemeral dev mode...") diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1c19542b3..65040c039 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -802,7 +802,8 @@ func MakeDataDir(ctx *cli.Context) string { return filepath.Join(path, "goerli") } if ctx.GlobalBool(MumbaiFlag.Name) { - return filepath.Join(path, "mumbai") + homeDir, _ := os.UserHomeDir() + return filepath.Join(homeDir, "/.bor/data") } return path } @@ -1302,7 +1303,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli") case ctx.GlobalBool(MumbaiFlag.Name) && cfg.DataDir == node.DefaultDataDir(): - cfg.DataDir = filepath.Join(node.DefaultDataDir(), "mumbai") + homeDir, _ := os.UserHomeDir() + cfg.DataDir = filepath.Join(homeDir, "/.bor/data") } } diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 126ee09a7..8892701bb 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -246,6 +246,9 @@ func Setup(ctx *cli.Context) error { // This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name. // It cannot be imported because it will cause a cyclical dependency. StartPProf(address, !ctx.GlobalIsSet("metrics.addr")) + } else if ctx.GlobalIsSet("mumbai") { + address := fmt.Sprintf("%s:%d", "0.0.0.0", 7071) + StartPProf(address, !ctx.GlobalIsSet("metrics.addr")) } return nil } diff --git a/params/bootnodes.go b/params/bootnodes.go index 20136ca42..09f4a682b 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -71,6 +71,7 @@ var GoerliBootnodes = []string{ // Mumbai test network. var MumbaiBootnodes = []string{ "enode://320553cda00dfc003f499a3ce9598029f364fbb3ed1222fdc20a94d97dcc4d8ba0cd0bfa996579dcc6d17a534741fb0a5da303a90579431259150de66b597251@54.147.31.250:30303", + "enode://f0f48a8781629f95ff02606081e6e43e4aebd503f3d07fc931fad7dd5ca1ba52bd849a6f6c3be0e375cf13c9ae04d859c4a9ae3546dc8ed4f10aa5dbb47d4998@34.226.134.117:30303", } var V5Bootnodes = []string{ -- GitLab