Add FastLZ compression into L1CostFunc#8635
Add FastLZ compression into L1CostFunc#8635mdehoog wants to merge 7 commits intoethereum-optimism:developfrom
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #8635 +/- ##
===========================================
+ Coverage 34.57% 34.62% +0.05%
===========================================
Files 167 168 +1
Lines 7162 7159 -3
Branches 1212 1211 -1
===========================================
+ Hits 2476 2479 +3
+ Misses 4537 4529 -8
- Partials 149 151 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
I would like this contract to be backwards compatible with branching logic based on an |
| /// gas over actually compressing the data, given we only need the length. | ||
| /// @dev Returns the length of the compressed data. | ||
| /// @custom:attribution Solady <https://github.com/Vectorized/solady> | ||
| function flzCompressLen(bytes memory data) internal pure returns (uint256 n) { |
There was a problem hiding this comment.
Can you put this in a library inside of src/libraries? Maybe Compression.sol or something like that. Then we need to differentially test against the Go version. It would be easier to do so by having the Go code in the monorepo
There was a problem hiding this comment.
@tynes Sure, i'll move it to a separate file in libraries.
I don't think op-geth has any dependencies on the monorepo yet, to avoid circular deps; but we can differentially test it by pulling in the op-geth commit here.
| ) | ||
|
|
||
| replace github.com/ethereum/go-ethereum v1.13.5 => github.com/ethereum-optimism/op-geth v1.101304.2-0.20231130012434-cd5316814d08 | ||
| replace github.com/ethereum/go-ethereum v1.13.5 => github.com/mdehoog/op-geth v0.0.0-20231216052905-14963121633c |
There was a problem hiding this comment.
ethereum-optimism/op-geth#202 will need to be merged first
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
I would like to close this PR as we have agreed that this functionality will not go into ecotone to not feature bloat it but could be considered for the following hardfork |
Description
We found that the FastLZ algorithm is a pretty good estimate for the actual results we'd see from zlib compressing the batches we write to L1 (albeit with a different
scalaras the compression ratios aren't quite as good). See https://github.com/roberto-bayardo/compression-analysis and this sheet.This PR introduces a
flzCompresscall into theGasPriceOracle. Companion op-geth PR is here: ethereum-optimism/op-geth#202Tests
TODO
Additional context
The current naive L1Cost approach:
works pretty well on average, but penalizes very compressible txs (e.g.), and undercharges incompressible txs (e.g.). This change makes the
L1CostFuncmuch fairer compared to real-world L1 costs.