fuel_core_shared_sequencer/config.rs
1use std::time::Duration;
2
3/// Endpoints for the shared sequencer client.
4#[derive(Debug, Clone)]
5pub struct Endpoints {
6 /// The RPC address of the sequencer chain tendermint API
7 /// (e.g. "http://127.0.0.1:26657")
8 pub tendermint_rpc_api: String,
9 /// The REST address of the sequencer chain tendermint API
10 /// (e.g. "http://127.0.0.1:1317")
11 pub blockchain_rest_api: String,
12}
13
14/// Configuration for the shared sequencer client
15#[derive(Debug, Clone)]
16pub struct Config {
17 /// Whether the sequencer is enabled.
18 pub enabled: bool,
19 /// The frequency at which to post blocks to the shared sequencer.
20 pub block_posting_frequency: Duration,
21 /// Endpoints for the shared sequencer client.
22 pub endpoints: Option<Endpoints>,
23 /// Topic to post blocks to
24 pub topic: [u8; 32],
25 /// Per-request timeout applied to REST/RPC calls against the shared
26 /// sequencer endpoints. Bounds how long a single HTTP request can hang
27 /// before failing, which in turn bounds shutdown latency.
28 pub http_request_timeout: Duration,
29 /// TCP connect timeout for REST/RPC calls.
30 pub http_connect_timeout: Duration,
31}
32
33impl Config {
34 /// Default configuration for locally running shared sequencer node
35 pub fn local_node() -> Self {
36 Self {
37 enabled: false,
38 block_posting_frequency: Duration::from_secs(12),
39 endpoints: None,
40 topic: [0u8; 32],
41 http_request_timeout: Duration::from_secs(5),
42 http_connect_timeout: Duration::from_secs(3),
43 }
44 }
45}