From eeaf669006f5e71b90fcc4be40dee832403f609a Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 14 Mar 2019 10:43:32 +0200 Subject: [PATCH] Add goerli testnet --- cmd/statusd/main.go | 4 ++-- node/node.go | 2 ++ params/config.go | 2 ++ params/defaults.go | 7 +++++++ t/utils/utils.go | 7 +++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/statusd/main.go b/cmd/statusd/main.go index f98918d95..1199238b8 100644 --- a/cmd/statusd/main.go +++ b/cmd/statusd/main.go @@ -49,8 +49,8 @@ var ( "network-id", params.RopstenNetworkID, fmt.Sprintf( - "A network ID: %d (Mainnet), %d (Ropsten), %d (Rinkeby)", - params.MainNetworkID, params.RopstenNetworkID, params.RinkebyNetworkID, + "A network ID: %d (Mainnet), %d (Ropsten), %d (Rinkeby), %d (Goerli)", + params.MainNetworkID, params.RopstenNetworkID, params.RinkebyNetworkID, params.GoerliNetworkID, ), ) diff --git a/node/node.go b/node/node.go index 2c0c0f2f3..d6c454242 100644 --- a/node/node.go +++ b/node/node.go @@ -174,6 +174,8 @@ func calculateGenesis(networkID uint64) (*core.Genesis, error) { genesis = core.DefaultTestnetGenesisBlock() case params.RinkebyNetworkID: genesis = core.DefaultRinkebyGenesisBlock() + case params.GoerliNetworkID: + genesis = core.DefaultGoerliGenesisBlock() case params.StatusChainNetworkID: var err error if genesis, err = defaultStatusChainGenesisBlock(); err != nil { diff --git a/params/config.go b/params/config.go index 78269be3a..6da3c6b69 100644 --- a/params/config.go +++ b/params/config.go @@ -726,6 +726,8 @@ func getUpstreamURL(networkID uint64) string { return RopstenEthereumNetworkURL case RinkebyNetworkID: return RinkebyEthereumNetworkURL + case GoerliNetworkID: + return GoerliEthereumNetworkURL } return "" diff --git a/params/defaults.go b/params/defaults.go index f182d8af0..811f943a4 100644 --- a/params/defaults.go +++ b/params/defaults.go @@ -39,6 +39,10 @@ const ( // allow us avoid syncing node. RinkebyEthereumNetworkURL = "https://rinkeby.infura.io/nKmXgiFgc2KqtoQ8BCGJ" + // GoerliEthereumNetworkURL is an open RPC endpoint to Goerli network + // Other RPC endpoints are available here: http://goerli.blockscout.com/ + GoerliEthereumNetworkURL = "http://goerli.blockscout.com/" + // MainNetworkID is id of the main network MainNetworkID = 1 @@ -48,6 +52,9 @@ const ( // RinkebyNetworkID is id of a test network (on PoA) RinkebyNetworkID = 4 + // GoerliNetworkID is id of goerli test network (PoA) + GoerliNetworkID = 5 + // StatusChainNetworkID is id of a test network (private chain) StatusChainNetworkID = 777 diff --git a/t/utils/utils.go b/t/utils/utils.go index cbbc75f86..5cfeab45b 100644 --- a/t/utils/utils.go +++ b/t/utils/utils.go @@ -52,6 +52,7 @@ var ( params.RopstenNetworkID: "Ropsten", params.RinkebyNetworkID: "Rinkeby", params.StatusChainNetworkID: "StatusChain", + params.GoerliNetworkID: "Goerli", } // All general log messages in this package should be routed through this logger. @@ -133,6 +134,8 @@ func GetRemoteURLFromNetworkID(id int) (url string, err error) { url = params.RinkebyEthereumNetworkURL case params.RopstenNetworkID: url = params.RopstenEthereumNetworkURL + case params.GoerliNetworkID: + url = params.GoerliEthereumNetworkURL default: err = ErrNoRemoteURL } @@ -151,6 +154,8 @@ func GetHeadHashFromNetworkID(id int) string { return "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d" case params.StatusChainNetworkID: return "0xe9d8920a99dc66a9557a87d51f9d14a34ec50aae04298e0f142187427d3c832e" + case params.GoerliNetworkID: + return "0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a" } // Every other ID must break the test. panic(fmt.Sprintf("invalid network id: %d", id)) @@ -178,6 +183,8 @@ func GetNetworkID() int { return params.RopstenNetworkID case fmt.Sprintf("%d", params.StatusChainNetworkID), "statuschain": return params.StatusChainNetworkID + case fmt.Sprintf("%d", params.GoerliNetworkID), "goerli": + return params.GoerliNetworkID } // Every other selected network must break the test. panic(fmt.Sprintf("invalid selected network: %q", *networkSelected))