-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Clean up and document gas tiers #14772
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
Changes from all commits
18cabee
f518815
686f5cd
a973b4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,20 +287,23 @@ inline Instruction logInstruction(unsigned _number) | |
| return Instruction(unsigned(Instruction::LOG0) + _number); | ||
| } | ||
|
|
||
| /// Gas price tiers representing static cost of an instruction. | ||
| /// Opcodes whose cost is dynamic or depends on EVM version should use the `Special` tier and need | ||
| /// dedicated logic in GasMeter (especially in estimateMax()). | ||
| /// The tiers loosely follow opcode groups originally defined in the Yellow Paper. | ||
| enum class Tier | ||
| { | ||
| Zero = 0, // 0, Zero | ||
| Base, // 2, Quick | ||
| VeryLow, // 3, Fastest | ||
| Low, // 5, Fast | ||
| Mid, // 8, Mid | ||
| High, // 10, Slow | ||
| Ext, // 20, Ext | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure where Since all of this is unnecessarily confusing, I decided to rename this tier to |
||
| WarmAccess, // 100, Warm Access | ||
| ExtCode, // 700, Extcode | ||
| Balance, // 400, Balance | ||
|
Comment on lines
-300
to
-301
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm removing the |
||
| Special, // multiparam or otherwise special | ||
| Invalid // Invalid. | ||
| // NOTE: Tiers should be ordered by cost, since we sometimes perform comparisons between them. | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's also the only place other than
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, I didn't have time to dig into this, but I wonder if that logic in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe, when |
||
| Zero = 0, // 0, Zero | ||
| Base, // 2, Quick | ||
| VeryLow, // 3, Fastest | ||
| Low, // 5, Fast | ||
| Mid, // 8, Mid | ||
| High, // 10, Slow | ||
| BlockHash, // 20 | ||
| WarmAccess, // 100, Warm Access | ||
| Special, // multiparam or otherwise special | ||
| Invalid, // Invalid. | ||
| }; | ||
|
|
||
| /// Information structure for a particular instruction. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1480,15 +1480,8 @@ void CompilerStack::compileContract( | |
| solAssert(!m_viaIR, ""); | ||
| bytes cborEncodedMetadata = createCBORMetadata(compiledContract, /* _forIR */ false); | ||
|
|
||
| try | ||
| { | ||
| // Run optimiser and compile the contract. | ||
| compiler->compileContract(_contract, _otherCompilers, cborEncodedMetadata); | ||
| } | ||
| catch(evmasm::OptimizerException const&) | ||
| { | ||
| solAssert(false, "Optimizer exception during compilation"); | ||
| } | ||
| // Run optimiser and compile the contract. | ||
| compiler->compileContract(_contract, _otherCompilers, cborEncodedMetadata); | ||
|
Comment on lines
-1483
to
+1484
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran into this when I forgot to update |
||
|
|
||
| _otherCompilers[compiledContract.contract] = compiler; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Cancun spec is still in a branch: https://github.com/ethereum/execution-specs/blob/forks/cancun/src/ethereum/cancun/vm/gas.py.
Also, the links for earlier versions (e.g. gas docs for shanghai) are broken temporarily. There was a PR merged an hour ago and something must have gone wrong. Fortunately it can also be viewed in the repo. E.g. gas docs for shanghai on
master.