Record some weight in min_gas_price #2073
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.
What does it do?
Records some weight in
min_gas_price
. I chose to record a db read not so much because that's what it is actually doing but because that happens to be a reasonable amount of weight in this case. The storage item being read (TransactionPayment::next_fee_multiplier()
) is read and written in each block, so it's going to be a cached read, but this is a reasonable amount to charge anyway.It's important to know what this weight is actually used for. In most cases, it's not used for anything; it's only used when there is some unexpected error (not a revert, etc.) in the evm stack runner. Basically, it should never be relevant unless there is some bug that triggers it.
If/when this occurs, this weight will end up being recorded for the Substrate extrinsic, allowing the block to fill a bit rather than recording 0 weight and potentially allowing for an unbounded block.
A db read is
25usec
, which works out to a limit of15_000
of these transactions maximum per block.