Skip to main content

reth_engine_primitives/
config.rs

1//! Engine tree configuration.
2
3use alloy_eips::merge::EPOCH_SLOTS;
4use core::time::Duration;
5
6/// Triggers persistence when the number of canonical blocks in memory exceeds this threshold.
7pub const DEFAULT_PERSISTENCE_THRESHOLD: u64 = 2;
8
9/// How close to the canonical head we persist blocks.
10pub const DEFAULT_MEMORY_BLOCK_BUFFER_TARGET: u64 = 0;
11
12/// Returns the default number of storage worker threads based on available parallelism.
13fn default_storage_worker_count() -> usize {
14    #[cfg(feature = "std")]
15    {
16        std::thread::available_parallelism().map_or(8, |n| n.get() * 2)
17    }
18    #[cfg(not(feature = "std"))]
19    {
20        8
21    }
22}
23
24/// Returns the default number of account worker threads.
25///
26/// Account workers coordinate storage proof collection and account trie traversal.
27/// They are set to the same count as storage workers for simplicity.
28fn default_account_worker_count() -> usize {
29    default_storage_worker_count()
30}
31
32/// The size of proof targets chunk to spawn in one multiproof calculation.
33pub const DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE: usize = 60;
34
35/// The size of proof targets chunk to spawn in one multiproof calculation when V2 proofs are
36/// enabled. This is 4x the default chunk size to take advantage of more efficient V2 proof
37/// computation.
38pub const DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE_V2: usize = DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE * 4;
39
40/// Default number of reserved CPU cores for non-reth processes.
41///
42/// This will be deducted from the thread count of main reth global threadpool.
43pub const DEFAULT_RESERVED_CPU_CORES: usize = 1;
44
45/// Returns the default maximum concurrency for prewarm task based on available parallelism.
46fn default_prewarm_max_concurrency() -> usize {
47    #[cfg(feature = "std")]
48    {
49        std::thread::available_parallelism().map_or(16, |n| n.get())
50    }
51    #[cfg(not(feature = "std"))]
52    {
53        16
54    }
55}
56
57/// Default depth for sparse trie pruning.
58///
59/// Nodes at this depth and below are converted to hash stubs to reduce memory.
60/// Depth 4 means we keep roughly 16^4 = 65536 potential branch paths at most.
61pub const DEFAULT_SPARSE_TRIE_PRUNE_DEPTH: usize = 4;
62
63/// Default maximum number of storage tries to keep after pruning.
64///
65/// Storage tries beyond this limit are cleared (but allocations preserved).
66pub const DEFAULT_SPARSE_TRIE_MAX_STORAGE_TRIES: usize = 100;
67
68/// Default timeout for the state root task before spawning a sequential fallback.
69pub const DEFAULT_STATE_ROOT_TASK_TIMEOUT: Duration = Duration::from_secs(1);
70
71const DEFAULT_BLOCK_BUFFER_LIMIT: u32 = EPOCH_SLOTS as u32 * 2;
72const DEFAULT_MAX_INVALID_HEADER_CACHE_LENGTH: u32 = 256;
73const DEFAULT_MAX_EXECUTE_BLOCK_BATCH_SIZE: usize = 4;
74const DEFAULT_CROSS_BLOCK_CACHE_SIZE: usize = default_cross_block_cache_size();
75
76const fn default_cross_block_cache_size() -> usize {
77    if cfg!(test) {
78        1024 * 1024 // 1 MB in tests
79    } else if cfg!(target_pointer_width = "32") {
80        usize::MAX // max possible on wasm32 / 32-bit
81    } else {
82        4 * 1024 * 1024 * 1024 // 4 GB on 64-bit
83    }
84}
85
86/// Determines if the host has enough parallelism to run the payload processor.
87///
88/// It requires at least 5 parallel threads:
89/// - Engine in main thread that spawns the state root task.
90/// - Multiproof task in payload processor
91/// - Sparse Trie task in payload processor
92/// - Multiproof computation spawned in payload processor
93/// - Storage root computation spawned in trie parallel proof
94pub fn has_enough_parallelism() -> bool {
95    #[cfg(feature = "std")]
96    {
97        std::thread::available_parallelism().is_ok_and(|num| num.get() >= 5)
98    }
99    #[cfg(not(feature = "std"))]
100    false
101}
102
103/// The configuration of the engine tree.
104#[derive(Debug, Clone)]
105pub struct TreeConfig {
106    /// Maximum number of blocks to be kept only in memory without triggering
107    /// persistence.
108    persistence_threshold: u64,
109    /// How close to the canonical head we persist blocks. Represents the ideal
110    /// number of most recent blocks to keep in memory for quick access and reorgs.
111    ///
112    /// Note: this should be less than or equal to `persistence_threshold`.
113    memory_block_buffer_target: u64,
114    /// Number of pending blocks that cannot be executed due to missing parent and
115    /// are kept in cache.
116    block_buffer_limit: u32,
117    /// Number of invalid headers to keep in cache.
118    max_invalid_header_cache_length: u32,
119    /// Maximum number of blocks to execute sequentially in a batch.
120    ///
121    /// This is used as a cutoff to prevent long-running sequential block execution when we receive
122    /// a batch of downloaded blocks.
123    max_execute_block_batch_size: usize,
124    /// Whether to use the legacy state root calculation method instead of the
125    /// new state root task.
126    legacy_state_root: bool,
127    /// Whether to always compare trie updates from the state root task to the trie updates from
128    /// the regular state root calculation.
129    always_compare_trie_updates: bool,
130    /// Whether to disable state cache.
131    disable_state_cache: bool,
132    /// Whether to disable parallel prewarming.
133    disable_prewarming: bool,
134    /// Whether to enable state provider metrics.
135    state_provider_metrics: bool,
136    /// Cross-block cache size in bytes.
137    cross_block_cache_size: usize,
138    /// Whether the host has enough parallelism to run state root task.
139    has_enough_parallelism: bool,
140    /// Whether multiproof task should chunk proof targets.
141    multiproof_chunking_enabled: bool,
142    /// Multiproof task chunk size for proof targets.
143    multiproof_chunk_size: usize,
144    /// Number of reserved CPU cores for non-reth processes
145    reserved_cpu_cores: usize,
146    /// Whether to disable the precompile cache
147    precompile_cache_disabled: bool,
148    /// Whether to use state root fallback for testing
149    state_root_fallback: bool,
150    /// Whether to always process payload attributes and begin a payload build process
151    /// even if `forkchoiceState.headBlockHash` is already the canonical head or an ancestor.
152    ///
153    /// The Engine API specification generally states that client software "MUST NOT begin a
154    /// payload build process if `forkchoiceState.headBlockHash` references a `VALID`
155    /// ancestor of the head of canonical chain".
156    /// See: <https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#engine_forkchoiceupdatedv1> (Rule 2)
157    ///
158    /// This flag allows overriding that behavior.
159    /// This is useful for specific chain configurations (e.g., OP Stack where proposers
160    /// can reorg their own chain), various custom chains, or for development/testing purposes
161    /// where immediate payload regeneration is desired despite the head not changing or moving to
162    /// an ancestor.
163    always_process_payload_attributes_on_canonical_head: bool,
164    /// Maximum concurrency for the prewarm task.
165    prewarm_max_concurrency: usize,
166    /// Whether to unwind canonical header to ancestor during forkchoice updates.
167    allow_unwind_canonical_header: bool,
168    /// Number of storage proof worker threads.
169    storage_worker_count: usize,
170    /// Number of account proof worker threads.
171    account_worker_count: usize,
172    /// Whether to disable V2 storage proofs.
173    disable_proof_v2: bool,
174    /// Whether to disable cache metrics recording (can be expensive with large cached state).
175    disable_cache_metrics: bool,
176    /// Whether to disable sparse trie cache.
177    disable_trie_cache: bool,
178    /// Depth for sparse trie pruning after state root computation.
179    sparse_trie_prune_depth: usize,
180    /// Maximum number of storage tries to retain after pruning.
181    sparse_trie_max_storage_tries: usize,
182    /// Whether to fully disable sparse trie cache pruning between blocks.
183    disable_sparse_trie_cache_pruning: bool,
184    /// Timeout for the state root task before spawning a sequential fallback computation.
185    /// If `Some`, after waiting this duration for the state root task, a sequential state root
186    /// computation is spawned in parallel and whichever finishes first is used.
187    /// If `None`, the timeout fallback is disabled.
188    state_root_task_timeout: Option<Duration>,
189}
190
191impl Default for TreeConfig {
192    fn default() -> Self {
193        Self {
194            persistence_threshold: DEFAULT_PERSISTENCE_THRESHOLD,
195            memory_block_buffer_target: DEFAULT_MEMORY_BLOCK_BUFFER_TARGET,
196            block_buffer_limit: DEFAULT_BLOCK_BUFFER_LIMIT,
197            max_invalid_header_cache_length: DEFAULT_MAX_INVALID_HEADER_CACHE_LENGTH,
198            max_execute_block_batch_size: DEFAULT_MAX_EXECUTE_BLOCK_BATCH_SIZE,
199            legacy_state_root: false,
200            always_compare_trie_updates: false,
201            disable_state_cache: false,
202            disable_prewarming: false,
203            state_provider_metrics: false,
204            cross_block_cache_size: DEFAULT_CROSS_BLOCK_CACHE_SIZE,
205            has_enough_parallelism: has_enough_parallelism(),
206            multiproof_chunking_enabled: true,
207            multiproof_chunk_size: DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE,
208            reserved_cpu_cores: DEFAULT_RESERVED_CPU_CORES,
209            precompile_cache_disabled: false,
210            state_root_fallback: false,
211            always_process_payload_attributes_on_canonical_head: false,
212            prewarm_max_concurrency: default_prewarm_max_concurrency(),
213            allow_unwind_canonical_header: false,
214            storage_worker_count: default_storage_worker_count(),
215            account_worker_count: default_account_worker_count(),
216            disable_proof_v2: false,
217            disable_cache_metrics: false,
218            disable_trie_cache: false,
219            sparse_trie_prune_depth: DEFAULT_SPARSE_TRIE_PRUNE_DEPTH,
220            sparse_trie_max_storage_tries: DEFAULT_SPARSE_TRIE_MAX_STORAGE_TRIES,
221            disable_sparse_trie_cache_pruning: false,
222            state_root_task_timeout: Some(DEFAULT_STATE_ROOT_TASK_TIMEOUT),
223        }
224    }
225}
226
227impl TreeConfig {
228    /// Create engine tree configuration.
229    #[expect(clippy::too_many_arguments)]
230    pub const fn new(
231        persistence_threshold: u64,
232        memory_block_buffer_target: u64,
233        block_buffer_limit: u32,
234        max_invalid_header_cache_length: u32,
235        max_execute_block_batch_size: usize,
236        legacy_state_root: bool,
237        always_compare_trie_updates: bool,
238        disable_state_cache: bool,
239        disable_prewarming: bool,
240        state_provider_metrics: bool,
241        cross_block_cache_size: usize,
242        has_enough_parallelism: bool,
243        multiproof_chunking_enabled: bool,
244        multiproof_chunk_size: usize,
245        reserved_cpu_cores: usize,
246        precompile_cache_disabled: bool,
247        state_root_fallback: bool,
248        always_process_payload_attributes_on_canonical_head: bool,
249        prewarm_max_concurrency: usize,
250        allow_unwind_canonical_header: bool,
251        storage_worker_count: usize,
252        account_worker_count: usize,
253        disable_proof_v2: bool,
254        disable_cache_metrics: bool,
255        sparse_trie_prune_depth: usize,
256        sparse_trie_max_storage_tries: usize,
257        state_root_task_timeout: Option<Duration>,
258    ) -> Self {
259        Self {
260            persistence_threshold,
261            memory_block_buffer_target,
262            block_buffer_limit,
263            max_invalid_header_cache_length,
264            max_execute_block_batch_size,
265            legacy_state_root,
266            always_compare_trie_updates,
267            disable_state_cache,
268            disable_prewarming,
269            state_provider_metrics,
270            cross_block_cache_size,
271            has_enough_parallelism,
272            multiproof_chunking_enabled,
273            multiproof_chunk_size,
274            reserved_cpu_cores,
275            precompile_cache_disabled,
276            state_root_fallback,
277            always_process_payload_attributes_on_canonical_head,
278            prewarm_max_concurrency,
279            allow_unwind_canonical_header,
280            storage_worker_count,
281            account_worker_count,
282            disable_proof_v2,
283            disable_cache_metrics,
284            disable_trie_cache: false,
285            sparse_trie_prune_depth,
286            sparse_trie_max_storage_tries,
287            disable_sparse_trie_cache_pruning: false,
288            state_root_task_timeout,
289        }
290    }
291
292    /// Return the persistence threshold.
293    pub const fn persistence_threshold(&self) -> u64 {
294        self.persistence_threshold
295    }
296
297    /// Return the memory block buffer target.
298    pub const fn memory_block_buffer_target(&self) -> u64 {
299        self.memory_block_buffer_target
300    }
301
302    /// Return the block buffer limit.
303    pub const fn block_buffer_limit(&self) -> u32 {
304        self.block_buffer_limit
305    }
306
307    /// Return the maximum invalid cache header length.
308    pub const fn max_invalid_header_cache_length(&self) -> u32 {
309        self.max_invalid_header_cache_length
310    }
311
312    /// Return the maximum execute block batch size.
313    pub const fn max_execute_block_batch_size(&self) -> usize {
314        self.max_execute_block_batch_size
315    }
316
317    /// Return whether the multiproof task chunking is enabled.
318    pub const fn multiproof_chunking_enabled(&self) -> bool {
319        self.multiproof_chunking_enabled
320    }
321
322    /// Return the multiproof task chunk size.
323    pub const fn multiproof_chunk_size(&self) -> usize {
324        self.multiproof_chunk_size
325    }
326
327    /// Return the multiproof task chunk size, using the V2 default if V2 proofs are enabled
328    /// and the chunk size is at the default value.
329    pub const fn effective_multiproof_chunk_size(&self) -> usize {
330        if !self.disable_proof_v2 &&
331            self.multiproof_chunk_size == DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE
332        {
333            DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE_V2
334        } else {
335            self.multiproof_chunk_size
336        }
337    }
338
339    /// Return the number of reserved CPU cores for non-reth processes
340    pub const fn reserved_cpu_cores(&self) -> usize {
341        self.reserved_cpu_cores
342    }
343
344    /// Returns whether to use the legacy state root calculation method instead
345    /// of the new state root task
346    pub const fn legacy_state_root(&self) -> bool {
347        self.legacy_state_root
348    }
349
350    /// Returns whether or not state provider metrics are enabled.
351    pub const fn state_provider_metrics(&self) -> bool {
352        self.state_provider_metrics
353    }
354
355    /// Returns whether or not state cache is disabled.
356    pub const fn disable_state_cache(&self) -> bool {
357        self.disable_state_cache
358    }
359
360    /// Returns whether or not parallel prewarming is disabled.
361    pub const fn disable_prewarming(&self) -> bool {
362        self.disable_prewarming
363    }
364
365    /// Returns whether to always compare trie updates from the state root task to the trie updates
366    /// from the regular state root calculation.
367    pub const fn always_compare_trie_updates(&self) -> bool {
368        self.always_compare_trie_updates
369    }
370
371    /// Returns the cross-block cache size.
372    pub const fn cross_block_cache_size(&self) -> usize {
373        self.cross_block_cache_size
374    }
375
376    /// Returns whether precompile cache is disabled.
377    pub const fn precompile_cache_disabled(&self) -> bool {
378        self.precompile_cache_disabled
379    }
380
381    /// Returns whether to use state root fallback.
382    pub const fn state_root_fallback(&self) -> bool {
383        self.state_root_fallback
384    }
385
386    /// Sets whether to always process payload attributes when the FCU head is already canonical.
387    pub const fn with_always_process_payload_attributes_on_canonical_head(
388        mut self,
389        always_process_payload_attributes_on_canonical_head: bool,
390    ) -> Self {
391        self.always_process_payload_attributes_on_canonical_head =
392            always_process_payload_attributes_on_canonical_head;
393        self
394    }
395
396    /// Returns true if payload attributes should always be processed even when the FCU head is
397    /// canonical.
398    pub const fn always_process_payload_attributes_on_canonical_head(&self) -> bool {
399        self.always_process_payload_attributes_on_canonical_head
400    }
401
402    /// Returns true if canonical header should be unwound to ancestor during forkchoice updates.
403    pub const fn unwind_canonical_header(&self) -> bool {
404        self.allow_unwind_canonical_header
405    }
406
407    /// Setter for persistence threshold.
408    pub const fn with_persistence_threshold(mut self, persistence_threshold: u64) -> Self {
409        self.persistence_threshold = persistence_threshold;
410        self
411    }
412
413    /// Setter for memory block buffer target.
414    pub const fn with_memory_block_buffer_target(
415        mut self,
416        memory_block_buffer_target: u64,
417    ) -> Self {
418        self.memory_block_buffer_target = memory_block_buffer_target;
419        self
420    }
421
422    /// Setter for block buffer limit.
423    pub const fn with_block_buffer_limit(mut self, block_buffer_limit: u32) -> Self {
424        self.block_buffer_limit = block_buffer_limit;
425        self
426    }
427
428    /// Setter for maximum invalid header cache length.
429    pub const fn with_max_invalid_header_cache_length(
430        mut self,
431        max_invalid_header_cache_length: u32,
432    ) -> Self {
433        self.max_invalid_header_cache_length = max_invalid_header_cache_length;
434        self
435    }
436
437    /// Setter for maximum execute block batch size.
438    pub const fn with_max_execute_block_batch_size(
439        mut self,
440        max_execute_block_batch_size: usize,
441    ) -> Self {
442        self.max_execute_block_batch_size = max_execute_block_batch_size;
443        self
444    }
445
446    /// Setter for whether to use the legacy state root calculation method.
447    pub const fn with_legacy_state_root(mut self, legacy_state_root: bool) -> Self {
448        self.legacy_state_root = legacy_state_root;
449        self
450    }
451
452    /// Setter for whether to disable state cache.
453    pub const fn without_state_cache(mut self, disable_state_cache: bool) -> Self {
454        self.disable_state_cache = disable_state_cache;
455        self
456    }
457
458    /// Setter for whether to disable parallel prewarming.
459    pub const fn without_prewarming(mut self, disable_prewarming: bool) -> Self {
460        self.disable_prewarming = disable_prewarming;
461        self
462    }
463
464    /// Setter for whether to always compare trie updates from the state root task to the trie
465    /// updates from the regular state root calculation.
466    pub const fn with_always_compare_trie_updates(
467        mut self,
468        always_compare_trie_updates: bool,
469    ) -> Self {
470        self.always_compare_trie_updates = always_compare_trie_updates;
471        self
472    }
473
474    /// Setter for cross block cache size.
475    pub const fn with_cross_block_cache_size(mut self, cross_block_cache_size: usize) -> Self {
476        self.cross_block_cache_size = cross_block_cache_size;
477        self
478    }
479
480    /// Setter for has enough parallelism.
481    pub const fn with_has_enough_parallelism(mut self, has_enough_parallelism: bool) -> Self {
482        self.has_enough_parallelism = has_enough_parallelism;
483        self
484    }
485
486    /// Setter for state provider metrics.
487    pub const fn with_state_provider_metrics(mut self, state_provider_metrics: bool) -> Self {
488        self.state_provider_metrics = state_provider_metrics;
489        self
490    }
491
492    /// Setter for whether multiproof task should chunk proof targets.
493    pub const fn with_multiproof_chunking_enabled(
494        mut self,
495        multiproof_chunking_enabled: bool,
496    ) -> Self {
497        self.multiproof_chunking_enabled = multiproof_chunking_enabled;
498        self
499    }
500
501    /// Setter for multiproof task chunk size for proof targets.
502    pub const fn with_multiproof_chunk_size(mut self, multiproof_chunk_size: usize) -> Self {
503        self.multiproof_chunk_size = multiproof_chunk_size;
504        self
505    }
506
507    /// Setter for the number of reserved CPU cores for any non-reth processes
508    pub const fn with_reserved_cpu_cores(mut self, reserved_cpu_cores: usize) -> Self {
509        self.reserved_cpu_cores = reserved_cpu_cores;
510        self
511    }
512
513    /// Setter for whether to disable the precompile cache.
514    pub const fn without_precompile_cache(mut self, precompile_cache_disabled: bool) -> Self {
515        self.precompile_cache_disabled = precompile_cache_disabled;
516        self
517    }
518
519    /// Setter for whether to use state root fallback, useful for testing.
520    pub const fn with_state_root_fallback(mut self, state_root_fallback: bool) -> Self {
521        self.state_root_fallback = state_root_fallback;
522        self
523    }
524
525    /// Setter for whether to unwind canonical header to ancestor during forkchoice updates.
526    pub const fn with_unwind_canonical_header(mut self, unwind_canonical_header: bool) -> Self {
527        self.allow_unwind_canonical_header = unwind_canonical_header;
528        self
529    }
530
531    /// Whether or not to use state root task
532    pub const fn use_state_root_task(&self) -> bool {
533        self.has_enough_parallelism && !self.legacy_state_root
534    }
535
536    /// Setter for prewarm max concurrency.
537    pub const fn with_prewarm_max_concurrency(mut self, prewarm_max_concurrency: usize) -> Self {
538        self.prewarm_max_concurrency = prewarm_max_concurrency;
539        self
540    }
541
542    /// Return the prewarm max concurrency.
543    pub const fn prewarm_max_concurrency(&self) -> usize {
544        self.prewarm_max_concurrency
545    }
546
547    /// Return the number of storage proof worker threads.
548    pub const fn storage_worker_count(&self) -> usize {
549        self.storage_worker_count
550    }
551
552    /// Setter for the number of storage proof worker threads.
553    ///
554    /// No-op if it's [`None`].
555    pub const fn with_storage_worker_count_opt(
556        mut self,
557        storage_worker_count: Option<usize>,
558    ) -> Self {
559        if let Some(count) = storage_worker_count {
560            self.storage_worker_count = count;
561        }
562        self
563    }
564
565    /// Return the number of account proof worker threads.
566    pub const fn account_worker_count(&self) -> usize {
567        self.account_worker_count
568    }
569
570    /// Setter for the number of account proof worker threads.
571    ///
572    /// No-op if it's [`None`].
573    pub const fn with_account_worker_count_opt(
574        mut self,
575        account_worker_count: Option<usize>,
576    ) -> Self {
577        if let Some(count) = account_worker_count {
578            self.account_worker_count = count;
579        }
580        self
581    }
582
583    /// Return whether V2 storage proofs are disabled.
584    pub const fn disable_proof_v2(&self) -> bool {
585        self.disable_proof_v2
586    }
587
588    /// Setter for whether to disable V2 storage proofs.
589    pub const fn with_disable_proof_v2(mut self, disable_proof_v2: bool) -> Self {
590        self.disable_proof_v2 = disable_proof_v2;
591        self
592    }
593
594    /// Returns whether cache metrics recording is disabled.
595    pub const fn disable_cache_metrics(&self) -> bool {
596        self.disable_cache_metrics
597    }
598
599    /// Setter for whether to disable cache metrics recording.
600    pub const fn without_cache_metrics(mut self, disable_cache_metrics: bool) -> Self {
601        self.disable_cache_metrics = disable_cache_metrics;
602        self
603    }
604
605    /// Returns whether sparse trie cache is disabled.
606    pub const fn disable_trie_cache(&self) -> bool {
607        self.disable_trie_cache
608    }
609
610    /// Setter for whether to disable sparse trie cache.
611    pub const fn with_disable_trie_cache(mut self, value: bool) -> Self {
612        self.disable_trie_cache = value;
613        self
614    }
615
616    /// Returns the sparse trie prune depth.
617    pub const fn sparse_trie_prune_depth(&self) -> usize {
618        self.sparse_trie_prune_depth
619    }
620
621    /// Setter for sparse trie prune depth.
622    pub const fn with_sparse_trie_prune_depth(mut self, depth: usize) -> Self {
623        self.sparse_trie_prune_depth = depth;
624        self
625    }
626
627    /// Returns the maximum number of storage tries to retain after pruning.
628    pub const fn sparse_trie_max_storage_tries(&self) -> usize {
629        self.sparse_trie_max_storage_tries
630    }
631
632    /// Setter for maximum storage tries to retain.
633    pub const fn with_sparse_trie_max_storage_tries(mut self, max_tries: usize) -> Self {
634        self.sparse_trie_max_storage_tries = max_tries;
635        self
636    }
637
638    /// Returns whether sparse trie cache pruning is disabled.
639    pub const fn disable_sparse_trie_cache_pruning(&self) -> bool {
640        self.disable_sparse_trie_cache_pruning
641    }
642
643    /// Setter for whether to disable sparse trie cache pruning.
644    pub const fn with_disable_sparse_trie_cache_pruning(mut self, value: bool) -> Self {
645        self.disable_sparse_trie_cache_pruning = value;
646        self
647    }
648
649    /// Returns the state root task timeout.
650    pub const fn state_root_task_timeout(&self) -> Option<Duration> {
651        self.state_root_task_timeout
652    }
653
654    /// Setter for state root task timeout.
655    pub const fn with_state_root_task_timeout(mut self, timeout: Option<Duration>) -> Self {
656        self.state_root_task_timeout = timeout;
657        self
658    }
659}