Skip to content

Commit

Permalink
introduce separate config for health
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalajiarun committed Jan 8, 2024
1 parent d5d7199 commit 2140a13
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
22 changes: 19 additions & 3 deletions config/src/config/dag_consensus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,32 @@ impl Default for DagRoundStateConfig {
}
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct DagHealthConfig {
pub chain_backoff_config: Vec<ChainHealthBackoffValues>,
pub voter_pipeline_latency_limit_ms: u64,
pub pipeline_backpressure_config: Vec<PipelineBackpressureValues>,
}

impl Default for DagHealthConfig {
fn default() -> Self {
Self {
chain_backoff_config: Vec::new(),
voter_pipeline_latency_limit_ms: 30_000,
pipeline_backpressure_config: Vec::new(),
}
}
}

#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct DagConsensusConfig {
pub node_payload_config: DagPayloadConfig,
pub rb_config: ReliableBroadcastConfig,
pub fetcher_config: DagFetcherConfig,
pub round_state_config: DagRoundStateConfig,
pub chain_backoff_config: Vec<ChainHealthBackoffValues>,
pub voter_pipeline_latency_limit_ms: u64,
pub pipeline_backpressure_config: Vec<PipelineBackpressureValues>,
pub health_config: DagHealthConfig,
#[serde(default = "QuorumStoreConfig::default_for_dag")]
pub quorum_store: QuorumStoreConfig,
}
Expand Down
13 changes: 10 additions & 3 deletions consensus/src/dag/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,21 @@ impl DagBootstrapper {

let chain_health: Arc<dyn TChainHealth> = match may_be_leader_reputation {
Some(adapter) => ChainHealthBackoff::new(
ChainHealthBackoffConfig::new(self.config.chain_backoff_config.clone()),
ChainHealthBackoffConfig::new(
self.config.health_config.chain_backoff_config.clone(),
),
adapter.clone(),
),
None => NoChainHealth::new(),
};
let pipeline_health = PipelineLatencyBasedBackpressure::new(
Duration::from_millis(self.config.voter_pipeline_latency_limit_ms),
PipelineBackpressureConfig::new(self.config.pipeline_backpressure_config.clone()),
Duration::from_millis(self.config.health_config.voter_pipeline_latency_limit_ms),
PipelineBackpressureConfig::new(
self.config
.health_config
.pipeline_backpressure_config
.clone(),
),
ordered_notifier.clone(),
);
let health_backoff =
Expand Down

0 comments on commit 2140a13

Please sign in to comment.