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
fees = gasPrice * gasConsumption
where gasPrice is a fixed price provided by the validators and gasConsumption is the total gas consumed by the transaction. Since the gasConsumption component is unknown before executing the transaction, the following strategy is used to determine the fees
Retrieve an estimated gasConsumption' value using cosmjs client simulate() function.
Calculate the final fees using cosmjscalculateFee(GAS_LIMIT, gasPrice) function, where GAS_LIMIT is gasConsumption' * LIMIT_MULTIPLIER, where LIMIT_MULTIPLIER is a pre-defined adjustment factor to allow some wiggle room as it is not rare that the gas estimation gasConsumption' is under-estimated.
The resulting behavior is that it will consume more tokens the bigger the deployment unless the gasPrice is set to 0.
E.g., deploying a 4.8MB compressed website resulting in a 23token fee, while deploying a 600kB compressed website results in a 1token fee.
The gas price and limit multiplier can be configured in the .env* files, e.g.,
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
gasPrice
is a fixed price provided by the validators andgasConsumption
is the total gas consumed by the transaction. Since thegasConsumption
component is unknown before executing the transaction, the following strategy is used to determine the feesgasConsumption'
value usingcosmjs
clientsimulate()
function.cosmjs
calculateFee(GAS_LIMIT, gasPrice)
function, whereGAS_LIMIT
isgasConsumption' * LIMIT_MULTIPLIER
, whereLIMIT_MULTIPLIER
is 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
gasPrice
is set to0
.E.g., deploying a
4.8MB
compressed website resulting in a23token
fee, while deploying a600kB
compressed website results in a1token
fee.The gas price and limit multiplier can be configured in the
.env*
files, e.g.,Relates #10 Relates https://github.com/liftedinit/ghostcloud-cosmos/pull/33