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.
Fixes #342
Adds a new consensus constant,
GAS_PRICE_FACTOR
(suggested to be set to 1 billion), that allows gas price to be provided with a precision of1/GAS_PRICE_FACTOR
of the base asset's unit.Gas used is rounded up to the nearest unit, and gas refunded in rounded down. Note gas and byte costs are accounted for separately. Therefore, the minimum non-zero used balance is 2 coins: one for gas and one for bytes.
E.g. if the base asset is ETH at 9 decimals, then its units are gwei. This change allows gas prices to be specified in wei. If a tx costs less than 1 gwei of
gas price * gas limit / GAS_PRICE_FACTOR
, then it rounds up to costing 1 gwei.Some considerations around parameter choice: a script that uses 10M gas can have a gas price of ~100B before you have to start worrying about overflow. Assuming ETH as the base asset:
I'm inclined towards a factor of 1M from the above, but would like to hear what @Voxelot @vlopes11 and @rakita think.
Implementation: