Skip to content

Commit

Permalink
Enhance test lab infrastructure
Browse files Browse the repository at this point in the history
To decide at a higher level if key certification is enabled.
  • Loading branch information
jpraynaud committed Oct 10, 2022
1 parent 2d03b4b commit 30ffa3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 0 additions & 3 deletions mithril-test-lab/mithril-end-to-end/src/devnet/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub struct BftNode {

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PoolNode {
pub node_index: u64,
pub db_path: PathBuf,
pub socket_path: PathBuf,
pool_env_path: PathBuf,
Expand Down Expand Up @@ -137,7 +136,6 @@ impl Devnet {
let pool_nodes = (1..=self.number_of_pool_nodes)
.into_iter()
.map(|n| PoolNode {
node_index: (n - 1) as u64,
db_path: self.artifacts_dir.join(format!("node-pool{}/db", n)),
socket_path: self
.artifacts_dir
Expand Down Expand Up @@ -255,7 +253,6 @@ mod tests {
socket_path: PathBuf::from(r"test/path/node-bft1/ipc/node.sock"),
}],
pool_nodes: vec![PoolNode {
node_index: 0,
db_path: PathBuf::from(r"test/path/node-pool1/db"),
socket_path: PathBuf::from(r"test/path/node-pool1/ipc/node.sock"),
pool_env_path: PathBuf::from(r"test/path/node-pool1/pool.env"),
Expand Down
4 changes: 3 additions & 1 deletion mithril-test-lab/mithril-end-to-end/src/end_to_end_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl Spec {
bootstrap_genesis_certificate(self.infrastructure.aggregator_mut()).await?;
wait_for_epoch_settings(&aggregator_endpoint).await?;

// Wait 2 epochs before changing stake distribution, so that we use at least once original stake distribution
target_epoch += 2;
wait_for_target_epoch(
self.infrastructure.chain_observer(),
Expand All @@ -50,11 +51,12 @@ impl Spec {
.await?;
delegate_stakes_to_pools(self.infrastructure.devnet()).await?;

// Wait 5 epochs after stake delegation, so that we make sure that we use new stake distribution a few times
target_epoch += 5;
wait_for_target_epoch(
self.infrastructure.chain_observer(),
target_epoch,
"epoch after which the certificate chain will be long enough".to_string(),
"epoch after which the certificate chain will be long enough to catch most common troubles".to_string(),
)
.await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ impl MithrilInfrastructure {
aggregator.serve()?;

let mut signers: Vec<Signer> = vec![];
for pool_node in devnet_topology.pool_nodes {
for (index, pool_node) in devnet_topology.pool_nodes.iter().enumerate() {
// 50% of signers with key certification
// TODO: Should be removed 100% once the signer certification is fully deployed
let enable_certification = index % 2 == 0;
let mut signer = Signer::new(
aggregator.endpoint(),
&pool_node,
pool_node,
&devnet.cardano_cli_path(),
work_dir,
bin_dir,
enable_certification,
)?;
signer.start()?;

Expand Down
6 changes: 2 additions & 4 deletions mithril-test-lab/mithril-end-to-end/src/mithril/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl Signer {
cardano_cli_path: &Path,
work_dir: &Path,
bin_dir: &Path,
enable_certification: bool,
) -> Result<Self, String> {
let party_id = pool_node.party_id()?;
let magic_id = DEVNET_MAGIC_ID.to_string();
Expand All @@ -37,8 +38,7 @@ impl Signer {
),
("CARDANO_CLI_PATH", cardano_cli_path.to_str().unwrap()),
]);
if pool_node.node_index % 2 == 0 {
// 50% of signers with key certification
if enable_certification {
env.insert(
"KES_SECRET_KEY_PATH",
pool_node.kes_secret_key_path.to_str().unwrap(),
Expand All @@ -48,8 +48,6 @@ impl Signer {
pool_node.operational_certificate_path.to_str().unwrap(),
);
} else {
// 50% of signers without key certification (legacy)
// TODO: Should be removed once the signer certification is fully deployed
env.insert("PARTY_ID", &party_id);
}
let args = vec!["-vvv"];
Expand Down

0 comments on commit 30ffa3c

Please sign in to comment.