Add a config option and arg to set gas price for auto
fees calculation
#81
74
README.md
74
README.md
@ -4,7 +4,7 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry-
|
||||
|
||||
## Install
|
||||
|
||||
- Add `.npmrc` file in desired project to resolve package
|
||||
* Add `.npmrc` file in desired project to resolve package
|
||||
|
||||
```bash
|
||||
@cerc-io:registry=https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
@ -12,13 +12,13 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry-
|
||||
|
||||
This will set the registry for `cerc-io` scoped packages in the project
|
||||
|
||||
- Install the CLI using package manager
|
||||
* Install the CLI using package manager
|
||||
|
||||
```bash
|
||||
yarn add @cerc-io/laconic-registry-cli
|
||||
```
|
||||
|
||||
- For installing CLI globally add `.npmrc` file above in home directory and run
|
||||
* For installing CLI globally add `.npmrc` file above in home directory and run
|
||||
|
||||
```bash
|
||||
yarn global add @cerc-io/laconic-registry-cli
|
||||
@ -26,13 +26,13 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry-
|
||||
|
||||
## Setup
|
||||
|
||||
- Run `yarn` to install all dependencies.
|
||||
* Run `yarn` to install all dependencies.
|
||||
|
||||
- Run `yarn build`.
|
||||
* Run `yarn build`.
|
||||
|
||||
- Create a `config.yml` file from [config.example.yml](./config.example.yml) file.
|
||||
* Create a `config.yml` file from [config.example.yml](./config.example.yml) file.
|
||||
|
||||
- Add CLI cmd to path
|
||||
* Add CLI cmd to path
|
||||
|
||||
```bash
|
||||
export PATH="$PWD/bin:$PATH"
|
||||
@ -42,7 +42,7 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry-
|
||||
|
||||
Run the chain:
|
||||
|
||||
- In laconicd repo run:
|
||||
* In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_AUCTION_ENABLED=true ./scripts/init.sh clean
|
||||
@ -66,24 +66,24 @@ services:
|
||||
|
||||
## Gas and Fees
|
||||
|
||||
- Gas and fees in `cosmos-sdk`:
|
||||
- <https://docs.cosmos.network/v0.50/learn/beginner/gas-fees>
|
||||
- `gas` is a special unit that is used to track the consumption of resources during execution of a transaction
|
||||
- The maximum value a tx is allowed to consume can be capped by setting `gas` in the config
|
||||
- `fees` have to be paid by sender to allow the transaction into the mempool and is calculated using `gasPrice`:
|
||||
* Gas and fees in `cosmos-sdk`:
|
||||
* <https://docs.cosmos.network/v0.50/learn/beginner/gas-fees>
|
||||
* `gas` is a special unit that is used to track the consumption of resources during execution of a transaction
|
||||
* The maximum value a tx is allowed to consume can be capped by setting `gas` in the config
|
||||
* `fees` have to be paid by sender to allow the transaction into the mempool and is calculated using `gasPrice`:
|
||||
|
||||
```bash
|
||||
fees = gas * gasPrice
|
||||
```
|
||||
|
||||
- Typically, validators / full nodes set `min-gas-prices` to only allow txs providing minimum amount of fees
|
||||
- Using `cosmjs`, there are two ways max fees amount can be given for a tx:
|
||||
- Either by specifying `fees` and `gas` (in which case `fees` should be >= `gas` * `min-gas-price`)
|
||||
- Or by specifying a `gasPrice` (in which case `gasPrice` should be >= `min-gas-price` set by the node and fees is `auto` calculated by simulating the tx)
|
||||
* Typically, validators / full nodes set `min-gas-prices` to only allow txs providing minimum amount of fees
|
||||
* Using `cosmjs`, there are two ways max fees amount can be given for a tx:
|
||||
* Either by specifying `fees` and `gas` (in which case `fees` should be >= `gas` * `min-gas-price`)
|
||||
* Or by specifying a `gasPrice` (in which case `gasPrice` should be >= `min-gas-price` set by the node and fees is `auto` calculated by simulating the tx)
|
||||
|
||||
When using the `auto` fees calculation, the gas estimation by tx simulation is typically multiplied by a multiplier
|
||||
- As such, following `gas`, `fees` and `gasPrice` combinations can be used in `laconic-registry-cli`:
|
||||
- Gas set, fees set to `Xalnt`:
|
||||
* As such, following `gas`, `fees` and `gasPrice` combinations can be used in `laconic-registry-cli`:
|
||||
* Gas set, fees set to `Xalnt`:
|
||||
|
||||
```bash
|
||||
# Example
|
||||
@ -92,10 +92,10 @@ services:
|
||||
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`:
|
||||
* `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
|
||||
@ -104,11 +104,11 @@ services:
|
||||
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) 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`:
|
||||
* `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) 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
|
||||
@ -117,11 +117,11 @@ services:
|
||||
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:
|
||||
* `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
|
||||
@ -130,15 +130,15 @@ services:
|
||||
gasPrice:
|
||||
```
|
||||
|
||||
- `gas` config ignored
|
||||
- uses `auto` fee calculation using gas estimation
|
||||
- throws error:
|
||||
* `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 `gas`, `fees` and `gasPrice` can be set to some default values in the config as shown above, and can be overriden for each command using the `--gas`, `--fees` and `--gasPrice` arguments:
|
||||
* The `gas`, `fees` and `gasPrice` can be set to some default values in the config as shown above, and can be overriden for each command using the `--gas`, `--fees` and `--gasPrice` arguments:
|
||||
|
||||
```bash
|
||||
# Example:
|
||||
|
Loading…
Reference in New Issue
Block a user