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

all: changes to fullsync the network from the nethermind import #3

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
44 changes: 43 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ var (
Usage: "Sepolia network: pre-configured proof-of-work 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{
Expand Down Expand Up @@ -928,6 +938,8 @@ var (
TestnetFlags = []cli.Flag{
GoerliFlag,
SepoliaFlag,
GnosisChainFlag,
ChiadoFlag,
}
// NetworkFlags is the flag group of all built-in supported networks.
NetworkFlags = append([]cli.Flag{MainnetFlag}, TestnetFlags...)
Expand Down Expand Up @@ -958,6 +970,12 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.Bool(SepoliaFlag.Name) {
return filepath.Join(path, "sepolia")
}
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 @@ -1008,6 +1026,10 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.SepoliaBootnodes
case ctx.Bool(GoerliFlag.Name):
urls = params.GoerliBootnodes
case ctx.Bool(GnosisChainFlag.Name):
urls = params.GnosisBootnodes
case ctx.Bool(ChiadoFlag.Name):
urls = params.ChiadoBootnodes
}

// don't apply defaults if BootstrapNodes is already set
Expand Down Expand Up @@ -1457,6 +1479,10 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli")
case ctx.Bool(SepoliaFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "sepolia")
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 @@ -1613,7 +1639,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, GoerliFlag, SepoliaFlag)
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, GoerliFlag, SepoliaFlag, GnosisChainFlag, ChiadoFlag)
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
if ctx.String(GCModeFlag.Name) == "archive" && ctx.Uint64(TxLookupLimitFlag.Name) != 0 {
Expand Down Expand Up @@ -1761,6 +1787,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultGoerliGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.GoerliGenesisHash)
case ctx.Bool(GnosisChainFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 100
}
cfg.Genesis = core.DefaultGnosisGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.GnosisChainHash)
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 @@ -2087,6 +2125,10 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultSepoliaGenesisBlock()
case ctx.Bool(GoerliFlag.Name):
genesis = core.DefaultGoerliGenesisBlock()
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
32 changes: 32 additions & 0 deletions consensus/aura/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2017 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package aura

import (
"github.com/ethereum/go-ethereum/consensus"
)

// API is a user facing RPC API to allow controlling the signer and voting
// mechanisms of the proof-of-authority scheme.
type API struct {
chain consensus.ChainHeaderReader
aura *Aura
}

func (api *API) Version() string {
return "0.1"
}
Loading