From ec4a1e26e505059cb749006fa1abb611d1c1e486 Mon Sep 17 00:00:00 2001 From: andrussal Date: Wed, 10 Dec 2025 05:48:44 +0100 Subject: [PATCH] Extend CI smoke runs to 120s --- .github/workflows/lint.yml | 4 +-- Cargo.lock | 1 + testing-framework/workflows/Cargo.toml | 4 +++ .../src/expectations/consensus_liveness.rs | 31 ++++++++++++++++--- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 14bd180..845549a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -259,7 +259,7 @@ jobs: RUST_LOG: "info" NOMOS_LOG_DIR: "${{ runner.temp }}/local-logs" run: | - scripts/run-examples.sh -t 60 -v 1 -e 1 host + scripts/run-examples.sh -t 120 -v 1 -e 1 host - name: Collect host demo logs (on failure) if: failure() run: | @@ -405,7 +405,7 @@ jobs: NOMOS_LOG_DIR: "${{ github.workspace }}/.tmp/compose-logs" run: | mkdir -p "$TMPDIR" - scripts/run-examples.sh -t 60 -v 1 -e 1 compose + scripts/run-examples.sh -t 120 -v 1 -e 1 compose - name: Show compose runner log env: diff --git a/Cargo.lock b/Cargo.lock index 5f5e947..7f971f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7323,6 +7323,7 @@ name = "testing-framework-workflows" version = "0.1.0" dependencies = [ "async-trait", + "chain-service", "ed25519-dalek", "executor-http-client", "nomos-core", diff --git a/testing-framework/workflows/Cargo.toml b/testing-framework/workflows/Cargo.toml index 3c8ec94..4bcf302 100644 --- a/testing-framework/workflows/Cargo.toml +++ b/testing-framework/workflows/Cargo.toml @@ -14,6 +14,7 @@ workspace = true [dependencies] async-trait = "0.1" +chain-service = { git = "https://github.com/logos-co/nomos-node", rev = "d2dd5a5084e1daef4032562c77d41de5e4d495f8" } ed25519-dalek = { version = "2.2.0", features = ["rand_core", "serde"] } executor-http-client = { workspace = true } nomos-core = { workspace = true } @@ -24,3 +25,6 @@ thiserror = { workspace = true } tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "time"] } tracing = { workspace = true } zksign = { workspace = true } + +[package.metadata.cargo-machete] +ignored = ["chain-service"] diff --git a/testing-framework/workflows/src/expectations/consensus_liveness.rs b/testing-framework/workflows/src/expectations/consensus_liveness.rs index 6124649..c44ad66 100644 --- a/testing-framework/workflows/src/expectations/consensus_liveness.rs +++ b/testing-framework/workflows/src/expectations/consensus_liveness.rs @@ -1,6 +1,7 @@ use std::time::Duration; use async_trait::async_trait; +use nomos_core::header::HeaderId; use testing_framework_core::scenario::{DynError, Expectation, RunContext}; use thiserror::Error; use tokio::time::sleep; @@ -51,6 +52,12 @@ enum ConsensusLivenessIssue { height: u64, target: u64, }, + #[error("{node} LIB {lib:?} diverged from reference {reference_lib:?}")] + LibDiverged { + node: String, + lib: HeaderId, + reference_lib: HeaderId, + }, #[error("{node} consensus_info failed: {source}")] RequestFailed { node: String, @@ -98,11 +105,13 @@ impl ConsensusLiveness { let mut issues = Vec::new(); for attempt in 0..max_attempts { - match Self::fetch_cluster_height(ctx).await { - Ok(height) => { + match Self::fetch_cluster_info(ctx).await { + Ok((height, lib, tip)) => { samples.push(NodeSample { label: format!("sample-{attempt}"), height, + lib, + tip, }); if samples.len() >= participant_count { break; @@ -122,14 +131,14 @@ impl ConsensusLiveness { LivenessCheck { samples, issues } } - async fn fetch_cluster_height(ctx: &RunContext) -> Result { + async fn fetch_cluster_info(ctx: &RunContext) -> Result<(u64, HeaderId, HeaderId), DynError> { ctx.cluster_client() .try_all_clients(|client| { Box::pin(async move { client .consensus_info() .await - .map(|info| info.height) + .map(|info| (info.height, info.lib, info.tip)) .map_err(|err| -> DynError { err.into() }) }) }) @@ -170,6 +179,7 @@ impl ConsensusLiveness { }); } + let reference_lib = check.samples.first().map(|s| s.lib); for sample in &check.samples { if sample.height + self.lag_allowance < target { check @@ -180,12 +190,23 @@ impl ConsensusLiveness { target, }); } + if let Some(lib) = reference_lib { + if sample.lib != lib { + check.issues.push(ConsensusLivenessIssue::LibDiverged { + node: sample.label.clone(), + lib: sample.lib, + reference_lib: lib, + }); + } + } } if check.issues.is_empty() { tracing::info!( target, heights = ?check.samples.iter().map(|s| s.height).collect::>(), + libs = ?check.samples.iter().map(|s| s.lib).collect::>(), + tips = ?check.samples.iter().map(|s| s.tip).collect::>(), "consensus liveness expectation satisfied" ); Ok(()) @@ -201,6 +222,8 @@ impl ConsensusLiveness { struct NodeSample { label: String, height: u64, + lib: HeaderId, + tip: HeaderId, } struct LivenessCheck {