Skip to content

Commit

Permalink
chain-id flag conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
nivasan1 committed Aug 10, 2023
1 parent 648c64d commit 591f7f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions chainspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions ibc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 591f7f9

Please sign in to comment.