Skip to content

Commit a53a7ac

Browse files
randygrokjgimeno
andauthored
feat: implement batch size validation and automatic splitting for DA (#2506)
Now is responsability of the node to split the batch that is sent to the DA. And the client only validates if the blob is too big (does not tries to split it) NOTE: There exists a case when the blob of a single block is too big, it wont be split and will fail after 30 attempts.' Closes: #2498 <!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> --------- Co-authored-by: Jonathan Gimeno <[email protected]>
1 parent fbfbcfc commit a53a7ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1982
-438
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ build
1515
coverage.out
1616
execution/evm/jwttoken
1717
target
18+
/.claude/settings.local.json
19+
1820

1921
docs/.vitepress/dist
2022
node_modules

apps/evm/single/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ func main() {
2121

2222
config.AddGlobalFlags(rootCmd, "evm-single")
2323

24+
// Add configuration flags to NetInfoCmd so it can read RPC address
25+
config.AddFlags(rollcmd.NetInfoCmd)
26+
2427
rootCmd.AddCommand(
2528
cmd.InitCmd(),
2629
cmd.RunCmd,

block/manager.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ const (
4343
// defaultMempoolTTL is the number of blocks until transaction is dropped from mempool
4444
defaultMempoolTTL = 25
4545

46-
// maxSubmitAttempts defines how many times evolve will re-try to publish block to DA layer.
47-
// This is temporary solution. It will be removed in future versions.
48-
maxSubmitAttempts = 30
49-
5046
// Key for storing namespace migration state in the store
5147
namespaceMigrationKey = "namespace_migration_completed"
5248

@@ -57,9 +53,6 @@ const (
5753
var (
5854
// dataHashForEmptyTxs to be used while only syncing headers from DA and no p2p to get the Data for no txs scenarios, the syncing can proceed without getting stuck forever.
5955
dataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165, 68, 230, 187, 120, 10, 44, 120, 144, 29, 63, 179, 55, 56, 118, 133, 17, 163, 6, 23, 175, 160, 29}
60-
61-
// initialBackoff defines initial value for block submission backoff
62-
initialBackoff = 100 * time.Millisecond
6356
)
6457

6558
// publishBlockFunc defines the function signature for publishing a block.
@@ -782,17 +775,6 @@ func (m *Manager) recordMetrics(data *types.Data) {
782775
m.metrics.CommittedHeight.Set(float64(data.Metadata.Height))
783776
}
784777

785-
func (m *Manager) exponentialBackoff(backoff time.Duration) time.Duration {
786-
backoff *= 2
787-
if backoff == 0 {
788-
backoff = initialBackoff
789-
}
790-
if backoff > m.config.DA.BlockTime.Duration {
791-
backoff = m.config.DA.BlockTime.Duration
792-
}
793-
return backoff
794-
}
795-
796778
func (m *Manager) getLastBlockTime() time.Time {
797779
m.lastStateMtx.RLock()
798780
defer m.lastStateMtx.RUnlock()

block/manager_test.go

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -703,24 +703,6 @@ func TestUtilityFunctions(t *testing.T) {
703703
require.Equal(input, reconstructed)
704704
})
705705

706-
t.Run("ExponentialBackoff", func(t *testing.T) {
707-
require := require.New(t)
708-
m, _ := getManager(t, mocks.NewMockDA(t), -1, -1)
709-
m.config.DA.BlockTime.Duration = 10 * time.Second
710-
711-
// Test initial backoff
712-
result := m.exponentialBackoff(0)
713-
require.Equal(initialBackoff, result)
714-
715-
// Test doubling
716-
result = m.exponentialBackoff(100 * time.Millisecond)
717-
require.Equal(200*time.Millisecond, result)
718-
719-
// Test max cap
720-
result = m.exponentialBackoff(20 * time.Second)
721-
require.Equal(m.config.DA.BlockTime.Duration, result)
722-
})
723-
724706
t.Run("GetHeaderSignature_NilSigner", func(t *testing.T) {
725707
require := require.New(t)
726708
m, _ := getManager(t, mocks.NewMockDA(t), -1, -1)
@@ -993,44 +975,10 @@ func TestValidationMethods(t *testing.T) {
993975
require.False(result)
994976
})
995977

996-
t.Run("ExponentialBackoff_WithConfig", func(t *testing.T) {
997-
require := require.New(t)
998-
m, _ := getManager(t, mocks.NewMockDA(t), -1, -1)
999-
1000-
// Set up a config with a specific block time
1001-
m.config.DA.BlockTime.Duration = 5 * time.Second
1002-
1003-
// Test that backoff is capped at config value
1004-
result := m.exponentialBackoff(10 * time.Second)
1005-
require.Equal(5*time.Second, result)
1006-
1007-
// Test normal doubling
1008-
result = m.exponentialBackoff(100 * time.Millisecond)
1009-
require.Equal(200*time.Millisecond, result)
1010-
})
1011978
}
1012979

1013980
// TestConfigurationDefaults tests default value handling and edge cases
1014981
func TestConfigurationDefaults(t *testing.T) {
1015-
t.Run("ExponentialBackoff_EdgeCases", func(t *testing.T) {
1016-
require := require.New(t)
1017-
m, _ := getManager(t, mocks.NewMockDA(t), -1, -1)
1018-
1019-
// Test with zero block time - should still double the backoff since there's no cap
1020-
m.config.DA.BlockTime.Duration = 0
1021-
result := m.exponentialBackoff(100 * time.Millisecond)
1022-
require.Equal(0*time.Millisecond, result) // Capped at 0
1023-
1024-
// Test with very small block time
1025-
m.config.DA.BlockTime.Duration = 1 * time.Millisecond
1026-
result = m.exponentialBackoff(100 * time.Millisecond)
1027-
require.Equal(1*time.Millisecond, result) // Should cap at block time
1028-
1029-
// Test normal doubling with larger block time
1030-
m.config.DA.BlockTime.Duration = 1 * time.Second
1031-
result = m.exponentialBackoff(100 * time.Millisecond)
1032-
require.Equal(200*time.Millisecond, result) // Should double
1033-
})
1034982

1035983
t.Run("IsProposer_NilSigner", func(t *testing.T) {
1036984
require := require.New(t)

0 commit comments

Comments
 (0)