Skip to content

Commit

Permalink
add paseo config
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishkatn committed Jan 15, 2024
1 parent 476932a commit 98a215c
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 53 deletions.
6 changes: 0 additions & 6 deletions chain/kusama/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

var (
// defaultName Default node name
defaultName = "Kusama"
// defaultID Default chain ID
defaultID = "ksmcc3"
// defaultBasePath Default node base directory path
defaultBasePath = "~/.gossamer/kusama"
// defaultChainSpec is the default chain-spec json path
Expand All @@ -22,8 +18,6 @@ var (
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.BasePath = defaultBasePath
config.ID = defaultID
config.Name = defaultName
config.ChainSpec = defaultChainSpec
config.Core.BabeAuthority = false
config.Core.GrandpaAuthority = false
Expand Down
214 changes: 214 additions & 0 deletions chain/paseo/chain-spec-raw.json

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions chain/paseo/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2021 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

package paseo

import (
cfg "github.com/ChainSafe/gossamer/config"
)

var (
// defaultName Default node name
defaultName = "Paseo"
// defaultID Default chain ID
defaultID = "paseo"
// defaultBasePath Default node base directory path
defaultBasePath = "~/.gossamer/paseo"
// defaultChainSpec is the default chain spec configuration path
defaultChainSpec = "./chain/paseo/chain-spec-raw.json"
)

// DefaultConfig returns a paseo node configuration
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.BasePath = defaultBasePath
config.ID = defaultID
config.Name = defaultName
config.ChainSpec = defaultChainSpec
config.Core.BabeAuthority = false
config.Core.GrandpaAuthority = false
config.Core.Role = 1
config.Network.NoMDNS = false

return config
}
6 changes: 0 additions & 6 deletions chain/polkadot/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

var (
// defaultName Default node name
defaultName = "Polkadot"
// defaultID Default chain ID
defaultID = "polkadot"
// defaultBasePath Default node base directory path
defaultBasePath = "~/.gossamer/polkadot"
// defaultChainSpec is the default chain spec configuration path
Expand All @@ -22,8 +18,6 @@ var (
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.BasePath = defaultBasePath
config.ID = defaultID
config.Name = defaultName
config.ChainSpec = defaultChainSpec
config.Core.BabeAuthority = false
config.Core.GrandpaAuthority = false
Expand Down
6 changes: 0 additions & 6 deletions chain/westend-dev/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

const (
// defaultName is the default node name
defaultName = "Westend"
// defaultID is the default node ID
defaultID = "westend_dev"
// defaultBasePath is the default basepath for the westend dev node
defaultBasePath = "~/.gossamer/westend-dev"
// defaultChainSpec is the default chain spec for the westend dev node
Expand All @@ -22,8 +18,6 @@ const (
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.BasePath = defaultBasePath
config.ID = defaultID
config.Name = defaultName
config.ChainSpec = defaultChainSpec
config.RPC.RPCExternal = true
config.RPC.UnsafeRPC = true
Expand Down
6 changes: 0 additions & 6 deletions chain/westend-local/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

const (
// defaultName is the default node name
defaultName = "Westend"
// defaultID is the default node ID
defaultID = "westend_local"
// defaultChainSpec is the default chain spec for the westend local node
defaultChainSpec = "./chain/westend-local/westend-local-spec-raw.json"

Expand All @@ -26,8 +22,6 @@ const (
// DefaultConfig returns a westend local node configuration
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.Name = defaultName
config.ID = defaultID
config.ChainSpec = defaultChainSpec
config.Network.NoMDNS = false
config.RPC.RPCExternal = true
Expand Down
6 changes: 0 additions & 6 deletions chain/westend/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

var (
// defaultName Default node name
defaultName = "Westend"
// defaultID Default chain ID
defaultID = "westend2"
// defaultBasePath Default node base directory path
defaultBasePath = "~/.gossamer/westend"
// defaultChainSpec is the default chain specification path
Expand All @@ -22,8 +18,6 @@ var (
func DefaultConfig() *cfg.Config {
config := cfg.DefaultConfig()
config.BasePath = defaultBasePath
config.ID = defaultID
config.Name = defaultName
config.ChainSpec = defaultChainSpec
config.Core.BabeAuthority = false
config.Core.GrandpaAuthority = false
Expand Down
19 changes: 6 additions & 13 deletions cmd/gossamer/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var (
logLevel string

// Base Config
name string
id string
pruning string
telemetryURLs string

Expand Down Expand Up @@ -75,6 +77,7 @@ Usage:
gossamer --chain westend-local --alice
gossamer --chain westend-dev --key alice --port 7002
gossamer --chain westend --key bob --port 7003
gossamer --chain paseo --key bob --port 7003
gossamer --chain kusama --key charlie --port 7004
gossamer --chain polkadot --key dave --port 7005`,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -209,19 +212,9 @@ func addRootFlags(cmd *cobra.Command) error {

// addBaseConfigFlags adds the base config flags to the command
func addBaseConfigFlags(cmd *cobra.Command) error {
if err := addStringFlagBindViper(cmd,
"name",
config.BaseConfig.Name,
"Name of the node",
"Name of the node"); err != nil {
return fmt.Errorf("failed to add --name flag: %s", err)
}
if err := addStringFlagBindViper(cmd,
"id", config.BaseConfig.ID,
"Identifier for the node",
"id"); err != nil {
return fmt.Errorf("failed to add --id flag: %s", err)
}
cmd.Flags().StringVar(&name, "name", "Gossamer", "Name of the node")
cmd.Flags().StringVar(&id, "id", "gssmr", "Identifier for the node")

if err := addBoolFlagBindViper(cmd,
"no-telemetry",
config.BaseConfig.NoTelemetry,
Expand Down
19 changes: 18 additions & 1 deletion cmd/gossamer/commands/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"syscall"
"time"

"github.com/ChainSafe/gossamer/chain/paseo"

"github.com/spf13/cobra"

"github.com/ChainSafe/gossamer/chain/kusama"
Expand Down Expand Up @@ -211,6 +213,19 @@ func getPassword(msg string) []byte {
}
}

// parseIdentity parses the node identity from the command line flags
func parseIdentity() {
if name != "" {
config.Name = name
viper.Set("name", name)
}

if id != "" {
config.ID = id
viper.Set("id", id)
}
}

// parseChainSpec parses the chain spec from the given chain
// and sets the default config
func parseChainSpec(chain string) error {
Expand All @@ -232,6 +247,8 @@ func parseChainSpec(chain string) error {
config = westend.DefaultConfig()
case cfg.WestendDevChain:
config = westenddev.DefaultConfig()
case cfg.PaseoChain:
config = paseo.DefaultConfig()
case cfg.WestendLocalChain:
if alice || key == "alice" {
config = westendlocal.DefaultAliceConfig()
Expand All @@ -253,9 +270,9 @@ func parseChainSpec(chain string) error {
return fmt.Errorf("failed to load chain spec: %s", err)
}

config.ID = spec.ID
config.Network.Bootnodes = spec.Bootnodes
config.Network.ProtocolID = spec.ProtocolID
parseIdentity()

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const (
// DefaultSystemName is the default system name
DefaultSystemName = "Gossamer"
// DefaultSystemVersion is the default system version
DefaultSystemVersion = "0.3.2"
DefaultSystemVersion = "0.9.0"
)

// DefaultRPCModules the default RPC modules
Expand Down Expand Up @@ -596,6 +596,8 @@ const (
WestendDevChain Chain = "westend-dev"
// WestendLocalChain is the Westend local chain
WestendLocalChain Chain = "westend-local"
// PaseoChain is the Paseo chain
PaseoChain Chain = "paseo"
)

// String returns the string representation of the chain
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/libp2p/go-libp2p v0.31.0
github.com/libp2p/go-libp2p-kad-dht v0.25.2
github.com/minio/sha256-simd v1.0.1
github.com/multiformats/go-multiaddr v0.12.0
github.com/multiformats/go-multiaddr v0.12.1
github.com/nanobox-io/golang-scribble v0.0.0-20190309225732-aa3e7c118975
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/client_model v0.5.0
Expand All @@ -38,8 +38,8 @@ require (
github.com/tetratelabs/wazero v1.1.0
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9
go.uber.org/mock v0.3.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e
golang.org/x/term v0.16.0
google.golang.org/protobuf v1.32.0
)
Expand Down Expand Up @@ -106,7 +106,7 @@ require (
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/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
Expand Down Expand Up @@ -157,7 +157,7 @@ require (
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/quic-go/quic-go v0.38.1 // indirect
github.com/quic-go/quic-go v0.38.2 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
Expand Down Expand Up @@ -191,7 +191,7 @@ require (
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
golang.org/x/tools v0.16.0 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
13 changes: 11 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6K
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down Expand Up @@ -501,6 +503,8 @@ github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU
github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4=
github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE=
github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8=
github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk=
github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE=
github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A=
github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk=
github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E=
Expand Down Expand Up @@ -584,8 +588,8 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM=
github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE=
github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/quic-go/quic-go v0.38.2 h1:VWv/6gxIoB8hROQJhx1JEyiegsUQ+zMN3em3kynTGdg=
github.com/quic-go/quic-go v0.38.2/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU=
github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU=
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
Expand Down Expand Up @@ -776,9 +780,13 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE=
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
Expand Down Expand Up @@ -918,6 +926,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down

0 comments on commit 98a215c

Please sign in to comment.