Expand cluster-sm/local testnet to 4 validators for BFT where f=1

This commit is contained in:
Luke Parker
2023-08-06 13:42:16 -04:00
parent cee788eac3
commit 0dd8aed134
5 changed files with 10 additions and 7 deletions

View File

@@ -22,8 +22,9 @@ All commands are assumed to be ran from `/deploy`, not the root folder.
* `processor` - Serai processor for one external network. * `processor` - Serai processor for one external network.
* `serai` - Serai node * `serai` - Serai node
* `cluster-sm` - "Alice", "Bob", and "Charlie" Serai nodes, all as validators * `cluster-sm` - "Alice", "Bob", "Charlie", and "Dave" Serai nodes, all as
* `cluster-lg` - `cluster-sm` with non-validators "Dave", "Eve", and "Ferdie" validators (enough to achieve BFT with one faulty node)
* `cluster-lg` - `cluster-sm` with non-validators "Eve" and "Ferdie"
You can supply one or more profiles to the docker compose command to orchestrate You can supply one or more profiles to the docker compose command to orchestrate
the desired components. the desired components.

View File

@@ -168,10 +168,12 @@ services:
hostname: serai-dave hostname: serai-dave
profiles: profiles:
- dave - dave
- cluster-sm
- cluster-lg - cluster-lg
environment: environment:
CHAIN: local CHAIN: local
NAME: dave NAME: dave
VALIDATOR: true
serai-eve: serai-eve:
<<: *serai_defaults <<: *serai_defaults

View File

@@ -124,7 +124,7 @@ pub fn testnet_config() -> Result<ChainSpec, &'static str> {
|| { || {
testnet_genesis( testnet_genesis(
wasm_binary, wasm_binary,
&["Alice", "Bob", "Charlie"], &["Alice", "Bob", "Charlie", "Dave"],
vec![ vec![
account_from_name("Alice"), account_from_name("Alice"),
account_from_name("Bob"), account_from_name("Bob"),

View File

@@ -36,7 +36,7 @@ pub fn coordinator_instance(
("DB_PATH".to_string(), "./coordinator-db".to_string()), ("DB_PATH".to_string(), "./coordinator-db".to_string()),
("SERAI_KEY".to_string(), { ("SERAI_KEY".to_string(), {
use serai_client::primitives::insecure_pair_from_name; use serai_client::primitives::insecure_pair_from_name;
hex::encode(insecure_pair_from_name(name).as_ref().secret.to_bytes()[.. 32].as_ref()) hex::encode(&insecure_pair_from_name(name).as_ref().secret.to_bytes()[.. 32])
}), }),
] ]
.into(), .into(),

View File

@@ -13,7 +13,7 @@ use dockertest::DockerTest;
use crate::*; use crate::*;
pub(crate) const COORDINATORS: usize = 3; pub(crate) const COORDINATORS: usize = 4;
// pub(crate) const THRESHOLD: usize = ((COORDINATORS * 2) / 3) + 1; // pub(crate) const THRESHOLD: usize = ((COORDINATORS * 2) / 3) + 1;
fn new_test() -> (Vec<(Handles, <Ristretto as Ciphersuite>::F)>, DockerTest) { fn new_test() -> (Vec<(Handles, <Ristretto as Ciphersuite>::F)>, DockerTest) {
@@ -27,7 +27,7 @@ fn new_test() -> (Vec<(Handles, <Ristretto as Ciphersuite>::F)>, DockerTest) {
3 => "Dave", 3 => "Dave",
4 => "Eve", 4 => "Eve",
5 => "Ferdie", 5 => "Ferdie",
_ => panic!("needed a 6th name for a serai node"), _ => panic!("needed a 7th name for a serai node"),
}); });
coordinators.push((handles, coord_key)); coordinators.push((handles, coord_key));
for composition in compositions { for composition in compositions {
@@ -63,7 +63,7 @@ async fn stack_test() {
}, },
params: ThresholdParams::new( params: ThresholdParams::new(
3, 3,
3, 4,
Participant::new(u16::try_from(i).unwrap() + 1).unwrap() Participant::new(u16::try_from(i).unwrap() + 1).unwrap()
) )
.unwrap() .unwrap()