Skip to content

Conversation

@Thegaram
Copy link

@Thegaram Thegaram commented Nov 5, 2025

This PR bumps revm to include the updated Galileo rollup fee (scroll-tech/scroll-revm#65), and adds logic to compute compressed_size(rlp(tx)) used in the formula.

The main changes are:

  • In crates/scroll/alloy/evm/src/tx/compression.rs, introduce the function compute_compressed_size in addition to the existing compute_compression_ratio. These both use zstd.
  • Functions taking a compression_ratio argument now take an additional compressed_size argument.
  • Related traits (WithCompressionRatio, FromTxWithCompressionRatio) are renamed to *CompressionInfo.

Important notes:

  • In Feynman, compression_ratio is computed on the transaction payload only. On the other hand, Galileo's compressed_size is computed on the full rlp-encoded transaction.
  • Because of the previous point, we cannot combine the two compression operations, and so we run zstd 2x for each transaction. I opened an issue for a optimizing this in the future.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 5, 2025

CodSpeed Performance Report

Merging #355 will not alter performance

Comparing feat-galileo-rollup-fee (7150467) with scroll (414c692)

Summary

✅ 77 untouched

frisitano
frisitano previously approved these changes Nov 5, 2025
Copy link

@roynalnaruto roynalnaruto left a comment

Choose a reason for hiding this comment

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

Correctness wise I don't really see an issue.

I just want to mention however that based on the current approach, we call compute_compression_ratio and compute_compressed_size for each transaction. Do note that compute_compression_ratio itself also calls compute_compressed_size to compute the ratio.

Effectively, compute_compressed_size is being called twice per transaction, meaning that the zstd-encoding is being performed twice per transaction. As such this is not desirable.

Since the inputs to both calls are different -- tx.input vs rlp-encoded tx, I suppose this is unavoidable, right?

@Thegaram
Copy link
Author

Thegaram commented Nov 5, 2025

Since the inputs to both calls are different -- tx.input vs rlp-encoded tx, I suppose this is unavoidable, right?

Yes, that was my conclusion.

Though in practice, we only need compression_ratio for Feynman, and we only need compressed_size for Galileo, i.e. we never need both.

There are some code paths where deciding which fork is active for a transaction is not straightforward (txpool, rpc), so after discussion with @frisitano, I suggest that we merge the current version and keep this as a future optimization. This "double compression" has no impact on proving performance, and can be optimized in reth later without a hard fork.

@Thegaram Thegaram merged commit 12160d7 into scroll Nov 5, 2025
45 of 46 checks passed
@Thegaram Thegaram deleted the feat-galileo-rollup-fee branch November 5, 2025 15:37
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.

4 participants