Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrary denominations for gas tokens #3970

Open
grarco opened this issue Nov 4, 2024 · 0 comments
Open

Arbitrary denominations for gas tokens #3970

grarco opened this issue Nov 4, 2024 · 0 comments

Comments

@grarco
Copy link
Contributor

grarco commented Nov 4, 2024

With #3956 we've updated the gas_scale parameter to allow for more flexibility when setting the minimum gas price for a given token. We might have the need for even more flexibility in the future but because of the fixed amount of decimal places for the tokens (6 for the native one, 0 for IBC tokens) and the need to keep the gas costs themselves at a minimum (~ 10k-1M gas units, to avoid squishing them too much), the current logic would not allow it.

If this scenario ever came up we should rework the way we define the gas used by transactions and the minimum costs:

  • The minimum gas prices should be DenominatedAmounts (even in storage, right now we convert them to Amounts) with an arbitrary denomination, so that we are not limited by the actual denomination of the specific token
  • At genesis we should avoid checking the validity of this denomination in the genesis file since it could be lower than the actual denomination of the token
  • When we fo the checks in protocol to validate the gas price declared by a transaction we should use DenominatedAmounts instead of Amounts
  • In the SDK we should account for this denomination when validating the gas cost of the tx
  • When computing the gas cost that the tx signer has to pay, we must multiply this denominated amount by the gas limit and ceil the result to the closer valid denomination for the gas token

Given that we might be able to remove the gas_scale param altogether.

Since we are already at it, we should avoid increasing the gas cost of non-wasm operations by removing the GAS_COST_CORRECTION constant:

const GAS_COST_CORRECTION: u64 = 5;

and we should instead reduce the gas cost of the single wasm opcodes by the same ratio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant