Skip to content

Commit 44faf54

Browse files
committed
fix westend chain option
1 parent 97b929a commit 44faf54

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

chain/westend/defaults.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ var (
2121
DefaultConfig = string("./chain/westend/config.toml")
2222
// DefaultBasePath Default node base directory path
2323
DefaultBasePath = string("~/.gossamer/westend")
24+
// DefaultMetricsAddress is the default metrics server listening address.
25+
DefaultMetricsAddress = "localhost:9876"
2426

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

cmd/gossamer/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var (
2828
defaultKusamaConfigPath = "./chain/kusama/config.toml"
2929
defaultPolkadotConfigPath = "./chain/polkadot/config.toml"
3030
defaultWestendDevConfigPath = "./chain/westend-dev/config.toml"
31+
defaultWestendConfigPath = "./chain/westend/config.toml"
3132
)
3233

3334
// loadConfigFile loads a default config file if --chain is specified, a specific
@@ -77,6 +78,11 @@ func setupConfigFromChain(ctx *cli.Context) (*ctoml.Config, *dot.Config, error)
7778
tomlCfg = &ctoml.Config{}
7879
cfg = dot.WestendDevConfig()
7980
err = loadConfig(tomlCfg, defaultWestendDevConfigPath)
81+
case "westend":
82+
logger.Info("loading toml configuration from " + defaultWestendConfigPath + "...")
83+
tomlCfg = &ctoml.Config{}
84+
cfg = dot.WestendConfig()
85+
err = loadConfig(tomlCfg, defaultWestendConfigPath)
8086
default:
8187
return nil, nil, fmt.Errorf("unknown chain id provided: %s", id)
8288
}

dot/config.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/ChainSafe/gossamer/chain/kusama"
1212
"github.com/ChainSafe/gossamer/chain/polkadot"
13+
"github.com/ChainSafe/gossamer/chain/westend"
1314
"github.com/ChainSafe/gossamer/dot/state/pruner"
1415
"github.com/ChainSafe/gossamer/dot/types"
1516
"github.com/ChainSafe/gossamer/internal/log"
@@ -361,3 +362,60 @@ func PolkadotConfig() *Config {
361362
},
362363
}
363364
}
365+
366+
// WestendConfig returns a "westend" node configuration
367+
func WestendConfig() *Config {
368+
return &Config{
369+
Global: GlobalConfig{
370+
Name: westend.DefaultName,
371+
ID: westend.DefaultID,
372+
BasePath: westend.DefaultBasePath,
373+
LogLvl: westend.DefaultLvl,
374+
RetainBlocks: westend.DefaultRetainBlocks,
375+
Pruning: pruner.Mode(westend.DefaultPruningMode),
376+
MetricsAddress: westend.DefaultMetricsAddress,
377+
TelemetryURLs: westend.DefaultTelemetryURLs,
378+
},
379+
Log: LogConfig{
380+
CoreLvl: westend.DefaultLvl,
381+
DigestLvl: westend.DefaultLvl,
382+
SyncLvl: westend.DefaultLvl,
383+
NetworkLvl: westend.DefaultLvl,
384+
RPCLvl: westend.DefaultLvl,
385+
StateLvl: westend.DefaultLvl,
386+
RuntimeLvl: westend.DefaultLvl,
387+
BlockProducerLvl: westend.DefaultLvl,
388+
FinalityGadgetLvl: westend.DefaultLvl,
389+
},
390+
Init: InitConfig{
391+
Genesis: westend.DefaultGenesis,
392+
},
393+
Account: AccountConfig{
394+
Key: westend.DefaultKey,
395+
Unlock: westend.DefaultUnlock,
396+
},
397+
Core: CoreConfig{
398+
Roles: westend.DefaultRoles,
399+
WasmInterpreter: westend.DefaultWasmInterpreter,
400+
},
401+
Network: NetworkConfig{
402+
Port: westend.DefaultNetworkPort,
403+
Bootnodes: westend.DefaultNetworkBootnodes,
404+
NoBootstrap: westend.DefaultNoBootstrap,
405+
NoMDNS: westend.DefaultNoMDNS,
406+
},
407+
RPC: RPCConfig{
408+
Port: westend.DefaultRPCHTTPPort,
409+
Host: westend.DefaultRPCHTTPHost,
410+
Modules: westend.DefaultRPCModules,
411+
WSPort: westend.DefaultRPCWSPort,
412+
},
413+
Pprof: PprofConfig{
414+
Settings: pprof.Settings{
415+
ListeningAddress: westend.DefaultPprofListeningAddress,
416+
BlockProfileRate: westend.DefaultPprofBlockRate,
417+
MutexProfileRate: westend.DefaultPprofMutexRate,
418+
},
419+
},
420+
}
421+
}

0 commit comments

Comments
 (0)