-
Notifications
You must be signed in to change notification settings - Fork 699
Add test for batch resizing via ErrMessageTooLarge #4183
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
base: master
Are you sure you want to change the base?
Conversation
This test validates the dynamic batch sizing behavior introduced in commit 05ac6df, which allows DA providers to signal that a message is too large without triggering a fallback to the next writer. When a DA provider returns ErrMessageTooLarge, the batch poster should: 1. Re-query GetMaxMessageSize() to learn the new size limit 2. Rebuild a smaller batch that fits within the limit 3. Post to the SAME DA provider (not fall back to calldata) The test has two phases: - Phase 1: Posts ~10KB batches with initial max size of 10KB - Phase 2: Reduces max size to 5KB mid-stream, verifying that subsequent batches are rebuilt smaller rather than falling back
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4183 +/- ##
===========================================
+ Coverage 33.01% 57.15% +24.14%
===========================================
Files 459 459
Lines 55830 55830
===========================================
+ Hits 18430 31911 +13481
+ Misses 34185 19108 -15077
- Partials 3215 4811 +1596 |
❌ 6 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
pmikolajczyk41
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I understand correctly: when the DA writer returns ErrMessageTooLarge, we shouldn't fallback, even if other DA systems (calldata, anytrust) are available - we should just rebuild batches for lower limit; therefore, I think we actually should enable batch poster falling back to e.g. calldata, and ensure that it didn't do so
| // Verify follower synced | ||
| _, err = l2B.Client.BlockNumber(ctx) | ||
| Require(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q1: how does this ensure that the second node actually synced?
Q2: why don't we have a similar check in the 2nd phase?
| // Create L1 blocks to trigger batch posting | ||
| for i := 0; i < 30; i++ { | ||
| SendWaitTestTransactions(t, ctx, builder.L1.Client, []*types.Transaction{ | ||
| builder.L1Info.PrepareTx("Faucet", "User", 30000, big.NewInt(1e12), nil), | ||
| }) | ||
| } | ||
|
|
||
| // Wait for batch to post | ||
| time.Sleep(time.Second * 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment 1: we can use AdvanceL1 utility instead of a loop here
Comment 2 (covering also the follower node syncing): could we reuse checkBatchPosting method here? I think it would be beneficial for us to have the batch posting check as standardized as possible. If I'm not mistaken, currently checkBatchPosting relies on MaxDelay=0, but maybe we can force posting with builder.L2.ConsensusNode.BatchPoster.MaybePostSequencerBatch(ctx) and some other config flag?
| if payloadSize > 6_000 { | ||
| t.Errorf("Phase 2: CustomDA payload size %d exceeds expected max ~5KB", payloadSize) | ||
| } | ||
| } else if daprovider.IsBrotliMessageHeaderByte(headerByte) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have just else here and fail in case there's a batch that is not AltDA; here and in the first phase loop
This test validates the dynamic batch sizing behavior introduced in commit 05ac6df, which allows DA providers to signal that a message is too large without triggering a fallback to the next writer.
When a DA provider returns ErrMessageTooLarge, the batch poster should:
The test has two phases:
fixes NIT-4158