From 591f7f9dc9244595e5c048125586a63051642c5a Mon Sep 17 00:00:00 2001 From: Nikhil Date: Thu, 10 Aug 2023 18:03:11 -0400 Subject: [PATCH] chain-id flag conditional --- chain/cosmos/chain_node.go | 7 ++++++- chainspec.go | 1 + ibc/types.go | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chain/cosmos/chain_node.go b/chain/cosmos/chain_node.go index 8a0b62a26..2647de75a 100644 --- a/chain/cosmos/chain_node.go +++ b/chain/cosmos/chain_node.go @@ -669,7 +669,12 @@ func (tn *ChainNode) AddGenesisAccount(ctx context.Context, address string, gene command = append(command, "genesis") } - command = append(command, "add-genesis-account", address, amount, "--chain-id", tn.Chain.Config().ChainID) + command = append(command, "add-genesis-account", address, amount) + + if tn.Chain.Config().UsingChainIDFlagCLI { + command = append(command, "--chain-id", tn.Chain.Config().ChainID) + } + _, _, err := tn.ExecBin(ctx, command...) return err diff --git a/chainspec.go b/chainspec.go index b893e086a..e111362ca 100644 --- a/chainspec.go +++ b/chainspec.go @@ -147,6 +147,7 @@ func (s *ChainSpec) applyConfigOverrides(cfg ibc.ChainConfig) (*ibc.ChainConfig, } cfg.UsingNewGenesisCommand = s.UsingNewGenesisCommand + cfg.UsingChainIDFlagCLI = s.UsingChainIDFlagCLI // Set the version depending on the chain type. switch cfg.Type { diff --git a/ibc/types.go b/ibc/types.go index 525dc900f..6c1d8fc63 100644 --- a/ibc/types.go +++ b/ibc/types.go @@ -50,6 +50,8 @@ type ChainConfig struct { EncodingConfig *testutil.TestEncodingConfig // Required when the chain uses the new sub commands for genesis (https://github.com/cosmos/cosmos-sdk/pull/14149) UsingNewGenesisCommand bool `yaml:"using-new-genesis-command"` + // Required when the chain requires the chain-id field to be populated for certain commands + UsingChainIDFlagCLI bool `yaml:"using-chain-id-flag-cli"` // Configuration describing additional sidecar processes. SidecarConfigs []SidecarConfig }