Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adjust block sync timeouts #6342

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions base_layer/core/src/base_node/sync/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ pub struct BlockchainSyncConfig {
pub validation_concurrency: usize,
/// The RPC deadline to set on sync clients. If this deadline is reached, a new sync peer will be selected for
/// sync.
#[serde(with = "serializers::seconds")]
pub rpc_deadline: Duration,
}

impl Default for BlockchainSyncConfig {
fn default() -> Self {
Self {
initial_max_sync_latency: Duration::from_secs(15),
max_latency_increase: Duration::from_secs(2),
ban_period: Duration::from_secs(60 * 60 * 2), // 2 hours
short_ban_period: Duration::from_secs(240), // 4 mins
initial_max_sync_latency: Duration::from_secs(240), // Syncing many full blocks over tor require this
max_latency_increase: Duration::from_secs(10), // Syncing many full blocks over tor require this
ban_period: Duration::from_secs(60 * 60 * 2), // 2 hours
short_ban_period: Duration::from_secs(240), // 4 mins
forced_sync_peers: Default::default(),
validation_concurrency: 6,
rpc_deadline: Duration::from_secs(15),
rpc_deadline: Duration::from_secs(240), // Syncing many full blocks over tor require this
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl<'a, B: BlockchainBackend + 'static> HorizonStateSynchronization<'a, B> {

let config = RpcClient::builder()
.with_deadline(self.config.rpc_deadline)
.with_deadline_grace_period(Duration::from_secs(3));
.with_deadline_grace_period(Duration::from_secs(5));

let mut client = conn
.connect_rpc_using_builder::<rpc::BaseNodeSyncRpcClient>(config)
Expand Down
23 changes: 14 additions & 9 deletions common/config/presets/c_base_node_c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,25 @@ track_reorgs = true
#service.block_sync_trigger = 5

[base_node.state_machine]
# The initial max sync latency. If a peer fails to stream a header/block within this deadline another sync peer will be
# selected. If there are no further peers the sync will be restarted with an increased by `max_latency_increase`.
#blockchain_sync_config.initial_max_sync_latency = 15
# If all sync peers exceed latency increase allowed latency by this value
#blockchain_sync_config.max_latency_increase =2
# Longer ban period for potentially malicious infractions (protocol violations etc.)
# The initial max sync latency (seconds). If a peer fails to stream a header/block within this deadline another sync
# peer will be selected. If there are no further peers the sync will be restarted with an increased by
# `max_latency_increase`. [default = 240]
blockchain_sync_config.initial_max_sync_latency = 240
# If all sync peers exceed latency increase allowed latency by this value (seconds) [default = 10]
blockchain_sync_config.max_latency_increase = 10
# Longer ban period (seconds) for potentially malicious infractions (protocol violations etc.) [default = 2 hours]
#blockchain_sync_config.ban_period = 7_200 # 2 * 60 * 60
# Short ban period for infractions that are likely not malicious (slow to respond spotty connections etc)
# Short ban period (seconds) for infractions that are likely not malicious (slow to respond spotty connections etc)
# [default = 4 minutes]
#blockchain_sync_config.short_ban_period = 240
# An allowlist of sync peers from which to sync. No other peers will be selected for sync. If empty sync peers
# are chosen based on their advertised chain metadata.
# are chosen based on their advertised chain metadata. [default = []]
#blockchain_sync_config.forced_sync_peers = []
# Number of threads to use for validation
# Number of threads to use for validation [default = 6]
#blockchain_sync_config.validation_concurrency = 6
# The RPC deadline to set on sync clients. If this deadline is reached, a new sync peer will be selected for sync.
# [default = 240]
blockchain_sync_config.rpc_deadline = 240

# The maximum amount of VMs that RandomX will be use (default = 0)
#max_randomx_vms = 0
Expand Down
Loading