Skip to content

Commit

Permalink
Merge branch 'development' into fix/kishan/IsDescendantOf
Browse files Browse the repository at this point in the history
  • Loading branch information
kishansagathiya committed Feb 27, 2023
2 parents 34e4021 + 2f5deb3 commit cbc7557
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 32 deletions.
2 changes: 2 additions & 0 deletions chain/westend/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var (
DefaultConfig = string("./chain/westend/config.toml")
// DefaultBasePath Default node base directory path
DefaultBasePath = string("~/.gossamer/westend")
// DefaultMetricsAddress is the default metrics server listening address.
DefaultMetricsAddress = "localhost:9876"

// DefaultLvl is the default log level
DefaultLvl = log.Info
Expand Down
6 changes: 6 additions & 0 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
defaultKusamaConfigPath = "./chain/kusama/config.toml"
defaultPolkadotConfigPath = "./chain/polkadot/config.toml"
defaultWestendDevConfigPath = "./chain/westend-dev/config.toml"
defaultWestendConfigPath = "./chain/westend/config.toml"
)

// loadConfigFile loads a default config file if --chain is specified, a specific
Expand Down Expand Up @@ -77,6 +78,11 @@ func setupConfigFromChain(ctx *cli.Context) (*ctoml.Config, *dot.Config, error)
tomlCfg = &ctoml.Config{}
cfg = dot.WestendDevConfig()
err = loadConfig(tomlCfg, defaultWestendDevConfigPath)
case "westend":
logger.Info("loading toml configuration from " + defaultWestendConfigPath + "...")
tomlCfg = &ctoml.Config{}
cfg = dot.WestendConfig()
err = loadConfig(tomlCfg, defaultWestendConfigPath)
default:
return nil, nil, fmt.Errorf("unknown chain id provided: %s", id)
}
Expand Down
58 changes: 58 additions & 0 deletions dot/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/ChainSafe/gossamer/chain/kusama"
"github.com/ChainSafe/gossamer/chain/polkadot"
"github.com/ChainSafe/gossamer/chain/westend"
"github.com/ChainSafe/gossamer/dot/state/pruner"
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/internal/log"
Expand Down Expand Up @@ -361,3 +362,60 @@ func PolkadotConfig() *Config {
},
}
}

// WestendConfig returns a "westend" node configuration
func WestendConfig() *Config {
return &Config{
Global: GlobalConfig{
Name: westend.DefaultName,
ID: westend.DefaultID,
BasePath: westend.DefaultBasePath,
LogLvl: westend.DefaultLvl,
RetainBlocks: westend.DefaultRetainBlocks,
Pruning: pruner.Mode(westend.DefaultPruningMode),
MetricsAddress: westend.DefaultMetricsAddress,
TelemetryURLs: westend.DefaultTelemetryURLs,
},
Log: LogConfig{
CoreLvl: westend.DefaultLvl,
DigestLvl: westend.DefaultLvl,
SyncLvl: westend.DefaultLvl,
NetworkLvl: westend.DefaultLvl,
RPCLvl: westend.DefaultLvl,
StateLvl: westend.DefaultLvl,
RuntimeLvl: westend.DefaultLvl,
BlockProducerLvl: westend.DefaultLvl,
FinalityGadgetLvl: westend.DefaultLvl,
},
Init: InitConfig{
Genesis: westend.DefaultGenesis,
},
Account: AccountConfig{
Key: westend.DefaultKey,
Unlock: westend.DefaultUnlock,
},
Core: CoreConfig{
Roles: westend.DefaultRoles,
WasmInterpreter: westend.DefaultWasmInterpreter,
},
Network: NetworkConfig{
Port: westend.DefaultNetworkPort,
Bootnodes: westend.DefaultNetworkBootnodes,
NoBootstrap: westend.DefaultNoBootstrap,
NoMDNS: westend.DefaultNoMDNS,
},
RPC: RPCConfig{
Port: westend.DefaultRPCHTTPPort,
Host: westend.DefaultRPCHTTPHost,
Modules: westend.DefaultRPCModules,
WSPort: westend.DefaultRPCWSPort,
},
Pprof: PprofConfig{
Settings: pprof.Settings{
ListeningAddress: westend.DefaultPprofListeningAddress,
BlockProfileRate: westend.DefaultPprofBlockRate,
MutexProfileRate: westend.DefaultPprofMutexRate,
},
},
}
}
2 changes: 1 addition & 1 deletion dot/sync/chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (s *chainProcessor) processReadyBlocks() {
if err := s.processBlockData(*bd); err != nil {
// depending on the error, we might want to save this block for later
if !errors.Is(err, errFailedToGetParent) && !errors.Is(err, blocktree.ErrParentNotFound) {
logger.Tracef("block data processing for block with hash %s failed: %s", bd.Hash, err)
logger.Errorf("block data processing for block with hash %s failed: %s", bd.Hash, err)
continue
}

Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ require (
github.com/ipfs/go-ipns v0.2.0 //indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipld/go-ipld-prime v0.16.0 // indirect
github.com/ipld/go-ipld-prime v0.19.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jcelliott/lumber v0.0.0-20160324203708-dd349441af25 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.1 // indirect
github.com/koron/go-ssdp v0.0.3 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
Expand Down Expand Up @@ -154,6 +155,7 @@ require (
github.com/rs/cors v1.8.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
Expand All @@ -168,7 +170,7 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/tools v0.3.0 // indirect
Expand Down
Loading

0 comments on commit cbc7557

Please sign in to comment.