Skip to content
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

Fjord: Add FastLZ compression into L1CostFunc #249

Merged
merged 13 commits into from
May 15, 2024

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Feb 21, 2024

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 scalar as the compression ratios aren't quite as good). See https://github.com/roberto-bayardo/compression-analysis and this sheet.

This PR introduces a flzCompress call into the DataGas part of the L1CostFunc. Companion optimism PR is here: ethereum-optimism/optimism#9618

Tests

TODO

Additional context

The current naive L1Cost approach:

l1fee = ((0s in calldata) * 4 + (1s in calldata) * 16 + 188) * l1BaseFee * 0.684

works pretty well on average, but penalizes very compressible txs (e.g.), and undercharges incompressible txs (e.g.). This change makes the L1CostFunc much fairer compared to real-world L1 costs.

@sebastianst sebastianst changed the title [Fjord] Add FastLZ compression into L1CostFunc Fjord: Add FastLZ compression into L1CostFunc Apr 9, 2024
Copy link
Member

@sebastianst sebastianst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@sebastianst sebastianst marked this pull request as ready for review May 13, 2024 21:15
@sebastianst sebastianst requested a review from a team as a code owner May 13, 2024 21:15
@sebastianst sebastianst requested review from ajsutton and protolambda and removed request for a team May 13, 2024 21:15
Copy link
Collaborator

@protolambda protolambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. FlzCompressLen is difficult to review in isolation, but the tests in the monorepo for it look good. Still looking into the differences with Brotli.

@danyalprout danyalprout force-pushed the flz-l1-cost-func branch 2 times, most recently from c8002af to ae09e9f Compare May 15, 2024 17:05
@sebastianst sebastianst merged commit 285e183 into ethereum-optimism:optimism May 15, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants