diff --git a/crates/hotshot/examples/infra/mod.rs b/crates/hotshot/examples/infra/mod.rs index 738b849402..6a0b54d3dd 100644 --- a/crates/hotshot/examples/infra/mod.rs +++ b/crates/hotshot/examples/infra/mod.rs @@ -107,14 +107,12 @@ pub fn load_config_from_file( config_toml.into(); // Generate network's public keys - let mut known_nodes_sk = Vec::new(); let known_nodes: Vec<_> = (0..config.config.total_nodes.get()) .map(|node_id| { let (key_pair, sk) = TYPES::SignatureKey::generated_from_seed_indexed( config.seed, node_id.try_into().unwrap(), ); - known_nodes_sk.push(sk); key_pair }) .collect(); diff --git a/crates/orchestrator/src/config.rs b/crates/orchestrator/src/config.rs index 79ea891bed..a35e413383 100644 --- a/crates/orchestrator/src/config.rs +++ b/crates/orchestrator/src/config.rs @@ -176,6 +176,8 @@ pub struct HotShotConfigFile { pub total_nodes: NonZeroUsize, /// My own public key, secret key, stake value pub my_own_validator_config: ValidatorConfig, + /// The known nodes' public key and stake value + pub known_nodes_with_stake: Vec, /// Number of committee nodes pub committee_nodes: usize, /// Maximum transactions per block @@ -205,7 +207,7 @@ impl From> for HotS total_nodes: val.total_nodes, max_transactions: val.max_transactions, min_transactions: val.min_transactions, - known_nodes_with_stake: Vec::new(), + known_nodes_with_stake: val.known_nodes_with_stake, my_own_validator_config: val.my_own_validator_config, da_committee_size: val.committee_nodes, next_view_timeout: val.next_view_timeout, @@ -233,9 +235,18 @@ fn default_padding() -> usize { impl Default for HotShotConfigFile { fn default() -> Self { + let gen_known_nodes_with_stake = (0..10) + .map(|node_id| { + let cur_validator_config: ValidatorConfig = + ValidatorConfig::generated_from_seed_indexed([0u8; 32], node_id, 1); + + cur_validator_config.public_key.get_stake_table_entry(cur_validator_config.stake_value) + } ) + .collect(); Self { total_nodes: NonZeroUsize::new(10).unwrap(), my_own_validator_config: ValidatorConfig::default(), + known_nodes_with_stake: gen_known_nodes_with_stake, committee_nodes: 5, max_transactions: NonZeroUsize::new(100).unwrap(), min_transactions: 1,