diff --git a/Cargo.lock b/Cargo.lock index d1e7c45d8d2..9af686d6430 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4603,7 +4603,7 @@ dependencies = [ [[package]] name = "mithril-end-to-end" -version = "0.5.9" +version = "0.5.10" dependencies = [ "anyhow", "async-recursion", diff --git a/mithril-test-lab/mithril-end-to-end/Cargo.toml b/mithril-test-lab/mithril-end-to-end/Cargo.toml index 9223981b088..b0f18df0b04 100644 --- a/mithril-test-lab/mithril-end-to-end/Cargo.toml +++ b/mithril-test-lab/mithril-end-to-end/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-end-to-end" -version = "0.5.9" +version = "0.5.10" authors = { workspace = true } edition = { workspace = true } documentation = { workspace = true } diff --git a/mithril-test-lab/mithril-end-to-end/src/scenario/full.rs b/mithril-test-lab/mithril-end-to-end/src/scenario/full.rs index af98b36a995..475b8d30c8a 100644 --- a/mithril-test-lab/mithril-end-to-end/src/scenario/full.rs +++ b/mithril-test-lab/mithril-end-to-end/src/scenario/full.rs @@ -175,6 +175,16 @@ impl FullScenario { .await?; if aggregator.is_first() || aggregator.version().is_below("0.7.94") { + // A certificate chain lagging one epoch behind the chain tip is normal, but a restart + // crossing an epoch boundary before the current epoch is certified would create an + // unrecoverable epoch gap and block the aggregator + let current_epoch = chain_observer.get_current_epoch().await?.unwrap_or_default(); + self.toolkit + .check + .certificate + .is_creating_certificate_with_min_epoch(aggregator, current_epoch) + .await?; + self.toolkit .exec .update_protocol_parameters(aggregator, infrastructure.aggregate_signature_type()) diff --git a/mithril-test-lab/mithril-end-to-end/src/toolkit/context.rs b/mithril-test-lab/mithril-end-to-end/src/toolkit/context.rs index 2ee68f3fec3..c8d8d47c3ff 100644 --- a/mithril-test-lab/mithril-end-to-end/src/toolkit/context.rs +++ b/mithril-test-lab/mithril-end-to-end/src/toolkit/context.rs @@ -31,6 +31,13 @@ impl ScenarioToolkitContext { Backoff::default() } + /// Backoff polling at a constant tenth of the epoch duration, so that epoch transitions + /// are detected shortly after the epoch boundary. + pub fn tenth_of_epoch_poll_backoff(&self) -> Backoff { + let delay = self.timeout_for_epochs(1) / 10; + Backoff::new(delay, delay, 1) + } + /// Timeout covering the given number of Cardano epochs. pub fn timeout_for_epochs(&self, epochs: u32) -> Duration { self.attempt_policy.timeout_for_epochs(epochs) @@ -38,7 +45,7 @@ impl ScenarioToolkitContext { /// Timeout to wait for the aggregator to produce a signed artifact once it is running. pub fn artifact_production_timeout(&self) -> Duration { - self.timeout_for_epochs(1) + self.timeout_for_epochs(3) } /// Timeout to wait for the devnet and aggregator to become ready during startup. @@ -96,13 +103,22 @@ mod tests { assert_eq!(policy.timeout_for_epochs(5), Duration::from_secs(50)); } + #[test] + fn tenth_of_epoch_poll_backoff_polls_at_a_constant_delay() { + let context = ScenarioToolkitContext::new(AttemptPolicy::new(Duration::from_secs(10))); + let mut backoff = context.tenth_of_epoch_poll_backoff(); + + assert_eq!(backoff.next_delay(), Duration::from_secs(1)); + assert_eq!(backoff.next_delay(), Duration::from_secs(1)); + } + #[test] fn named_timeouts_cover_expected_epochs() { let context = ScenarioToolkitContext::new(AttemptPolicy::new(Duration::from_secs(10))); assert_eq!( context.artifact_production_timeout(), - Duration::from_secs(10) + Duration::from_secs(30) ); assert_eq!( context.startup_readiness_timeout(), diff --git a/mithril-test-lab/mithril-end-to-end/src/toolkit/exec.rs b/mithril-test-lab/mithril-end-to-end/src/toolkit/exec.rs index 4b093fa6f9d..8acc4382e9b 100644 --- a/mithril-test-lab/mithril-end-to-end/src/toolkit/exec.rs +++ b/mithril-test-lab/mithril-end-to-end/src/toolkit/exec.rs @@ -102,9 +102,9 @@ impl ExecToolkit { aggregator.stop().await?; let protocol_parameters_new = match aggregate_signature_type { AggregateSignatureType::Concatenation => ProtocolParameters { - k: 145, - m: 210, - phi_f: 0.80, + k: 83, + m: 130, + phi_f: 0.75, }, AggregateSignatureType::Snark => ProtocolParameters { k: 7, diff --git a/mithril-test-lab/mithril-end-to-end/src/toolkit/wait.rs b/mithril-test-lab/mithril-end-to-end/src/toolkit/wait.rs index 02d56b2cc38..bac21408c5d 100644 --- a/mithril-test-lab/mithril-end-to-end/src/toolkit/wait.rs +++ b/mithril-test-lab/mithril-end-to-end/src/toolkit/wait.rs @@ -114,7 +114,7 @@ impl WaitToolkit { let epochs_to_wait = Self::compute_number_of_epochs_to_wait(target_epoch, current_epoch); let timeout = self.context.timeout_for_epochs(epochs_to_wait); - match poll_until!(timeout, self.context.poll_backoff(), { + match poll_until!(timeout, self.context.tenth_of_epoch_poll_backoff(), { match aggregator .chain_observer() .get_current_epoch()