Skip to content

Commit 5b0af6c

Browse files
committed
Merge branch 'main' into julien/fi
2 parents 2fa58b1 + 474818d commit 5b0af6c

File tree

6 files changed

+12
-40
lines changed

6 files changed

+12
-40
lines changed

block/internal/da/client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type Config struct {
6060
// NewClient creates a new DA client with pre-calculated namespace bytes.
6161
func NewClient(cfg Config) *client {
6262
if cfg.DefaultTimeout == 0 {
63-
cfg.DefaultTimeout = 30 * time.Second
63+
cfg.DefaultTimeout = 60 * time.Second
6464
}
6565
if cfg.RetrieveBatchSize <= 0 {
6666
cfg.RetrieveBatchSize = defaultRetrieveBatchSize
@@ -86,7 +86,10 @@ func NewClient(cfg Config) *client {
8686

8787
// Submit submits blobs to the DA layer with the specified options.
8888
func (c *client) Submit(ctx context.Context, data [][]byte, gasPrice float64, namespace []byte, options []byte) coreda.ResultSubmit {
89-
ids, err := c.da.SubmitWithOptions(ctx, data, gasPrice, namespace, options)
89+
submitCtx, cancel := context.WithTimeout(ctx, c.defaultTimeout)
90+
defer cancel()
91+
92+
ids, err := c.da.SubmitWithOptions(submitCtx, data, gasPrice, namespace, options)
9093

9194
// calculate blob size
9295
var blobSize uint64
@@ -174,9 +177,9 @@ func (c *client) Submit(ctx context.Context, data [][]byte, gasPrice float64, na
174177

175178
// Retrieve retrieves blobs from the DA layer at the specified height and namespace.
176179
func (c *client) Retrieve(ctx context.Context, height uint64, namespace []byte) coreda.ResultRetrieve {
177-
// 1. Get IDs
178180
getIDsCtx, cancel := context.WithTimeout(ctx, c.defaultTimeout)
179181
defer cancel()
182+
180183
idsResult, err := c.da.GetIDs(getIDsCtx, height, namespace)
181184
if err != nil {
182185
// Handle specific "not found" error

block/internal/da/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func TestNewClient(t *testing.T) {
114114

115115
expectedTimeout := tt.cfg.DefaultTimeout
116116
if expectedTimeout == 0 {
117-
expectedTimeout = 30 * time.Second
117+
expectedTimeout = 60 * time.Second
118118
}
119119
assert.Equal(t, client.defaultTimeout, expectedTimeout)
120120
})

block/internal/syncing/da_retriever_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -110,38 +110,7 @@ func TestDARetriever_RetrieveFromDA_HeightFromFuture(t *testing.T) {
110110
assert.Nil(t, events)
111111
}
112112

113-
func TestDARetriever_RetrieveFromDA_Timeout(t *testing.T) {
114-
t.Skip("Skipping flaky timeout test - timing is now controlled by DA client")
115-
116-
mockDA := testmocks.NewMockDA(t)
117-
118-
// Mock GetIDs to hang longer than the timeout
119-
mockDA.EXPECT().GetIDs(mock.Anything, mock.Anything, mock.Anything).
120-
Run(func(ctx context.Context, height uint64, namespace []byte) {
121-
<-ctx.Done()
122-
}).
123-
Return(nil, context.DeadlineExceeded).Maybe()
124-
125-
r := newTestDARetriever(t, mockDA, config.DefaultConfig(), genesis.Genesis{})
126-
127-
start := time.Now()
128-
events, err := r.RetrieveFromDA(context.Background(), 42)
129-
duration := time.Since(start)
130-
131-
// Verify error is returned and contains deadline exceeded information
132-
require.Error(t, err)
133-
assert.Contains(t, err.Error(), "DA retrieval failed")
134-
assert.Contains(t, err.Error(), "context deadline exceeded")
135-
assert.Len(t, events, 0)
136-
137-
// Verify timeout occurred approximately at expected time (with some tolerance)
138-
// DA client has a 30-second default timeout
139-
assert.Greater(t, duration, 29*time.Second, "should timeout after approximately 30 seconds")
140-
assert.Less(t, duration, 35*time.Second, "should not take much longer than timeout")
141-
}
142-
143113
func TestDARetriever_RetrieveFromDA_TimeoutFast(t *testing.T) {
144-
145114
mockDA := testmocks.NewMockDA(t)
146115

147116
// Mock GetIDs to immediately return context deadline exceeded

pkg/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ type DAConfig struct {
171171
BlockTime DurationWrapper `mapstructure:"block_time" yaml:"block_time" comment:"Average block time of the DA chain (duration). Determines frequency of DA layer syncing, maximum backoff time for retries, and is multiplied by MempoolTTL to calculate transaction expiration. Examples: \"15s\", \"30s\", \"1m\", \"2m30s\", \"10m\"."`
172172
MempoolTTL uint64 `mapstructure:"mempool_ttl" yaml:"mempool_ttl" comment:"Number of DA blocks after which a transaction is considered expired and dropped from the mempool. Controls retry backoff timing."`
173173
MaxSubmitAttempts int `mapstructure:"max_submit_attempts" yaml:"max_submit_attempts" comment:"Maximum number of attempts to submit data to the DA layer before giving up. Higher values provide more resilience but can delay error reporting."`
174-
RetrieveBatchSize int `mapstructure:"retrieve_batch_size" yaml:"retrieve_batch_size" comment:"Number of IDs to request per DA Get call when retrieving blobs. Smaller batches lower per-request latency; larger batches reduce the number of RPC round trips. Default: 100."`
175-
RequestTimeout DurationWrapper `mapstructure:"request_timeout" yaml:"request_timeout" comment:"Per-request timeout applied to DA GetIDs/Get calls when retrieving blobs. Larger values tolerate slower DA nodes at the cost of waiting longer before failing. Default: 30s."`
174+
RetrieveBatchSize int `mapstructure:"retrieve_batch_size" yaml:"retrieve_batch_size" comment:"Number of IDs to request per DA Get call when retrieving blobs. Smaller batches lower per-request latency; larger batches reduce the number of RPC round trips."`
175+
RequestTimeout DurationWrapper `mapstructure:"request_timeout" yaml:"request_timeout" comment:"Per-request timeout applied to DA interactions. Larger values tolerate slower DA nodes at the cost of waiting longer before failing."`
176176
}
177177

178178
// GetNamespace returns the namespace for header submissions.
@@ -353,7 +353,7 @@ func AddFlags(cmd *cobra.Command) {
353353
cmd.Flags().Uint64(FlagDAMempoolTTL, def.DA.MempoolTTL, "number of DA blocks until transaction is dropped from the mempool")
354354
cmd.Flags().Int(FlagDAMaxSubmitAttempts, def.DA.MaxSubmitAttempts, "maximum number of attempts to submit data to the DA layer before giving up")
355355
cmd.Flags().Int(FlagDARetrieveBatchSize, def.DA.RetrieveBatchSize, "number of IDs to request per DA Get call when retrieving blobs")
356-
cmd.Flags().Duration(FlagDARequestTimeout, def.DA.RequestTimeout.Duration, "per-request timeout when retrieving blobs from the DA layer")
356+
cmd.Flags().Duration(FlagDARequestTimeout, def.DA.RequestTimeout.Duration, "per-request timeout when interacting with the DA layer")
357357

358358
// P2P configuration flags
359359
cmd.Flags().String(FlagP2PListenAddress, def.P2P.ListenAddress, "P2P listen address (host:port)")

pkg/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestDefaultConfig(t *testing.T) {
2727
assert.Equal(t, "", def.DA.SubmitOptions)
2828
assert.NotEmpty(t, def.DA.Namespace)
2929
assert.Equal(t, 100, def.DA.RetrieveBatchSize)
30-
assert.Equal(t, 30*time.Second, def.DA.RequestTimeout.Duration)
30+
assert.Equal(t, 60*time.Second, def.DA.RequestTimeout.Duration)
3131
assert.Equal(t, 1*time.Second, def.Node.BlockTime.Duration)
3232
assert.Equal(t, 6*time.Second, def.DA.BlockTime.Duration)
3333
assert.Equal(t, uint64(0), def.DA.MempoolTTL)

pkg/config/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func DefaultConfig() Config {
7474
BlockTime: DurationWrapper{6 * time.Second},
7575
MaxSubmitAttempts: 30,
7676
RetrieveBatchSize: 100,
77-
RequestTimeout: DurationWrapper{30 * time.Second},
77+
RequestTimeout: DurationWrapper{60 * time.Second},
7878
Namespace: randString(10),
7979
DataNamespace: "",
8080
ForcedInclusionNamespace: "",

0 commit comments

Comments
 (0)