-
Notifications
You must be signed in to change notification settings - Fork 37
[Feature]: CLI: fetch gas prices from the x/dynamicfee module #122
Description
When a transaction is broadcasted using the CLI, the fees must be set, by providing a value to the --fees or to the --gas-prices flag (the latter being multiplied by the gas limit to set the fees). The reason is because validators are free to define their gas-prices, so for the CLI it's not straighforward to fetch the expected gas-prices for a transaction.
But with the integration of the x/dynamicfee module, the validator gas prices setting becomes irrelevant; only the gas prices from the x/dynamicfee module counts.
This gives an opportunity for the CLI to easily fetch the current gas price just before the broadcast of the transaction, and to set the fees accordingly. This would work a bit like when the flag --gas auto is passed: if nor --fees or --gas-prices flag is passed, then the CLI fetches the dyamicfee gas prices and fills the --gas-prices flag with its value.
In term of code, since most of the CLI code is imported from the SDK, we cannot change it directly. One solution could be to attach a PreRun cobra command for all txs commands, where the behavior explained above takes place.