Skip to content

Commit

Permalink
fix: remove redundant keyring-backend option (#3190)
Browse files Browse the repository at this point in the history
* fix: remove redundant `keyring-backend` option

* test: fix broken integration tests

* chore: fix broken unit test config file

Co-authored-by: Alex Johnson <[email protected]>
  • Loading branch information
jeronimoalbi and Alex Johnson authored Nov 30, 2022
1 parent 2dc8560 commit 1d2517f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- [#3068](https://github.com/ignite/cli/pull/3068) Fix REST codegen method casing bug
- [#3031](https://github.com/ignite/cli/pull/3031) Move keeper hooks to after all keepers initialized in `app.go` template.
- [#3098](https://github.com/ignite/cli/issues/3098) Fix config upgrade issue that left config empty on error.
- [#3129](https://github.com/ignite/cli/issues/3129) Remove redundant `keyring-backend` config option.
- [#3187](https://github.com/ignite/cli/issues/3187) Change prompt text to fit within 80 characters width.

## [`v0.25.2`](https://github.com/ignite/cli/releases/tag/v0.25.1)
Expand Down
3 changes: 0 additions & 3 deletions ignite/config/chain/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ type Init struct {

// Home overwrites default home directory used for the app
Home string `yaml:"home"`

// KeyringBackend is the default keyring backend to use for blockchain initialization
KeyringBackend string `yaml:"keyring-backend"`
}

// Host keeps configuration related to started servers.
Expand Down
1 change: 0 additions & 1 deletion ignite/config/chain/v0/config_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func (c *Config) ConvertNext() (chainconfig.Converter, error) {
validator.Name = c.Validator.Name
validator.Bonded = c.Validator.Staked
validator.Home = c.Init.Home
validator.KeyringBackend = c.Init.KeyringBackend
validator.Client = c.Init.Client

if c.Init.App != nil {
Expand Down
1 change: 0 additions & 1 deletion ignite/config/chain/v0/config_convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestV0ToV1Validator(t *testing.T) {
require.Equal(t, cfgV0.Validator.Name, validator.Name)
require.Equal(t, cfgV0.Validator.Staked, validator.Bonded)
require.Equal(t, cfgV0.Init.Home, validator.Home)
require.Equal(t, cfgV0.Init.KeyringBackend, validator.KeyringBackend)
require.Equal(t, cfgV0.Init.Client, validator.Client)
require.Equal(t, cfgV0.Host.RPC, servers.RPC.Address)
require.Equal(t, cfgV0.Host.P2P, servers.P2P.Address)
Expand Down
2 changes: 2 additions & 0 deletions ignite/config/chain/v0/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ build:
binary: "evmosd"
init:
home: "$HOME/.evmosd"
client:
keyring-backend: "os"
app:
evm-rpc:
address: "0.0.0.0:8545"
Expand Down
2 changes: 2 additions & 0 deletions ignite/config/chain/v1/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ validators:
evm-rpc:
address: 0.0.0.0:8545
ws-address: 0.0.0.0:8546
client:
keyring-backend: os
home: $HOME/.evmosd
3 changes: 0 additions & 3 deletions ignite/config/chain/v1/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ type Validator struct {
// Home overwrites default home directory used for the app
Home string `yaml:"home,omitempty"`

// KeyringBackend is the default keyring backend to use for blockchain initialization
KeyringBackend string `yaml:"keyring-backend,omitempty"`

// Gentx overwrites appd's config/gentx.toml configs.
Gentx *Gentx `yaml:"gentx,omitempty"`
}
Expand Down
15 changes: 5 additions & 10 deletions ignite/services/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,15 @@ func (c *Chain) KeyringBackend() (chaincmd.KeyringBackend, error) {

// 2nd.
validator := config.Validators[0]
if validator.KeyringBackend != "" {
return chaincmd.KeyringBackendFromString(validator.KeyringBackend)
}

// 3rd.
if validator.Client != nil {
if backend, ok := validator.Client["keyring-backend"]; ok {
if backendStr, ok := backend.(string); ok {
return chaincmd.KeyringBackendFromString(backendStr)
if v, ok := validator.Client["keyring-backend"]; ok {
if backend, ok := v.(string); ok {
return chaincmd.KeyringBackendFromString(backend)
}
}
}

// 4th.
// 3rd.
configTOMLPath, err := c.ClientTOMLPath()
if err != nil {
return "", err
Expand All @@ -400,7 +395,7 @@ func (c *Chain) KeyringBackend() (chaincmd.KeyringBackend, error) {
return chaincmd.KeyringBackendFromString(conf.KeyringBackend)
}

// 5th.
// 4th.
return chaincmd.KeyringBackendTest, nil
}

Expand Down
5 changes: 4 additions & 1 deletion integration/node/cmd_query_bank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ignite/cli/ignite/pkg/cosmosclient"
"github.com/ignite/cli/ignite/pkg/randstr"
"github.com/ignite/cli/ignite/pkg/xurl"
xyaml "github.com/ignite/cli/ignite/pkg/yaml"
envtest "github.com/ignite/cli/integration"
)

Expand Down Expand Up @@ -74,7 +75,9 @@ func TestNodeQueryBankBalances(t *testing.T) {
},
}
c.Faucet = base.Faucet{}
c.Validators[0].KeyringBackend = keyring.BackendTest
c.Validators[0].Client = xyaml.Map{
"keyring-backend": keyring.BackendTest,
}
})

env.Must(env.Exec("import alice",
Expand Down
5 changes: 4 additions & 1 deletion integration/node/cmd_tx_bank_send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/ignite/cli/ignite/pkg/cosmosclient"
"github.com/ignite/cli/ignite/pkg/randstr"
"github.com/ignite/cli/ignite/pkg/xurl"
xyaml "github.com/ignite/cli/ignite/pkg/yaml"
envtest "github.com/ignite/cli/integration"
)

Expand Down Expand Up @@ -70,7 +71,9 @@ func TestNodeTxBankSend(t *testing.T) {
},
}
c.Faucet = base.Faucet{}
c.Validators[0].KeyringBackend = keyring.BackendTest
c.Validators[0].Client = xyaml.Map{
"keyring-backend": keyring.BackendTest,
}
})
env.Must(env.Exec("import alice",
step.NewSteps(step.New(
Expand Down

0 comments on commit 1d2517f

Please sign in to comment.