Remove mention of DevMode (#869)
* Remove mention of DevMode * Remove prodMode
This commit is contained in:
parent
5f45f6498d
commit
c85e0802eb
|
@ -32,7 +32,6 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
clusterConfigFile = flag.String("clusterconfig", "", "Cluster configuration file")
|
clusterConfigFile = flag.String("clusterconfig", "", "Cluster configuration file")
|
||||||
prodMode = flag.Bool("production", false, "Whether production settings should be loaded")
|
|
||||||
nodeKeyFile = flag.String("nodekey", "", "P2P node key file (private key)")
|
nodeKeyFile = flag.String("nodekey", "", "P2P node key file (private key)")
|
||||||
dataDir = flag.String("datadir", params.DataDir, "Data directory for the databases and keystore")
|
dataDir = flag.String("datadir", params.DataDir, "Data directory for the databases and keystore")
|
||||||
networkID = flag.Int("networkid", params.RopstenNetworkID, "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby, 777=StatusChain)")
|
networkID = flag.Int("networkid", params.RopstenNetworkID, "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby, 777=StatusChain)")
|
||||||
|
@ -214,8 +213,7 @@ func startCollectingStats(interruptCh <-chan struct{}, statusNode *node.StatusNo
|
||||||
|
|
||||||
// makeNodeConfig parses incoming CLI options and returns node configuration object
|
// makeNodeConfig parses incoming CLI options and returns node configuration object
|
||||||
func makeNodeConfig() (*params.NodeConfig, error) {
|
func makeNodeConfig() (*params.NodeConfig, error) {
|
||||||
devMode := !*prodMode
|
nodeConfig, err := params.NewNodeConfig(*dataDir, *clusterConfigFile, uint64(*networkID))
|
||||||
nodeConfig, err := params.NewNodeConfig(*dataDir, *clusterConfigFile, uint64(*networkID), devMode)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,12 +213,6 @@ type UpstreamRPCConfig struct {
|
||||||
|
|
||||||
// NodeConfig stores configuration options for a node
|
// NodeConfig stores configuration options for a node
|
||||||
type NodeConfig struct {
|
type NodeConfig struct {
|
||||||
// DevMode is true when given configuration is to be used during development.
|
|
||||||
// For production, this flag should be turned off, so that more strict requirements
|
|
||||||
// are applied to node's configuration
|
|
||||||
// DEPRECATED.
|
|
||||||
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" validate:"required"`
|
NetworkID uint64 `json:"NetworkId" validate:"required"`
|
||||||
|
|
||||||
|
@ -315,9 +309,8 @@ type NodeConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeConfig creates new node configuration object
|
// NewNodeConfig creates new node configuration object
|
||||||
func NewNodeConfig(dataDir string, clstrCfgFile string, networkID uint64, devMode bool) (*NodeConfig, error) {
|
func NewNodeConfig(dataDir string, clstrCfgFile string, networkID uint64) (*NodeConfig, error) {
|
||||||
nodeConfig := &NodeConfig{
|
nodeConfig := &NodeConfig{
|
||||||
DevMode: devMode,
|
|
||||||
NetworkID: networkID,
|
NetworkID: networkID,
|
||||||
DataDir: dataDir,
|
DataDir: dataDir,
|
||||||
Name: ClientIdentifier,
|
Name: ClientIdentifier,
|
||||||
|
@ -380,7 +373,7 @@ func LoadNodeConfig(configJSON string) (*NodeConfig, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadNodeConfig(configJSON string) (*NodeConfig, error) {
|
func loadNodeConfig(configJSON string) (*NodeConfig, error) {
|
||||||
nodeConfig, err := NewNodeConfig("", "", 0, true)
|
nodeConfig, err := NewNodeConfig("", "", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,8 +269,7 @@ var loadConfigTestCases = []struct {
|
||||||
`default cluster configuration (Ropsten Prod)`,
|
`default cluster configuration (Ropsten Prod)`,
|
||||||
`{
|
`{
|
||||||
"NetworkId": 3,
|
"NetworkId": 3,
|
||||||
"DataDir": "$TMPDIR",
|
"DataDir": "$TMPDIR"
|
||||||
"DevMode": false
|
|
||||||
}`,
|
}`,
|
||||||
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
|
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -321,31 +320,6 @@ var loadConfigTestCases = []struct {
|
||||||
require.True(t, len(enodes) >= 2)
|
require.True(t, len(enodes) >= 2)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
`default DevMode (true)`,
|
|
||||||
`{
|
|
||||||
"NetworkId": 311,
|
|
||||||
"DataDir": "$TMPDIR"
|
|
||||||
}`,
|
|
||||||
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, nodeConfig.DevMode)
|
|
||||||
require.True(t, nodeConfig.ClusterConfig.Enabled)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
`explicit DevMode = false`,
|
|
||||||
`{
|
|
||||||
"NetworkId": 3,
|
|
||||||
"DataDir": "$TMPDIR",
|
|
||||||
"DevMode": false
|
|
||||||
}`,
|
|
||||||
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.False(t, nodeConfig.DevMode)
|
|
||||||
require.True(t, nodeConfig.ClusterConfig.Enabled)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
`explicit WhisperConfig.LightClient = true`,
|
`explicit WhisperConfig.LightClient = true`,
|
||||||
`{
|
`{
|
||||||
|
@ -403,7 +377,7 @@ func TestConfigWriteRead(t *testing.T) {
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
defer os.RemoveAll(tmpDir) // nolint: errcheck
|
defer os.RemoveAll(tmpDir) // nolint: errcheck
|
||||||
|
|
||||||
nodeConfig, err := params.NewNodeConfig(tmpDir, "", params.RopstenNetworkID, true)
|
nodeConfig, err := params.NewNodeConfig(tmpDir, "", params.RopstenNetworkID)
|
||||||
require.Nil(t, err, "cannot create new config object")
|
require.Nil(t, err, "cannot create new config object")
|
||||||
|
|
||||||
err = nodeConfig.Save()
|
err = nodeConfig.Save()
|
||||||
|
@ -411,7 +385,6 @@ func TestConfigWriteRead(t *testing.T) {
|
||||||
|
|
||||||
loadedConfigData, err := ioutil.ReadFile(filepath.Join(nodeConfig.DataDir, "config.json"))
|
loadedConfigData, err := ioutil.ReadFile(filepath.Join(nodeConfig.DataDir, "config.json"))
|
||||||
require.Nil(t, err, "cannot read configuration from disk")
|
require.Nil(t, err, "cannot read configuration from disk")
|
||||||
require.Contains(t, string(loadedConfigData), fmt.Sprintf(`"DevMode": %t`, true))
|
|
||||||
require.Contains(t, string(loadedConfigData), fmt.Sprintf(`"NetworkId": %d`, params.RopstenNetworkID))
|
require.Contains(t, string(loadedConfigData), fmt.Sprintf(`"NetworkId": %d`, params.RopstenNetworkID))
|
||||||
require.Contains(t, string(loadedConfigData), fmt.Sprintf(`"DataDir": "%s"`, tmpDir))
|
require.Contains(t, string(loadedConfigData), fmt.Sprintf(`"DataDir": "%s"`, tmpDir))
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (s *TxQueueTestSuite) SetupTest() {
|
||||||
rpcClient, _ := rpc.NewClient(s.client, params.UpstreamRPCConfig{})
|
rpcClient, _ := rpc.NewClient(s.client, params.UpstreamRPCConfig{})
|
||||||
// expected by simulated backend
|
// expected by simulated backend
|
||||||
chainID := gethparams.AllEthashProtocolChanges.ChainId.Uint64()
|
chainID := gethparams.AllEthashProtocolChanges.ChainId.Uint64()
|
||||||
nodeConfig, err := params.NewNodeConfig("/tmp", "", chainID, true)
|
nodeConfig, err := params.NewNodeConfig("/tmp", "", chainID)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.nodeConfig = nodeConfig
|
s.nodeConfig = nodeConfig
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ var logger = log.New("package", "status-go/lib")
|
||||||
|
|
||||||
//GenerateConfig for status node
|
//GenerateConfig for status node
|
||||||
//export GenerateConfig
|
//export GenerateConfig
|
||||||
func GenerateConfig(datadir *C.char, networkID C.int, devMode C.int) *C.char {
|
func GenerateConfig(datadir *C.char, networkID C.int) *C.char {
|
||||||
config, err := params.NewNodeConfig(C.GoString(datadir), "", uint64(networkID), devMode == 1)
|
config, err := params.NewNodeConfig(C.GoString(datadir), "", uint64(networkID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return makeJSONResponse(err)
|
return makeJSONResponse(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ func testGetDefaultConfig(t *testing.T) bool {
|
||||||
t.Run(fmt.Sprintf("networkID=%d", network.chainID), func(t *testing.T) {
|
t.Run(fmt.Sprintf("networkID=%d", network.chainID), func(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
nodeConfig = params.NodeConfig{}
|
nodeConfig = params.NodeConfig{}
|
||||||
rawResponse = GenerateConfig(C.CString("/tmp/data-folder"), C.int(network.chainID), 1)
|
rawResponse = GenerateConfig(C.CString("/tmp/data-folder"), C.int(network.chainID))
|
||||||
)
|
)
|
||||||
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)
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (s *WhisperExtensionSuite) SetupTest() {
|
||||||
dir, err := ioutil.TempDir("", "test-shhext-")
|
dir, err := ioutil.TempDir("", "test-shhext-")
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
// network id is irrelevant
|
// network id is irrelevant
|
||||||
cfg, err := params.NewNodeConfig(dir, "", 777, true)
|
cfg, err := params.NewNodeConfig(dir, "", 777)
|
||||||
cfg.LightEthConfig.Enabled = false
|
cfg.LightEthConfig.Enabled = false
|
||||||
cfg.Name = fmt.Sprintf("test-shhext-%d", i)
|
cfg.Name = fmt.Sprintf("test-shhext-%d", i)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
Loading…
Reference in New Issue