@@ -21,6 +21,8 @@ pub struct SequencerConfig {
21
21
pub block_production_interval_ms : u64 ,
22
22
/// Bridge system contract initialize function parameters
23
23
pub bridge_initialize_params : String ,
24
+ /// Configuration for the listen mode sequencer
25
+ pub listen_mode_config : Option < ListenModeConfig > ,
24
26
}
25
27
26
28
impl Default for SequencerConfig {
@@ -35,6 +37,7 @@ impl Default for SequencerConfig {
35
37
da_update_interval_ms : 100 ,
36
38
mempool_conf : SequencerMempoolConfig :: default ( ) ,
37
39
bridge_initialize_params : PRE_FORK2_BRIDGE_INITIALIZE_PARAMS . to_string ( ) ,
40
+ listen_mode_config : None ,
38
41
}
39
42
}
40
43
}
@@ -73,6 +76,24 @@ impl Default for SequencerMempoolConfig {
73
76
}
74
77
}
75
78
79
+ /// Configuration for the listen mode sequencer
80
+ #[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
81
+ pub struct ListenModeConfig {
82
+ /// The sequencer client URL to connect to
83
+ pub sequencer_client_url : String ,
84
+ /// The number of blocks to sync from the sequencer
85
+ pub sync_blocks_count : u64 ,
86
+ }
87
+
88
+ impl Default for ListenModeConfig {
89
+ fn default ( ) -> Self {
90
+ ListenModeConfig {
91
+ sequencer_client_url : "http://localhost:8545" . to_string ( ) ,
92
+ sync_blocks_count : 10 ,
93
+ }
94
+ }
95
+ }
96
+
76
97
#[ cfg( test) ]
77
98
mod tests {
78
99
use std:: io:: Write ;
@@ -130,6 +151,60 @@ mod tests {
130
151
da_update_interval_ms : 1000 ,
131
152
block_production_interval_ms : 1000 ,
132
153
bridge_initialize_params : PRE_FORK2_BRIDGE_INITIALIZE_PARAMS . to_string ( ) ,
154
+ listen_mode_config : None ,
155
+ } ;
156
+ assert_eq ! ( config, expected) ;
157
+ }
158
+
159
+ #[ test]
160
+ fn test_correct_config_listen_mode_sequencer ( ) {
161
+ let config = r#"
162
+ private_key = "1212121212121212121212121212121212121212121212121212121212121212"
163
+ max_l2_blocks_per_commitment = 123
164
+ test_mode = false
165
+ deposit_mempool_fetch_limit = 10
166
+ da_update_interval_ms = 1000
167
+ block_production_interval_ms = 1000
168
+ bridge_initialize_params = "000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000008ac7230489e80000000000000000000000000000000000000000000000000000000000000000002d4a209fb3a961d8b1f4ec1caa220c6a50b815febc0b689ddf0b9ddfbf99cb74479e41ac0063066369747265611400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a08000000003b9aca006800000000000000000000000000000000000000000000"
169
+ [mempool_conf]
170
+ pending_tx_limit = 100000
171
+ pending_tx_size = 200
172
+ queue_tx_limit = 100000
173
+ queue_tx_size = 200
174
+ base_fee_tx_limit = 100000
175
+ base_fee_tx_size = 200
176
+ max_account_slots = 16
177
+ [listen_mode_config]
178
+ sequencer_client_url = "http://localhost:8545"
179
+ sync_blocks_count = 10
180
+ "# ;
181
+
182
+ let config_file = create_config_from ( config) ;
183
+
184
+ let config: SequencerConfig = from_toml_path ( config_file. path ( ) ) . unwrap ( ) ;
185
+
186
+ let expected = SequencerConfig {
187
+ private_key : "1212121212121212121212121212121212121212121212121212121212121212"
188
+ . to_string ( ) ,
189
+ max_l2_blocks_per_commitment : 123 ,
190
+ test_mode : false ,
191
+ deposit_mempool_fetch_limit : 10 ,
192
+ mempool_conf : SequencerMempoolConfig {
193
+ pending_tx_limit : 100000 ,
194
+ pending_tx_size : 200 ,
195
+ queue_tx_limit : 100000 ,
196
+ queue_tx_size : 200 ,
197
+ base_fee_tx_limit : 100000 ,
198
+ base_fee_tx_size : 200 ,
199
+ max_account_slots : 16 ,
200
+ } ,
201
+ da_update_interval_ms : 1000 ,
202
+ block_production_interval_ms : 1000 ,
203
+ bridge_initialize_params : PRE_FORK2_BRIDGE_INITIALIZE_PARAMS . to_string ( ) ,
204
+ listen_mode_config : Some ( ListenModeConfig {
205
+ sequencer_client_url : "http://localhost:8545" . to_string ( ) ,
206
+ sync_blocks_count : 10 ,
207
+ } ) ,
133
208
} ;
134
209
assert_eq ! ( config, expected) ;
135
210
}
0 commit comments