Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
alindima committed Dec 4, 2024
1 parent 060bd62 commit 8c10400
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 106 deletions.
25 changes: 16 additions & 9 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,6 @@ zombienet-polkadot-functional-0015-coretime-shared-core:
--local-dir="${LOCAL_DIR}/functional"
--test="0016-approval-voting-parallel.zndsl"

zombienet-polkadot-functional-0017-sync-backing:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/functional"
--test="0017-sync-backing.zndsl"

zombienet-polkadot-functional-0018-shared-core-idle-parachain:
extends:
- .zombienet-polkadot-common
Expand Down Expand Up @@ -403,7 +395,6 @@ zombienet-polkadot-elastic-scaling-doesnt-break-parachains:
artifacts: true
before_script:
- !reference [ ".zombienet-polkadot-common", "before_script" ]
- export CUMULUS_IMAGE="docker.io/paritypr/test-parachain:${PIPELINE_IMAGE_TAG}"
script:
# we want to use `--no-capture` in zombienet tests.
- unset NEXTEST_FAILURE_OUTPUT
Expand All @@ -424,3 +415,19 @@ zombienet-polkadot-elastic-scaling-basic-3cores:
- unset NEXTEST_FAILURE_OUTPUT
- unset NEXTEST_SUCCESS_OUTPUT
- cargo nextest run --archive-file ./artifacts/polkadot-zombienet-tests.tar.zst --no-capture -- elastic_scaling::basic_3cores::basic_3cores_test

zombienet-polkadot-functional-sync-backing:
extends:
- .zombienet-polkadot-common
needs:
- job: build-polkadot-zombienet-tests
artifacts: true
before_script:
- !reference [ ".zombienet-polkadot-common", "before_script" ]
# Hardcoded to an old polkadot-parachain image, pre async backing.
- export CUMULUS_IMAGE="docker.io/paritypr/polkadot-parachain-debug:master-99623e62"
script:
# we want to use `--no-capture` in zombienet tests.
- unset NEXTEST_FAILURE_OUTPUT
- unset NEXTEST_SUCCESS_OUTPUT
- cargo nextest run --archive-file ./artifacts/polkadot-zombienet-tests.tar.zst --no-capture -- elastic_scaling::sync_backing::sync_backing_test
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

use anyhow::anyhow;

use super::{
helpers::assert_para_throughput,
rococo,
use crate::helpers::{
assert_para_throughput, rococo,
rococo::runtime_types::{
pallet_broker::coretime_interface::CoreAssignment,
polkadot_runtime_parachains::assigner_coretime::PartsOf57600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

use anyhow::anyhow;

use super::{
helpers::{assert_finalized_block_height, assert_para_throughput},
rococo,
use crate::helpers::{
assert_finalized_block_height, assert_para_throughput, rococo,
rococo::runtime_types::{
pallet_broker::coretime_interface::CoreAssignment,
polkadot_runtime_parachains::assigner_coretime::PartsOf57600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

use anyhow::anyhow;

use super::{
helpers::{assert_finalized_block_height, assert_para_throughput},
rococo,
use crate::helpers::{
assert_finalized_block_height, assert_para_throughput, rococo,
rococo::runtime_types::{
pallet_broker::coretime_interface::CoreAssignment,
polkadot_runtime_parachains::assigner_coretime::PartsOf57600,
Expand Down
4 changes: 0 additions & 4 deletions polkadot/zombienet-sdk-tests/tests/elastic_scaling/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

#[subxt::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")]
pub mod rococo {}

mod basic_3cores;
mod doesnt_break_parachains;
mod helpers;
mod mixed_receipt_versions;
mod slot_based_3cores;
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

use anyhow::anyhow;

use super::{
helpers::{assert_finalized_block_height, assert_para_throughput},
rococo,
use crate::helpers::{
assert_finalized_block_height, assert_para_throughput, rococo,
rococo::runtime_types::{
pallet_broker::coretime_interface::CoreAssignment,
polkadot_runtime_parachains::assigner_coretime::PartsOf57600,
Expand Down
4 changes: 4 additions & 0 deletions polkadot/zombienet-sdk-tests/tests/functional/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

mod sync_backing;
72 changes: 72 additions & 0 deletions polkadot/zombienet-sdk-tests/tests/functional/sync_backing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Test we are producing 12-second parachain blocks if using an old collator, pre async-backing.

use anyhow::anyhow;

use crate::helpers::{assert_finalized_block_height, assert_para_throughput};
use serde_json::json;
use subxt::{OnlineClient, PolkadotConfig};
use zombienet_sdk::NetworkConfigBuilder;

#[tokio::test(flavor = "multi_thread")]
async fn sync_backing_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 = zombienet_sdk::environment::get_images_from_env();

let config = NetworkConfigBuilder::new()
.with_relaychain(|r| {
let r = r
.with_chain("rococo-local")
.with_default_command("polkadot")
.with_default_image(images.polkadot.as_str())
.with_default_args(vec![("-lparachain=debug").into()])
.with_genesis_overrides(json!({
"configuration": {
"config": {
"scheduler_params": {
"group_rotation_frequency": 4,
},
}
}
}))
.with_node(|node| node.with_name("validator-0"));

(1..5).fold(r, |acc, i| acc.with_node(|node| node.with_name(&format!("validator-{i}"))))
})
.with_parachain(|p| {
p.with_id(2000)
.with_default_command("polkadot-parachain")
// This must be a very old polkadot-parachain image, pre async backing
.with_default_image(images.cumulus.as_str())
.with_default_args(vec![("-lparachain=debug,aura=debug").into()])
.with_collator(|n| n.with_name("collator-2000"))
})
.build()
.map_err(|e| {
let errs = e.into_iter().map(|e| e.to_string()).collect::<Vec<_>>().join(" ");
anyhow!("config errs: {errs}")
})?;

let spawn_fn = zombienet_sdk::environment::get_spawn_fn();
let network = spawn_fn(config).await?;

let relay_node = network.get_node("validator-0")?;
let para_node = network.get_node("collator-2000")?;

let relay_client: OnlineClient<PolkadotConfig> = relay_node.wait_client().await?;

assert_para_throughput(&relay_client, 15, [(2000, 6..9)].into_iter().collect()).await?;

// Assert the parachain finalized block height is also on par with the number of backed
// candidates.
assert_finalized_block_height(&para_node.wait_client().await?, 6..9).await?;

log::info!("Test finished successfully");

Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

use super::rococo;
use std::{collections::HashMap, ops::Range};
use subxt::{OnlineClient, PolkadotConfig};

#[subxt::subxt(runtime_metadata_path = "metadata-files/rococo-local.scale")]
pub mod rococo {}

// Helper function for asserting the throughput of parachains (total number of backed candidates in
// a window of relay chain blocks), after the first session change.
pub async fn assert_para_throughput(
Expand Down Expand Up @@ -67,7 +69,7 @@ pub async fn assert_finalized_block_height(
) -> Result<(), anyhow::Error> {
if let Some(block) = client.blocks().subscribe_finalized().await?.next().await {
let height = block?.number();
log::info!("Finalized block number number {height}");
log::info!("Finalized block number {height}");

assert!(
expected_range.contains(&height),
Expand Down
5 changes: 5 additions & 0 deletions polkadot/zombienet-sdk-tests/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

#[cfg(feature = "zombie-metadata")]
mod helpers;

#[cfg(feature = "zombie-metadata")]
mod elastic_scaling;
#[cfg(feature = "zombie-metadata")]
mod functional;
#[cfg(feature = "zombie-metadata")]
mod smoke;
21 changes: 12 additions & 9 deletions polkadot/zombienet-sdk-tests/tests/smoke/coretime_revenue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ pub mod rococo {}
#[subxt::subxt(runtime_metadata_path = "metadata-files/coretime-rococo-local.scale")]
mod coretime_rococo {}

use rococo::runtime_types::{
staging_xcm::v4::{
asset::{Asset, AssetId, Assets, Fungibility},
junction::Junction,
junctions::Junctions,
location::Location,
use crate::helpers::rococo::{
self as rococo_api,
runtime_types::{
polkadot_parachain_primitives::primitives,
staging_xcm::v4::{
asset::{Asset, AssetId, Assets, Fungibility},
junction::Junction,
junctions::Junctions,
location::Location,
},
xcm::{VersionedAssets, VersionedLocation},
},
xcm::{VersionedAssets, VersionedLocation},
};

use serde_json::json;
use std::{fmt::Display, sync::Arc};
use subxt::{events::StaticEvent, utils::AccountId32, OnlineClient, PolkadotConfig};
Expand All @@ -41,8 +46,6 @@ use coretime_rococo::{
},
};

use rococo::{self as rococo_api, runtime_types::polkadot_parachain_primitives::primitives};

type CoretimeRuntimeCall = coretime_api::runtime_types::coretime_rococo_runtime::RuntimeCall;
type CoretimeUtilityCall = coretime_api::runtime_types::pallet_utility::pallet::Call;
type CoretimeBrokerCall = coretime_api::runtime_types::pallet_broker::pallet::Call;
Expand Down
48 changes: 0 additions & 48 deletions polkadot/zombienet_tests/functional/0017-sync-backing.toml

This file was deleted.

22 changes: 0 additions & 22 deletions polkadot/zombienet_tests/functional/0017-sync-backing.zndsl

This file was deleted.

0 comments on commit 8c10400

Please sign in to comment.