-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Revive] Add configuration to set Ethereum gas scale #10393
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
Open
TorstenStueber
wants to merge
23
commits into
torsten/gas-fixes
Choose a base branch
from
torsten/scale-eth-gas
base: torsten/gas-fixes
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+124
−40
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8f07b75
Add configuration to set Ethereum gas scale
TorstenStueber 5e98c43
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 2b823cc
Add GasScale config to other chains
TorstenStueber b3c9192
Merge branch 'torsten/scale-eth-gas' of github.com:paritytech/polkado…
TorstenStueber 15b8c76
Address clippy complaints
TorstenStueber cb29390
Increase endowments on dev-node
TorstenStueber aec7970
Increase the GasScale on the dev node
TorstenStueber bd87e40
Increase endowments on dev-node again
TorstenStueber 338f0ee
Clean up code structure
TorstenStueber 7268c14
Merge changes from torsten/gas-fixes
TorstenStueber 21e7687
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber f3a9a3e
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 8388ab1
Update commit of differential testing CI
TorstenStueber 2a8a6c6
Merge branch 'torsten/scale-eth-gas' of github.com:paritytech/polkado…
TorstenStueber aacd84f
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber cda93cc
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 56c8a3c
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 7362fa1
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber aadd6fe
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 6c80641
Add doc comment and integrity check
TorstenStueber ec0b8fb
Fix typo
TorstenStueber 54a9c43
Fix cargo check error
TorstenStueber 94f1a05
Increase gas scale further on dev node
TorstenStueber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| title: Add configuration to set Ethereum gas scale | ||
| doc: | ||
| - audience: Runtime Dev | ||
| description: |- | ||
| This PR adds a new configuration parameter (`GasScale`) to pallet-revive that allows to change the scale of the Ethereum gas and of the Ethereum gas price. | ||
|
|
||
| Before this PR, the Ethereum gas price is simply the next fee multiplier of pallet-transaction-payment multiplied by `NativeToEthRatio`. Thus, on Polkadot this is 100_000_000 when the multiplier has its default value of 1. | ||
|
|
||
| The required gas of a transaction is its total cost divided by the gas price, where the total cost is the sum of the transaction fee and the storage deposit. | ||
|
|
||
| This leads to a situation where the required gas for a transaction on revive is usually orders of magnitude larger than the required amount of gas on Ethereum. This can lead to issues with tools or systems that interact with revive and hard code expected gas amounts or upper limits of gas amounts. | ||
|
|
||
| Setting `GasScale` has two effects: | ||
| - revive's Ethereum gas price is scaled up by the factor `GasScale` | ||
| - resulting used/estimated gas amounts get scaled down by the factor `GasScale`. | ||
|
|
||
| ## Technical Details | ||
| Internally, revive uses exactly the same gas price and gas units as before. Only at the interface these amounts and prices get scaled by `GasScale`. | ||
|
|
||
| ## Recommended | ||
| This PR sets `GasScale` for the dev-node to 50_000. | ||
|
|
||
| This is motivated by the fact that storing a value in a contract storage slot costs `DepositPerChildTrieItem + DepositPerByte * 32`, which is `2_000_000_000 + 10_000_000 * 32` (= `2_320_000_000`) plancks. Before this change the gas price was 1_000_000 wei, so that this | ||
| equated to 2_320_000_000 gas units. In EVM this operation requires 22_100 gas only. | ||
|
|
||
| Thus, `GasScale` would need to be about 100_000 in order for `SSTORE` to have similar worst case gas requirements. | ||
|
|
||
| ## Resolved Issues | ||
|
|
||
| This PR addresses https://github.com/paritytech/contract-issues/issues/18 but we also need to find an appropriate `GasScale` for a mainnet installment of pallet-revive. | ||
| crates: | ||
| - name: revive-dev-runtime | ||
| bump: patch | ||
| - name: pallet-revive | ||
| bump: patch | ||
| - name: asset-hub-westend-runtime | ||
| bump: patch | ||
| - name: penpal-runtime | ||
| bump: patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.