From 99a50eb404e6a3601056d5cdb08b8a4942e40ea6 Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Tue, 16 Mar 2021 18:16:29 -0400 Subject: [PATCH] chore: rename ksmcc -> kusama (#1470) --- README.md | 10 ++-- chain/{ksmcc => kusama}/config.toml | 4 +- chain/{ksmcc => kusama}/defaults.go | 10 ++-- chain/{ksmcc => kusama}/genesis-raw.json | 0 cmd/gossamer/config.go | 11 ++--- cmd/gossamer/config_test.go | 16 +++---- cmd/gossamer/main_test.go | 2 +- cmd/gossamer/toml_config_test.go | 13 +++--- docs/pages/Get_Started.md | 4 +- docs/pages/Host_Architecture.md | 4 +- docs/pages/Official_Nodes.md | 8 ++-- dot/config.go | 58 ++++++++++++------------ lib/runtime/life/exports_test.go | 2 +- lib/runtime/wasmer/exports_test.go | 4 +- lib/utils/utils.go | 8 ++-- 15 files changed, 73 insertions(+), 81 deletions(-) rename chain/{ksmcc => kusama}/config.toml (85%) rename chain/{ksmcc => kusama}/defaults.go (92%) rename chain/{ksmcc => kusama}/genesis-raw.json (100%) diff --git a/README.md b/README.md index 08d930db0c..ff6dd07a19 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -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: ``` diff --git a/chain/ksmcc/config.toml b/chain/kusama/config.toml similarity index 85% rename from chain/ksmcc/config.toml rename to chain/kusama/config.toml index 952fde7604..5c3142c913 100644 --- a/chain/ksmcc/config.toml +++ b/chain/kusama/config.toml @@ -1,5 +1,5 @@ [global] -basepath = "~/.gossamer/ksmcc" +basepath = "~/.gossamer/kusama" log = "info" metrics-port = 9876 @@ -14,7 +14,7 @@ grandpa = "" sync = "" [init] -genesis-raw = "./chain/ksmcc/genesis-raw.json" +genesis-raw = "./chain/kusama/genesis-raw.json" [account] key = "" diff --git a/chain/ksmcc/defaults.go b/chain/kusama/defaults.go similarity index 92% rename from chain/ksmcc/defaults.go rename to chain/kusama/defaults.go index 088e5d4759..c7fd992406 100644 --- a/chain/ksmcc/defaults.go +++ b/chain/kusama/defaults.go @@ -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 . -package ksmcc +package kusama import ( "github.com/ChainSafe/gossamer/lib/runtime/wasmer" @@ -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) @@ -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 diff --git a/chain/ksmcc/genesis-raw.json b/chain/kusama/genesis-raw.json similarity index 100% rename from chain/ksmcc/genesis-raw.json rename to chain/kusama/genesis-raw.json diff --git a/cmd/gossamer/config.go b/cmd/gossamer/config.go index 2d29d7a018..bcfdaacb22 100644 --- a/cmd/gossamer/config.go +++ b/cmd/gossamer/config.go @@ -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" ) @@ -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) @@ -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 diff --git a/cmd/gossamer/config_test.go b/cmd/gossamer/config_test.go index be8615c797..909f78eae5 100644 --- a/cmd/gossamer/config_test.go +++ b/cmd/gossamer/config_test.go @@ -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", @@ -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, diff --git a/cmd/gossamer/main_test.go b/cmd/gossamer/main_test.go index 07c09b4c1d..65c0fc7652 100644 --- a/cmd/gossamer/main_test.go +++ b/cmd/gossamer/main_test.go @@ -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()) } diff --git a/cmd/gossamer/toml_config_test.go b/cmd/gossamer/toml_config_test.go index b258a3121e..9f825deb6d 100644 --- a/cmd/gossamer/toml_config_test.go +++ b/cmd/gossamer/toml_config_test.go @@ -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) { @@ -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) } diff --git a/docs/pages/Get_Started.md b/docs/pages/Get_Started.md index 11a217340c..48b9100c51 100644 --- a/docs/pages/Get_Started.md +++ b/docs/pages/Get_Started.md @@ -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_) diff --git a/docs/pages/Host_Architecture.md b/docs/pages/Host_Architecture.md index 2494314b36..da8d8677c3 100644 --- a/docs/pages/Host_Architecture.md +++ b/docs/pages/Host_Architecture.md @@ -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 diff --git a/docs/pages/Official_Nodes.md b/docs/pages/Official_Nodes.md index f1c88758a8..30239e870c 100644 --- a/docs/pages/Official_Nodes.md +++ b/docs/pages/Official_Nodes.md @@ -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)). diff --git a/dot/config.go b/dot/config.go index 0b10b2e514..c7d27acf88 100644 --- a/dot/config.go +++ b/dot/config.go @@ -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" @@ -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, }, } } diff --git a/lib/runtime/life/exports_test.go b/lib/runtime/life/exports_test.go index 7189a97456..3c1e29386c 100644 --- a/lib/runtime/life/exports_test.go +++ b/lib/runtime/life/exports_test.go @@ -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) diff --git a/lib/runtime/wasmer/exports_test.go b/lib/runtime/wasmer/exports_test.go index 574000bd94..2f412d58e1 100644 --- a/lib/runtime/wasmer/exports_test.go +++ b/lib/runtime/wasmer/exports_test.go @@ -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) @@ -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) diff --git a/lib/utils/utils.go b/lib/utils/utils.go index 714b0c37c2..79fbaa734a 100644 --- a/lib/utils/utils.go +++ b/lib/utils/utils.go @@ -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