Skip to content

Commit

Permalink
chore(consensus): add sync_retry_interval to config
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaastarkware committed Dec 25, 2024
1 parent 1f01d83 commit 47282a4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/papyrus/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
"privacy": "Public",
"value": 0
},
"consensus.sync_retry_interval": {
"description": "The duration (seconds) between sync attempts.",
"privacy": "Public",
"value": 1.0
},
"consensus.timeouts.precommit_timeout": {
"description": "The timeout (seconds) for a precommit.",
"privacy": "Public",
Expand Down
5 changes: 5 additions & 0 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,11 @@
"privacy": "Public",
"value": 0
},
"consensus_manager_config.consensus_config.sync_retry_interval": {
"description": "The duration (seconds) between sync attempts.",
"privacy": "Public",
"value": 1.0
},
"consensus_manager_config.consensus_config.timeouts.precommit_timeout": {
"description": "The timeout (seconds) for a precommit.",
"privacy": "Public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ expression: dumped_default_config
},
"privacy": "Public"
},
"consensus.sync_retry_interval": {
"description": "The duration (seconds) between sync attempts.",
"value": {
"$serde_json::private::Number": "1.0"
},
"privacy": "Public"
},
"consensus.timeouts.precommit_timeout": {
"description": "The timeout (seconds) for a precommit.",
"value": {
Expand Down
10 changes: 10 additions & 0 deletions crates/sequencing/papyrus_consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub struct ConsensusConfig {
pub consensus_delay: Duration,
/// Timeouts configuration for consensus.
pub timeouts: TimeoutsConfig,
/// The duration (seconds) between sync attempts.
#[serde(deserialize_with = "deserialize_float_seconds_to_duration")]
pub sync_retry_interval: Duration,
/// The network configuration for the consensus.
#[validate]
pub network_config: NetworkConfig,
Expand Down Expand Up @@ -86,6 +89,12 @@ impl SerializeConfig for ConsensusConfig {
"Delay (seconds) before starting consensus to give time for network peering.",
ParamPrivacyInput::Public,
),
ser_param(
"sync_retry_interval",
&self.sync_retry_interval.as_secs_f64(),
"The duration (seconds) between sync attempts.",
ParamPrivacyInput::Public,
),
]);
config.extend(append_sub_config_name(self.timeouts.dump(), "timeouts"));
config.extend(append_sub_config_name(self.network_config.dump(), "network_config"));
Expand All @@ -108,6 +117,7 @@ impl Default for ConsensusConfig {
num_validators: 1,
consensus_delay: Duration::from_secs(5),
timeouts: TimeoutsConfig::default(),
sync_retry_interval: Duration::from_secs_f64(1.0),
network_config,
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/sequencing/papyrus_consensus/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
/// - `must_observer`: Whether the node must observe or if it is allowed to be active (assuming
/// it is in the validator set).
#[instrument(skip(self, context, broadcast_channels, sync_receiver), level = "info")]
#[allow(clippy::too_many_arguments)]
pub(crate) async fn run_height<SyncReceiverT>(
&mut self,
context: &mut ContextT,
Expand Down

0 comments on commit 47282a4

Please sign in to comment.