diff --git a/crates/orchestrator/run-config.toml b/crates/orchestrator/run-config.toml index 946e4319aa..e543d1ef0d 100644 --- a/crates/orchestrator/run-config.toml +++ b/crates/orchestrator/run-config.toml @@ -42,6 +42,10 @@ cdn_marshal_address = "127.0.0.1:9000" [config] num_nodes_with_stake = 10 num_nodes_without_stake = 0 +start_threshold = [ + 8, + 10, +] staked_committee_nodes = 10 non_staked_committee_nodes = 0 fixed_leader_for_gpuvid = 0 diff --git a/crates/orchestrator/src/config.rs b/crates/orchestrator/src/config.rs index e23a2d8856..a7e44f2892 100644 --- a/crates/orchestrator/src/config.rs +++ b/crates/orchestrator/src/config.rs @@ -566,6 +566,9 @@ fn default_builder_url() -> Url { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[serde(bound(deserialize = ""))] pub struct HotShotConfigFile { + /// The proportion of nodes required before the orchestrator issues the ready signal, + /// expressed as (numerator, denominator) + pub start_threshold: (u64, u64), /// Total number of staked nodes in the network pub num_nodes_with_stake: NonZeroUsize, /// Total number of non-staked nodes in the network @@ -667,6 +670,7 @@ impl From> for HotS fn from(val: HotShotConfigFile) -> Self { HotShotConfig { execution_type: ExecutionType::Continuous, + start_threshold: val.start_threshold, num_nodes_with_stake: val.num_nodes_with_stake, num_nodes_without_stake: val.num_nodes_without_stake, known_da_nodes: val.known_da_nodes, @@ -737,6 +741,7 @@ impl Default for HotShotConfigFile { Self { num_nodes_with_stake: NonZeroUsize::new(10).unwrap(), + start_threshold: (8, 10), num_nodes_without_stake: 0, my_own_validator_config: ValidatorConfig::default(), known_nodes_with_stake: gen_known_nodes_with_stake, diff --git a/crates/orchestrator/src/lib.rs b/crates/orchestrator/src/lib.rs index 3535f24674..d7250320ef 100644 --- a/crates/orchestrator/src/lib.rs +++ b/crates/orchestrator/src/lib.rs @@ -334,7 +334,11 @@ where fn post_ready(&mut self) -> Result<(), ServerError> { self.nodes_connected += 1; println!("Nodes connected: {}", self.nodes_connected); - if self.nodes_connected >= (self.config.config.num_nodes_with_stake.get() as u64) { + // i.e. nodes_connected >= num_nodes_with_stake * (start_threshold.0 / start_threshold.1) + if self.nodes_connected * self.config.config.start_threshold.1 + >= (self.config.config.num_nodes_with_stake.get() as u64) + * self.config.config.start_threshold.0 + { self.start = true; } Ok(()) diff --git a/crates/testing/src/test_builder.rs b/crates/testing/src/test_builder.rs index d80f0f85c0..8421de7f8d 100644 --- a/crates/testing/src/test_builder.rs +++ b/crates/testing/src/test_builder.rs @@ -286,6 +286,7 @@ impl TestDescription { let config = HotShotConfig { // TODO this doesn't exist anymore execution_type: ExecutionType::Incremental, + start_threshold: (1, 1), num_nodes_with_stake: NonZeroUsize::new(num_nodes_with_stake).unwrap(), // Currently making this zero for simplicity known_da_nodes, diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 12e080b1ff..e9ca937f5d 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -160,6 +160,9 @@ impl Default for PeerConfig { pub struct HotShotConfig { /// Whether to run one view or continuous views pub execution_type: ExecutionType, + /// The proportion of nodes required before the orchestrator issues the ready signal, + /// expressed as (numerator, denominator) + pub start_threshold: (u64, u64), /// Total number of nodes in the network // Earlier it was total_nodes pub num_nodes_with_stake: NonZeroUsize,