@@ -5,17 +5,40 @@ static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::ne
5
5
6
6
use clap:: { Args , Parser } ;
7
7
use reth:: { args:: utils:: DefaultChainSpecParser , cli:: Cli } ;
8
- use reth_node_builder:: EngineNodeLauncher ;
8
+ use reth_node_builder:: {
9
+ engine_tree_config:: {
10
+ TreeConfig , DEFAULT_MEMORY_BLOCK_BUFFER_TARGET , DEFAULT_PERSISTENCE_THRESHOLD ,
11
+ } ,
12
+ EngineNodeLauncher ,
13
+ } ;
9
14
use reth_node_ethereum:: { node:: EthereumAddOns , EthereumNode } ;
10
15
use reth_provider:: providers:: BlockchainProvider2 ;
11
16
12
17
/// Parameters for configuring the engine
13
- #[ derive( Debug , Clone , Args , PartialEq , Eq , Default ) ]
18
+ #[ derive( Debug , Clone , Args , PartialEq , Eq ) ]
14
19
#[ command( next_help_heading = "Engine" ) ]
15
20
pub struct EngineArgs {
16
21
/// Enable the engine2 experimental features on reth binary
17
22
#[ arg( long = "engine.experimental" , default_value = "false" ) ]
18
23
pub experimental : bool ,
24
+
25
+ /// Configure persistence threshold for engine experimental.
26
+ #[ arg( long = "engine.persistence-threshold" , requires = "experimental" , default_value_t = DEFAULT_PERSISTENCE_THRESHOLD ) ]
27
+ pub persistence_threshold : u64 ,
28
+
29
+ /// Configure the target number of blocks to keep in memory.
30
+ #[ arg( long = "engine.memory-block-buffer-target" , requires = "experimental" , default_value_t = DEFAULT_MEMORY_BLOCK_BUFFER_TARGET ) ]
31
+ pub memory_block_buffer_target : u64 ,
32
+ }
33
+
34
+ impl Default for EngineArgs {
35
+ fn default ( ) -> Self {
36
+ Self {
37
+ experimental : false ,
38
+ persistence_threshold : DEFAULT_PERSISTENCE_THRESHOLD ,
39
+ memory_block_buffer_target : DEFAULT_MEMORY_BLOCK_BUFFER_TARGET ,
40
+ }
41
+ }
19
42
}
20
43
21
44
fn main ( ) {
@@ -31,6 +54,9 @@ fn main() {
31
54
let enable_engine2 = engine_args. experimental ;
32
55
match enable_engine2 {
33
56
true => {
57
+ let engine_tree_config = TreeConfig :: default ( )
58
+ . with_persistence_threshold ( engine_args. persistence_threshold )
59
+ . with_memory_block_buffer_target ( engine_args. memory_block_buffer_target ) ;
34
60
let handle = builder
35
61
. with_types_and_provider :: < EthereumNode , BlockchainProvider2 < _ > > ( )
36
62
. with_components ( EthereumNode :: components ( ) )
@@ -39,6 +65,7 @@ fn main() {
39
65
let launcher = EngineNodeLauncher :: new (
40
66
builder. task_executor ( ) . clone ( ) ,
41
67
builder. config ( ) . datadir ( ) ,
68
+ engine_tree_config,
42
69
) ;
43
70
builder. launch_with ( launcher)
44
71
} )
0 commit comments