From 01949018f7623790e25d741f74c0560b1da5c60a Mon Sep 17 00:00:00 2001 From: riyasng12 Date: Tue, 19 Dec 2023 15:41:03 +0530 Subject: [PATCH] fix: remove ports for relay chains --- cli/cmd/chains/icon/run.go | 4 ++++ cli/cmd/chains/utils/types.go | 12 +++--------- cli/common/constants.go | 1 + cli/common/errors.go | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/cmd/chains/icon/run.go b/cli/cmd/chains/icon/run.go index 54d45020..590ea9d9 100644 --- a/cli/cmd/chains/icon/run.go +++ b/cli/cmd/chains/icon/run.go @@ -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()) diff --git a/cli/cmd/chains/utils/types.go b/cli/cmd/chains/utils/types.go index ce602733..02b88e6d 100644 --- a/cli/cmd/chains/utils/types.go +++ b/cli/cmd/chains/utils/types.go @@ -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"` } @@ -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{ { @@ -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 diff --git a/cli/common/constants.go b/cli/common/constants.go index 630238f9..fd7e7746 100644 --- a/cli/common/constants.go +++ b/cli/common/constants.go @@ -82,6 +82,7 @@ const ( PortError EmptyFileError EmptyFieldsError + MissingFlagsError ) var DiveLogs bool diff --git a/cli/common/errors.go b/cli/common/errors.go index 4707c5ec..5bb02ed2 100644 --- a/cli/common/errors.go +++ b/cli/common/errors.go @@ -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 {