config: homestead and rinkeby confg + allow dev/prod modes

This commit is contained in:
Victor Farazdagi 2017-05-16 06:24:56 +03:00
parent 88394690c2
commit 4f27a79d83
22 changed files with 568 additions and 140 deletions

View File

@ -56,7 +56,6 @@ func parseFaucetCommandConfig(ctx *cli.Context) (*params.NodeConfig, error) {
// extra options // extra options
nodeConfig.BootClusterConfig.Enabled = true nodeConfig.BootClusterConfig.Enabled = true
nodeConfig.BootClusterConfig.ConfigFile = ctx.GlobalString(BootClusterConfigFileFlag.Name)
return nodeConfig, nil return nodeConfig, nil
} }

View File

@ -179,8 +179,8 @@ func DiscardTransactions(ids *C.char) *C.char {
} }
//export GenerateConfig //export GenerateConfig
func GenerateConfig(datadir *C.char, networkID C.int) *C.char { func GenerateConfig(datadir *C.char, networkID C.int, devMode C.int) *C.char {
config, err := params.NewNodeConfig(C.GoString(datadir), uint64(networkID)) config, err := params.NewNodeConfig(C.GoString(datadir), uint64(networkID), devMode == 1)
if err != nil { if err != nil {
return makeJSONErrorResponse(err) return makeJSONErrorResponse(err)
} }

View File

@ -17,6 +17,12 @@ var (
) )
var ( var (
// ProdModeFlag is whether we need dev or production settings
ProdModeFlag = cli.BoolFlag{
Name: "production",
Usage: "Whether production settings should be loaded",
}
// NodeKeyFileFlag is a node key file to be used as node's private key // NodeKeyFileFlag is a node key file to be used as node's private key
NodeKeyFileFlag = cli.StringFlag{ NodeKeyFileFlag = cli.StringFlag{
Name: "nodekey", Name: "nodekey",
@ -34,14 +40,25 @@ var (
NetworkIDFlag = cli.IntFlag{ NetworkIDFlag = cli.IntFlag{
Name: "networkid", Name: "networkid",
Usage: "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby)", Usage: "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby)",
Value: params.TestNetworkID, Value: params.RopstenNetworkID,
} }
// BootClusterConfigFileFlag allows to switch boot cluster nodes // LightEthEnabledFlag flags whether LES is enabled or not
BootClusterConfigFileFlag = cli.StringFlag{ LightEthEnabledFlag = cli.BoolFlag{
Name: "bootcluster", Name: "les",
Usage: "Boot cluster config file", Usage: "LES protocol enabled",
Value: params.BootClusterConfigFile, }
// WhisperEnabledFlag flags whether Whisper is enabled or not
WhisperEnabledFlag = cli.BoolFlag{
Name: "shh",
Usage: "SHH protocol enabled",
}
// SwarmEnabledFlag flags whether Swarm is enabled or not
SwarmEnabledFlag = cli.BoolFlag{
Name: "swarm",
Usage: "Swarm protocol enabled",
} }
// HTTPEnabledFlag defines whether HTTP RPC endpoint should be opened or not // HTTPEnabledFlag defines whether HTTP RPC endpoint should be opened or not
@ -78,14 +95,15 @@ func init() {
app.Commands = []cli.Command{ app.Commands = []cli.Command{
versionCommand, versionCommand,
faucetCommand, faucetCommand,
lesCommand,
wnodeCommand, wnodeCommand,
} }
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
ProdModeFlag,
NodeKeyFileFlag, NodeKeyFileFlag,
DataDirFlag, DataDirFlag,
NetworkIDFlag, NetworkIDFlag,
LogLevelFlag, LogLevelFlag,
BootClusterConfigFileFlag,
} }
app.Before = func(ctx *cli.Context) error { app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
@ -120,7 +138,10 @@ func makeApp(gitCommit string) *cli.App {
// makeNodeConfig parses incoming CLI options and returns node configuration object // makeNodeConfig parses incoming CLI options and returns node configuration object
func makeNodeConfig(ctx *cli.Context) (*params.NodeConfig, error) { func makeNodeConfig(ctx *cli.Context) (*params.NodeConfig, error) {
nodeConfig, err := params.NewNodeConfig(ctx.GlobalString(DataDirFlag.Name), ctx.GlobalUint64(NetworkIDFlag.Name)) nodeConfig, err := params.NewNodeConfig(
ctx.GlobalString(DataDirFlag.Name),
ctx.GlobalUint64(NetworkIDFlag.Name),
!ctx.GlobalBool(ProdModeFlag.Name))
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -153,7 +153,7 @@ func testGetDefaultConfig(t *testing.T) bool {
// test Mainnet config // test Mainnet config
nodeConfig := params.NodeConfig{} nodeConfig := params.NodeConfig{}
rawResponse := GenerateConfig(C.CString("/tmp/data-folder"), 1) rawResponse := GenerateConfig(C.CString("/tmp/data-folder"), 1, 1)
if err := json.Unmarshal([]byte(C.GoString(rawResponse)), &nodeConfig); err != nil { if err := json.Unmarshal([]byte(C.GoString(rawResponse)), &nodeConfig); err != nil {
t.Errorf("cannot decode response (%s): %v", C.GoString(rawResponse), err) t.Errorf("cannot decode response (%s): %v", C.GoString(rawResponse), err)
return false return false
@ -200,7 +200,7 @@ func testGetDefaultConfig(t *testing.T) bool {
// test Testnet // test Testnet
nodeConfig = params.NodeConfig{} nodeConfig = params.NodeConfig{}
rawResponse = GenerateConfig(C.CString("/tmp/data-folder"), 3) rawResponse = GenerateConfig(C.CString("/tmp/data-folder"), 3, 1)
if err := json.Unmarshal([]byte(C.GoString(rawResponse)), &nodeConfig); err != nil { if err := json.Unmarshal([]byte(C.GoString(rawResponse)), &nodeConfig); err != nil {
t.Errorf("cannot decode response (%s): %v", C.GoString(rawResponse), err) t.Errorf("cannot decode response (%s): %v", C.GoString(rawResponse), err)
return false return false
@ -1430,7 +1430,7 @@ func startTestNode(t *testing.T) <-chan struct{} {
go func() { go func() {
configJSON := `{ configJSON := `{
"NetworkId": ` + strconv.Itoa(params.TestNetworkID) + `, "NetworkId": ` + strconv.Itoa(params.RopstenNetworkID) + `,
"DataDir": "` + geth.TestDataDir + `", "DataDir": "` + geth.TestDataDir + `",
"HTTPPort": ` + strconv.Itoa(testConfig.Node.HTTPPort) + `, "HTTPPort": ` + strconv.Itoa(testConfig.Node.HTTPPort) + `,
"WSPort": ` + strconv.Itoa(testConfig.Node.WSPort) + `, "WSPort": ` + strconv.Itoa(testConfig.Node.WSPort) + `,

View File

@ -80,33 +80,7 @@ func MakeNode(config *params.NodeConfig) *Node {
} }
// configure required node (should you need to update node's config, e.g. add bootstrap nodes, see node.Config) // configure required node (should you need to update node's config, e.g. add bootstrap nodes, see node.Config)
stackConfig := &node.Config{ stackConfig := defaultEmbeddedNodeConfig(config)
DataDir: config.DataDir,
KeyStoreDir: config.KeyStoreDir,
UseLightweightKDF: true,
Name: config.Name,
Version: config.Version,
P2P: p2p.Config{
NoDiscovery: true,
DiscoveryV5: false,
DiscoveryV5Addr: ":0",
BootstrapNodes: makeBootstrapNodes(),
BootstrapNodesV5: makeBootstrapNodesV5(),
ListenAddr: ":0",
NAT: nat.Any(),
MaxPeers: config.MaxPeers,
MaxPendingPeers: config.MaxPendingPeers,
},
IPCPath: makeIPCPath(config),
HTTPHost: config.HTTPHost,
HTTPPort: config.HTTPPort,
HTTPCors: []string{"*"},
HTTPModules: strings.Split(config.APIModules, ","),
WSHost: makeWSHost(config),
WSPort: config.WSPort,
WSOrigins: []string{"*"},
WSModules: strings.Split(config.APIModules, ","),
}
if len(config.NodeKeyFile) > 0 { if len(config.NodeKeyFile) > 0 {
log.Info("Loading private key file", "file", config.NodeKeyFile) log.Info("Loading private key file", "file", config.NodeKeyFile)
@ -153,6 +127,37 @@ func MakeNode(config *params.NodeConfig) *Node {
} }
} }
// defaultEmbeddedNodeConfig returns default stack configuration for mobile client node
func defaultEmbeddedNodeConfig(config *params.NodeConfig) *node.Config {
return &node.Config{
DataDir: config.DataDir,
KeyStoreDir: config.KeyStoreDir,
UseLightweightKDF: true,
Name: config.Name,
Version: config.Version,
P2P: p2p.Config{
NoDiscovery: true,
DiscoveryV5: false,
DiscoveryV5Addr: ":0",
BootstrapNodes: makeBootstrapNodes(),
BootstrapNodesV5: makeBootstrapNodesV5(),
ListenAddr: ":0",
NAT: nat.Any(),
MaxPeers: config.MaxPeers,
MaxPendingPeers: config.MaxPendingPeers,
},
IPCPath: makeIPCPath(config),
HTTPHost: config.HTTPHost,
HTTPPort: config.HTTPPort,
HTTPCors: []string{"*"},
HTTPModules: strings.Split(config.APIModules, ","),
WSHost: makeWSHost(config),
WSPort: config.WSPort,
WSOrigins: []string{"*"},
WSModules: strings.Split(config.APIModules, ","),
}
}
// activateEthService configures and registers the eth.Ethereum service with a given node. // activateEthService configures and registers the eth.Ethereum service with a given node.
func activateEthService(stack *node.Node, config *params.NodeConfig) error { func activateEthService(stack *node.Node, config *params.NodeConfig) error {
if !config.LightEthConfig.Enabled { if !config.LightEthConfig.Enabled {

View File

@ -414,17 +414,17 @@ func (m *NodeManager) onNodeStarted() {
// PopulateStaticPeers connects current node with our publicly available LES/SHH/Swarm cluster // PopulateStaticPeers connects current node with our publicly available LES/SHH/Swarm cluster
func (m *NodeManager) PopulateStaticPeers() { func (m *NodeManager) PopulateStaticPeers() {
if !m.node.config.BootClusterConfig.Enabled { if !m.node.config.BootClusterConfig.Enabled {
log.Info("bootcluster is disabled") log.Info("Boot cluster is disabled")
return return
} }
enodes, err := m.node.config.LoadBootClusterNodes() enodes, err := m.node.config.LoadBootClusterNodes()
if err != nil { if err != nil {
Fatalf("can not load boot nodes: %v", err) log.Warn("Can not load boot nodes", "error", err)
} }
for _, enode := range enodes { for _, enode := range enodes {
m.AddPeer(enode) // nolint: errcheck m.AddPeer(enode) // nolint: errcheck
log.Info("bootnode added", "enode", enode) log.Info("Boot node added", "enode", enode)
} }
} }

View File

@ -126,8 +126,10 @@ type BootClusterConfig struct {
// NodeConfig stores configuration options for a node // NodeConfig stores configuration options for a node
type NodeConfig struct { type NodeConfig struct {
// TestNet flag whether given configuration describes a test or mainnet // DevMode is true when given configuration is to be used during development.
TestNet bool // For production, this flag should be turned off, so that more strict requirements
// are applied to node's configuration
DevMode bool
// NetworkID sets network to use for selecting peers to connect to // NetworkID sets network to use for selecting peers to connect to
NetworkID uint64 `json:"NetworkId,"` NetworkID uint64 `json:"NetworkId,"`
@ -213,15 +215,15 @@ type NodeConfig struct {
} }
// NewNodeConfig creates new node configuration object // NewNodeConfig creates new node configuration object
func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) { func NewNodeConfig(dataDir string, networkID uint64, devMode bool) (*NodeConfig, error) {
nodeConfig := &NodeConfig{ nodeConfig := &NodeConfig{
DevMode: devMode,
NetworkID: networkID, NetworkID: networkID,
DataDir: dataDir, DataDir: dataDir,
Name: ClientIdentifier, Name: ClientIdentifier,
Version: Version, Version: Version,
HTTPHost: HTTPHost, HTTPHost: HTTPHost,
HTTPPort: HTTPPort, HTTPPort: HTTPPort,
APIModules: APIModules,
WSHost: WSHost, WSHost: WSHost,
WSPort: WSPort, WSPort: WSPort,
MaxPeers: MaxPeers, MaxPeers: MaxPeers,
@ -250,64 +252,17 @@ func NewNodeConfig(dataDir string, networkID uint64) (*NodeConfig, error) {
SwarmConfig: &SwarmConfig{}, SwarmConfig: &SwarmConfig{},
} }
// auto-populate some dependent values // adjust dependent values
if err := nodeConfig.populateGenesis(); err != nil { if err := nodeConfig.updateConfig(); err != nil {
return nil, err
}
if err := nodeConfig.populateDirs(); err != nil {
return nil, err return nil, err
} }
return nodeConfig, nil return nodeConfig, nil
} }
// populateDirs updates directories that should be wrt to DataDir
func (c *NodeConfig) populateDirs() error {
makeSubDirPath := func(baseDir, subDir string) string {
if len(baseDir) == 0 {
return ""
}
return filepath.Join(baseDir, subDir)
}
if len(c.KeyStoreDir) == 0 {
c.KeyStoreDir = makeSubDirPath(c.DataDir, KeyStoreDir)
}
if len(c.WhisperConfig.DataDir) == 0 {
c.WhisperConfig.DataDir = makeSubDirPath(c.DataDir, WhisperDataDir)
}
return nil
}
// populateChainConfig does necessary adjustments to config object (depending on network node will be runnin on)
func (c *NodeConfig) populateGenesis() error {
c.TestNet = false
if c.NetworkID == TestNetworkID {
c.TestNet = true
}
var genesis *core.Genesis
if c.TestNet {
genesis = core.DefaultTestnetGenesisBlock()
} else {
genesis = core.DefaultGenesisBlock()
}
// encode the genesis into JSON
enc, err := json.Marshal(genesis)
if err != nil {
return err
}
c.LightEthConfig.Genesis = string(enc)
return nil
}
// LoadNodeConfig parses incoming JSON and returned it as Config // LoadNodeConfig parses incoming JSON and returned it as Config
func LoadNodeConfig(configJSON string) (*NodeConfig, error) { func LoadNodeConfig(configJSON string) (*NodeConfig, error) {
nodeConfig, err := NewNodeConfig("", 0) nodeConfig, err := NewNodeConfig("", 0, true)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -321,10 +276,7 @@ func LoadNodeConfig(configJSON string) (*NodeConfig, error) {
} }
// repopulate // repopulate
if err := nodeConfig.populateGenesis(); err != nil { if err := nodeConfig.updateConfig(); err != nil {
return nil, err
}
if err := nodeConfig.populateDirs(); err != nil {
return nil, err return nil, err
} }
@ -366,7 +318,7 @@ func (c *NodeConfig) LoadBootClusterNodes() ([]string, error) {
var err error var err error
filename := c.BootClusterConfig.ConfigFile filename := c.BootClusterConfig.ConfigFile
log.Info("loading boot nodes", "source", filename) log.Info("Loading boot nodes config file", "source", filename)
if _, err = os.Stat(filename); os.IsNotExist(err) { // load from static resources if _, err = os.Stat(filename); os.IsNotExist(err) { // load from static resources
configData, err = static.Asset("bootcluster/" + filename) configData, err = static.Asset("bootcluster/" + filename)
} else { } else {
@ -383,6 +335,101 @@ func (c *NodeConfig) LoadBootClusterNodes() ([]string, error) {
return bootnodes, nil return bootnodes, nil
} }
// updateConfig traverses configuration and adjusts dependent fields
// (we have a development/production and mobile/full node dependent configurations)
func (c *NodeConfig) updateConfig() error {
if err := c.updateGenesisConfig(); err != nil {
return err
}
if err := c.updateRPCConfig(); err != nil {
return err
}
if err := c.updateBootClusterConfig(); err != nil {
return err
}
if err := c.updateRelativeDirsConfig(); err != nil {
return err
}
return nil
}
// updateGenesisConfig does necessary adjustments to config object (depending on network node will be running on)
func (c *NodeConfig) updateGenesisConfig() error {
var genesis *core.Genesis
switch c.NetworkID {
case MainNetworkID:
genesis = core.DefaultGenesisBlock()
case RopstenNetworkID:
genesis = core.DefaultTestnetGenesisBlock()
case RinkebyNetworkID:
genesis = core.DefaultRinkebyGenesisBlock()
default:
return nil
}
// encode the genesis into JSON
enc, err := json.Marshal(genesis)
if err != nil {
return err
}
c.LightEthConfig.Genesis = string(enc)
return nil
}
// updateBootClusterConfig populates cluster config file, depending on dev/prod and mobile/full settings
func (c *NodeConfig) updateBootClusterConfig() error {
var configFile string
switch c.NetworkID {
case MainNetworkID:
configFile = "homestead.prod.json"
case RopstenNetworkID:
configFile = "ropsten.prod.json"
case RinkebyNetworkID:
configFile = "rinkeby.prod.json"
}
if c.DevMode {
configFile = strings.Replace(configFile, "prod", "dev", 1)
}
if len(configFile) > 0 {
c.BootClusterConfig.ConfigFile = configFile
}
return nil
}
// updateRPCConfig transforms RPC settings to meet requirements of a given configuration
func (c *NodeConfig) updateRPCConfig() error {
c.APIModules = ProdAPIModules
if c.DevMode {
c.APIModules = DevAPIModules
}
return nil
}
// updateRelativeDirsConfig updates directories that should be wrt to DataDir
func (c *NodeConfig) updateRelativeDirsConfig() error {
makeSubDirPath := func(baseDir, subDir string) string {
if len(baseDir) == 0 {
return ""
}
return filepath.Join(baseDir, subDir)
}
if len(c.KeyStoreDir) == 0 {
c.KeyStoreDir = makeSubDirPath(c.DataDir, KeyStoreDir)
}
if len(c.WhisperConfig.DataDir) == 0 {
c.WhisperConfig.DataDir = makeSubDirPath(c.DataDir, WhisperDataDir)
}
return nil
}
// String dumps config object as nicely indented JSON // String dumps config object as nicely indented JSON
func (c *NodeConfig) String() string { func (c *NodeConfig) String() string {
data, _ := json.MarshalIndent(c, "", " ") data, _ := json.MarshalIndent(c, "", " ")

View File

@ -299,7 +299,7 @@ var loadConfigTestCases = []struct {
{ {
`default boot cluster (Ropsten Dev)`, `default boot cluster (Ropsten Dev)`,
`{ `{
"NetworkId": 311, "NetworkId": 3,
"DataDir": "$TMPDIR" "DataDir": "$TMPDIR"
}`, }`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) { func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
@ -312,6 +312,10 @@ var loadConfigTestCases = []struct {
params.BootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile) params.BootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
} }
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("boot cluster is expected to be enabled by default")
}
enodes, err := nodeConfig.LoadBootClusterNodes() enodes, err := nodeConfig.LoadBootClusterNodes()
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
@ -336,6 +340,25 @@ var loadConfigTestCases = []struct {
} }
}, },
}, },
{
`disabled boot cluster`,
`{
"NetworkId": 311,
"DataDir": "$TMPDIR",
"BootClusterConfig": {
"Enabled": false
}
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.BootClusterConfig.Enabled != false {
t.Fatal("boot cluster is expected to be disabled")
}
},
},
{ {
`select boot cluster (Ropsten Prod)`, `select boot cluster (Ropsten Prod)`,
`{ `{
@ -404,7 +427,11 @@ var loadConfigTestCases = []struct {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
expectedEnodes := []string{} expectedEnodes := []string{
"enode://7512c8f6e7ffdcc723cf77e602a1de9d8cc2e8ad35db309464819122cd773857131aee390fec33894db13da730c8432bb248eed64039e3810e156e979b2847cb@51.15.78.243:30303",
"enode://1cc27a5a41130a5c8b90db5b2273dc28f7b56f3edfc0dcc57b665d451274b26541e8de49ea7a074281906a82209b9600239c981163b6ff85c3038a8e2bc5d8b8@51.15.68.93:30303",
"enode://798d17064141b8f88df718028a8272b943d1cb8e696b3dab56519c70b77b1d3469b56b6f4ce3788457646808f5c7299e9116626f2281f30b959527b969a71e4f@51.15.75.244:30303",
}
if len(enodes) != len(expectedEnodes) { if len(enodes) != len(expectedEnodes) {
t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes)) t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes))
} }
@ -437,7 +464,11 @@ var loadConfigTestCases = []struct {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
expectedEnodes := []string{} expectedEnodes := []string{
"enode://fda3f6273a0f2da4ac5858d1f52e5afaf9def281121be3d37558c67d4d9ca26c6ad7a0520b2cd7454120fb770e86d5760487c9924b2166e65485f606e56d60fc@51.15.69.144:30303",
"enode://ba41aa829287a0a9076d9bffed97c8ce2e491b99873288c9e886f16fd575306ac6c656db4fbf814f5a9021aec004ffa9c0ae8650f92fd10c12eeb7c364593eb3@51.15.69.147:30303",
"enode://28ecf5272b560ca951f4cd7f1eb8bd62da5853b026b46db432c4b01797f5b0114819a090a72acd7f32685365ecd8e00450074fa0673039aefe10f3fb666e0f3f@51.15.76.249:30303",
}
if len(enodes) != len(expectedEnodes) { if len(enodes) != len(expectedEnodes) {
t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes)) t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes))
} }
@ -470,7 +501,11 @@ var loadConfigTestCases = []struct {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
expectedEnodes := []string{} expectedEnodes := []string{
"enode://93833be81c3d1bdb2ae5cde258c8f82ad1011a1bea8eb49fe50b0af394d4f7f7e45974356870552f36744efd732692a64865d1e8b64114eaf89a1bad0a1903a2@51.15.64.29:30303",
"enode://d76854bc54144b2269c5316d5f00f0a194efee2fb8d31e7b1939effd7e17f25773f8dc7fda8c4eb469450799da7f39b4e364e2a278d91b53539dcbb10b139635@51.15.73.37:30303",
"enode://57874205931df976079e4ff8ebb5756461030fb00f73486bd5ec4ae6ed6ba98e27d09f58e59bd85281d24084a6062bc8ab514dbcdaa9678fc3001d47772e626e@51.15.75.213:30303",
}
if len(enodes) != len(expectedEnodes) { if len(enodes) != len(expectedEnodes) {
t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes)) t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes))
} }
@ -503,7 +538,11 @@ var loadConfigTestCases = []struct {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
expectedEnodes := []string{} expectedEnodes := []string{
"enode://f3b0e5dca730962bae814f3402b8f8a296644c33e8d7a95bd1ab313143a752c77076a03bcb76263570f2f34d4eb530f1daf5054c0990921a872a34eb505dcedf@51.15.73.129:30303",
"enode://fce0d1c2292829b0eccce444f8943f88087ce00a5e910b157972ee1658a948d23c7a046f26567f73b2b18d126811509d7ef1de5be9b1decfcbb14738a590c477@51.15.75.187:30303",
"enode://3b4b9fa02ae8d54c2db51a674bc93d85649b4775f22400f74ae25e9f1c665baa3bcdd33cadd2c1a93cd08a6af984cb605fbb61ec0d750a11d48d4080298af008@51.15.77.193:30303",
}
if len(enodes) != len(expectedEnodes) { if len(enodes) != len(expectedEnodes) {
t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes)) t.Fatalf("wrong number of enodes, expected: %d, got: %d", len(expectedEnodes), len(enodes))
} }
@ -548,6 +587,218 @@ var loadConfigTestCases = []struct {
} }
}, },
}, },
{
`default DevMode (true)`,
`{
"NetworkId": 311,
"DataDir": "$TMPDIR"
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != true {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", true, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
if nodeConfig.BootClusterConfig.ConfigFile != params.BootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
params.BootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`explicit DevMode = false`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != false {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", false, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "ropsten.prod.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Homestead/Dev)`,
`{
"NetworkId": 1,
"DataDir": "$TMPDIR",
"DevMode": true
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != true {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", true, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "homestead.dev.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Homestead/Prod)`,
`{
"NetworkId": 1,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != false {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", false, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "homestead.prod.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Ropsten/Dev)`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR"
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != true {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", true, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "ropsten.dev.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Ropsten/Prod)`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != false {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", false, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "ropsten.prod.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Rinkeby/Dev)`,
`{
"NetworkId": 4,
"DataDir": "$TMPDIR"
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != true {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", true, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "rinkeby.dev.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
{
`populate bootstrap config (Rinkeby/Prod)`,
`{
"NetworkId": 4,
"DataDir": "$TMPDIR",
"DevMode": false
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if nodeConfig.DevMode != false {
t.Fatalf("unexpected dev mode: expected: %v, got: %v", false, nodeConfig.DevMode)
}
if nodeConfig.BootClusterConfig.Enabled != true {
t.Fatal("expected boot cluster to be enabled")
}
expectedBootClusterConfigFile := "rinkeby.prod.json"
if nodeConfig.BootClusterConfig.ConfigFile != expectedBootClusterConfigFile {
t.Fatalf("unexpected bootcluster config file, expected: %v, got: %v",
expectedBootClusterConfigFile, nodeConfig.BootClusterConfig.ConfigFile)
}
},
},
} }
func TestLoadNodeConfig(t *testing.T) { func TestLoadNodeConfig(t *testing.T) {
@ -580,7 +831,7 @@ func TestConfigWriteRead(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) // nolint: errcheck defer os.RemoveAll(tmpDir) // nolint: errcheck
nodeConfig, err := params.NewNodeConfig(tmpDir, networkId) nodeConfig, err := params.NewNodeConfig(tmpDir, networkId, true)
if err != nil { if err != nil {
t.Fatalf("cannot create new config object: %v", err) t.Fatalf("cannot create new config object: %v", err)
} }
@ -603,6 +854,7 @@ func TestConfigWriteRead(t *testing.T) {
} }
} }
configReadWrite(params.TestNetworkID, "testdata/config.testnet.json") configReadWrite(params.RinkebyNetworkID, "testdata/config.rinkeby.json")
configReadWrite(params.RopstenNetworkID, "testdata/config.ropsten.json")
configReadWrite(params.MainNetworkID, "testdata/config.mainnet.json") configReadWrite(params.MainNetworkID, "testdata/config.mainnet.json")
} }

View File

@ -19,9 +19,11 @@ const (
// HTTPPort is HTTP-RPC port (replaced in unit tests) // HTTPPort is HTTP-RPC port (replaced in unit tests)
HTTPPort = 8545 HTTPPort = 8545
// APIModules is a list of modules to expose vie HTTP RPC // DevAPIModules is a list of modules to expose via any type of RPC (HTTP, IPC) during development
// TODO remove "admin" on main net DevAPIModules = "db,eth,net,web3,shh,personal,admin"
APIModules = "db,eth,net,web3,shh,personal,admin"
// ProdAPIModules is a list of modules to expose via any type of RPC (HTTP, IPC) in production
ProdAPIModules = "eth,net,web3,shh,personal"
// WSHost is a host interface for the websocket RPC server // WSHost is a host interface for the websocket RPC server
WSHost = "localhost" WSHost = "localhost"
@ -72,8 +74,11 @@ const (
// MainNetworkID is id of the main network // MainNetworkID is id of the main network
MainNetworkID = 1 MainNetworkID = 1
// TestNetworkID is id of a test network // RopstenNetworkID is id of a test network (on PoW)
TestNetworkID = 3 RopstenNetworkID = 3
// RinkebyNetworkID is id of a test network (on PoA)
RinkebyNetworkID = 4
// BootClusterConfigFile is default config file containing boot node list (as JSON array) // BootClusterConfigFile is default config file containing boot node list (as JSON array)
BootClusterConfigFile = "ropsten.dev.json" BootClusterConfigFile = "ropsten.dev.json"

View File

@ -18,7 +18,7 @@ func TestLogger(t *testing.T) {
} }
//defer os.RemoveAll(tmpDir) //defer os.RemoveAll(tmpDir)
nodeConfig, err := params.NewNodeConfig(tmpDir, params.TestNetworkID) nodeConfig, err := params.NewNodeConfig(tmpDir, params.RopstenNetworkID, true)
if err != nil { if err != nil {
t.Fatal("cannot create config object") t.Fatal("cannot create config object")
} }

View File

@ -1,5 +1,5 @@
{ {
"TestNet": false, "DevMode": true,
"NetworkId": 1, "NetworkId": 1,
"DataDir": "$TMPDIR", "DataDir": "$TMPDIR",
"KeyStoreDir": "$TMPDIR/keystore", "KeyStoreDir": "$TMPDIR/keystore",
@ -23,7 +23,7 @@
"LogToStderr": true, "LogToStderr": true,
"BootClusterConfig": { "BootClusterConfig": {
"Enabled": true, "Enabled": true,
"ConfigFile": "ropsten.dev.json" "ConfigFile": "homestead.dev.json"
}, },
"LightEthConfig": { "LightEthConfig": {
"Enabled": true, "Enabled": true,

54
geth/params/testdata/config.rinkeby.json vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{ {
"TestNet": true, "DevMode": true,
"NetworkId": 3, "NetworkId": 3,
"DataDir": "$TMPDIR", "DataDir": "$TMPDIR",
"KeyStoreDir": "$TMPDIR/keystore", "KeyStoreDir": "$TMPDIR/keystore",

View File

@ -165,7 +165,7 @@ func PrepareTestNode() (err error) {
} }
// start geth node and wait for it to initialize // start geth node and wait for it to initialize
config, err := params.NewNodeConfig(filepath.Join(TestDataDir, "data"), params.TestNetworkID) config, err := params.NewNodeConfig(filepath.Join(TestDataDir, "data"), params.RopstenNetworkID, true)
if err != nil { if err != nil {
return err return err
} }

View File

@ -97,7 +97,7 @@ func scriptsReadmeMd() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "scripts/README.md", size: 133, mode: os.FileMode(420), modTime: time.Unix(1494795629, 0)} info := bindataFileInfo{name: "scripts/README.md", size: 133, mode: os.FileMode(420), modTime: time.Unix(1494856773, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -117,12 +117,12 @@ func scriptsWeb3Js() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "scripts/web3.js", size: 496165, mode: os.FileMode(420), modTime: time.Unix(1494795674, 0)} info := bindataFileInfo{name: "scripts/web3.js", size: 496165, mode: os.FileMode(420), modTime: time.Unix(1494910434, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
var _bootclusterHomesteadDevJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8a\x8e\x05\x04\x00\x00\xff\xff\x29\xbb\x4c\x0d\x02\x00\x00\x00") var _bootclusterHomesteadDevJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x6c\xce\x39\x6e\x96\x5b\x0c\x00\xd0\xfe\x5f\x45\x94\xfa\xe9\x8b\xe7\x21\xd5\xdb\x07\xa2\xb8\xbe\xb6\x4b\xd8\x7f\x87\x90\x82\x44\xc1\x06\x8e\xce\xb7\xd7\xdb\xdb\xfb\xfc\xf8\xd9\xf3\xf9\xf1\x91\x1c\xcc\x35\x81\x97\x1b\xab\x8b\xce\xe8\xed\x21\x8d\x1b\x1b\x74\x1a\x01\xf1\x60\xcd\x89\x29\xc9\x1d\x85\x82\xb3\x9c\xd2\xb2\xbe\x3e\xa2\xe9\xc2\x6a\xe1\xa0\x4a\xcb\xe6\x22\xb3\xed\x4c\x96\x74\x4c\xc2\xb4\x71\xa2\x4c\x10\x65\xce\x46\x1e\xac\xd3\x70\x30\x81\x0f\xfd\xaf\xf8\xa0\x3e\x26\x0f\xe5\x27\x03\x03\xbf\xff\xf7\xf7\xaf\xdd\x42\xa5\xae\x0a\x8a\x14\x91\xe5\x55\x46\x6b\x5d\x80\xfd\x8d\xc8\xec\x0c\x6d\x45\x33\x8e\x17\x26\xe7\xec\xb6\x0f\xfa\x92\xba\xf3\x46\x5f\xdf\x3e\x71\x65\x4a\x2c\x45\xc1\x33\xfb\xf8\x72\x96\x0c\x9b\x0c\x1d\xf2\xe8\xc4\x52\x56\xce\xbe\x55\x08\x85\x9c\xc6\xfa\xf5\x73\x7e\xd8\xff\xf5\x53\x0f\x17\x02\x4d\xc6\xde\x74\x03\xcf\x91\xdd\x98\x2a\x75\x35\x31\x04\x86\x2d\x80\x75\x96\xb0\x6a\x9d\x2b\x67\x6c\xda\xea\x64\x0c\x79\x43\xae\xc6\x68\x56\x87\x52\x60\x93\x40\xc8\x31\x30\xaa\x1b\xa7\x14\xa5\xeb\xf6\x39\x69\x1e\x7b\x19\x00\x5b\xdc\x9d\xc6\xc8\xe6\xcf\x4f\x1f\x42\xfe\x0a\xbe\xbe\xbf\x7e\x05\x00\x00\xff\xff\x73\x83\xab\x93\xe4\x01\x00\x00")
func bootclusterHomesteadDevJsonBytes() ([]byte, error) { func bootclusterHomesteadDevJsonBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -137,12 +137,12 @@ func bootclusterHomesteadDevJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/homestead.dev.json", size: 2, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/homestead.dev.json", size: 484, mode: os.FileMode(420), modTime: time.Unix(1494909603, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
var _bootclusterHomesteadProdJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8a\x8e\x05\x04\x00\x00\xff\xff\x29\xbb\x4c\x0d\x02\x00\x00\x00") var _bootclusterHomesteadProdJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x6c\xce\x29\x6e\x9e\x5b\x0c\x00\x50\xfe\xaf\x22\x0a\x7e\xfa\xe2\xf1\xda\x0e\x7a\xfb\xa8\x0a\x3c\x5d\xd8\xee\x9f\x55\x95\x1a\x50\xa9\xf8\x90\xf3\xed\xf5\xf6\xf6\xbe\x3f\x7e\xce\x7e\x7e\x7c\x5c\x2e\x58\x9d\x4e\x63\x88\x43\x95\xeb\x28\x97\x05\xa8\xfc\x7a\x52\x9c\x23\xd2\xcc\xeb\x63\x19\x5a\x83\x59\x8c\x8c\xc2\x69\x4a\x6d\x06\x76\x12\xb8\xba\xec\xd0\x61\x35\xb8\x74\x59\x46\xb6\x94\xe1\xe2\xe4\x55\x50\x69\x88\x80\x20\x4c\x37\x4a\xfe\x8d\xa0\xd3\x3b\xf7\x7f\xc5\x07\xf5\x31\x7e\x90\xe2\x93\x81\x81\xdf\xff\xfb\x2b\xd8\x0b\x83\x4d\x14\xe4\x14\x05\xdb\xdd\x2b\x22\xd7\x43\xf8\xba\x83\x5b\x2f\x40\xea\x06\x42\xa1\x5a\x18\xed\xe2\x51\xcf\x10\x1f\xe2\xb6\x04\x39\x97\x8e\x1e\xbb\xc6\x45\x85\x3e\x48\xc7\x11\x15\x62\x6c\x2f\xce\x6a\x6d\x14\xce\xf6\xed\x2a\x14\x63\x4f\x0d\x68\x31\xfb\x0a\xea\x83\x6e\xff\x0a\x72\x49\xc5\x4d\xa0\x5c\x1f\x95\xa6\x29\xc5\x3c\x26\xd5\xc1\xe3\x7a\x24\x4a\xcc\xf4\x12\x09\xc0\x35\xc9\x25\xdd\xb8\xd8\xe7\x68\x65\x72\xf5\x0c\x73\xe7\x0c\x35\x66\x70\x0f\x78\x9e\xbc\xe1\xd2\x75\x40\x6f\xd5\xc1\x6d\x18\x53\x48\xc4\x11\x1f\x01\x07\x0a\xcf\x0b\xe0\x5f\x41\x7b\x30\xf8\x4f\xf0\xf5\xfd\xf5\x2b\x00\x00\xff\xff\xd9\xb7\x34\x6d\xe6\x01\x00\x00")
func bootclusterHomesteadProdJsonBytes() ([]byte, error) { func bootclusterHomesteadProdJsonBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -157,12 +157,12 @@ func bootclusterHomesteadProdJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/homestead.prod.json", size: 2, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/homestead.prod.json", size: 486, mode: os.FileMode(420), modTime: time.Unix(1494910338, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
var _bootclusterRinkebyDevJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8a\x8e\x05\x04\x00\x00\xff\xff\x29\xbb\x4c\x0d\x02\x00\x00\x00") var _bootclusterRinkebyDevJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x6c\xd0\x29\x6e\x96\x51\x14\x00\x50\xdf\x55\x34\xd5\xe4\xeb\x9d\x87\x2a\xf6\x41\x10\xef\x0e\x4f\xc2\xfe\x1d\xe6\x27\x41\xb0\x83\x93\xf3\xe3\xed\xfd\xfd\x63\x7f\xfd\x9e\xfd\xfa\xfc\x74\x45\xea\xb8\xb6\x7e\xef\x74\x3b\x71\x5f\xf7\x35\xa0\x83\xb3\x39\xd1\x4d\x1b\x67\x58\xa7\x18\x52\x4c\x02\x13\x89\x7a\xdc\x39\xd4\x91\xf1\xec\x72\xc2\xdd\x66\x8e\x94\x29\xe4\x39\xce\xd0\x21\x4c\x55\x24\xb1\x3b\x26\xc0\xb9\x1c\x08\x8b\x6a\x9b\x9e\x45\x21\xde\xf5\x5d\xf1\x41\x7d\x3c\x1e\x12\xfe\x62\x60\xe0\x8f\x6f\xff\x02\xb1\x9b\xfc\xe8\x11\x44\x86\xa3\x1d\x95\x30\xa5\x45\xe4\x3c\x4d\x71\xbd\xd4\x2e\xef\xdc\x86\xe9\x56\x2f\x33\x1d\x51\x24\x97\x22\x53\xc1\x8d\x59\xc9\x3d\x7e\xc0\x85\x02\x13\xec\x04\x11\x64\xa5\x01\x10\x67\x67\x20\x1a\x97\xdd\x1b\xda\x0c\x1c\x27\x96\xaa\x75\xa2\xe2\x05\xb4\x78\xf2\xbf\x3e\xcf\x18\x74\x30\x41\xc1\x8a\x1b\x31\xd7\x31\x80\xe2\x04\x39\x55\x0a\x0f\x76\xc5\x5a\x5a\xf1\x9c\x52\x53\xcc\x76\x28\xf7\xc2\x61\xb1\x2c\xb5\xb2\x2b\xbd\xec\x11\xa2\x6e\x62\x01\x71\xb5\x9d\x32\x37\x11\xcd\xc8\x2e\x51\xe0\x65\xa8\xd4\x54\xf2\x4a\xcb\xe3\xb8\x72\xff\x06\xea\x43\x22\x2f\xe0\xdb\xcf\x3f\x01\x00\x00\xff\xff\x18\xe1\x19\x8d\xe4\x01\x00\x00")
func bootclusterRinkebyDevJsonBytes() ([]byte, error) { func bootclusterRinkebyDevJsonBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -177,12 +177,12 @@ func bootclusterRinkebyDevJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/rinkeby.dev.json", size: 2, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/rinkeby.dev.json", size: 484, mode: os.FileMode(420), modTime: time.Unix(1494903581, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
var _bootclusterRinkebyProdJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8a\x8e\x05\x04\x00\x00\xff\xff\x29\xbb\x4c\x0d\x02\x00\x00\x00") var _bootclusterRinkebyProdJson = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x6c\xce\x2b\x6e\x1c\x50\x0c\x40\x51\x3e\xab\x88\x82\xab\x89\xed\xe7\x6f\x50\xf7\x51\x15\xf8\xf9\x03\xdb\xfd\xb3\x6a\xa4\x80\x80\xb2\x4b\xae\x74\x7e\x3d\xde\xde\xde\xe7\xcf\xdf\x9e\xcf\x8f\x8f\xed\x3c\xab\x64\x27\x61\xa9\x93\xb3\xc4\xc5\x1b\x57\x68\x24\x37\x37\x7a\x96\x1c\x91\xf0\xce\xe9\x63\x22\x5e\x6a\xcd\x1d\x95\xa4\xa5\xd9\x96\x20\x04\x97\xaa\x8d\x85\x91\x60\xaf\x19\x8c\x6b\x8b\x29\xb0\x5b\x45\x10\x5f\x42\xd5\x51\x61\x97\x55\xd0\x11\x6d\x85\xad\x9f\x82\x4f\x94\xa7\xc6\x13\x99\x3f\x0f\x1c\x38\xef\x3f\xbe\x03\x6f\x32\x66\x3a\x05\xb9\x25\x64\x80\x69\xc7\xdd\x9d\x0e\x2b\xaf\xa1\xe1\xc0\x1b\xe1\x76\xc8\xbd\x62\xdc\x75\x51\xb7\xc5\xe4\x80\x66\x69\xa9\x68\x5f\xde\xbb\x8e\xbc\x92\x01\x84\x39\x05\xc0\xbb\x19\x05\x39\xae\x02\x1b\xb4\x8d\x50\x48\x33\xd7\xea\x28\x4b\x9c\xb9\xe7\x3b\xd0\xfe\x07\x24\x9f\x5a\x21\xa3\x2b\x0a\x95\x21\xb8\x5c\x6d\x8b\x73\xfd\xb6\x52\xa7\xb8\x9c\x0b\xa4\x97\x5f\x8e\x43\xc5\x17\xd0\xc2\x56\x2e\x20\xb2\x63\x24\x04\xa4\x51\xbe\xbe\x43\xea\x72\x54\xa6\xda\x07\x80\x05\xc0\x78\x13\xd4\x0e\x9c\xc8\xd9\x41\xd8\xb3\x57\x55\xe7\x15\x5f\x40\xd3\x27\x71\x7c\x01\x1f\xbf\x1f\xff\x02\x00\x00\xff\xff\x4f\x3f\xe5\x15\xe6\x01\x00\x00")
func bootclusterRinkebyProdJsonBytes() ([]byte, error) { func bootclusterRinkebyProdJsonBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -197,7 +197,7 @@ func bootclusterRinkebyProdJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/rinkeby.prod.json", size: 2, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/rinkeby.prod.json", size: 486, mode: os.FileMode(420), modTime: time.Unix(1494904778, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -217,7 +217,7 @@ func bootclusterRopstenDevJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/ropsten.dev.json", size: 1610, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/ropsten.dev.json", size: 1610, mode: os.FileMode(420), modTime: time.Unix(1494885551, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -237,7 +237,7 @@ func bootclusterRopstenProdJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "bootcluster/ropsten.prod.json", size: 1608, mode: os.FileMode(420), modTime: time.Unix(1494793949, 0)} info := bindataFileInfo{name: "bootcluster/ropsten.prod.json", size: 1608, mode: os.FileMode(420), modTime: time.Unix(1494885551, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -257,7 +257,7 @@ func configLinter_exclude_listTxt() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "config/linter_exclude_list.txt", size: 2258, mode: os.FileMode(420), modTime: time.Unix(1494795629, 0)} info := bindataFileInfo{name: "config/linter_exclude_list.txt", size: 2258, mode: os.FileMode(420), modTime: time.Unix(1494856838, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -297,7 +297,7 @@ func keysFirebaseauthkey() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "keys/firebaseauthkey", size: 153, mode: os.FileMode(420), modTime: time.Unix(1494795629, 0)} info := bindataFileInfo{name: "keys/firebaseauthkey", size: 153, mode: os.FileMode(420), modTime: time.Unix(1494845997, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -357,7 +357,7 @@ func keysWnodekey() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "keys/wnodekey", size: 65, mode: os.FileMode(420), modTime: time.Unix(1494795629, 0)} info := bindataFileInfo{name: "keys/wnodekey", size: 65, mode: os.FileMode(420), modTime: time.Unix(1494845997, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -377,7 +377,7 @@ func keysWnodepassword() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "keys/wnodepassword", size: 9, mode: os.FileMode(420), modTime: time.Unix(1494795629, 0)} info := bindataFileInfo{name: "keys/wnodepassword", size: 9, mode: os.FileMode(420), modTime: time.Unix(1494845997, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }

View File

@ -1 +1,5 @@
[] [
"enode://93833be81c3d1bdb2ae5cde258c8f82ad1011a1bea8eb49fe50b0af394d4f7f7e45974356870552f36744efd732692a64865d1e8b64114eaf89a1bad0a1903a2@51.15.64.29:30303",
"enode://d76854bc54144b2269c5316d5f00f0a194efee2fb8d31e7b1939effd7e17f25773f8dc7fda8c4eb469450799da7f39b4e364e2a278d91b53539dcbb10b139635@51.15.73.37:30303",
"enode://57874205931df976079e4ff8ebb5756461030fb00f73486bd5ec4ae6ed6ba98e27d09f58e59bd85281d24084a6062bc8ab514dbcdaa9678fc3001d47772e626e@51.15.75.213:30303"
]

View File

@ -1 +1,5 @@
[] [
"enode://f3b0e5dca730962bae814f3402b8f8a296644c33e8d7a95bd1ab313143a752c77076a03bcb76263570f2f34d4eb530f1daf5054c0990921a872a34eb505dcedf@51.15.73.129:30303",
"enode://fce0d1c2292829b0eccce444f8943f88087ce00a5e910b157972ee1658a948d23c7a046f26567f73b2b18d126811509d7ef1de5be9b1decfcbb14738a590c477@51.15.75.187:30303",
"enode://3b4b9fa02ae8d54c2db51a674bc93d85649b4775f22400f74ae25e9f1c665baa3bcdd33cadd2c1a93cd08a6af984cb605fbb61ec0d750a11d48d4080298af008@51.15.77.193:30303"
]

View File

@ -1 +1,5 @@
[] [
"enode://7512c8f6e7ffdcc723cf77e602a1de9d8cc2e8ad35db309464819122cd773857131aee390fec33894db13da730c8432bb248eed64039e3810e156e979b2847cb@51.15.78.243:30303",
"enode://1cc27a5a41130a5c8b90db5b2273dc28f7b56f3edfc0dcc57b665d451274b26541e8de49ea7a074281906a82209b9600239c981163b6ff85c3038a8e2bc5d8b8@51.15.68.93:30303",
"enode://798d17064141b8f88df718028a8272b943d1cb8e696b3dab56519c70b77b1d3469b56b6f4ce3788457646808f5c7299e9116626f2281f30b959527b969a71e4f@51.15.75.244:30303"
]

View File

@ -1 +1,5 @@
[] [
"enode://fda3f6273a0f2da4ac5858d1f52e5afaf9def281121be3d37558c67d4d9ca26c6ad7a0520b2cd7454120fb770e86d5760487c9924b2166e65485f606e56d60fc@51.15.69.144:30303",
"enode://ba41aa829287a0a9076d9bffed97c8ce2e491b99873288c9e886f16fd575306ac6c656db4fbf814f5a9021aec004ffa9c0ae8650f92fd10c12eeb7c364593eb3@51.15.69.147:30303",
"enode://28ecf5272b560ca951f4cd7f1eb8bd62da5853b026b46db432c4b01797f5b0114819a090a72acd7f32685365ecd8e00450074fa0673039aefe10f3fb666e0f3f@51.15.76.249:30303"
]

View File

@ -278,6 +278,18 @@ func DefaultTestnetGenesisBlock() *Genesis {
} }
} }
// DefaultRinkebyGenesisBlock returns the Rinkeby network genesis block.
func DefaultRinkebyGenesisBlock() *Genesis {
return &Genesis{
Config: params.RinkebyChainConfig,
Timestamp: 1492009146,
ExtraData: hexutil.MustDecode("0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 4700000,
Difficulty: big.NewInt(1),
Alloc: decodePrealloc(rinkebyAllocData),
}
}
// DevGenesisBlock returns the 'geth --dev' genesis block. // DevGenesisBlock returns the 'geth --dev' genesis block.
func DevGenesisBlock() *Genesis { func DevGenesisBlock() *Genesis {
return &Genesis{ return &Genesis{

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,22 @@ var (
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
} }
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig = &ChainConfig{
ChainId: big.NewInt(4),
HomesteadBlock: big.NewInt(1),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(2),
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
EIP155Block: big.NewInt(3),
EIP158Block: big.NewInt(3),
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
},
}
// AllProtocolChanges contains every protocol change (EIPs) // AllProtocolChanges contains every protocol change (EIPs)
// introduced and accepted by the Ethereum core developers. // introduced and accepted by the Ethereum core developers.
// TestChainConfig is like AllProtocolChanges but has chain ID 1. // TestChainConfig is like AllProtocolChanges but has chain ID 1.