laconic-registry-cli/test
Prathamesh Musale 86259b35a6
All checks were successful
Lint / lint (18.x) (push) Successful in 1m12s
Publish npm package to gitea / npm_publish (18.x) (release) Successful in 1m24s
Tests / cli_tests (18.x) (push) Successful in 9m15s
Add a config option and arg to set gas price for auto fees calculation (#81)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)
Requires cerc-io/registry-sdk#22

Behaviour in different configuration scenarios:
- Gas set, fees set to `Xalnt`:

  ```bash
  # Example
  gas: 500000
  fees: 500000alnt
  gasPrice:
  ```

  - `gasPrice` config ignored
  - tx rejected if given `fees` < `gas` * `min-gas-price` set by the node
  - tx fails mid-execution if it runs out of given `gas`
- Fees not set, gas price set to `Xalnt`:

  ```bash
  # Example
  gas:
  fees:
  gasPrice: 1alnt
  ```

  - `gas` config ignored
  - uses `auto` fee calculation using gas estimation with [default multiplier](https://git.vdb.to/cerc-io/registry-sdk/src/branch/main/src/constants.ts) (`2`) value from `registry-sdk`
  - tx rejected if given `gasPrice` < `min-gas-price` set by the node
  - tx fails mid-execution if it runs out of calculated gas
- Fees set to a `X` (without `alnt` suffix), gas price set to `Yalnt`:

  ```bash
  # Example
  gas:
  fees: 1.8
  gasPrice: 1alnt
  ```

  - `gas` config ignored
  - uses `auto` fee calculation using gas estimation with `fees` as the multiplier
  - tx rejected if given `gasPrice` < `min-gas-price` set by the node
  - tx fails mid-execution if it runs out of calculated gas, can be retried with a higher gas estimation multiplier (`fees`)
- Fees and gas price both not set:

  ```bash
  # Example
  gas:
  fees:
  gasPrice:
  ```

  - `gas` config ignored
  - uses `auto` fee calculation using gas estimation
  - throws error:
    ```bash
    Gas price must be set in the client options when auto gas is used.
    ```

The provided config can be overridden with CLI args if required.

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #81
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-06 09:44:47 +00:00
..
data Add CLI tests and setup CI (#53) 2024-01-29 04:46:32 +00:00
cli.test.ts Add a config option and arg to set gas price for auto fees calculation (#81) 2024-09-06 09:44:47 +00:00
helpers.ts Add a config option and arg to set gas price for auto fees calculation (#81) 2024-09-06 09:44:47 +00:00
README.md Rename laconic2d to laconicd and upgrade SDK (#61) 2024-04-02 13:25:31 +00:00
run-tests.sh Replace photon with alnt token denom (#73) 2024-07-30 13:24:46 +00:00

Run CLI tests

  • Follow the project Setup and Account Setup from root README

  • Add laconic cmd to path

    export PATH="$PWD/bin:$PATH"
    
  • Create a .env file using .env.example:

    cp .env.example .env
    
  • Get account address of test account:

    laconicd keys list --keyring-backend test
    
    # - address: laconic10er85pyd7ukw732e88fzv7k0jq205764hye2dx
    #   name: alice
    #   pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AsDoWlNIr3W013pOiwmopaB/SaWQj6r3g56xb2d9GxYK"}'
    #   type: local
    

    Use the address field from the result and assign it in TEST_ACCOUNT field of .env file

  • Run CLI tests:

    yarn test