-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[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
Merged
Merged
Changes from all commits
Commits
Show all changes
100 commits
Select commit
Hold shift + click to select a range
c49a1ee
Remove stale TODOs
athei 2c69ffd
Rename gas metering to weight metering
TorstenStueber faa5866
Implement general resource metering
TorstenStueber 43e1bd1
Resolve rebase conflicts
TorstenStueber ef060f5
Fix conflicts and existing tests
TorstenStueber 6a8afd8
Use max storage deposit for dry runs
TorstenStueber a96a66f
Use SignedGas instead of StorageDeposit
TorstenStueber 11b57ce
Add doc comments
TorstenStueber 548a143
Use correct gas handling in tracer
TorstenStueber bdeddd5
Merge master
TorstenStueber 947a492
Add tweaks for dry running
TorstenStueber 7454d91
Merge latest changes from master
TorstenStueber 66cfae5
Add call stipends for *CALL instructions
TorstenStueber d8b2d89
Merge latest changes from master
TorstenStueber 3115020
Fix errors in other crates
TorstenStueber 695357c
Fix errors in other crates (2)
TorstenStueber 3ee4ed5
Fix errors in other crates (3)
TorstenStueber 9117c8c
Fix errors in other crates (4)
TorstenStueber cd7cbf2
Fix calculation of max storage deposit
TorstenStueber 2a308bc
Merge branch 'master' into torsten/gas-fixes
pgherveou e5a3668
Add tests
TorstenStueber a20f8ed
Fix weight tracing (issue 8362)
TorstenStueber 3fff1a5
Fix max deposit calculation
TorstenStueber 0d2b69f
Merge branch 'torsten/gas-fixes' of github.com:paritytech/polkadot-sd…
TorstenStueber 1c928c9
Add test for max deposits
TorstenStueber e644aff
Merge branch 'master' into torsten/gas-fixes
TorstenStueber 14947c1
Fix issue with dry running length encoding
TorstenStueber ed242f0
Merge branch 'master' into torsten/gas-fixes
TorstenStueber 74135f8
Set max block gas to u64::MAX
TorstenStueber 631f6d5
Lower the concurrency of the DT framework
0xOmarA c7eefbd
Update the concurrency value of the DT framework.
0xOmarA 57b1c13
Merge branch 'master' into torsten/gas-fixes
pgherveou 2f5077e
fix BENCH_INIT_CODE
pgherveou 2f6624a
master merge fix
pgherveou 37e46f9
Add tracing logs
TorstenStueber 7fd98e6
Clean up create call arguments
TorstenStueber dd3ca1e
Merge branch 'torsten/gas-fixes' of github.com:paritytech/polkadot-sd…
TorstenStueber c604122
Add optimizations and correct numerical calculations
TorstenStueber 4466f09
Merge branch 'master' into torsten/gas-fixes
TorstenStueber 8bbb05a
Fix code in other crates
TorstenStueber 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 e722626
Set standard differential test concurrency
TorstenStueber 43f54eb
Improve code consistency
TorstenStueber 338f0ee
Clean up code structure
TorstenStueber 7268c14
Merge changes from torsten/gas-fixes
TorstenStueber e6fcef8
Fix doc comment
TorstenStueber 21e7687
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 4f1419a
Lower differential testing concurrency
TorstenStueber cc32190
Make tests less brittle
TorstenStueber 539a9e9
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 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 5a0919b
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] 0f55b11
Implement PR feedback
TorstenStueber 8e609dc
Merge branch 'torsten/gas-fixes' of github.com:paritytech/polkadot-sd…
TorstenStueber cab85be
Merge master
TorstenStueber aacd84f
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 116ba4f
Implement review feedback
TorstenStueber 2dba778
Simplify return type of try_upload_code
TorstenStueber 2c1acdf
Make some members crate public
TorstenStueber aa31d6e
simplify test
pgherveou 7b3ae17
Merge changes from master (PR 10302, PR 10309)
TorstenStueber c8ced0e
Deprecate gas_meter API
TorstenStueber c40e273
Simplify deposit refund tests
TorstenStueber 6d7c398
Merge remote-tracking branch 'origin/pg/gas-fix-comment' into torsten…
TorstenStueber 7edd38f
Remove dead code
TorstenStueber 6186657
Merge branch 'master' into torsten/gas-fixes
TorstenStueber cda93cc
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 9a412ae
Format
TorstenStueber 56c8a3c
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber 93bf186
Fix compiler errors
TorstenStueber 7362fa1
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber bc26308
Fix benchmark code
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 8a626e7
Merge branch 'master' into torsten/gas-fixes
TorstenStueber 72fde93
Implement PR feedback
TorstenStueber ac9155b
Merge branch 'master' into torsten/gas-fixes
TorstenStueber 63862fd
Merge torsten/gas-fixes
TorstenStueber 2d7b95f
Raise endowment of dev node
TorstenStueber 3d8eec1
Lower GasScale of dev node
TorstenStueber f872bac
Implement code review feedback
TorstenStueber 4a591e0
Address clippy complaints
TorstenStueber 314fe4b
Merge branch 'master' into torsten/gas-fixes
TorstenStueber c27a97e
Add missing licenses
TorstenStueber 6c42907
Merge branch 'torsten/gas-fixes' into torsten/scale-eth-gas
TorstenStueber cef5cbb
Merge master
TorstenStueber 922eb7a
Change GasScale to u32
TorstenStueber 70b4010
Merge branch 'master' into torsten/scale-eth-gas
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
| 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: major | ||
| - 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.
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.
Why is this necessary? The scale shouldn't change the price apart from rounding.
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.
It's just because the evm test suite has one test with a very high hard coded gas limit and the endowment was not sufficient anymore to execute that transaction.
We can also change the hard coded limit in the test suite but I was lazy and just changed it here.