Skip to content

Commit

Permalink
address rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardmack committed Feb 16, 2023
1 parent c87e07e commit 72546bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
10 changes: 2 additions & 8 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
36 changes: 15 additions & 21 deletions cmd/gossamer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion cmd/gossamer/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package main

import (
"github.com/ChainSafe/gossamer/chain/dev"
"github.com/urfave/cli/v2"
)

Expand Down

0 comments on commit 72546bf

Please sign in to comment.