Skip to content

Commit 03a1a51

Browse files
committed
Update and make crash end to end test
Added a protocol parameters transition that make the test fail, when it should succeed.
1 parent bc19ee5 commit 03a1a51

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

mithril-test-lab/mithril-end-to-end/src/end_to_end_spec.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ impl Spec {
5656
wait_for_target_epoch(
5757
self.infrastructure.chain_observer(),
5858
target_epoch,
59-
"epoch after which the certificate chain will be long enough to catch most common troubles".to_string(),
59+
"epoch after which the certificate chain will be long enough to catch most common troubles with stake distribution".to_string(),
60+
)
61+
.await?;
62+
63+
// Wait 5 epochs after updating protocol parameters, so that we make sure that we use new protool parameters a few times
64+
update_protocol_parameters(self.infrastructure.aggregator_mut()).await?;
65+
wait_for_epoch_settings(&aggregator_endpoint).await?;
66+
target_epoch += 5;
67+
wait_for_target_epoch(
68+
self.infrastructure.chain_observer(),
69+
target_epoch,
70+
"epoch after which the certificate chain will be long enough to catch most common troubles with protocol parameters".to_string(),
6071
)
6172
.await?;
6273

@@ -210,6 +221,19 @@ async fn delegate_stakes_to_pools(devnet: &Devnet) -> Result<(), String> {
210221
Ok(())
211222
}
212223

224+
async fn update_protocol_parameters(aggregator: &mut Aggregator) -> Result<(), String> {
225+
info!("Update protocol parameters");
226+
227+
info!("> stopping aggregator");
228+
aggregator.stop().await?;
229+
info!("> updating protocol parameters ...");
230+
aggregator.update_protocol_parameters();
231+
info!("> done, restarting aggregator");
232+
aggregator.serve()?;
233+
234+
Ok(())
235+
}
236+
213237
async fn assert_node_producing_snapshot(aggregator_endpoint: &str) -> Result<String, String> {
214238
let url = format!("{}/snapshots", aggregator_endpoint);
215239
info!("Waiting for the aggregator to produce a snapshot");

mithril-test-lab/mithril-end-to-end/src/mithril/aggregator.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ impl Aggregator {
105105
Ok(())
106106
}
107107

108+
pub fn update_protocol_parameters(&mut self) {
109+
self.command.set_env_var("PROTOCOL_PARAMETERS__K", "150");
110+
self.command.set_env_var("PROTOCOL_PARAMETERS__M", "200");
111+
self.command
112+
.set_env_var("PROTOCOL_PARAMETERS__PHI_F", "0.95");
113+
}
114+
108115
pub async fn tail_logs(&self, number_of_line: u64) -> Result<(), String> {
109116
self.command.tail_logs(None, number_of_line).await
110117
}

mithril-test-lab/mithril-end-to-end/src/utils/mithril_command.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ impl MithrilCommand {
5656
self.log_path = self.work_dir.join(format!("{}.log", name));
5757
}
5858

59+
pub fn set_env_var(&mut self, name: &str, value: &str) {
60+
self.env_vars.insert(name.to_string(), value.to_string());
61+
}
62+
5963
pub fn start(&mut self, args: &[String]) -> Result<Child, String> {
6064
let args = [&self.default_args, args].concat();
6165

0 commit comments

Comments
 (0)