Skip to content

fix(l2): remove empty account diffs from payload builder's blob size estimation #4042

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

xqft
Copy link
Contributor

@xqft xqft commented Aug 13, 2025

Motivation

The payload builder estimates the state diff encoded size before adding another transaction to the block to make sure that we can fit it in a blob, and a batch can be committed with that single block.

When I executed load tests on the L2 the batch size metric reported 0, so I initially suspected that the estimation was wrong (smaller than the real state diff size) and I investigated the implementation but found that the batch size metric was wrong instead, and the estimation was correct*.

*Nevertheless I found that sometimes get_account_diffs_in_tx() returns empty account diffs (I think because of accounts in the callframe's original state that didn't participate in that transaction) and they get accounted when estimating the state diff size, making the estimation larger than the true value.

Description

  • prevent get_account_diffs_in_tx() to retrieve empty account diffs
  • add an internal error in the case that the sequencer can't make a single block batch because of blob size, instead of getting stuck silently.

Closes #issue_number

@xqft xqft requested a review from a team as a code owner August 13, 2025 19:00
@github-actions github-actions bot added the L2 Rollup client label Aug 13, 2025
Copy link

github-actions bot commented Aug 13, 2025

Lines of code report

Total lines added: 7
Total lines removed: 0
Total lines changed: 7

Detailed view
+--------------------------------------------------------------+-------+------+
| File                                                         | Lines | Diff |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer/payload_builder.rs | 344   | +2   |
+--------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs                   | 539   | +5   |
+--------------------------------------------------------------+-------+------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Rollup client
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant