diem_config/config/state_sync_config.rs
1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use serde::{Deserialize, Serialize};
9
10#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
11#[serde(default, deny_unknown_fields)]
12pub struct StateSyncConfig {
13 // Size of chunk to request for state synchronization
14 pub chunk_limit: u64,
15 // The timeout of the state sync client to process a commit notification
16 // (in milliseconds)
17 pub client_commit_timeout_ms: u64,
18 // default timeout used for long polling to remote peer
19 pub long_poll_timeout_ms: u64,
20 // valid maximum chunk limit for sanity check
21 pub max_chunk_limit: u64,
22 // valid maximum timeout limit for sanity check
23 pub max_timeout_ms: u64,
24 // The timeout of the state sync coordinator to receive a commit ack from
25 // mempool (in milliseconds)
26 pub mempool_commit_timeout_ms: u64,
27 // default timeout to make state sync progress by sending chunk requests to
28 // a certain number of networks if no progress is made by sending chunk
29 // requests to a number of networks, the next sync request will be
30 // multicasted, i.e. sent to more networks
31 pub multicast_timeout_ms: u64,
32 // The timeout for ensuring sync requests are making progress (i.e., the
33 // maximum time between commits when processing a sync request).
34 pub sync_request_timeout_ms: u64,
35 // interval used for checking state synchronization progress
36 pub tick_interval_ms: u64,
37}
38
39impl Default for StateSyncConfig {
40 fn default() -> Self {
41 Self {
42 chunk_limit: 1000,
43 client_commit_timeout_ms: 5_000,
44 long_poll_timeout_ms: 10_000,
45 max_chunk_limit: 1000,
46 max_timeout_ms: 120_000,
47 mempool_commit_timeout_ms: 5_000,
48 multicast_timeout_ms: 30_000,
49 sync_request_timeout_ms: 60_000,
50 tick_interval_ms: 100,
51 }
52 }
53}