diff --git a/cmd/genesis/genesis.go b/cmd/genesis/genesis.go index e789b5c9d..59211b3c7 100644 --- a/cmd/genesis/genesis.go +++ b/cmd/genesis/genesis.go @@ -14,6 +14,7 @@ import ( "github.com/mr-tron/base58" "github.com/pkg/errors" + "github.com/wavesplatform/gowaves/pkg/crypto" "github.com/wavesplatform/gowaves/pkg/proto" "github.com/wavesplatform/gowaves/pkg/settings" @@ -120,7 +121,7 @@ func run() error { } var js []byte if config { - cfg := *settings.DefaultCustomSettings + cfg := settings.DefaultCustomSettings cfg.Genesis = *block cfg.AddressSchemeCharacter = sc var err error diff --git a/itests/config/genesis_settings.go b/itests/config/genesis_settings.go index 07791d82e..61163947a 100644 --- a/itests/config/genesis_settings.go +++ b/itests/config/genesis_settings.go @@ -121,11 +121,12 @@ func newBlockchainConfig() (*config, []AccountInfo, error) { cfg.FeaturesVotingPeriod = 1 cfg.VotesForFeatureActivation = 1 cfg.MinUpdateAssetInfoInterval = 2 - for _, feature := range genSettings.PreactivatedFeatures { - cfg.PreactivatedFeatures = append(cfg.PreactivatedFeatures, feature.Feature) + cfg.PreactivatedFeatures = make([]int16, len(genSettings.PreactivatedFeatures)) + for i, f := range genSettings.PreactivatedFeatures { + cfg.PreactivatedFeatures[i] = f.Feature } return &config{ - BlockchainSettings: cfg, + BlockchainSettings: &cfg, ScalaOpts: &scalaCustomOptions{Features: genSettings.PreactivatedFeatures, EnableMining: false}, }, acc, nil } diff --git a/itests/docker/docker.go b/itests/docker/docker.go index 961556e53..d3563448b 100644 --- a/itests/docker/docker.go +++ b/itests/docker/docker.go @@ -36,8 +36,10 @@ const ( const ( goNodeLogFileName = "go-node.log" + goNodeErrFileName = "go-node.err" scalaNodeLogFileName = "scala-node.log" - logDir = "../build/logs" + scalaNodeErrFileName = "scala-node.err" + logsDir = "../build/logs" walletPath = "wallet" ) @@ -58,8 +60,10 @@ type Docker struct { network *dockertest.Network goNode *dockertest.Resource goLogFile *os.File + goErrFile *os.File scalaNode *dockertest.Resource scalaLogFile *os.File + scalaErrFile *os.File } func NewDocker(suiteName string) (*Docker, error) { @@ -112,7 +116,7 @@ func (d *Docker) RunContainers(ctx context.Context, paths config.ConfigPaths, su if err != nil { return nil, err } - err = os.MkdirAll(filepath.Join(pwd, logDir, suiteName), os.ModePerm) + err = os.MkdirAll(filepath.Join(pwd, logsDir, suiteName), os.ModePerm) if err != nil { return nil, err } @@ -155,11 +159,21 @@ func (d *Docker) Finish(cancel context.CancelFunc) { log.Warnf("Failed to close go-node logs file: %s", err) } } + if d.goErrFile != nil { + if err := d.goErrFile.Close(); err != nil { + log.Warnf("Failed to close go-node errors file: %s", err) + } + } if d.scalaLogFile != nil { if err := d.scalaLogFile.Close(); err != nil { log.Warnf("Failed to close scala-node logs file: %s", err) } } + if d.scalaErrFile != nil { + if err := d.scalaErrFile.Close(); err != nil { + log.Warnf("Failed to close scala-node errors file: %s", err) + } + } } func (d *Docker) runGoNode(ctx context.Context, cfgPath string, suiteName string) (*dockertest.Resource, *PortConfig, error) { @@ -199,7 +213,12 @@ func (d *Docker) runGoNode(ctx context.Context, cfgPath string, suiteName string return nil, nil, err } - logfile, err := os.Create(filepath.Clean(filepath.Join(pwd, logDir, suiteName, goNodeLogFileName))) + dir := filepath.Join(pwd, logsDir, suiteName) + logFile, err := os.Create(filepath.Clean(filepath.Join(dir, goNodeLogFileName))) + if err != nil { + return nil, nil, err + } + errFile, err := os.Create(filepath.Clean(filepath.Join(dir, goNodeErrFileName))) if err != nil { return nil, nil, err } @@ -215,13 +234,15 @@ func (d *Docker) runGoNode(ctx context.Context, cfgPath string, suiteName string Container: res.Container.ID, - OutputStream: logfile, + OutputStream: logFile, + ErrorStream: errFile, }) if err != nil { log.Warnf("Fail to get logs from go-node: %s", err) } }() - d.goLogFile = logfile + d.goLogFile = logFile + d.goErrFile = errFile portCfg := &PortConfig{ RestApiPort: res.GetPort(RESTApiPort + tcp), @@ -287,7 +308,12 @@ func (d *Docker) runScalaNode(ctx context.Context, cfgPath string, suiteName str return nil, nil, err } - logfile, err := os.Create(filepath.Clean(filepath.Join(pwd, logDir, suiteName, scalaNodeLogFileName))) + dir := filepath.Join(pwd, logsDir, suiteName) + logFile, err := os.Create(filepath.Clean(filepath.Join(dir, scalaNodeLogFileName))) + if err != nil { + return nil, nil, err + } + errFile, err := os.Create(filepath.Clean(filepath.Join(dir, scalaNodeErrFileName))) if err != nil { return nil, nil, err } @@ -303,13 +329,15 @@ func (d *Docker) runScalaNode(ctx context.Context, cfgPath string, suiteName str Container: res.Container.ID, - OutputStream: logfile, + OutputStream: logFile, + ErrorStream: errFile, }) if err != nil { log.Warnf("Fail to get logs from scala-node: %s", err) } }() - d.scalaLogFile = logfile + d.scalaLogFile = logFile + d.scalaErrFile = errFile portCfg := &PortConfig{ RestApiPort: res.GetPort(RESTApiPort + tcp), diff --git a/pkg/grpc/server/common_test.go b/pkg/grpc/server/common_test.go index 937a7d999..b02d567f5 100644 --- a/pkg/grpc/server/common_test.go +++ b/pkg/grpc/server/common_test.go @@ -16,6 +16,9 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/wavesplatform/gowaves/pkg/crypto" g "github.com/wavesplatform/gowaves/pkg/grpc/generated/waves/node/grpc" "github.com/wavesplatform/gowaves/pkg/proto" @@ -24,8 +27,6 @@ import ( "github.com/wavesplatform/gowaves/pkg/state" "github.com/wavesplatform/gowaves/pkg/types" "github.com/wavesplatform/gowaves/pkg/wallet" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) const ( @@ -76,7 +77,7 @@ func customSettingsWithGenesis(t *testing.T, genesisPath string) *settings.Block // This is needed because transactions from MainNet blockchain are used in tests' genesis blocks. sets.AddressSchemeCharacter = settings.MainNetSettings.AddressSchemeCharacter sets.BlockRewardTerm = 100000 - return sets + return &sets } func stateWithCustomGenesis(t *testing.T, genesisPath string) state.State { diff --git a/pkg/settings/blockchain_settings.go b/pkg/settings/blockchain_settings.go index 872e99438..5c9190e18 100644 --- a/pkg/settings/blockchain_settings.go +++ b/pkg/settings/blockchain_settings.go @@ -145,7 +145,7 @@ var ( DelayDelta: delayDeltaDefault, }, } - DefaultCustomSettings = &BlockchainSettings{ + DefaultCustomSettings = BlockchainSettings{ Type: Custom, FunctionalitySettings: FunctionalitySettings{ FeaturesVotingPeriod: 5000,