diff --git a/VERSION b/VERSION index 9ed317fb4..787ffc30a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.41.1 +0.42.0 diff --git a/api/geth_backend.go b/api/geth_backend.go index 62b5c45c3..875f24ad6 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -205,6 +205,7 @@ func (b *GethStatusBackend) startNodeWithKey(acc multiaccounts.Account, password if err != nil { return err } + if err := logutils.OverrideRootLogWithConfig(conf, false); err != nil { return err } @@ -372,6 +373,15 @@ func (b *GethStatusBackend) loadNodeConfig() (*params.NodeConfig, error) { // which is set at the compile time. // What's cached is usually outdated so we overwrite it here. conf.Version = params.Version + conf.DataDir = filepath.Join(b.rootDataDir, conf.DataDir) + conf.ShhextConfig.BackupDisabledDataDir = filepath.Join(b.rootDataDir, conf.ShhextConfig.BackupDisabledDataDir) + if len(conf.LogDir) == 0 { + conf.LogFile = filepath.Join(b.rootDataDir, conf.LogFile) + } else { + conf.LogFile = filepath.Join(conf.LogDir, conf.LogFile) + } + conf.KeyStoreDir = filepath.Join(b.rootDataDir, conf.KeyStoreDir) + return &conf, nil } diff --git a/api/nimbus_backend.go b/api/nimbus_backend.go index 611b645b5..ed3cda16d 100644 --- a/api/nimbus_backend.go +++ b/api/nimbus_backend.go @@ -366,6 +366,17 @@ func (b *nimbusStatusBackend) loadNodeConfig() (*params.NodeConfig, error) { // which is set at the compile time. // What's cached is usually outdated so we overwrite it here. conf.Version = params.Version + + // Replace all relative paths with absolute + conf.DataDir = filepath.Join(b.rootDataDir, conf.DataDir) + conf.ShhextConfig.BackupDisabledDataDir = filepath.Join(b.rootDataDir, conf.ShhextConfig.BackupDisabledDataDir) + if len(conf.LogDir) == 0 { + conf.LogFile = filepath.Join(b.rootDataDir, conf.LogFile) + } else { + conf.LogFile = filepath.Join(conf.LogDir, conf.LogFile) + } + conf.KeyStoreDir = filepath.Join(b.rootDataDir, conf.KeyStoreDir) + return &conf, nil } diff --git a/lib/library_test_utils.go b/lib/library_test_utils.go index 94d06fb99..f8e4f2b10 100644 --- a/lib/library_test_utils.go +++ b/lib/library_test_utils.go @@ -37,6 +37,7 @@ import ( . "github.com/status-im/status-go/t/utils" //nolint: golint "github.com/status-im/status-go/transactions" ) +import "github.com/status-im/status-go/params" var ( testChainDir string @@ -109,13 +110,18 @@ func createAccountAndLogin(t *testing.T, feed *event.Feed) account.Info { signalErrC <- waitSignal(feed, signal.EventLoggedIn, 5*time.Second) }() + nodeConfig, _ := params.NewConfigFromJSON(nodeConfigJSON) + nodeConfig.KeyStoreDir = "keystore" + nodeConfig.DataDir = "/" + cnf, _ := json.Marshal(nodeConfig) + // SaveAccountAndLogin must be called only once when an account is created. // If the account already exists, Login should be used. rawResponse := SaveAccountAndLogin( buildAccountData("test", account1.WalletAddress), C.CString(TestConfig.Account1.Password), buildAccountSettings("test"), - C.CString(nodeConfigJSON), + C.CString(string(cnf)), buildSubAccountData(account1.WalletAddress), ) var loginResponse APIResponse @@ -131,13 +137,18 @@ func loginUsingAccount(t *testing.T, feed *event.Feed, addr string) { signalErrC <- waitSignal(feed, signal.EventLoggedIn, 5*time.Second) }() + nodeConfig, _ := params.NewConfigFromJSON(nodeConfigJSON) + nodeConfig.KeyStoreDir = "keystore" + nodeConfig.DataDir = "/" + cnf, _ := json.Marshal(nodeConfig) + // SaveAccountAndLogin must be called only once when an account is created. // If the account already exists, Login should be used. rawResponse := SaveAccountAndLogin( buildAccountData("test", addr), C.CString(TestConfig.Account1.Password), buildAccountSettings("test"), - C.CString(nodeConfigJSON), + C.CString(string(cnf)), buildSubAccountData(addr), ) var loginResponse APIResponse diff --git a/node/get_status_node.go b/node/get_status_node.go index e4c434d08..cb2d131f7 100644 --- a/node/get_status_node.go +++ b/node/get_status_node.go @@ -693,7 +693,7 @@ func (n *StatusNode) ChaosModeCheckRPCClientsUpstreamURL(on bool) error { if on { if strings.Contains(url, "infura.io") { - url = "https://httpstat.us/500" + url = "https://httpbin.org/status/500" } } diff --git a/node/geth_status_node_test.go b/node/geth_status_node_test.go index 284b0458e..cee41d9ce 100644 --- a/node/geth_status_node_test.go +++ b/node/geth_status_node_test.go @@ -364,7 +364,7 @@ func TestChaosModeCheckRPCClientsUpstreamURL(t *testing.T) { // assert err = client.Call(nil, "net_version") - require.EqualError(t, err, `500 Internal Server Error {"code": 500, "description": "Internal Server Error"}`) + require.EqualError(t, err, `500 Internal Server Error `) // act err = n.ChaosModeCheckRPCClientsUpstreamURL(false) diff --git a/node/nimbus_status_node.go b/node/nimbus_status_node.go index 4f1f95bed..2b7c561a0 100644 --- a/node/nimbus_status_node.go +++ b/node/nimbus_status_node.go @@ -703,7 +703,7 @@ func (n *NimbusStatusNode) ChaosModeCheckRPCClientsUpstreamURL(on bool) error { if on { if strings.Contains(url, "infura.io") { - url = "https://httpstat.us/500" + url = "https://httpbin.org/status/500" } } diff --git a/params/config.go b/params/config.go index bcd158853..0e4c35bd4 100644 --- a/params/config.go +++ b/params/config.go @@ -386,6 +386,9 @@ type NodeConfig struct { // LogMobileSystem enables log redirection to android/ios system logger. LogMobileSystem bool + // LogFile is a folder which contains LogFile + LogDir string + // LogFile is filename where exposed logs get written to LogFile string diff --git a/t/e2e/suites.go b/t/e2e/suites.go index 63fbd3332..622edb767 100644 --- a/t/e2e/suites.go +++ b/t/e2e/suites.go @@ -134,11 +134,16 @@ func (s *BackendTestSuite) StartTestBackendWithAccount(account multiaccounts.Acc for i := range opts { opts[i](nodeConfig) } + + keystoreDir := nodeConfig.KeyStoreDir + dataDir := nodeConfig.DataDir + nodeConfig.KeyStoreDir = "keystore" + nodeConfig.DataDir = "/" // accounts must be imported before keystore is initialized - s.NoError(importTestAccounts(nodeConfig.KeyStoreDir)) - s.Backend.UpdateRootDataDir(nodeConfig.DataDir) + s.NoError(importTestAccounts(keystoreDir)) + s.Backend.UpdateRootDataDir(dataDir) s.NoError(s.Backend.OpenAccounts()) - s.NoError(s.Backend.AccountManager().InitKeystore(nodeConfig.KeyStoreDir)) + s.NoError(s.Backend.AccountManager().InitKeystore(keystoreDir)) s.Require().NoError(s.Backend.StartNodeWithAccountAndConfig(account, password, settings, nodeConfig, subaccs)) }