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 21, 2023
1 parent e4e53df commit f4b19a6
Show file tree
Hide file tree
Showing 34 changed files with 310 additions and 20 deletions.
10 changes: 4 additions & 6 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
"github.com/ChainSafe/gossamer/dot/state"
"github.com/ChainSafe/gossamer/dot/state/pruner"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/genesis"
Expand All @@ -27,17 +25,17 @@ import (
var (
// DefaultCfg is the default configuration for the node.
DefaultCfg = dot.PolkadotConfig
defaultKusamaConfigPath = "./chain/kusama/config.toml"
defaultPolkadotConfigPath = "./chain/polkadot/config.toml"
defaultWestendDevConfigPath = "./chain/westend-dev/config.toml"
defaultKusamaConfigPath = "chain/kusama/config.toml"
defaultPolkadotConfigPath = "chain/polkadot/config.toml"
defaultWestendDevConfigPath = "chain/westend-dev/config.toml"
)

// loadConfigFile loads a default config file if --chain is specified, a specific
// config if --config is specified, or the default gossamer config otherwise.
func loadConfigFile(ctx *cli.Context, cfg *ctoml.Config) (err error) {
cfgPath := ctx.GlobalString(ConfigFlag.Name)
if cfgPath == "" {
return loadConfigFromResource(cfg, defaultGssmrConfigPath)
return loadConfigFromResource(cfg, defaultPolkadotConfigPath)
}

logger.Info("loading toml configuration from " + cfgPath + "...")
Expand Down
6 changes: 2 additions & 4 deletions cmd/gossamer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ import (
"testing"
"time"

"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"
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/chain/kusama"
"github.com/ChainSafe/gossamer/internal/chain/polkadot"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/genesis"
Expand Down
1 change: 0 additions & 1 deletion cmd/gossamer/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/ChainSafe/gossamer/dot"
ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/stretchr/testify/require"
"github.com/urfave/cli"
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/internal/chain/dev"
"github.com/urfave/cli"
)

Expand Down
1 change: 0 additions & 1 deletion cmd/gossamer/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"testing"

"github.com/ChainSafe/gossamer/dot"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/stretchr/testify/require"
"github.com/urfave/cli"
)
Expand Down
11 changes: 5 additions & 6 deletions cmd/gossamer/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func runTestGossamer(t *testing.T, args ...string) *testgossamer {
return tt
}

var testWestendDevConfigPath string

func TestMain(m *testing.M) {
if reexec.Init() {
return
Expand All @@ -202,10 +204,7 @@ func TestMain(m *testing.M) {
panic(err)
}

defaultKusamaConfigPath = filepath.Join(rootPath, "./chain/kusama/config.toml")
defaultPolkadotConfigPath = filepath.Join(rootPath, "./chain/polkadot/config.toml")
defaultWestendDevConfigPath = filepath.Join(rootPath, "./chain/westend-dev/config.toml")

testWestendDevConfigPath = filepath.Join(rootPath, "./internal/chain/westend-dev/config.toml")
os.Exit(m.Run())
}

Expand Down Expand Up @@ -234,7 +233,7 @@ func TestInitCommand_RenameNodeWhenCalled(t *testing.T) {
"--basepath", tempDir,
"--genesis", genesisPath,
"--name", nodeName,
"--config", defaultWestendDevConfigPath,
"--config", testWestendDevConfigPath,
"--force",
)

Expand All @@ -249,7 +248,7 @@ func TestInitCommand_RenameNodeWhenCalled(t *testing.T) {
"init",
"--basepath", tempDir,
"--genesis", genesisPath,
"--config", defaultWestendDevConfigPath,
"--config", testWestendDevConfigPath,
"--force",
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/gossamer/toml_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadConfigWestendDev(t *testing.T) {
require.NoError(t, err)

projectRootPath := utils.GetProjectRootPathTest(t)
configPath := filepath.Join(projectRootPath, "./chain/westend-dev/config.toml")
configPath := filepath.Join(projectRootPath, "./internal/chain/westend-dev/config.toml")

err = loadConfigFromFile(dotConfigToToml(cfg), configPath)
require.NoError(t, err)
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file removed internal/chain/dev/config.toml
Empty file.
Empty file.
Empty file removed internal/chain/dev/genesis.json
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file removed internal/chain/gssmr/config.toml
Empty file.
Empty file.
Empty file removed internal/chain/gssmr/genesis.json
Empty file.
Empty file.
Empty file.
Empty file.
59 changes: 59 additions & 0 deletions internal/chain/westend/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[global]
basepath = "~/.gossamer/westend"
log = "info"
metrics-address = "localhost:9876"

[log]
core = ""
network = ""
rpc = ""
state = ""
runtime = ""
babe = ""
grandpa = ""
sync = ""
digest = ""

[init]
genesis = "./chain/westend/genesis.json"

[account]
key = ""
unlock = ""

[core]
roles = 1
babe-authority = false
grandpa-authority = false

[network]
port = 7001
nobootstrap = false
nomdns = false

[rpc]
enabled = false
external = false
port = 8545
host = "localhost"
modules = [
"system",
"author",
"chain",
"state",
"rpc",
"grandpa",
"offchain",
"childstate",
"syncstate",
"payment",
]
ws-port = 8546
ws = false
ws-external = false


[pprof]
listening-address = "localhost:6060"
block-rate = 0
mutex-rate = 0
99 changes: 99 additions & 0 deletions internal/chain/westend/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

package westend

import (
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/genesis"
"github.com/ChainSafe/gossamer/lib/runtime/wasmer"
)

var (
// GlobalConfig

// DefaultName Default node name
DefaultName = string("Westend")
// DefaultID Default chain ID
DefaultID = string("westend2")
// DefaultConfig Default toml configuration path
DefaultConfig = string("./chain/westend/config.toml")
// DefaultBasePath Default node base directory path
DefaultBasePath = string("~/.gossamer/westend")

// DefaultLvl is the default log level
DefaultLvl = log.Info

// DefaultPruningMode is the default pruning mode
DefaultPruningMode = "archive"
// DefaultRetainBlocks is the default pruning mode
DefaultRetainBlocks = uint32(512)

// DefaultTelemetryURLs is the default URL of the telemetry server to connect to.
DefaultTelemetryURLs []genesis.TelemetryEndpoint

// InitConfig

// DefaultGenesis is the default genesis configuration path
DefaultGenesis = string("./chain/westend/genesis.json")

// AccountConfig

// DefaultKey Default account key
DefaultKey = string("")
// DefaultUnlock Default account unlock
DefaultUnlock = string("")

// CoreConfig

// DefaultAuthority is true if the node is a block producer and a grandpa authority
DefaultAuthority = true
// DefaultRoles Default node roles
DefaultRoles = common.FullNodeRole // authority node (see Table D.2)
// DefaultBabeAuthority is true if the node is a block producer (overwrites previous settings)
DefaultBabeAuthority = true
// DefaultGrandpaAuthority is true if the node is a grandpa authority (overwrites previous settings)
DefaultGrandpaAuthority = true
// DefaultWasmInterpreter is the name of the wasm interpreter to use by default
DefaultWasmInterpreter = wasmer.Name

// NetworkConfig

// DefaultNetworkPort network port
DefaultNetworkPort = uint16(7001)
// DefaultNetworkBootnodes network bootnodes
DefaultNetworkBootnodes = []string(nil)
// DefaultNoBootstrap disables bootstrap
DefaultNoBootstrap = false
// DefaultNoMDNS disables mDNS discovery
DefaultNoMDNS = false

// RPCConfig

// DefaultRPCHTTPHost rpc host
DefaultRPCHTTPHost = string("localhost")
// DefaultRPCHTTPPort rpc port
DefaultRPCHTTPPort = uint32(8545)
// DefaultRPCModules rpc modules
DefaultRPCModules = []string{
"system", "author", "chain", "state", "rpc",
"grandpa", "offchain", "childstate", "syncstate", "payment"}
// DefaultRPCWSPort rpc websocket port
DefaultRPCWSPort = uint32(8546)
)

const (
// PprofConfig

// DefaultPprofListeningAddress default pprof HTTP server listening address.
DefaultPprofListeningAddress = "localhost:6060"

// DefaultPprofBlockRate default block profile rate.
// Set to 0 to disable profiling.
DefaultPprofBlockRate = 0

// DefaultPprofMutexRate default mutex profile rate.
// Set to 0 to disable profiling.
DefaultPprofMutexRate = 0
)
140 changes: 140 additions & 0 deletions internal/chain/westend/genesis.json

Large diffs are not rendered by default.

0 comments on commit f4b19a6

Please sign in to comment.