Remove mention of DevMode (#869)

* Remove mention of DevMode

* Remove prodMode
This commit is contained in:
Frank Mueller 2018-04-26 19:59:57 +02:00 committed by GitHub
parent 5f45f6498d
commit c85e0802eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 46 deletions

View File

@ -32,7 +32,6 @@ var (
var (
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)")
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)")
@ -214,8 +213,7 @@ func startCollectingStats(interruptCh <-chan struct{}, statusNode *node.StatusNo
// makeNodeConfig parses incoming CLI options and returns node configuration object
func makeNodeConfig() (*params.NodeConfig, error) {
devMode := !*prodMode
nodeConfig, err := params.NewNodeConfig(*dataDir, *clusterConfigFile, uint64(*networkID), devMode)
nodeConfig, err := params.NewNodeConfig(*dataDir, *clusterConfigFile, uint64(*networkID))
if err != nil {
return nil, err
}

View File

@ -213,12 +213,6 @@ type UpstreamRPCConfig struct {
// NodeConfig stores configuration options for a node
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 uint64 `json:"NetworkId" validate:"required"`
@ -315,9 +309,8 @@ type NodeConfig struct {
}
// 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{
DevMode: devMode,
NetworkID: networkID,
DataDir: dataDir,
Name: ClientIdentifier,
@ -380,7 +373,7 @@ func LoadNodeConfig(configJSON string) (*NodeConfig, error) {
}
func loadNodeConfig(configJSON string) (*NodeConfig, error) {
nodeConfig, err := NewNodeConfig("", "", 0, true)
nodeConfig, err := NewNodeConfig("", "", 0)
if err != nil {
return nil, err
}

View File

@ -269,8 +269,7 @@ var loadConfigTestCases = []struct {
`default cluster configuration (Ropsten Prod)`,
`{
"NetworkId": 3,
"DataDir": "$TMPDIR",
"DevMode": false
"DataDir": "$TMPDIR"
}`,
func(t *testing.T, dataDir string, nodeConfig *params.NodeConfig, err error) {
require.NoError(t, err)
@ -321,31 +320,6 @@ var loadConfigTestCases = []struct {
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`,
`{
@ -403,7 +377,7 @@ func TestConfigWriteRead(t *testing.T) {
require.Nil(t, err)
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")
err = nodeConfig.Save()
@ -411,7 +385,6 @@ func TestConfigWriteRead(t *testing.T) {
loadedConfigData, err := ioutil.ReadFile(filepath.Join(nodeConfig.DataDir, "config.json"))
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(`"DataDir": "%s"`, tmpDir))
}

View File

@ -59,7 +59,7 @@ func (s *TxQueueTestSuite) SetupTest() {
rpcClient, _ := rpc.NewClient(s.client, params.UpstreamRPCConfig{})
// expected by simulated backend
chainID := gethparams.AllEthashProtocolChanges.ChainId.Uint64()
nodeConfig, err := params.NewNodeConfig("/tmp", "", chainID, true)
nodeConfig, err := params.NewNodeConfig("/tmp", "", chainID)
s.Require().NoError(err)
s.nodeConfig = nodeConfig

View File

@ -19,8 +19,8 @@ var logger = log.New("package", "status-go/lib")
//GenerateConfig for status node
//export GenerateConfig
func GenerateConfig(datadir *C.char, networkID C.int, devMode C.int) *C.char {
config, err := params.NewNodeConfig(C.GoString(datadir), "", uint64(networkID), devMode == 1)
func GenerateConfig(datadir *C.char, networkID C.int) *C.char {
config, err := params.NewNodeConfig(C.GoString(datadir), "", uint64(networkID))
if err != nil {
return makeJSONResponse(err)
}

View File

@ -233,7 +233,7 @@ func testGetDefaultConfig(t *testing.T) bool {
t.Run(fmt.Sprintf("networkID=%d", network.chainID), func(t *testing.T) {
var (
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 {
t.Errorf("cannot decode response (%s): %v", C.GoString(rawResponse), err)

View File

@ -33,7 +33,7 @@ func (s *WhisperExtensionSuite) SetupTest() {
dir, err := ioutil.TempDir("", "test-shhext-")
s.NoError(err)
// network id is irrelevant
cfg, err := params.NewNodeConfig(dir, "", 777, true)
cfg, err := params.NewNodeConfig(dir, "", 777)
cfg.LightEthConfig.Enabled = false
cfg.Name = fmt.Sprintf("test-shhext-%d", i)
s.Require().NoError(err)