From b9fcadbe5839a15fb457a3ca1865dfeae62b0b38 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Wed, 18 Sep 2024 09:12:17 +0200 Subject: [PATCH 01/10] add spec_version incremented runtime --- polkadot/runtime/rococo/Cargo.toml | 3 +++ polkadot/runtime/rococo/build.rs | 13 +++++++++++++ polkadot/runtime/rococo/src/lib.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/polkadot/runtime/rococo/Cargo.toml b/polkadot/runtime/rococo/Cargo.toml index 4aaaf94da586..b39fbc5e3f4c 100644 --- a/polkadot/runtime/rococo/Cargo.toml +++ b/polkadot/runtime/rococo/Cargo.toml @@ -340,3 +340,6 @@ runtime-metrics = [ # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. on-chain-release-build = ["metadata-hash"] + +# Produce a runtime with the spec_version incremented to use in upgrade tests. +increment-spec-version = [] diff --git a/polkadot/runtime/rococo/build.rs b/polkadot/runtime/rococo/build.rs index aab666b0f11c..cc8afc8c0365 100644 --- a/polkadot/runtime/rococo/build.rs +++ b/polkadot/runtime/rococo/build.rs @@ -22,6 +22,12 @@ fn main() { .set_file_name("fast_runtime_binary.rs") .enable_feature("fast-runtime") .build(); + + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_feature("increment-spec-version") + .enable_feature("fast-runtime") + .set_file_name("wasm_binary_spec_version_incremented.rs") + .build(); } #[cfg(all(feature = "metadata-hash", feature = "std"))] @@ -35,6 +41,13 @@ fn main() { .enable_feature("fast-runtime") .enable_metadata_hash("ROC", 12) .build(); + + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_feature("increment-spec-version") + .enable_feature("fast-runtime") + .enable_metadata_hash("ROC", 12) + .set_file_name("wasm_binary_spec_version_incremented.rs") + .build(); } #[cfg(not(feature = "std"))] diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 6ec49c5830f7..0772e0fb077a 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -164,7 +164,19 @@ pub mod fast_runtime_binary { include!(concat!(env!("OUT_DIR"), "/fast_runtime_binary.rs")); } +// The only difference between the two declarations below is the `spec_version`. With the +// `increment-spec-version` feature enabled `spec_version` should be greater than the one of without +// the `increment-spec-version` feature. +// +// The duplication here is unfortunate necessity. +// +// runtime_version macro is dumb. It accepts a const item declaration, passes it through and +// also emits runtime version custom section. It parses the expressions to extract the version +// details. Since macro kicks in early, it operates on AST. Thus you cannot use constants. +// Macros are expanded top to bottom, meaning we also cannot use `cfg` here. + /// Runtime version (Rococo). +#[cfg(not(feature = "increment-spec-version"))] #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("rococo"), @@ -177,6 +189,20 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { system_version: 1, }; +/// Runtime version (Rococo). +#[cfg(feature = "increment-spec-version")] +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("rococo"), + impl_name: create_runtime_str!("parity-rococo-v2.0"), + authoring_version: 0, + spec_version: 1_016_000, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 26, + system_version: 1, +}; + /// The BABE epoch configuration at genesis. pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = sp_consensus_babe::BabeEpochConfiguration { From ec9c43956a05190d4e224f3faa32a809d8b65ab2 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Fri, 20 Sep 2024 16:15:46 +0200 Subject: [PATCH 02/10] add runtime upgrade test --- .gitlab/pipeline/build.yml | 1 + .gitlab/pipeline/zombienet/polkadot.yml | 19 +++++++ polkadot/zombienet-sdk-tests/Cargo.toml | 3 +- .../zombienet-sdk-tests/tests/smoke/mod.rs | 3 + .../tests/smoke/runtime_upgrade.rs | 55 +++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 931aef802330..00f141064d08 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -31,6 +31,7 @@ build-linux-stable: - mv ./target/testnet/polkadot-prepare-worker ./artifacts/. - mv ./target/testnet/polkadot-execute-worker ./artifacts/. - mv ./runtimes/ ./artifacts/. + - vm ./target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm ./artifacts/. - pushd artifacts - sha256sum polkadot | tee polkadot.sha256 - shasum -c polkadot.sha256 diff --git a/.gitlab/pipeline/zombienet/polkadot.yml b/.gitlab/pipeline/zombienet/polkadot.yml index 93fc4bbb578a..ce3baff21100 100644 --- a/.gitlab/pipeline/zombienet/polkadot.yml +++ b/.gitlab/pipeline/zombienet/polkadot.yml @@ -357,3 +357,22 @@ zombienet-polkadot-coretime-revenue: - unset NEXTEST_FAILURE_OUTPUT - unset NEXTEST_SUCCESS_OUTPUT - cargo nextest run --archive-file ./artifacts/polkadot-zombienet-tests.tar.zst --no-capture -- smoke::coretime_revenue::coretime_revenue_test + +zombienet-polkadot-smoke-runtime-upgrade: + extends: + - .zombienet-polkadot-common + needs: + - job: build-linux-stable + artifacts: true + - job: build-polkadot-zombienet-tests + artifacts: true + before_script: + - !reference [".zombienet-polkadot-common", "before_script"] + - export POLKADOT_IMAGE="${ZOMBIENET_INTEGRATION_TEST_IMAGE}" + - export ZOMBIE_WASM_INCREMENTED_PATH="./artifacts/wasm_binary_spec_version_incremented.rs.compact.wasm" + 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 -- smoke::runtime_upgrade::runtime_upgrade_test + diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index 3374ad572b9f..b0b6f39df721 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -20,7 +20,8 @@ serde_json = "1.0.114" parity-scale-codec = { version = "3.6.9", features = ["derive"] } [features] -zombie-metadata = [] +zombienet = [] +zombie-metadata = ["zombienet"] [build-dependencies] substrate-build-script-utils = { workspace = true, default-features = true } diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs b/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs index a3fe15382674..c19c4f0df2fc 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs @@ -3,3 +3,6 @@ #[cfg(feature = "zombie-metadata")] mod coretime_revenue; + +#[cfg(feature = "zombienet")] +mod runtime_upgrade; \ No newline at end of file diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs new file mode 100644 index 000000000000..7bd8972e253e --- /dev/null +++ b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs @@ -0,0 +1,55 @@ +use std::env; +use anyhow::anyhow; +use zombienet_sdk::NetworkConfigBuilder; + +const best_block_metric: &str = "block_height{status=\"best\"}"; + +#[tokio::test(flavor = "multi_thread")] +async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { + env_logger::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| { + r.with_chain("rococo-local") + .with_default_command("polkadot") + .with_default_image(images.polkadot.as_str()) + .with_node(|node| { + node.with_name("latest-release") + // used for getting the chain-spec + .with_image("parity/polkadot:latest") + }) + .with_node(|node| node.with_name("bob")) + .with_node(|node| node.with_name("charlie")) + }) + + .build() + .map_err(|e| { + let errs = e.into_iter().map(|e| e.to_string()).collect::>().join(" "); + anyhow!("config errs: {errs}") + })?; + + let spawn_fn = zombienet_sdk::environment::get_spawn_fn(); + let network = spawn_fn(config).await?; + + // wait 10 blocks + let latest_release = network.get_node("latest-release")?; + assert!(latest_release.wait_metric(best_block_metric, |b| b > 10_f64).await.is_ok()); + + // ge current best + node.wait_metric(best_block_metric, |x| x > 10_f64).await?; + let best_block = node.reports(best_block_metric).await?; + + // upgrade runtime + let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or("target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm"); + + network + .relaychain() + .runtime_upgrade(RuntimeUpgradeOptions::new(wasm.into())) + .await?; + + // wait 10 more blocks + node.wait_metric(best_block_metric, |x| x > best_block + 10_f64); +} From 01fae8f0777bc27321e33d7c5dda70149dfe3342 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Fri, 20 Sep 2024 16:54:12 +0200 Subject: [PATCH 03/10] fmt --- .../zombienet-sdk-tests/tests/smoke/mod.rs | 2 +- .../tests/smoke/runtime_upgrade.rs | 50 +++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs b/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs index c19c4f0df2fc..cb6a5c9d14e3 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/mod.rs @@ -5,4 +5,4 @@ mod coretime_revenue; #[cfg(feature = "zombienet")] -mod runtime_upgrade; \ No newline at end of file +mod runtime_upgrade; diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs index 7bd8972e253e..5ab689e32936 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs @@ -1,5 +1,5 @@ -use std::env; use anyhow::anyhow; +use std::env; use zombienet_sdk::NetworkConfigBuilder; const best_block_metric: &str = "block_height{status=\"best\"}"; @@ -17,14 +17,12 @@ async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { .with_default_command("polkadot") .with_default_image(images.polkadot.as_str()) .with_node(|node| { - node.with_name("latest-release") - // used for getting the chain-spec - .with_image("parity/polkadot:latest") - }) + node.with_name("latest-release") + // used for getting the chain-spec + .with_image("parity/polkadot:latest") + }) .with_node(|node| node.with_name("bob")) - .with_node(|node| node.with_name("charlie")) }) - .build() .map_err(|e| { let errs = e.into_iter().map(|e| e.to_string()).collect::>().join(" "); @@ -34,22 +32,32 @@ async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { let spawn_fn = zombienet_sdk::environment::get_spawn_fn(); let network = spawn_fn(config).await?; - // wait 10 blocks - let latest_release = network.get_node("latest-release")?; - assert!(latest_release.wait_metric(best_block_metric, |b| b > 10_f64).await.is_ok()); + // wait 10 blocks + let latest_release = network.get_node("latest-release")?; + assert!(latest_release.wait_metric(best_block_metric, |b| b > 10_f64).await.is_ok()); + + // get current runtime spec + let client = network.get_node("latest-release")?.client::().await?; + let current_runtime = client.backend().current_runtime_version().await?; + + // get current best + node.wait_metric(best_block_metric, |x| x > 10_f64).await?; + let best_block = node.reports(best_block_metric).await?; + + // upgrade runtime + let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or( + "target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm", + ); - // ge current best - node.wait_metric(best_block_metric, |x| x > 10_f64).await?; - let best_block = node.reports(best_block_metric).await?; + network + .relaychain() + .runtime_upgrade(RuntimeUpgradeOptions::new(wasm.into())) + .await?; - // upgrade runtime - let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or("target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm"); + // wait 10 more blocks + node.wait_metric(best_block_metric, |x| x > best_block + 10_f64); - network - .relaychain() - .runtime_upgrade(RuntimeUpgradeOptions::new(wasm.into())) - .await?; + let incremented_runtime = client.backend().current_runtime_version().await?; - // wait 10 more blocks - node.wait_metric(best_block_metric, |x| x > best_block + 10_f64); + assert_eq(incremented_runtime, current_version + 1000, "version should be incremented"); } From 9348c738c73cac2cdad0c6aff85f98c2a602d5ba Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Fri, 20 Sep 2024 17:19:28 +0200 Subject: [PATCH 04/10] bump zombienet version and update test --- Cargo.lock | 26 ++++++++++--------- polkadot/zombienet-sdk-tests/Cargo.toml | 2 +- .../tests/smoke/runtime_upgrade.rs | 20 +++++++------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a8f570fabe4..ca09119cf6f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27234,17 +27234,19 @@ dependencies = [ [[package]] name = "zombienet-configuration" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23322e411b8d19b41b5c20ab8e88c10822189a4fcfd069c7fcd1542b8d3035aa" +checksum = "7060f41da2d9957fb41322c95febaae026ee787f1cc66947ebbe7ad02ba7e601" dependencies = [ "anyhow", "lazy_static", "multiaddr 0.18.1", "regex", + "reqwest 0.11.20", "serde", "serde_json", "thiserror", + "tokio", "toml 0.7.8", "url", "zombienet-support", @@ -27252,9 +27254,9 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381f701565b3918a909132743b3674569ce3da25b5c3a6493883abaf1046577a" +checksum = "263c55c59f1d47d780d7ea0d46a5cb6cf633d5ca72e6589a2de4293cece12f96" dependencies = [ "anyhow", "async-trait", @@ -27285,9 +27287,9 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dab79fa58bcfecbcd41485c6f13052853ccde8b09f173b601f78747d7abc2b7f" +checksum = "203fc73aa94889f24faf7e6ee6c4e3981bdce02db191b4cbe67a0ff8f4068afe" dependencies = [ "pest", "pest_derive", @@ -27296,9 +27298,9 @@ dependencies = [ [[package]] name = "zombienet-provider" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af0264938da61b25da89f17ee0630393a4ba793582a4a8a1650eb15b47fc1ef" +checksum = "4aaf46811216ffbcd5adbebd5473ece1a6418e09feed591547d32566929a95c2" dependencies = [ "anyhow", "async-trait", @@ -27327,9 +27329,9 @@ dependencies = [ [[package]] name = "zombienet-sdk" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc5b7ebfba4ab62486c8cb5bcd7345c4376487487cfe3481476cb4d4accc75e" +checksum = "6e58f39845d6d4d2e643e50db5ff4cddfcb9810e79f86422fc872f2eb09d5fcf" dependencies = [ "async-trait", "futures", @@ -27344,9 +27346,9 @@ dependencies = [ [[package]] name = "zombienet-support" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5b80d34a0eecca69dd84c2e13f84f1fae0cc378baf4f15f769027af068418b" +checksum = "29a9794001ac80112fc2fc823bae7e3379d07d48aa8ce6e5f5b98a488f2e78df" dependencies = [ "anyhow", "async-trait", diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index b0b6f39df721..700e9ca5f8f7 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -14,7 +14,7 @@ subxt = { version = "0.37", features = ["substrate-compat"] } subxt-signer = { version = "0.37" } tokio = { version = "1.36.0", features = ["rt-multi-thread"] } anyhow = "1.0.81" -zombienet-sdk = "0.2.6" +zombienet-sdk = "0.2.11" serde = "1.0.197" serde_json = "1.0.114" parity-scale-codec = { version = "3.6.9", features = ["derive"] } diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs index 5ab689e32936..10e4be61789f 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs @@ -1,8 +1,8 @@ use anyhow::anyhow; use std::env; -use zombienet_sdk::NetworkConfigBuilder; +use zombienet_sdk::{tx_helper::RuntimeUpgradeOptions, NetworkConfigBuilder}; -const best_block_metric: &str = "block_height{status=\"best\"}"; +const BEST_BLOCK_METRIC: &str = "block_height{status=\"best\"}"; #[tokio::test(flavor = "multi_thread")] async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { @@ -34,30 +34,32 @@ async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { // wait 10 blocks let latest_release = network.get_node("latest-release")?; - assert!(latest_release.wait_metric(best_block_metric, |b| b > 10_f64).await.is_ok()); + assert!(latest_release.wait_metric(BEST_BLOCK_METRIC, |b| b > 10_f64).await.is_ok()); // get current runtime spec let client = network.get_node("latest-release")?.client::().await?; let current_runtime = client.backend().current_runtime_version().await?; // get current best - node.wait_metric(best_block_metric, |x| x > 10_f64).await?; - let best_block = node.reports(best_block_metric).await?; + latest_release.wait_metric(BEST_BLOCK_METRIC, |x| x > 10_f64).await?; + let best_block = latest_release.reports(BEST_BLOCK_METRIC).await?; // upgrade runtime let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or( - "target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm", + String::from("target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm"), ); network .relaychain() - .runtime_upgrade(RuntimeUpgradeOptions::new(wasm.into())) + .runtime_upgrade(RuntimeUpgradeOptions::new(wasm.as_str().into())) .await?; // wait 10 more blocks - node.wait_metric(best_block_metric, |x| x > best_block + 10_f64); + latest_release.wait_metric(BEST_BLOCK_METRIC, |x| x > best_block + 10_f64).await?; let incremented_runtime = client.backend().current_runtime_version().await?; - assert_eq(incremented_runtime, current_version + 1000, "version should be incremented"); + assert_eq!(incremented_runtime.spec_version, current_runtime.spec_version + 1000, "version should be incremented"); + + Ok(()) } From 9dd43a08384e8919c30ec38cf3d667fa6440c6e0 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 21 Sep 2024 09:31:06 +0200 Subject: [PATCH 05/10] fix default location for incremented runtime --- .../tests/smoke/runtime_upgrade.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs index 10e4be61789f..68938fac26fe 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs @@ -45,9 +45,10 @@ async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { let best_block = latest_release.reports(BEST_BLOCK_METRIC).await?; // upgrade runtime - let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or( - String::from("target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm"), - ); + let wasm = env::var("ZOMBIE_WASM_INCREMENTED_PATH").unwrap_or_else(|_| { + let root_workspace_dir = env!("CARGO_WORKSPACE_ROOT_DIR"); + format!("{root_workspace_dir}/target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm") + }); network .relaychain() @@ -55,11 +56,17 @@ async fn runtime_upgrade_test() -> Result<(), anyhow::Error> { .await?; // wait 10 more blocks - latest_release.wait_metric(BEST_BLOCK_METRIC, |x| x > best_block + 10_f64).await?; + latest_release + .wait_metric(BEST_BLOCK_METRIC, |x| x > best_block + 10_f64) + .await?; let incremented_runtime = client.backend().current_runtime_version().await?; - assert_eq!(incremented_runtime.spec_version, current_runtime.spec_version + 1000, "version should be incremented"); + assert_eq!( + incremented_runtime.spec_version, + current_runtime.spec_version + 1000, + "version should be incremented" + ); - Ok(()) + Ok(()) } From a90e9b86ddbe1f9d4906eff72d13adafd8cae8ce Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 21 Sep 2024 11:41:06 +0200 Subject: [PATCH 06/10] ci fixes --- .gitlab/pipeline/build.yml | 2 +- polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 00f141064d08..8b1ab0e1722c 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -31,7 +31,7 @@ build-linux-stable: - mv ./target/testnet/polkadot-prepare-worker ./artifacts/. - mv ./target/testnet/polkadot-execute-worker ./artifacts/. - mv ./runtimes/ ./artifacts/. - - vm ./target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm ./artifacts/. + - mv ./target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm ./artifacts/. - pushd artifacts - sha256sum polkadot | tee polkadot.sha256 - shasum -c polkadot.sha256 diff --git a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs index 68938fac26fe..b9da4135b026 100644 --- a/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs +++ b/polkadot/zombienet-sdk-tests/tests/smoke/runtime_upgrade.rs @@ -1,3 +1,6 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + use anyhow::anyhow; use std::env; use zombienet_sdk::{tx_helper::RuntimeUpgradeOptions, NetworkConfigBuilder}; From c5bc15ca63ad9e0e9339a1176a21ea07b8a6f301 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 21 Sep 2024 15:07:16 +0200 Subject: [PATCH 07/10] ci fixes --- .gitlab/pipeline/build.yml | 2 +- .gitlab/pipeline/zombienet/polkadot.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 8b1ab0e1722c..10d78cca5ed5 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -31,7 +31,7 @@ build-linux-stable: - mv ./target/testnet/polkadot-prepare-worker ./artifacts/. - mv ./target/testnet/polkadot-execute-worker ./artifacts/. - mv ./runtimes/ ./artifacts/. - - mv ./target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.wasm ./artifacts/. + - mv ./target/testnet/wbuild/rococo-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm ./artifacts/. - pushd artifacts - sha256sum polkadot | tee polkadot.sha256 - shasum -c polkadot.sha256 diff --git a/.gitlab/pipeline/zombienet/polkadot.yml b/.gitlab/pipeline/zombienet/polkadot.yml index ce3baff21100..02bf0d37adce 100644 --- a/.gitlab/pipeline/zombienet/polkadot.yml +++ b/.gitlab/pipeline/zombienet/polkadot.yml @@ -369,10 +369,12 @@ zombienet-polkadot-smoke-runtime-upgrade: before_script: - !reference [".zombienet-polkadot-common", "before_script"] - export POLKADOT_IMAGE="${ZOMBIENET_INTEGRATION_TEST_IMAGE}" - - export ZOMBIE_WASM_INCREMENTED_PATH="./artifacts/wasm_binary_spec_version_incremented.rs.compact.wasm" + - export ZOMBIE_WASM_INCREMENTED_PATH="$(pwd)/artifacts/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm" script: # we want to use `--no-capture` in zombienet tests. - unset NEXTEST_FAILURE_OUTPUT - unset NEXTEST_SUCCESS_OUTPUT + # retries is handle by gitlab + - export NEXTEST_RETRIES=0 - cargo nextest run --archive-file ./artifacts/polkadot-zombienet-tests.tar.zst --no-capture -- smoke::runtime_upgrade::runtime_upgrade_test From 2e626dc634c346e26054a25068c08dc78fda5484 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sat, 21 Sep 2024 19:24:00 +0200 Subject: [PATCH 08/10] ci fix --- .gitlab/pipeline/zombienet/polkadot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/pipeline/zombienet/polkadot.yml b/.gitlab/pipeline/zombienet/polkadot.yml index 02bf0d37adce..c83a670718b6 100644 --- a/.gitlab/pipeline/zombienet/polkadot.yml +++ b/.gitlab/pipeline/zombienet/polkadot.yml @@ -63,6 +63,7 @@ LOCAL_SDK_TEST: "/builds/parity/mirrors/polkadot-sdk/polkadot/zombienet-sdk-tests" FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1 RUN_IN_CONTAINER: "1" + RUN_IN_CI: "1" artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" when: always From 2839e07deaa37d996bdb480d0b49e47dd54b8795 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Sun, 22 Sep 2024 14:08:27 +0200 Subject: [PATCH 09/10] bump zombienet version --- polkadot/zombienet-sdk-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/zombienet-sdk-tests/Cargo.toml b/polkadot/zombienet-sdk-tests/Cargo.toml index 700e9ca5f8f7..2a6b7a6285b2 100644 --- a/polkadot/zombienet-sdk-tests/Cargo.toml +++ b/polkadot/zombienet-sdk-tests/Cargo.toml @@ -14,7 +14,7 @@ subxt = { version = "0.37", features = ["substrate-compat"] } subxt-signer = { version = "0.37" } tokio = { version = "1.36.0", features = ["rt-multi-thread"] } anyhow = "1.0.81" -zombienet-sdk = "0.2.11" +zombienet-sdk = "0.2.12" serde = "1.0.197" serde_json = "1.0.114" parity-scale-codec = { version = "3.6.9", features = ["derive"] } From e141238a525984217e5633d8766b54880e14b0b2 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Mon, 23 Sep 2024 12:00:34 +0200 Subject: [PATCH 10/10] update lock file --- Cargo.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 272808af5a7f..8d750ee6a77e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27229,9 +27229,9 @@ dependencies = [ [[package]] name = "zombienet-configuration" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7060f41da2d9957fb41322c95febaae026ee787f1cc66947ebbe7ad02ba7e601" +checksum = "d20a7c88bdc730f4b4040428dab165035fd6466965cb2cc8f03da607d4c3e3db" dependencies = [ "anyhow", "lazy_static", @@ -27249,9 +27249,9 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "263c55c59f1d47d780d7ea0d46a5cb6cf633d5ca72e6589a2de4293cece12f96" +checksum = "c6aa47ff58f1ec1518e0e59378c2023ebe9e9aa5d0fad610c62c9980a45a2f49" dependencies = [ "anyhow", "async-trait", @@ -27282,9 +27282,9 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203fc73aa94889f24faf7e6ee6c4e3981bdce02db191b4cbe67a0ff8f4068afe" +checksum = "b64b050be858bb774f4ffb933872c2dfad2cef8b16d701102670b439e58a9640" dependencies = [ "pest", "pest_derive", @@ -27293,9 +27293,9 @@ dependencies = [ [[package]] name = "zombienet-provider" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aaf46811216ffbcd5adbebd5473ece1a6418e09feed591547d32566929a95c2" +checksum = "9e7988f9dab43842db9cf39031b056db14ba58d13055d7ec651cc60ab3414973" dependencies = [ "anyhow", "async-trait", @@ -27324,9 +27324,9 @@ dependencies = [ [[package]] name = "zombienet-sdk" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e58f39845d6d4d2e643e50db5ff4cddfcb9810e79f86422fc872f2eb09d5fcf" +checksum = "f2f2c3f48ff86cc92654bc56c602c1cf2bd823d189448bae7a1f4bbd4ce8f42d" dependencies = [ "async-trait", "futures", @@ -27341,9 +27341,9 @@ dependencies = [ [[package]] name = "zombienet-support" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a9794001ac80112fc2fc823bae7e3379d07d48aa8ce6e5f5b98a488f2e78df" +checksum = "c3b30950a2866bd6650e1f808895b6760cccd68b40dd75de23055db04d509a8a" dependencies = [ "anyhow", "async-trait",