Skip to content

Commit 0a3592c

Browse files
committed
make da request timeout configurable
1 parent a5c4434 commit 0a3592c

6 files changed

Lines changed: 49 additions & 6 deletions

File tree

block/public.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package block
22

33
import (
4-
"time"
5-
64
"github.com/evstack/ev-node/block/internal/common"
75
"github.com/evstack/ev-node/block/internal/da"
86
coreda "github.com/evstack/ev-node/core/da"
@@ -44,7 +42,7 @@ func NewDAClient(
4442
DA: daLayer,
4543
Logger: logger,
4644
Namespace: config.DA.GetNamespace(),
47-
DefaultTimeout: 15 * time.Second,
45+
DefaultTimeout: config.DA.RequestTimeout.Duration,
4846
DataNamespace: config.DA.GetDataNamespace(),
4947
RetrieveBatchSize: config.DA.RetrieveBatchSize,
5048
})

docs/learn/config.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,42 @@ _Example:_ `--rollkit.da.mempool_ttl 30`
490490
_Default:_ `20`
491491
_Constant:_ `FlagDAMempoolTTL`
492492

493+
### DA Retrieve Batch Size
494+
495+
**Description:**
496+
Number of blob IDs requested per DA `Get` call when the node retrieves blocks from the DA layer. Smaller batches help unreliable DA RPC endpoints return data before the per-request timeout, while larger batches reduce the total number of round trips for fast DA nodes.
497+
498+
**YAML:**
499+
500+
```yaml
501+
da:
502+
retrieve_batch_size: 100
503+
```
504+
505+
**Command-line Flag:**
506+
`--rollkit.da.retrieve_batch_size <int>`
507+
_Example:_ `--rollkit.da.retrieve_batch_size 50`
508+
_Default:_ `100`
509+
_Constant:_ `FlagDARetrieveBatchSize`
510+
511+
### DA Request Timeout
512+
513+
**Description:**
514+
Per-request timeout applied to DA `GetIDs` and `Get` RPC calls while retrieving blobs. Increase this value if your DA endpoint has high latency to avoid premature failures; decrease it to make the syncer fail fast and free resources sooner when the DA node becomes unresponsive.
515+
516+
**YAML:**
517+
518+
```yaml
519+
da:
520+
request_timeout: "30s"
521+
```
522+
523+
**Command-line Flag:**
524+
`--rollkit.da.request_timeout <duration>`
525+
_Example:_ `--rollkit.da.request_timeout 45s`
526+
_Default:_ `"30s"`
527+
_Constant:_ `FlagDARequestTimeout`
528+
493529
## P2P Configuration (`p2p`)
494530

495531
Settings for peer-to-peer networking, enabling nodes to discover each other, exchange blocks, and share transactions.

docs/learn/specs/block-manager.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ The block components share a common configuration:
167167
| Namespace | da.Namespace | DA namespace ID for block submissions (deprecated, use HeaderNamespace and DataNamespace instead) |
168168
| HeaderNamespace | string | namespace ID for submitting headers to DA layer (automatically encoded by the node) |
169169
| DataNamespace | string | namespace ID for submitting data to DA layer (automatically encoded by the node) |
170+
| RetrieveBatchSize | int | number of blob IDs fetched per DA `Get` call, trading off payload size vs. number of RPC round trips (default: 100) |
171+
| RequestTimeout | duration | per-request timeout for DA `GetIDs`/`Get` calls; higher values tolerate slow DA nodes, lower values fail faster (default: 30s) |
170172

171173
### Block Production (Executor Component)
172174

pkg/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ const (
7272
FlagDAMaxSubmitAttempts = FlagPrefixEvnode + "da.max_submit_attempts"
7373
// FlagDARetrieveBatchSize configures how many IDs are fetched per DA Get request
7474
FlagDARetrieveBatchSize = FlagPrefixEvnode + "da.retrieve_batch_size"
75+
// FlagDARequestTimeout controls the per-request timeout when talking to the DA layer
76+
FlagDARequestTimeout = FlagPrefixEvnode + "da.request_timeout"
7577

7678
// P2P configuration flags
7779

@@ -165,6 +167,7 @@ type DAConfig struct {
165167
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."`
166168
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."`
167169
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."`
170+
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."`
168171
}
169172

170173
// GetNamespace returns the namespace for header submissions.
@@ -324,6 +327,7 @@ func AddFlags(cmd *cobra.Command) {
324327
cmd.Flags().Uint64(FlagDAMempoolTTL, def.DA.MempoolTTL, "number of DA blocks until transaction is dropped from the mempool")
325328
cmd.Flags().Int(FlagDAMaxSubmitAttempts, def.DA.MaxSubmitAttempts, "maximum number of attempts to submit data to the DA layer before giving up")
326329
cmd.Flags().Int(FlagDARetrieveBatchSize, def.DA.RetrieveBatchSize, "number of IDs to request per DA Get call when retrieving blobs")
330+
cmd.Flags().Duration(FlagDARequestTimeout, def.DA.RequestTimeout.Duration, "per-request timeout when retrieving blobs from the DA layer")
327331

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

pkg/config/config_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ func TestDefaultConfig(t *testing.T) {
2626
assert.Equal(t, "", def.DA.AuthToken)
2727
assert.Equal(t, "", def.DA.SubmitOptions)
2828
assert.NotEmpty(t, def.DA.Namespace)
29-
assert.Equal(t, 150, def.DA.RetrieveBatchSize)
29+
assert.Equal(t, 100, def.DA.RetrieveBatchSize)
30+
assert.Equal(t, 30*time.Second, def.DA.RequestTimeout.Duration)
3031
assert.Equal(t, 1*time.Second, def.Node.BlockTime.Duration)
3132
assert.Equal(t, 6*time.Second, def.DA.BlockTime.Duration)
3233
assert.Equal(t, uint64(0), def.DA.MempoolTTL)
@@ -72,6 +73,7 @@ func TestAddFlags(t *testing.T) {
7273
assertFlagValue(t, flags, FlagDAMempoolTTL, DefaultConfig().DA.MempoolTTL)
7374
assertFlagValue(t, flags, FlagDAMaxSubmitAttempts, DefaultConfig().DA.MaxSubmitAttempts)
7475
assertFlagValue(t, flags, FlagDARetrieveBatchSize, DefaultConfig().DA.RetrieveBatchSize)
76+
assertFlagValue(t, flags, FlagDARequestTimeout, DefaultConfig().DA.RequestTimeout.Duration)
7577

7678
// P2P flags
7779
assertFlagValue(t, flags, FlagP2PListenAddress, DefaultConfig().P2P.ListenAddress)
@@ -101,7 +103,7 @@ func TestAddFlags(t *testing.T) {
101103
assertFlagValue(t, flags, FlagRPCAddress, DefaultConfig().RPC.Address)
102104

103105
// Count the number of flags we're explicitly checking
104-
expectedFlagCount := 38 // Update this number if you add more flag checks above
106+
expectedFlagCount := 39 // Update this number if you add more flag checks above
105107

106108
// Get the actual number of flags (both regular and persistent)
107109
actualFlagCount := 0

pkg/config/defaults.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func DefaultConfig() Config {
7575
MaxSubmitAttempts: 30,
7676
Namespace: randString(10),
7777
DataNamespace: "",
78-
RetrieveBatchSize: 150,
78+
RetrieveBatchSize: 100,
79+
RequestTimeout: DurationWrapper{30 * time.Second},
7980
},
8081
Instrumentation: DefaultInstrumentationConfig(),
8182
Log: LogConfig{

0 commit comments

Comments
 (0)