Files
pezkuwi-sdk/pezkuwi/zombienet-sdk-tests/tests/functional/async_backing_6_seconds_rate.rs
T
pezkuwichain 57fef835e3 fix(ci): resolve all quick-checks failures
- Remove missing cli crate from workspace members
- Fix TOML array syntax errors in pvf and benchmarking-cli Cargo.toml
- Fix Rust import ordering with cargo fmt
- Fix feature propagation with zepter (try-runtime, runtime-benchmarks, std)
2026-01-04 17:22:12 +03:00

96 lines
2.9 KiB
Rust

// Copyright (C) Parity Technologies (UK) Ltd. and Dijital Kurdistan Tech Institute
// SPDX-License-Identifier: Apache-2.0
// Test we are producing 12-second teyrchain blocks if using an old collator, pre async-backing.
use anyhow::anyhow;
use pezcumulus_zombienet_sdk_helpers::{assert_finality_lag, assert_para_throughput};
use pezkuwi_primitives::Id as ParaId;
use pezkuwi_zombienet_sdk::{
subxt::{OnlineClient, PezkuwiConfig},
NetworkConfigBuilder,
};
use serde_json::json;
#[tokio::test(flavor = "multi_thread")]
async fn async_backing_6_seconds_rate_test() -> Result<(), anyhow::Error> {
let _ = env_logger::try_init_from_env(
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),
);
let images = pezkuwi_zombienet_sdk::environment::get_images_from_env();
let config = NetworkConfigBuilder::new()
.with_relaychain(|r| {
let r = r
.with_chain("pezkuwichain-local")
.with_default_command("pezkuwi")
.with_default_image(images.pezkuwi())
.with_default_args(vec![("-lteyrchain=debug").into()])
.with_genesis_overrides(json!({
"configuration": {
"config": {
"scheduler_params": {
"group_rotation_frequency": 4
}
}
}
}))
.with_validator(|node| node.with_name("validator-0"));
(1..12).fold(r, |acc, i| {
acc.with_validator(|node| node.with_name(&format!("validator-{i}")))
})
})
.with_teyrchain(|p| {
p.with_id(2000)
.with_default_command("adder-collator")
.with_default_image(
std::env::var("COL_IMAGE")
.unwrap_or("docker.io/paritypr/colander:latest".to_string())
.as_str(),
)
.pezcumulus_based(false)
.with_default_args(vec![("-lteyrchain=debug").into()])
.with_collator(|n| n.with_name("collator-adder-2000"))
})
.with_teyrchain(|p| {
p.with_id(2001)
.with_default_command("pezkuwi-teyrchain")
.with_default_image(images.pezcumulus())
.with_default_args(vec![("-lteyrchain=debug,aura=debug").into()])
.with_collator(|n| n.with_name("collator-2001"))
})
.build()
.map_err(|e| {
let errs = e.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(" ");
anyhow!("config errs: {errs}")
})?;
let spawn_fn = pezkuwi_zombienet_sdk::environment::get_spawn_fn();
let network = spawn_fn(config).await?;
let relay_node = network.get_node("validator-0")?;
let para_node_2001 = network.get_node("collator-2001")?;
let relay_client: OnlineClient<PezkuwiConfig> = relay_node.wait_client().await?;
assert_para_throughput(
&relay_client,
15,
[(ParaId::from(2000), 11..16), (ParaId::from(2001), 11..16)]
.into_iter()
.collect(),
)
.await?;
// Assert the teyrchain finalized block height is also on par with the number of backed
// candidates. We can only do this for the collator based on pezcumulus.
assert_finality_lag(&para_node_2001.wait_client().await?, 6).await?;
log::info!("Test finished successfully");
Ok(())
}