Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage.txt
*.out
proto/pb
proto/tendermint
types/pb/tendermint
Expand Down
2 changes: 1 addition & 1 deletion block/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func NewAggregatorComponents(
logger,
executor,
cacheManager,
reaping.DefaultInterval,
config.Node.ScrapeInterval.Duration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Now that the reaper interval is configurable and passed in here, the reaping.DefaultInterval constant appears to be unused. It would be good to remove it from block/internal/reaping/reaper.go to avoid dead code.

Copy link
Member

@julienrbrt julienrbrt Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on this, cc @chatton

)
if err != nil {
return nil, fmt.Errorf("failed to create reaper: %w", err)
Expand Down
4 changes: 0 additions & 4 deletions block/internal/reaping/reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ import (
)

const (
// DefaultInterval is the default reaper interval
DefaultInterval = 1 * time.Second
// MaxBackoffInterval is the maximum backoff interval for retries
MaxBackoffInterval = 30 * time.Second
// BackoffMultiplier is the multiplier for exponential backoff
BackoffMultiplier = 2
)

// Reaper is responsible for periodically retrieving transactions from the executor,
Expand Down
1 change: 1 addition & 0 deletions node/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func getTestConfig(t *testing.T, n int) evconfig.Config {
BlockTime: evconfig.DurationWrapper{Duration: 100 * time.Millisecond},
MaxPendingHeadersAndData: 1000,
LazyBlockInterval: evconfig.DurationWrapper{Duration: 5 * time.Second},
ScrapeInterval: evconfig.DurationWrapper{Duration: time.Second},
},
DA: evconfig.DAConfig{
BlockTime: evconfig.DurationWrapper{Duration: 200 * time.Millisecond},
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const (
FlagReadinessWindowSeconds = FlagPrefixEvnode + "node.readiness_window_seconds"
// FlagReadinessMaxBlocksBehind configures how many blocks behind best-known head is still considered ready
FlagReadinessMaxBlocksBehind = FlagPrefixEvnode + "node.readiness_max_blocks_behind"
// FlagScrapeInterval is a flag for specifying the reaper scrape interval
FlagScrapeInterval = FlagPrefixEvnode + "node.scrape_interval"
// FlagClearCache is a flag for clearing the cache
FlagClearCache = FlagPrefixEvnode + "clear_cache"

Expand Down Expand Up @@ -203,6 +205,7 @@ type NodeConfig struct {
MaxPendingHeadersAndData uint64 `mapstructure:"max_pending_headers_and_data" yaml:"max_pending_headers_and_data" comment:"Maximum number of headers or data pending DA submission. When this limit is reached, the aggregator pauses block production until some headers or data are confirmed. Use 0 for no limit."`
LazyMode bool `mapstructure:"lazy_mode" yaml:"lazy_mode" comment:"Enables lazy aggregation mode, where blocks are only produced when transactions are available or after LazyBlockTime. Optimizes resources by avoiding empty block creation during periods of inactivity."`
LazyBlockInterval DurationWrapper `mapstructure:"lazy_block_interval" yaml:"lazy_block_interval" comment:"Maximum interval between blocks in lazy aggregation mode (LazyAggregator). Ensures blocks are produced periodically even without transactions to keep the chain active. Generally larger than BlockTime."`
ScrapeInterval DurationWrapper `mapstructure:"scrape_interval" yaml:"scrape_interval" comment:"Interval at which the reaper polls the execution layer for new transactions. Lower values reduce transaction detection latency but increase RPC load. Examples: \"250ms\", \"500ms\", \"1s\"."`

// Readiness / health configuration
ReadinessWindowSeconds uint64 `mapstructure:"readiness_window_seconds" yaml:"readiness_window_seconds" comment:"Time window in seconds used to calculate ReadinessMaxBlocksBehind based on block time. Default: 15 seconds."`
Expand Down Expand Up @@ -337,6 +340,7 @@ func AddFlags(cmd *cobra.Command) {
cmd.Flags().Duration(FlagLazyBlockTime, def.Node.LazyBlockInterval.Duration, "maximum interval between blocks in lazy aggregation mode")
cmd.Flags().Uint64(FlagReadinessWindowSeconds, def.Node.ReadinessWindowSeconds, "time window in seconds for calculating readiness threshold based on block time (default: 15s)")
cmd.Flags().Uint64(FlagReadinessMaxBlocksBehind, def.Node.ReadinessMaxBlocksBehind, "how many blocks behind best-known head the node can be and still be considered ready (0 = must be at head)")
cmd.Flags().Duration(FlagScrapeInterval, def.Node.ScrapeInterval.Duration, "interval at which the reaper polls the execution layer for new transactions")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's great that you've added this new configuration flag. To ensure it's working as expected and to maintain test coverage, please consider adding a test case for FlagScrapeInterval in TestAddFlags within pkg/config/config_test.go. You'll also likely need to update the expectedFlagCount in that test to ensure all flags are accounted for.


// Data Availability configuration flags
cmd.Flags().String(FlagDAAddress, def.DA.Address, "DA address (host:port)")
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestAddFlags(t *testing.T) {
assertFlagValue(t, flags, FlagLazyBlockTime, DefaultConfig().Node.LazyBlockInterval.Duration)
assertFlagValue(t, flags, FlagReadinessWindowSeconds, DefaultConfig().Node.ReadinessWindowSeconds)
assertFlagValue(t, flags, FlagReadinessMaxBlocksBehind, DefaultConfig().Node.ReadinessMaxBlocksBehind)
assertFlagValue(t, flags, FlagScrapeInterval, DefaultConfig().Node.ScrapeInterval)

// DA flags
assertFlagValue(t, flags, FlagDAAddress, DefaultConfig().DA.Address)
Expand Down Expand Up @@ -107,7 +108,7 @@ func TestAddFlags(t *testing.T) {
assertFlagValue(t, flags, FlagRPCEnableDAVisualization, DefaultConfig().RPC.EnableDAVisualization)

// Count the number of flags we're explicitly checking
expectedFlagCount := 44 // Update this number if you add more flag checks above
expectedFlagCount := 45 // Update this number if you add more flag checks above

// Get the actual number of flags (both regular and persistent)
actualFlagCount := 0
Expand Down
1 change: 1 addition & 0 deletions pkg/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func DefaultConfig() Config {
Light: false,
ReadinessWindowSeconds: defaultReadinessWindowSeconds,
ReadinessMaxBlocksBehind: calculateReadinessMaxBlocksBehind(defaultBlockTime.Duration, defaultReadinessWindowSeconds),
ScrapeInterval: DurationWrapper{1 * time.Second},
},
DA: DAConfig{
Address: "http://localhost:7980",
Expand Down
Loading