Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use getter to read first config validator #3969

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- [#3953](https://github.com/ignite/cli/pull/3953) Fix apps `Stdout` is redirected to `Stderr`
- [#3863](https://github.com/ignite/cli/pull/3963) Fix breaking issue for app client API when reading app chain info
- [#3969](https://github.com/ignite/cli/pull/3969) Get first config validator using a getter to avoid index errors

## [`v28.2.0`](https://github.com/ignite/cli/releases/tag/v28.2.0)

Expand Down
8 changes: 6 additions & 2 deletions ignite/cmd/chain_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"github.com/spf13/cobra"

cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model"
chainconfig "github.com/ignite/cli/v28/ignite/config/chain"
"github.com/ignite/cli/v28/ignite/pkg/chaincmd"
"github.com/ignite/cli/v28/ignite/pkg/cliui"
"github.com/ignite/cli/v28/ignite/pkg/cliui/icons"
Expand Down Expand Up @@ -117,8 +118,11 @@
return err
}

// TODO: Replace by config.FirstValidator when PR #3199 is merged
validator := cfg.Validators[0]
validator, err := chainconfig.FirstValidator(cfg)
if err != nil {
return err
}

Check warning on line 124 in ignite/cmd/chain_debug.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/chain_debug.go#L121-L124

Added lines #L121 - L124 were not covered by tests

servers, err := validator.GetServers()
if err != nil {
return err
Expand Down
7 changes: 6 additions & 1 deletion ignite/services/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@
if err != nil {
return "", err
}
validator := conf.Validators[0]

validator, err := chainconfig.FirstValidator(conf)
if err != nil {
return "", err
}

Check warning on line 213 in ignite/services/chain/chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/chain/chain.go#L210-L213

Added lines #L210 - L213 were not covered by tests

servers, err := validator.GetServers()
if err != nil {
return "", err
Expand Down
Loading