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

Record some weight in min_gas_price #2073

Merged
merged 4 commits into from Feb 6, 2023
Merged

Conversation

notlesh
Copy link
Contributor

@notlesh notlesh commented Feb 3, 2023

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 of 15_000 of these transactions maximum per block.

@notlesh notlesh requested a review from tgmichel February 3, 2023 17:22
@notlesh notlesh added A0-pleasereview Pull request needs code review. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes labels Feb 3, 2023
@notlesh notlesh merged commit 6780d94 into master Feb 6, 2023
@notlesh notlesh deleted the notlesh-gas-price-weight branch February 6, 2023 17:30
imstar15 pushed a commit to OAK-Foundation/moonbeam that referenced this pull request May 16, 2023
* Record a db read in min_gas_price

* Remove empty line

* Reflect added weight in test case

* fmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview Pull request needs code review. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants