feat: flexible pricing #25
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR adds support for a flexible pricing scheme based on a fixed gas price provided by the validators. The total fees are calculated following
where
gasPriceis a fixed price provided by the validators andgasConsumptionis the total gas consumed by the transaction. Since thegasConsumptioncomponent is unknown before executing the transaction, the following strategy is used to determine the feesgasConsumption'value usingcosmjsclientsimulate()function.cosmjscalculateFee(GAS_LIMIT, gasPrice)function, whereGAS_LIMITisgasConsumption' * LIMIT_MULTIPLIER, whereLIMIT_MULTIPLIERis a pre-defined adjustment factor to allow some wiggle room as it is not rare that the gas estimationgasConsumption'is under-estimated.The resulting behavior is that it will consume more tokens the bigger the deployment unless the
gasPriceis set to0.E.g., deploying a
4.8MBcompressed website resulting in a23tokenfee, while deploying a600kBcompressed website results in a1tokenfee.The gas price and limit multiplier can be configured in the
.env*files, e.g.,Relates #10
Relates liftedinit/ghostcloud#33