-
Notifications
You must be signed in to change notification settings - Fork 268
feat: implement batch size validation and automatic splitting for DA #2506
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
4abeec2
feat: implement batch size validation and automatic splitting for DA …
randygrok e383efb
feat: add blob size validation and end-to-end test for DA layer restart
randygrok e14a743
feat: implement recursive batch splitting for DA submissions
randygrok 063c858
refactor to simplify code for retry
randygrok 398e911
Merge branch 'main' into feat/fix-node-restart
randygrok cd18407
add changes from pr
randygrok e0806f5
add exponential backoff fully into retryStrategy
randygrok 2d18d0e
clean exponential backoff flow
randygrok 3aaed4d
clean a little more
randygrok e64dba7
move methods for better readability
randygrok cce5308
refactor submission handling to improve context management and error …
randygrok 21a2880
refactor recursive to really use recursive
randygrok adff059
cleanup the recursive func
randygrok 3cc3334
remove logging into client
randygrok 7703555
add maxAttempts as a da config
randygrok d12b0e5
check all txs
randygrok 1ce35f2
Merge branch 'main' into feat/fix-node-restart
randygrok ac17de1
fix integrations tests
randygrok dc29c63
increase timeout
randygrok 672a8a7
Merge branch 'main' into feat/fix-node-restart
randygrok e6299cd
Merge remote-tracking branch 'origin/main' into feat/fix-node-restart
randygrok b1f5457
use tastora v0.1.0
randygrok 6806e00
use version 0.2.0 of tastora
randygrok b379974
make SubmissionOutcome, SubmissionBatch, BatchResult private
randygrok 6012782
refactor: reorder parameters in handleSubmissionResult function
randygrok 8f43c2e
fix: handle errors in batch submission and recursive splitting
randygrok d02ff04
add unit tests for the submit half batch
randygrok 12cbedf
refactor: rename BatchAction to batchAction
randygrok b8a0bcd
Merge remote-tracking branch 'origin/main' into feat/fix-node-restart
randygrok 20bc4af
docs: update block manager documentation with MaxSubmitAttempts and M…
randygrok 10ac5a2
fix: update README.md formatting for deploy badge
randygrok c1b860f
fix mod tidy
randygrok b9fc88d
Merge branch 'main' into feat/fix-node-restart
randygrok 24fe0f0
Merge remote-tracking branch 'origin/main' into feat/fix-node-restart
randygrok fb369a7
Merge branch 'feat/fix-node-restart' of github.com-randy:evstack/ev-n…
randygrok 0f87ffc
fix md links
randygrok 2457ed7
Update tastora.
randygrok ef24e94
tidy all
randygrok bee0f2b
fix: update test-e2e command to use relative paths for binaries
randygrok d155f4e
try to fix ports issues
randygrok b12cdc5
Merge branch 'main' into feat/fix-node-restart
randygrok 864385d
Merge remote-tracking branch 'origin/main' into feat/fix-node-restart
jgimeno 992a9d6
fix: add namespace parameter to submission functions
randygrok 9b950cc
fix: correct formatting of namespace fields in config and defaults
randygrok 190df5b
Merge branch 'main' into feat/fix-node-restart
randygrok ce2b81e
Merge branch 'main' into feat/fix-node-restart
randygrok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,5 @@ build | |
| .DS_Store | ||
| coverage.out | ||
| execution/evm/jwttoken | ||
| target | ||
| target | ||
| /.claude/settings.local.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| package jsonrpc | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| logging "github.com/ipfs/go-log/v2" | ||
| "github.com/stretchr/testify/assert" | ||
|
|
||
| "github.com/evstack/ev-node/core/da" | ||
| ) | ||
|
|
||
| // TestSubmitWithOptions_SizeValidation tests the corrected behavior of SubmitWithOptions | ||
| // where it validates the entire batch before submission and returns ErrBlobSizeOverLimit | ||
| // if the batch is too large, instead of silently dropping blobs. | ||
| func TestSubmitWithOptions_SizeValidation(t *testing.T) { | ||
| logger := logging.Logger("test") | ||
|
|
||
| testCases := []struct { | ||
| name string | ||
| maxBlobSize uint64 | ||
| inputBlobs []da.Blob | ||
| expectError bool | ||
| expectedError error | ||
| description string | ||
| }{ | ||
| { | ||
| name: "Empty input", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{}, | ||
| expectError: false, | ||
| description: "Empty input should return empty result without error", | ||
| }, | ||
| { | ||
| name: "Single blob within limit", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 500)}, | ||
| expectError: false, | ||
| description: "Single blob smaller than limit should succeed", | ||
| }, | ||
| { | ||
| name: "Single blob exceeds limit", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 1500)}, | ||
| expectError: true, | ||
| expectedError: da.ErrBlobSizeOverLimit, | ||
| description: "Single blob larger than limit should fail", | ||
| }, | ||
| { | ||
| name: "Multiple blobs within limit", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 300), make([]byte, 400), make([]byte, 200)}, | ||
| expectError: false, | ||
| description: "Multiple blobs totaling less than limit should succeed", | ||
| }, | ||
| { | ||
| name: "Multiple blobs exceed total limit", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 400), make([]byte, 400), make([]byte, 400)}, | ||
| expectError: true, | ||
| expectedError: da.ErrBlobSizeOverLimit, | ||
| description: "Multiple blobs totaling more than limit should fail completely", | ||
| }, | ||
| { | ||
| name: "Mixed: some blobs fit, total exceeds limit", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 100), make([]byte, 200), make([]byte, 800)}, | ||
| expectError: true, | ||
| expectedError: da.ErrBlobSizeOverLimit, | ||
| description: "Should fail completely, not partially submit blobs that fit", | ||
| }, | ||
| { | ||
| name: "One blob exceeds limit individually", | ||
| maxBlobSize: 1000, | ||
| inputBlobs: []da.Blob{make([]byte, 300), make([]byte, 1500), make([]byte, 200)}, | ||
| expectError: true, | ||
| expectedError: da.ErrBlobSizeOverLimit, | ||
| description: "Should fail if any individual blob exceeds limit", | ||
| }, | ||
| } | ||
|
|
||
| for _, tc := range testCases { | ||
| t.Run(tc.name, func(t *testing.T) { | ||
| // Create API with test configuration | ||
| api := &API{ | ||
| Logger: logger, | ||
| MaxBlobSize: tc.maxBlobSize, | ||
| Namespace: []byte("test"), | ||
| } | ||
|
|
||
| // Mock the Internal.SubmitWithOptions to always succeed if called | ||
| // This tests that our validation logic works before reaching the actual RPC call | ||
| mockCalled := false | ||
| api.Internal.SubmitWithOptions = func(ctx context.Context, blobs []da.Blob, gasPrice float64, namespace []byte, options []byte) ([]da.ID, error) { | ||
| mockCalled = true | ||
| // Return mock IDs for successful submissions | ||
| ids := make([]da.ID, len(blobs)) | ||
| for i := range blobs { | ||
| ids[i] = []byte{byte(i)} | ||
| } | ||
| return ids, nil | ||
| } | ||
|
|
||
| // Call SubmitWithOptions | ||
| ctx := context.Background() | ||
| result, err := api.SubmitWithOptions(ctx, tc.inputBlobs, 1.0, nil, nil) | ||
|
|
||
| // Verify expectations | ||
| if tc.expectError { | ||
| assert.Error(t, err, tc.description) | ||
| if tc.expectedError != nil { | ||
| assert.ErrorIs(t, err, tc.expectedError, tc.description) | ||
| } | ||
| assert.Nil(t, result, "Result should be nil on error") | ||
| assert.False(t, mockCalled, "Internal RPC should not be called when validation fails") | ||
| } else { | ||
| assert.NoError(t, err, tc.description) | ||
| assert.NotNil(t, result, "Result should not be nil on success") | ||
| if len(tc.inputBlobs) > 0 { | ||
| assert.True(t, mockCalled, "Internal RPC should be called for valid submissions") | ||
| assert.Len(t, result, len(tc.inputBlobs), "Should return IDs for all submitted blobs") | ||
| } | ||
| } | ||
| }) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.