Update root command setup to respect home flag #34

Merged
ashwin merged 2 commits from pm-handle-config-resolution into main 2024-07-10 12:32:50 +00:00
Member

Part of cerc-io/laconic2d#32 and cerc-io/laconic2d#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
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 added 1 commit 2024-07-10 08:51:41 +00:00
Fix root command setup to respect home flag
All checks were successful
Integration Tests / test-integration (pull_request) Successful in 2m47s
Build / build (pull_request) Successful in 2m50s
E2E Tests / test-e2e (pull_request) Successful in 4m5s
Lint / Run golangci-lint (pull_request) Successful in 5m30s
Unit Tests / test-unit (pull_request) Successful in 1m59s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m27s
SDK Tests / sdk_tests (pull_request) Successful in 8m28s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 12m53s
d19e833d7f
prathamesh changed title from [WIP] Fix root command setup to respect home flag to [WIP] Update root command setup to respect home flag 2024-07-10 08:52:00 +00:00
prathamesh added 1 commit 2024-07-10 09:48:50 +00:00
Avoid providing default home dir to depinject
All checks were successful
Unit Tests / test-unit (pull_request) Successful in 1m57s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m42s
SDK Tests / sdk_tests (pull_request) Successful in 8m10s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 13m0s
Integration Tests / test-integration (pull_request) Successful in 2m36s
Build / build (pull_request) Successful in 2m38s
E2E Tests / test-e2e (pull_request) Successful in 3m57s
Lint / Run golangci-lint (pull_request) Successful in 5m36s
8750ef06f0
Author
Member

After the PR changes:

  • bank transfer with configured client.toml and without using explicit flags (see cerc-io/laconic2d#32):

    ➜  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 cerc-io/laconic2d#33):

    ➜  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 / 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 changed title from [WIP] Update root command setup to respect home flag to Update root command setup to respect home flag 2024-07-10 11:44:04 +00:00
ashwin merged commit 576569fe66 into main 2024-07-10 12:32:50 +00:00
ashwin deleted branch pm-handle-config-resolution 2024-07-10 12:32:51 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/laconicd#34
No description provided.