Skip to content

Commit

Permalink
chore(fleets)_: reuse api.DefaultFleet in GetFleet()
Browse files Browse the repository at this point in the history
fixes #5381
  • Loading branch information
friofry committed Jul 11, 2024
1 parent 1b86c08 commit 0940e2e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const DefaultVerifyTransactionChainID = 1

var paths = []string{pathWalletRoot, pathEIP1581, pathDefaultChat, pathDefaultWallet, pathEncryption}

var DefaultFleet = params.FleetShardsTest

var overrideApiConfig = overrideApiConfigProd

func defaultSettings(keyUID string, address string, derivedAddresses map[string]generator.AccountInfo) (*settings.Settings, error) {
Expand Down Expand Up @@ -127,7 +125,7 @@ func defaultSettings(keyUID string, address string, derivedAddresses map[string]
}

func SetDefaultFleet(nodeConfig *params.NodeConfig) error {
return SetFleet(DefaultFleet, nodeConfig)
return SetFleet(params.DefaultFleet, nodeConfig)
}

func SetFleet(fleet string, nodeConfig *params.NodeConfig) error {
Expand Down
4 changes: 2 additions & 2 deletions api/geth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ func (b *GethStatusBackend) UpdateNodeConfigFleet(acc multiaccounts.Account, pas
if !params.IsFleetSupported(fleet) {
b.log.Warn("fleet is not supported, overriding with default value",
"fleet", fleet,
"defaultFleet", DefaultFleet)
fleet = DefaultFleet
"defaultFleet", params.DefaultFleet)
fleet = params.DefaultFleet
}

err = SetFleet(fleet, config)
Expand Down
4 changes: 2 additions & 2 deletions cmd/statusd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var (
)
fleet = flag.String(
"fleet",
params.FleetShardsTest,
params.DefaultFleet,
fmt.Sprintf(
"Select fleet: %s (default %s)",
[]string{
Expand All @@ -76,7 +76,7 @@ var (
params.FleetWakuSandbox,
params.FleetWakuTest,
},
params.FleetShardsTest,
params.DefaultFleet,
),
)
listenAddr = flag.String("addr", "", "address to bind listener to")
Expand Down
2 changes: 1 addition & 1 deletion mobile/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ type FleetDescription struct {

func Fleets() string {
fleets := FleetDescription{
DefaultFleet: api.DefaultFleet,
DefaultFleet: params.DefaultFleet,
Fleets: params.GetSupportedFleets(),
}

Expand Down
1 change: 1 addition & 0 deletions params/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const (
FleetWakuSandbox = "waku.sandbox"
FleetWakuTest = "waku.test"
)
const DefaultFleet = FleetShardsTest

// Cluster defines a list of Ethereum nodes.
type Cluster struct {
Expand Down
8 changes: 4 additions & 4 deletions params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestNewNodeConfigWithDefaults(t *testing.T) {
c, err := params.NewNodeConfigWithDefaults(
"/some/data/path",
params.GoerliNetworkID,
params.WithFleet(params.FleetShardsTest),
params.WithFleet(params.FleetShardsTest), // see config/cli/fleet-shards.test.json
params.WithLES(),
params.WithMailserver(),
)
Expand All @@ -33,10 +33,10 @@ func TestNewNodeConfigWithDefaults(t *testing.T) {
// assert MailServer
assert.Equal(t, false, c.WakuConfig.EnableMailServer)
// assert cluster
assert.Equal(t, false, c.NoDiscovery)
assert.Equal(t, true, c.NoDiscovery)
assert.Equal(t, params.FleetShardsTest, c.ClusterConfig.Fleet)
assert.NotEmpty(t, c.ClusterConfig.BootNodes)
assert.NotEmpty(t, c.ClusterConfig.StaticNodes)
assert.Empty(t, c.ClusterConfig.BootNodes)
assert.Empty(t, c.ClusterConfig.StaticNodes)
assert.NotEmpty(t, c.ClusterConfig.PushNotificationsServers)
// assert LES
assert.Equal(t, true, c.LightEthConfig.Enabled)
Expand Down
2 changes: 1 addition & 1 deletion protocol/messenger_mailserver_cycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (m *Messenger) getFleet() (string, error) {
} else if m.config.clusterConfig.Fleet != "" {
fleet = m.config.clusterConfig.Fleet
} else {
fleet = params.FleetShardsTest
fleet = params.DefaultFleet
}
return fleet, nil
}
Expand Down

0 comments on commit 0940e2e

Please sign in to comment.