-
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
base: torsten/gas-fixes
Are you sure you want to change the base?
Conversation
|
/cmd prdoc --audience runtime_dev --bump patch |
…time_dev --bump patch'
…t-sdk into torsten/scale-eth-gas
Differential Tests Results (PolkaVM)Specified Tests
Counts
FailuresThe test specifiers seen in this section have the format 'path::case_idx::compilation_mode' and they're compatible with the revive differential tests framework and can be specified to it directly in the same way that they're provided through the The failures are provided in an expandable section to ensure that the PR does not get polluted with information. Please click on the section below for more information Detailed Differential Tests Failure Information
|
Differential Tests Results (REVM)Specified Tests
Counts
FailuresThe test specifiers seen in this section have the format 'path::case_idx::compilation_mode' and they're compatible with the revive differential tests framework and can be specified to it directly in the same way that they're provided through the The failures are provided in an expandable section to ensure that the PR does not get polluted with information. Please click on the section below for more information Detailed Differential Tests Failure Information
|
.github/workflows/tests-evm.yml
Outdated
| with: | ||
| repository: paritytech/revive-differential-tests | ||
| ref: a6e4932a08b1ca231e4a02ca6e54e08a53f0e786 | ||
| ref: b145f45cd3114fd378ce3d5031b127fb39cf9cbd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to change this to a commit on master once paritytech/revive-differential-tests#213 has been merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated, I updates this now.
|
/cmd prdoc --audience runtime_dev --bump patch |
|
Command "prdoc --audience runtime_dev --bump patch" has failed ❌! See logs here |
|
/cmd prdoc --audience runtime_dev --bump patch --force |
…time_dev --bump patch --force'
…t-sdk into torsten/scale-eth-gas
pgherveou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good the downside is that we end up burning more, when we adjust the gas so that gas_used * gas_price = fee.
We should probably mention that in the doc of type GasScale
I added this to the doc comment. |
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
This PR is based on #10166 (i.e., it merges into the branch
torsten/gas-fixes).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
GasScalehas two effects:GasScaleGasScale.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.The actual logical changes are almost trivial and I use
GasScaleat only three places: inevm_base_feeto scale the gas price and in the functionsfrom_ethereum_gasandto_ethereum_gas.Recommended
This PR sets
GasScalefor 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 is2_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 thisequated to 2_320_000_000 gas units. In EVM this operation requires 22_100 gas only.
Thus,
GasScalewould need to be about 100_000 in order forSSTOREto have similar worst case gas requirements.Resolved Issues
This PR addresses paritytech/contract-issues#18 but we also need to find an appropriate
GasScalefor a mainnet installment of pallet-revive (see this comment).