Skip to content

Commit

Permalink
Genesis nonce is now added via network.env
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed May 4, 2023
1 parent 8fff515 commit 8a49a28
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ include network.env

# Build the base command
# WARNING: WS_ADDR is a sensitive interface and should only be exposed to trusted networks
BASE_CMD = nice -n -20 ./build/bin/go-quai --$(NETWORK) --syncmode $(SYNCMODE) --verbosity $(VERBOSITY)
BASE_CMD = nice -n -20 ./build/bin/go-quai --$(NETWORK) --syncmode $(SYNCMODE) --verbosity $(VERBOSITY) --nonce $(NONCE)
BASE_CMD += --http --http.vhosts=* --http.addr $(HTTP_ADDR) --http.api $(HTTP_API)
BASE_CMD += --ws --ws.addr $(WS_ADDR) --ws.api $(WS_API)
ifeq ($(ENABLE_ARCHIVE),true)
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var (
utils.OrchardFlag,
utils.GalenaFlag,
utils.LocalFlag,
utils.GenesisNonceFlag,
utils.VMEnableDebugFlag,
utils.NetworkIdFlag,
utils.QuaiStatsURLFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/go-quai/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.OrchardFlag,
utils.GalenaFlag,
utils.LocalFlag,
utils.GenesisNonceFlag,
utils.SyncModeFlag,
utils.ExitWhenSyncedFlag,
utils.GCModeFlag,
Expand Down
7 changes: 7 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ var (
Name: "local",
Usage: "Local network: localhost proof-of-work node, will not attempt to connect to bootnode or any public network",
}
GenesisNonceFlag = cli.Uint64Flag{
Name: "nonce",
Usage: "Genesis block nonce (integer)",
}
DeveloperFlag = cli.BoolFlag{
Name: "dev",
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
Expand Down Expand Up @@ -1486,6 +1490,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
SetDNSDiscoveryDefaults(cfg, params.ColosseumGenesisHash)
}
}
if !ctx.GlobalBool(ColosseumFlag.Name) {
cfg.Genesis.Nonce = ctx.GlobalUint64(GenesisNonceFlag.Name)
}
}

// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
Expand Down
8 changes: 4 additions & 4 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func DefaultColosseumGenesisBlock() *Genesis {
func DefaultGardenGenesisBlock() *Genesis {
return &Genesis{
Config: params.GardenChainConfig,
Nonce: 67,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 160000000,
Difficulty: big.NewInt(441092),
Expand All @@ -386,7 +386,7 @@ func DefaultGardenGenesisBlock() *Genesis {
func DefaultOrchardGenesisBlock() *Genesis {
return &Genesis{
Config: params.OrchardChainConfig,
Nonce: 68,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 80000000,
Difficulty: big.NewInt(4000000),
Expand All @@ -398,7 +398,7 @@ func DefaultOrchardGenesisBlock() *Genesis {
func DefaultGalenaGenesisBlock() *Genesis {
return &Genesis{
Config: params.GalenaChainConfig,
Nonce: 68,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 160000000,
Difficulty: big.NewInt(8800000000),
Expand All @@ -410,7 +410,7 @@ func DefaultGalenaGenesisBlock() *Genesis {
func DefaultLocalGenesisBlock() *Genesis {
return &Genesis{
Config: params.LocalChainConfig,
Nonce: 67,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 160000000,
Difficulty: big.NewInt(300000),
Expand Down
1 change: 1 addition & 0 deletions network.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ENABLE_ARCHIVE=false
# network. At time of writing, no transport security is implemented, but this is
# a trusted communication channel.
NETWORK=colosseum
NONCE=0 #Change this along with network
HTTP_ADDR=0.0.0.0
WS_ADDR=127.0.0.1
WS_API=eth,net,web3,quai
Expand Down

0 comments on commit 8a49a28

Please sign in to comment.