Skip to content

Commit

Permalink
Merge branch 'development' of github.com:ChainSafe/gossamer into noot…
Browse files Browse the repository at this point in the history
…/sync-at-head
  • Loading branch information
noot committed Mar 16, 2021
2 parents 5694367 + 99a50eb commit 605a42e
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 81 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ babe-threshold-denominator = 1

Then, re-run the above steps. NOTE: this feature is for testing only; if you wish to change the BABE block production parameters, you need to create a modified runtime.

### Run Kusama Node (_in development_)
### Run Kusama Node

initialize kusama node:
```
./bin/gossamer --chain ksmcc init
./bin/gossamer --chain kusama init
```

start kusama node:
```
./bin/gossamer --chain ksmcc
./bin/gossamer --chain kusama
```

The node may not appear to do anything for the first minute or so (it's bootstrapping to the network.) If you wish to see what is it doing in this time, you can turn on debug logs in `chain/gssmr/config.toml`:
Expand All @@ -105,9 +105,7 @@ network = "debug"

After it's finished bootstrapping, the node should begin to sync.

### Run Polkadot Node (_in development_)

NOTE: This is currently not supported.
### Run Polkadot Node

initialize polkadot node:
```
Expand Down
4 changes: 2 additions & 2 deletions chain/ksmcc/config.toml → chain/kusama/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[global]
basepath = "~/.gossamer/ksmcc"
basepath = "~/.gossamer/kusama"
log = "info"
metrics-port = 9876

Expand All @@ -14,7 +14,7 @@ grandpa = ""
sync = ""

[init]
genesis-raw = "./chain/ksmcc/genesis-raw.json"
genesis-raw = "./chain/kusama/genesis-raw.json"

[account]
key = ""
Expand Down
10 changes: 5 additions & 5 deletions chain/ksmcc/defaults.go → chain/kusama/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the gossamer library. If not, see <http://www.gnu.org/licenses/>.

package ksmcc
package kusama

import (
"github.com/ChainSafe/gossamer/lib/runtime/wasmer"
Expand All @@ -27,11 +27,11 @@ var (
// DefaultName Default node name
DefaultName = string("Kusama")
// DefaultID Default chain ID
DefaultID = string("ksmcc")
DefaultID = string("ksmcc3")
// DefaultConfig Default toml configuration path
DefaultConfig = string("./chain/ksmcc/config.toml")
DefaultConfig = string("./chain/kusama/config.toml")
// DefaultBasePath Default node base directory path
DefaultBasePath = string("~/.gossamer/ksmcc")
DefaultBasePath = string("~/.gossamer/kusama")

// DefaultMetricsPort is the metrics server port
DefaultMetricsPort = uint32(9876)
Expand All @@ -42,7 +42,7 @@ var (
// InitConfig

// DefaultGenesisRaw Default genesis configuration path
DefaultGenesisRaw = string("./chain/ksmcc/genesis-raw.json")
DefaultGenesisRaw = string("./chain/kusama/genesis-raw.json")

// AccountConfig

Expand Down
File renamed without changes.
11 changes: 3 additions & 8 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ import (
var (
DefaultCfg = dot.GssmrConfig
defaultGssmrConfigPath = "./chain/gssmr/config.toml"
defaultKusamaConfigPath = "./chain/ksmcc/config.toml"
defaultKusamaConfigPath = "./chain/kusama/config.toml"
defaultPolkadotConfigPath = "./chain/polkadot/config.toml"

gossamerName = "gssmr"
kusamaName = "ksmcc"
kusamaName = "kusama"
polkadotName = "polkadot"
)

Expand Down Expand Up @@ -92,7 +92,7 @@ func setupConfigFromChain(ctx *cli.Context) (*ctoml.Config, *dot.Config, error)
case kusamaName:
logger.Info("loading toml configuration...", "config path", defaultKusamaConfigPath)
tomlCfg = &ctoml.Config{}
cfg = dot.KsmccConfig()
cfg = dot.KusamaConfig()
err = loadConfig(tomlCfg, defaultKusamaConfigPath)
case polkadotName:
logger.Info("loading toml configuration...", "config path", defaultPolkadotConfigPath)
Expand Down Expand Up @@ -410,11 +410,6 @@ func setDotGlobalConfig(ctx *cli.Context, tomlCfg *ctoml.Config, cfg *dot.Global
cfg.Name = name
}

// check --chain flag and update node configuration
if id := ctx.GlobalString(ChainFlag.Name); id != "" {
cfg.ID = id
}

// check --basepath flag and update node configuration
if basepath := ctx.GlobalString(BasePathFlag.Name); basepath != "" {
cfg.BasePath = basepath
Expand Down
16 changes: 8 additions & 8 deletions cmd/gossamer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ func TestConfigFromChainFlag(t *testing.T) {
dot.GssmrConfig(),
},
{
"Test gossamer --chain ksmcc",
"Test gossamer --chain kusama",
[]string{"chain"},
[]interface{}{"ksmcc"},
dot.KsmccConfig(),
[]interface{}{"kusama"},
dot.KusamaConfig(),
},
{
"Test gossamer --chain polkadot",
Expand Down Expand Up @@ -145,13 +145,13 @@ func TestGlobalConfigFromFlags(t *testing.T) {
},
},
{
"Test gossamer --chain",
"Test kusama --chain",
[]string{"config", "chain"},
[]interface{}{testCfgFile.Name(), "ksmcc"},
[]interface{}{testCfgFile.Name(), "kusama"},
dot.GlobalConfig{
Name: dot.KsmccConfig().Global.Name,
ID: "ksmcc",
BasePath: dot.KsmccConfig().Global.BasePath,
Name: dot.KusamaConfig().Global.Name,
ID: "ksmcc3",
BasePath: dot.KusamaConfig().Global.BasePath,
LogLvl: log.LvlInfo,
PublishMetrics: testCfg.Global.PublishMetrics,
MetricsPort: testCfg.Global.MetricsPort,
Expand Down
2 changes: 1 addition & 1 deletion cmd/gossamer/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestMain(m *testing.M) {
return
}
defaultGssmrConfigPath = "../../chain/gssmr/config.toml"
defaultKusamaConfigPath = "../../chain/ksmcc/config.toml"
defaultKusamaConfigPath = "../../chain/kusama/config.toml"
defaultPolkadotConfigPath = "../../chain/polkadot/config.toml"
os.Exit(m.Run())
}
Expand Down
13 changes: 6 additions & 7 deletions cmd/gossamer/toml_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
const GssmrConfigPath = "../../chain/gssmr/config.toml"
const GssmrGenesisPath = "../../chain/gssmr/genesis-raw.json"

const KsmccConfigPath = "../../chain/ksmcc/config.toml"
const KsmccGenesisPath = "../../chain/ksmcc/genesis-raw.json"
const KusamaConfigPath = "../../chain/kusama/config.toml"
const KusamaGenesisPath = "../../chain/kusama/genesis-raw.json"

// TestLoadConfig tests loading a toml configuration file
func TestLoadConfig(t *testing.T) {
Expand Down Expand Up @@ -53,20 +53,19 @@ func TestLoadConfigGssmr(t *testing.T) {
require.NotNil(t, cfg)
}

// TestLoadConfigKsmcc tests loading the toml configuration file for ksmcc
func TestLoadConfigKsmcc(t *testing.T) {
func TestLoadConfigKusama(t *testing.T) {
t.Skip() // TODO: fix by updating kusama runtime
cfg := dot.KsmccConfig()
cfg := dot.KusamaConfig()
require.NotNil(t, cfg)

cfg.Global.BasePath = utils.NewTestDir(t)
cfg.Init.GenesisRaw = KsmccGenesisPath
cfg.Init.GenesisRaw = KusamaGenesisPath

defer utils.RemoveTestDir(t)

err := dot.InitNode(cfg)
require.Nil(t, err)

err = loadConfig(dotConfigToToml(cfg), KsmccConfigPath)
err = loadConfig(dotConfigToToml(cfg), KusamaConfigPath)
require.Nil(t, err)
}
4 changes: 2 additions & 2 deletions docs/pages/Get_Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ start gossamer node:

initialize kusama node:
```
./bin/gossamer --chain ksmcc --key alice init
./bin/gossamer --chain kusama --key alice init
```

start kusama node:
```
./bin/gossamer --chain ksmcc --key alice
./bin/gossamer --chain kusama --key alice
```

## Run Polkadot Node (_in development_)
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/Host_Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ The **host node** is the base node implementation. As the base node implementati

The **gssmr node** is an official node implementation for the Gossamer Testnet - a configuration file, genesis file, compiled runtime, and runtime imports used with the **host node**.

The **ksmcc node** is an official node implementation for the Kusama Network - a configuration file, genesis file, compiled runtime, and runtime imports used with the **host node**.
The **kusama node** is an official node implementation for the Kusama Network - a configuration file, genesis file, compiled runtime, and runtime imports used with the **host node**.

The **dotcc node** is an official node implementation for the Polkadot Network - a configuration file, genesis file, compiled runtime, and runtime imports used with the **host node**.
The **polkadot node** is an official node implementation for the Polkadot Network - a configuration file, genesis file, compiled runtime, and runtime imports used with the **host node**.

### Custom Services

Expand Down
8 changes: 4 additions & 4 deletions docs/pages/Official_Nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ permalink: /official-nodes/

- The **gssmr** directory includes configuration files for the ***gssmr node*** implementation - an official node implementation for the Gossamer Testnet (see [Official Nodes](../host-architecture#official-nodes)).

## `chain/ksmcc`
## `chain/kusama`

- The **ksmcc** directory includes configuration files for the ***ksmcc node*** implementation - an official node implementation for the Kusama Network (see [Official Nodes](../host-architecture#official-nodes)).
- The **kusama** directory includes configuration files for the ***kusama node*** implementation - an official node implementation for the Kusama Network (see [Official Nodes](../host-architecture#official-nodes)).

## `chain/dotcc`
## `chain/polkadot`

- The **dotcc** directory includes configuration files for the ***dotcc node*** implementation - an official node implementation for the Polkadot Network (see [Official Nodes](../host-architecture#official-nodes)).
- The **polkadot** directory includes configuration files for the ***polkadot node*** implementation - an official node implementation for the Polkadot Network (see [Official Nodes](../host-architecture#official-nodes)).
58 changes: 29 additions & 29 deletions dot/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"encoding/json"

"github.com/ChainSafe/gossamer/chain/gssmr"
"github.com/ChainSafe/gossamer/chain/ksmcc"
"github.com/ChainSafe/gossamer/chain/kusama"
"github.com/ChainSafe/gossamer/chain/polkadot"
"github.com/ChainSafe/gossamer/dot/types"
log "github.com/ChainSafe/log15"
Expand Down Expand Up @@ -174,48 +174,48 @@ func GssmrConfig() *Config {
}
}

// KsmccConfig returns a "ksmcc" node configuration
func KsmccConfig() *Config {
// KusamaConfig returns a kusama node configuration
func KusamaConfig() *Config {
return &Config{
Global: GlobalConfig{
Name: ksmcc.DefaultName,
ID: ksmcc.DefaultID,
BasePath: ksmcc.DefaultBasePath,
LogLvl: ksmcc.DefaultLvl,
MetricsPort: ksmcc.DefaultMetricsPort,
Name: kusama.DefaultName,
ID: kusama.DefaultID,
BasePath: kusama.DefaultBasePath,
LogLvl: kusama.DefaultLvl,
MetricsPort: kusama.DefaultMetricsPort,
},
Log: LogConfig{
CoreLvl: ksmcc.DefaultLvl,
SyncLvl: ksmcc.DefaultLvl,
NetworkLvl: ksmcc.DefaultLvl,
RPCLvl: ksmcc.DefaultLvl,
StateLvl: ksmcc.DefaultLvl,
RuntimeLvl: ksmcc.DefaultLvl,
BlockProducerLvl: ksmcc.DefaultLvl,
FinalityGadgetLvl: ksmcc.DefaultLvl,
CoreLvl: kusama.DefaultLvl,
SyncLvl: kusama.DefaultLvl,
NetworkLvl: kusama.DefaultLvl,
RPCLvl: kusama.DefaultLvl,
StateLvl: kusama.DefaultLvl,
RuntimeLvl: kusama.DefaultLvl,
BlockProducerLvl: kusama.DefaultLvl,
FinalityGadgetLvl: kusama.DefaultLvl,
},
Init: InitConfig{
GenesisRaw: ksmcc.DefaultGenesisRaw,
GenesisRaw: kusama.DefaultGenesisRaw,
},
Account: AccountConfig{
Key: ksmcc.DefaultKey,
Unlock: ksmcc.DefaultUnlock,
Key: kusama.DefaultKey,
Unlock: kusama.DefaultUnlock,
},
Core: CoreConfig{
Roles: ksmcc.DefaultRoles,
WasmInterpreter: ksmcc.DefaultWasmInterpreter,
Roles: kusama.DefaultRoles,
WasmInterpreter: kusama.DefaultWasmInterpreter,
},
Network: NetworkConfig{
Port: ksmcc.DefaultNetworkPort,
Bootnodes: ksmcc.DefaultNetworkBootnodes,
NoBootstrap: ksmcc.DefaultNoBootstrap,
NoMDNS: ksmcc.DefaultNoMDNS,
Port: kusama.DefaultNetworkPort,
Bootnodes: kusama.DefaultNetworkBootnodes,
NoBootstrap: kusama.DefaultNoBootstrap,
NoMDNS: kusama.DefaultNoMDNS,
},
RPC: RPCConfig{
Port: ksmcc.DefaultRPCHTTPPort,
Host: ksmcc.DefaultRPCHTTPHost,
Modules: ksmcc.DefaultRPCModules,
WSPort: ksmcc.DefaultRPCWSPort,
Port: kusama.DefaultRPCHTTPPort,
Host: kusama.DefaultRPCHTTPHost,
Modules: kusama.DefaultRPCModules,
WSPort: kusama.DefaultRPCWSPort,
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime/life/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func TestInstance_ExecuteBlock_GossamerRuntime(t *testing.T) {
}

func TestInstance_ExecuteBlock_KusamaRuntime_KusamaBlock1(t *testing.T) {
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/ksmcc/genesis-raw.json")
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/kusama/genesis-raw.json")
require.NoError(t, err)

genTrie, err := genesis.NewTrieFromGenesis(gen)
Expand Down
4 changes: 2 additions & 2 deletions lib/runtime/wasmer/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestInstance_Version_PolkadotRuntime(t *testing.T) {
}

func TestInstance_Version_KusamaRuntime(t *testing.T) {
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/ksmcc/genesis-raw.json")
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/kusama/genesis-raw.json")
require.NoError(t, err)

genTrie, err := genesis.NewTrieFromGenesis(gen)
Expand Down Expand Up @@ -540,7 +540,7 @@ func TestInstance_ExecuteBlock_PolkadotRuntime_PolkadotBlock1(t *testing.T) {
}

func TestInstance_ExecuteBlock_KusamaRuntime_KusamaBlock1(t *testing.T) {
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/ksmcc/genesis-raw.json")
gen, err := genesis.NewGenesisFromJSONRaw("../../../chain/kusama/genesis-raw.json")
require.NoError(t, err)

genTrie, err := genesis.NewTrieFromGenesis(gen)
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ func GetGssmrGenesisPath() string {
return fp
}

// GetKsmccGenesisPath gets the ksmcc genesis path
func GetKsmccGenesisPath() string {
path1 := "../chain/ksmcc/genesis.json"
path2 := "../../chain/ksmcc/genesis.json"
// GetKusamaGenesisPath gets the kusama genesis path
func GetKusamaGenesisPath() string {
path1 := "../chain/kusama/genesis.json"
path2 := "../../chain/kusama/genesis.json"

var fp string

Expand Down

0 comments on commit 605a42e

Please sign in to comment.