feat: eip 1159 like pricing for deposits charged on L1#438
feat: eip 1159 like pricing for deposits charged on L1#438
Conversation
Codecov Report
@@ Coverage Diff @@
## main #438 +/- ##
==========================================
- Coverage 51.86% 51.68% -0.19%
==========================================
Files 63 133 +70
Lines 6696 14278 +7582
==========================================
+ Hits 3473 7379 +3906
- Misses 2784 5937 +3153
- Partials 439 962 +523
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
|
||
| storage1 = SlotPacking128x64x64.set(prevBaseFee, prevNum, prevBoughtGas); | ||
|
|
||
| storage2 = SlotPacking128x128.set(gasTargetLimit, gasSanityLimit); |
There was a problem hiding this comment.
The gasTargetLimit and gasSanityLimit were technically defined as uint64s in the spec, I made them into uint128s out of convenience. If the must be uint64s then I will update this code
| slot := or(slot, shl(64, b)) | ||
| slot := or(slot, c) | ||
| } | ||
| return slot; |
There was a problem hiding this comment.
can delete this return
| } | ||
| } | ||
|
|
||
| // TODO: rename variables + update spec with renamed variables |
There was a problem hiding this comment.
Clamp the basefee to 0 if subtraction would underflow, it needs to not underflow and cause a revert. Use saturating math
| if (baseFeePerGasDelta == 0) { | ||
| baseFeePerGasDelta = 1; | ||
| } | ||
| nowBaseFee = prevBaseFee - baseFeePerGasDelta; |
There was a problem hiding this comment.
This needs to be a + and not a -
| uint128 baseFeePerGasDelta = (prevBaseFee * gasUsedDelta) / | ||
| gasTarget / | ||
| BASE_FEE_MAX_CHANGE_DENOMINATOR; | ||
| if (baseFeePerGasDelta == 0) { |
There was a problem hiding this comment.
TODO: office hours on whether or not we want this in the spec
| uint128 nowBaseFee = prevBaseFee; | ||
| uint64 nowBoughtGas = prevBoughtGas + requestedGas; | ||
| uint64 nowNum = uint64(block.number); | ||
|
|
There was a problem hiding this comment.
TODO: add comments explaining that dividing by 0 is impossible
|
Simple way: |
|
Closing in favor of ethereum-optimism/optimism#2575 |
Description
Meter deposits on L1, WIP
Implements #401
Replaces:
Metadata
Fixes: ENG-2187