Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable gnosis chain in go-ethereum v1.14.12 #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ var (
Usage: "Holesky network: pre-configured proof-of-stake test network",
Category: flags.EthCategory,
}
GnosisChainFlag = &cli.BoolFlag{
Name: "gnosis",
Usage: "Gnosis chain network: pre-configured merged proof-of-authority test network",
Category: flags.EthCategory,
}
ChiadoFlag = &cli.BoolFlag{
Name: "chiado",
Usage: "Chiado network: pre-configured merged proof-of-authority test network",
Category: flags.EthCategory,
}
// Dev mode
DeveloperFlag = &cli.BoolFlag{
Name: "dev",
Expand Down Expand Up @@ -936,6 +946,8 @@ var (
TestnetFlags = []cli.Flag{
SepoliaFlag,
HoleskyFlag,
GnosisChainFlag,
ChiadoFlag,
}
// NetworkFlags is the flag group of all built-in supported networks.
NetworkFlags = append([]cli.Flag{MainnetFlag}, TestnetFlags...)
Expand All @@ -962,6 +974,12 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.Bool(HoleskyFlag.Name) {
return filepath.Join(path, "holesky")
}
if ctx.Bool(GnosisChainFlag.Name) {
return filepath.Join(path, "gnosis")
}
if ctx.Bool(ChiadoFlag.Name) {
return filepath.Join(path, "chiado")
}
return path
}
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
Expand Down Expand Up @@ -1022,6 +1040,10 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.HoleskyBootnodes
case ctx.Bool(SepoliaFlag.Name):
urls = params.SepoliaBootnodes
case ctx.Bool(GnosisChainFlag.Name):
urls = params.GnosisBootnodes
case ctx.Bool(ChiadoFlag.Name):
urls = params.ChiadoBootnodes
}
}
cfg.BootstrapNodes = mustParseBootnodes(urls)
Expand Down Expand Up @@ -1406,6 +1428,10 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "sepolia")
case ctx.Bool(HoleskyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "holesky")
case ctx.Bool(GnosisChainFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "gnosis")
case ctx.Bool(ChiadoFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "chiado")
}
}

Expand Down Expand Up @@ -1573,7 +1599,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Avoid conflicting network flags
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, SepoliaFlag, HoleskyFlag)
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, SepoliaFlag, HoleskyFlag, ChiadoFlag, GnosisChainFlag)
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer

// Set configurations from CLI flags
Expand Down Expand Up @@ -1739,6 +1765,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultSepoliaGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.SepoliaGenesisHash)
case ctx.Bool(GnosisChainFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 100
}
cfg.Genesis = core.DefaultGnosisGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.GnosisGenesisHash)
case ctx.Bool(ChiadoFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 10200
}
cfg.Genesis = core.DefaultChiadoGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.ChiadoGenesisHash)
case ctx.Bool(DeveloperFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337
Expand Down Expand Up @@ -2127,6 +2165,10 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultHoleskyGenesisBlock()
case ctx.Bool(SepoliaFlag.Name):
genesis = core.DefaultSepoliaGenesisBlock()
case ctx.Bool(GnosisChainFlag.Name):
genesis = core.DefaultGnosisGenesisBlock()
case ctx.Bool(ChiadoFlag.Name):
genesis = core.DefaultChiadoGenesisBlock()
case ctx.Bool(DeveloperFlag.Name):
Fatalf("Developer chains are ephemeral")
}
Expand Down
Loading