Update context used in root command with Viper so that it recognizes the client config from home directory passed in CLI flags
Avoid providing default home dir to depinject so that the home directory passed in CLI flags is used in txs
Known issue: The client config from non-default home directory still doesn't seem to be getting used for some commands; in such cases, user has to pass the required flags explicitly
Part of https://git.vdb.to/cerc-io/laconic2d/issues/32 and https://git.vdb.to/cerc-io/laconic2d/issues/33
- Update context used in root command with Viper so that it recognizes the client config from home directory passed in CLI flags
- Avoid providing default home dir to depinject so that the home directory passed in CLI flags is used in txs
- Known issue: The client config from non-default home directory still doesn't seem to be getting used for some commands; in such cases, user has to pass the required flags explicitly
prathamesh
changed title from [WIP] Fix root command setup to respect home flag to [WIP] Update root command setup to respect home flag2024-07-10 08:52:00 +00:00
The root issue seems to be in the app wiring with depinject as suggested in cosmos-sdk docs / ignite-cli.
However, for bond creation command, the client config still doesn't seem to be getting used from given --home directory:
➜ laconic2d git:(pm-handle-config-resolution) ✗ laconicd tx bond create 1000000photon --from val_001 --gas auto --fees 1000photon --home ~/temp/.val_001 -y
Error: val_001.info: key not found
val_001.info: key not found [cosmos/cosmos-sdk@v0.50.3/crypto/keyring/keyring.go:538]
We will keep this as a known issue for now as it's working with the explicit flags.
After the PR changes:
* `bank` transfer with configured `client.toml` and without using explicit flags (see https://git.vdb.to/cerc-io/laconic2d/issues/32):
```bash
➜ laconic2d git:(pm-handle-config-resolution) ✗ laconicd tx bank send laconic1vsmgzyhh9jutktnvpq4gxlr0s47zjvhae63t3a laconic1vsmgzyhh9jutktnvpq4gxlr0s47zjvhae63t3a 1000photon --from val_001 --gas auto --fees 1000photon --home ~/temp/.val_001 -y
gas estimate: 69456
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: ""
timestamp: ""
tx: null
txhash: 760C5EA18127EFDEBCFB592FF078EB71C2E79D2FAE0BFEC0EE15B3FB04D5DE08
```
* `bond` creation after the workaround from this PR (see https://git.vdb.to/cerc-io/laconic2d/issues/33):
```bash
➜ laconic2d git:(pm-handle-config-resolution) ✗ laconicd tx bond create 1000000photon --from val_001 --gas auto --fees 1000photon --home ~/temp/.val_001 -y --keyring-backend test --node http://localhost:27001 --chain-id laconic_9000-1
gas estimate: 49126
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: ""
timestamp: ""
tx: null
txhash: CDE7AC0E228CF6B1642FF873D158C883C1E630B93258438C9F619F725F437A55
➜ laconic2d git:(pm-handle-config-resolution) ✗ laconicd query bond list --node http://localhost:27001
bonds:
- balance:
- amount: "1000000"
denom: photon
id: 61302a90f81778264893c955150f361bce93d316489505e51676eca81c42ceae
owner: laconic1vsmgzyhh9jutktnvpq4gxlr0s47zjvhae63t3a
```
The root issue seems to be in the app wiring with depinject as suggested in cosmos-sdk [docs](https://tutorials.cosmos.network/hands-on-exercise/0-native/1-preparation.html) / [ignite-cli](https://docs.ignite.com/).
* However, for bond creation command, the client config still doesn't seem to be getting used from given `--home` directory:
```bash
➜ laconic2d git:(pm-handle-config-resolution) ✗ laconicd tx bond create 1000000photon --from val_001 --gas auto --fees 1000photon --home ~/temp/.val_001 -y
Error: val_001.info: key not found
val_001.info: key not found [cosmos/cosmos-sdk@v0.50.3/crypto/keyring/keyring.go:538]
```
We will keep this as a known issue for now as it's working with the explicit flags.
prathamesh
marked the pull request as ready for review 2024-07-10 11:44:04 +00:00
ashwin
merged commit 576569fe66 into main2024-07-10 12:32:50 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of cerc-io/laconic2d#32 and cerc-io/laconic2d#33
[WIP] Fix root command setup to respect home flagto [WIP] Update root command setup to respect home flagAfter the PR changes:
banktransfer with configuredclient.tomland without using explicit flags (see cerc-io/laconic2d#32):bondcreation after the workaround from this PR (see cerc-io/laconic2d#33):The root issue seems to be in the app wiring with depinject as suggested in cosmos-sdk docs / ignite-cli.
However, for bond creation command, the client config still doesn't seem to be getting used from given
--homedirectory:We will keep this as a known issue for now as it's working with the explicit flags.