fix(l2): remove empty account diffs from payload builder's blob size estimation #4042
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
get_account_diffs_in_tx()
to retrieve empty account diffsCloses #issue_number