-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Implement EIP-2200: Structured Definitions for Net Gas Metering in LegacyVM #5709
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5709 +/- ##
=========================================
Coverage ? 63.76%
=========================================
Files ? 358
Lines ? 30556
Branches ? 3405
=========================================
Hits ? 19483
Misses ? 9844
Partials ? 1229 |
2e8eeca
to
34dd540
Compare
Rebased. |
You're getting an internal compiler error on the gcc config for some reason:
|
Not enough memory. Try to lower the number of parallel builds. |
@chfast @halfalicious lowered |
libethcore/EVMSchedule.h
Outdated
@@ -156,6 +158,9 @@ static const EVMSchedule IstanbulSchedule = [] { | |||
schedule.extcodehashGas = 700; | |||
schedule.haveChainID = true; | |||
schedule.haveSelfbalance = true; | |||
schedule.eip1283Mode = true; |
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.
Do we still need this var? eip1283 was rejected from Istanbul in favor of eip2200: https://eips.ethereum.org/EIPS/eip-1679
Can we control both the sstore and sload net gas metering via eip2200Mode?
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.
Well it's basically the same rules...
(These two EIPs differ only in some price constants and in additional "throw below 2300 gas" rule)
But yeah, I think it would make sense to have eip1283Mode = true
only in Constantinople, and then I'll change sstoreNetGasMetering()
to return true
for both eip1283Mode
and eip2200Mode
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.
changed
@@ -97,10 +97,13 @@ void LegacyVM::adjustStack(unsigned _removed, unsigned _added) | |||
|
|||
void LegacyVM::updateSSGas() | |||
{ | |||
if (m_schedule->sstoreThrowsIfGasBelowCallStipend() && m_io_gas <= m_schedule->callStipend) |
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 do we only throw OOG if EIP2200 is enabled, I'd expect us to always throw OOG if we don't have enough gas to cover the call stipend?
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.
This rule is introduced only in EIP-2200.
(without it we normally throw in case of OOG from the updateIOGas
call here
Line 1678 in 0faec9d
updateIOGas(); |
988c8cf
to
0c4aaaf
Compare
Also express gas cost calculations of SSTORE setting to original value closer to how EIP specifies them.
Rework SSTORE unit tests to make them more table-driven.
Rebased. |
ethereum/EIPs#2200
I refactored SSTORE pricing unit tests a bit, to make them more table-driven.