diff --git a/.gitignore b/.gitignore index 7e7576c6d4..08d1d2bfdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ coverage.txt +*.out proto/pb proto/tendermint types/pb/tendermint diff --git a/block/components.go b/block/components.go index 5602e5a8e6..eea7691a0b 100644 --- a/block/components.go +++ b/block/components.go @@ -227,7 +227,7 @@ func NewAggregatorComponents( logger, executor, cacheManager, - reaping.DefaultInterval, + config.Node.ScrapeInterval.Duration, ) if err != nil { return nil, fmt.Errorf("failed to create reaper: %w", err) diff --git a/block/internal/reaping/reaper.go b/block/internal/reaping/reaper.go index 62ff5dfba1..203c66869d 100644 --- a/block/internal/reaping/reaper.go +++ b/block/internal/reaping/reaper.go @@ -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, diff --git a/node/helpers_test.go b/node/helpers_test.go index 9d586c3d24..46ded00674 100644 --- a/node/helpers_test.go +++ b/node/helpers_test.go @@ -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}, diff --git a/pkg/config/config.go b/pkg/config/config.go index 81d10b2eb0..6f358e8764 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -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" @@ -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."` @@ -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") // Data Availability configuration flags cmd.Flags().String(FlagDAAddress, def.DA.Address, "DA address (host:port)") diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index f7cfa653d9..bde8f5e8f0 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -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) @@ -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 diff --git a/pkg/config/defaults.go b/pkg/config/defaults.go index 78aef49e85..062c9fe19c 100644 --- a/pkg/config/defaults.go +++ b/pkg/config/defaults.go @@ -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",