-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconfig.rs
More file actions
39 lines (34 loc) · 1.35 KB
/
config.rs
File metadata and controls
39 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::sync::Arc;
/// Configuration for the chain orchestrator.
#[derive(Debug)]
pub struct ChainOrchestratorConfig<ChainSpec> {
/// The chain specification.
chain_spec: Arc<ChainSpec>,
/// The threshold for optimistic sync. If the received block is more than this many blocks
/// ahead of the current chain, we optimistically sync the chain.
optimistic_sync_threshold: u64,
/// The L1 message queue index at which the V2 L1 message queue was enabled.
l1_v2_message_queue_start_index: u64,
}
impl<ChainSpec> ChainOrchestratorConfig<ChainSpec> {
/// Creates a new chain configuration.
pub const fn new(
chain_spec: Arc<ChainSpec>,
optimistic_sync_threshold: u64,
l1_v2_message_queue_start_index: u64,
) -> Self {
Self { chain_spec, optimistic_sync_threshold, l1_v2_message_queue_start_index }
}
/// Returns a reference to the chain specification.
pub const fn chain_spec(&self) -> &Arc<ChainSpec> {
&self.chain_spec
}
/// Returns the optimistic sync threshold.
pub const fn optimistic_sync_threshold(&self) -> u64 {
self.optimistic_sync_threshold
}
/// Returns the L1 message queue index at which the V2 L1 message queue was enabled.
pub const fn l1_v2_message_queue_start_index(&self) -> u64 {
self.l1_v2_message_queue_start_index
}
}