From 72546bffc22438a777543ddf6f32beda61c0feac Mon Sep 17 00:00:00 2001 From: edwardmack Date: Thu, 16 Feb 2023 17:35:57 -0500 Subject: [PATCH] address rebase conflicts --- cmd/gossamer/config.go | 10 ++-------- cmd/gossamer/config_test.go | 36 +++++++++++++++--------------------- cmd/gossamer/flags.go | 1 - 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/cmd/gossamer/config.go b/cmd/gossamer/config.go index a83928b0f6d..89e5734f770 100644 --- a/cmd/gossamer/config.go +++ b/cmd/gossamer/config.go @@ -6,13 +6,11 @@ package main import ( "errors" "fmt" + "github.com/ChainSafe/gossamer/dot" "strconv" "strings" "time" - "github.com/ChainSafe/gossamer/chain/dev" - "github.com/ChainSafe/gossamer/chain/gssmr" - "github.com/ChainSafe/gossamer/dot" ctoml "github.com/ChainSafe/gossamer/dot/config/toml" "github.com/ChainSafe/gossamer/dot/state" "github.com/ChainSafe/gossamer/dot/state/pruner" @@ -776,16 +774,12 @@ func setDotRPCConfig(ctx *cli.Context, tomlCfg ctoml.RPCConfig, cfg *dot.RPCConf cfg.WSPort = uint32(wsport) } - if WS := ctx.Bool(WSFlag.Name); WS || cfg.WS { - cfg.WS = true - } else if ctx.IsSet(WSFlag.Name) && !WS { - cfg.WS = false wsFlagIsSet := ctx.IsSet(WSFlag.Name) // if ws flag is set then set its value otherwise keep // cfg.WS as it is if wsFlagIsSet { - cfg.WS = ctx.GlobalBool(WSFlag.Name) + cfg.WS = ctx.Bool(WSFlag.Name) } if wsExternal := ctx.Bool(WSExternalFlag.Name); wsExternal { diff --git a/cmd/gossamer/config_test.go b/cmd/gossamer/config_test.go index 2a73d07713d..e7ec727a51f 100644 --- a/cmd/gossamer/config_test.go +++ b/cmd/gossamer/config_test.go @@ -12,10 +12,9 @@ import ( "os" "path/filepath" "testing" - "time" - "github.com/ChainSafe/gossamer/chain/dev" - "github.com/ChainSafe/gossamer/chain/gssmr" + "github.com/ChainSafe/gossamer/chain/kusama" + "github.com/ChainSafe/gossamer/chain/polkadot" "github.com/ChainSafe/gossamer/dot" ctoml "github.com/ChainSafe/gossamer/dot/config/toml" "github.com/ChainSafe/gossamer/dot/state" @@ -24,6 +23,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" + "github.com/ChainSafe/gossamer/lib/runtime/wasmer" "github.com/ChainSafe/gossamer/lib/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -401,14 +401,8 @@ func TestCoreConfigFromFlags(t *testing.T) { // TestNetworkConfigFromFlags tests createDotNetworkConfig using relevant network flags func TestNetworkConfigFromFlags(t *testing.T) { t.Parallel() - defaultNetworkCfg := dot.NetworkConfig{ - Port: 7001, - MinPeers: 1, - MaxPeers: 50, - DiscoveryInterval: 10 * time.Second, - } westendDevConfig := dot.WestendDevConfig() - testCfg, testCfgFile := newTestConfigWithFile(t, westendDevConfig) + testCfg, _ := newTestConfigWithFile(t, westendDevConfig) testcases := map[string]struct { args []string @@ -418,29 +412,29 @@ func TestNetworkConfigFromFlags(t *testing.T) { []string{"app", "--port", "1234"}, dot.NetworkConfig{ Port: 1234, - DiscoveryInterval: defaultNetworkCfg.DiscoveryInterval, - MinPeers: defaultNetworkCfg.MinPeers, - MaxPeers: defaultNetworkCfg.MaxPeers, + DiscoveryInterval: testCfg.DiscoveryInterval, + MinPeers: testCfg.MinPeers, + MaxPeers: testCfg.MaxPeers, }, }, "Test_gossamer_--bootnodes": { []string{"app", "--bootnodes", "peer1,peer2"}, dot.NetworkConfig{ - Port: defaultNetworkCfg.Port, + Port: testCfg.Port, Bootnodes: []string{"peer1", "peer2"}, - DiscoveryInterval: defaultNetworkCfg.DiscoveryInterval, - MinPeers: defaultNetworkCfg.MinPeers, - MaxPeers: defaultNetworkCfg.MaxPeers, + DiscoveryInterval: testCfg.DiscoveryInterval, + MinPeers: testCfg.MinPeers, + MaxPeers: testCfg.MaxPeers, }, }, "Test_gossamer_--protocol": { []string{"app", "--protocol", "/gossamer/test/0"}, dot.NetworkConfig{ - Port: defaultNetworkCfg.Port, + Port: testCfg.Port, ProtocolID: "/gossamer/test/0", - DiscoveryInterval: defaultNetworkCfg.DiscoveryInterval, - MinPeers: defaultNetworkCfg.MinPeers, - MaxPeers: defaultNetworkCfg.MaxPeers, + DiscoveryInterval: testCfg.DiscoveryInterval, + MinPeers: testCfg.MinPeers, + MaxPeers: testCfg.MaxPeers, }, }, "Test_gossamer_--nobootstrap": { diff --git a/cmd/gossamer/flags.go b/cmd/gossamer/flags.go index 559aa9e7307..e600ae95877 100644 --- a/cmd/gossamer/flags.go +++ b/cmd/gossamer/flags.go @@ -4,7 +4,6 @@ package main import ( - "github.com/ChainSafe/gossamer/chain/dev" "github.com/urfave/cli/v2" )