Skip to content

Commit

Permalink
fix: remove ports for relay chains
Browse files Browse the repository at this point in the history
  • Loading branch information
riyasng12 committed Dec 19, 2023
1 parent 0ba7026 commit 0194901
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions cli/cmd/chains/icon/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func RunIconNode(cli *common.Cli) (*common.DiveServiceResponse, error) {
return nil, err
}

if configFilePath != "" && genesis == "" {
return nil, common.WrapMessageToError(common.ErrMissingFlags, "Missing genesis flag")
}

genesisHandler, err := genesismanager(enclaveContext)
if err != nil {
return nil, common.WrapMessageToError(common.ErrInvalidFile, err.Error())
Expand Down
12 changes: 3 additions & 9 deletions cli/cmd/chains/utils/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ func (sc *HardhatServiceConfig) EncodeToString() (string, error) {
type NodeConfig struct {
Name string `json:"name"`
NodeType string `json:"node-type"`
Port int `json:"port"`
Prometheus bool `json:"prometheus"`
}

Expand Down Expand Up @@ -208,14 +207,9 @@ func (sc *PolkadotServiceConfig) LoadDefaultConfig() error {
sc.ChainType = "local"
sc.Explorer = false
sc.RelayChain.Name = "rococo-local"
Port1, err := common.GetAvailablePort()
if err != nil {
return err
}
Port2 := Port1 + 1
sc.RelayChain.Nodes = []NodeConfig{
{Name: "bob", NodeType: "full", Port: Port1, Prometheus: false},
{Name: "alice", NodeType: "validator", Port: Port2, Prometheus: false},
{Name: "bob", NodeType: "full", Prometheus: false},
{Name: "alice", NodeType: "validator", Prometheus: false},
}
sc.Para = []ParaNodeConfig{
{
Expand Down Expand Up @@ -277,7 +271,7 @@ func (pnc *ParaNodeConfig) IsEmpty() error {
}

func (nc *NodeConfig) IsEmpty() error {
if nc == nil || nc.Name == "" || nc.NodeType == "" || nc.Port == 0 {
if nc == nil || nc.Name == "" || nc.NodeType == "" {
return common.WrapMessageToErrorf(common.ErrEmptyFields, "Missing Fields In NodeConfig")
}
return nil
Expand Down
1 change: 1 addition & 0 deletions cli/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const (
PortError
EmptyFileError
EmptyFieldsError
MissingFlagsError
)

var DiveLogs bool
Expand Down
1 change: 1 addition & 0 deletions cli/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var (
ErrPortAllocation = NewBase(PortError, "Failed To Allocate Port")
ErrEmptyFile = NewBase(EmptyFileError, "Cannot Load Config From Empty File")
ErrEmptyFields = NewBase(EmptyFieldsError, "Missing Fields In The Config File")
ErrMissingFlags = NewBase(MissingFlagsError, "Missing Flags")
)

func (c ErrorCode) New(msg string) error {
Expand Down

0 comments on commit 0194901

Please sign in to comment.