From 65e572080340e50bdbba426cbf8db0976e152eb0 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 11:03:28 +1200 Subject: [PATCH 01/35] add jobs for polkadot and kusama --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2e0465ba1eb1..46c1057288a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -388,3 +388,13 @@ cancel-pipeline-check-runtime-migration-westend: extends: .cancel-pipeline-template needs: - job: check-runtime-migration-westend + +cancel-pipeline-check-runtime-migration-polkadot: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-polkadot + +cancel-pipeline-check-runtime-migration-kusama: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-kusama From b20dea3ba1007aab25d7684907e2fd9400a32806 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 11:04:45 +1200 Subject: [PATCH 02/35] add polkadot and kusama jobs --- .gitlab/pipeline/check.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index f88f5808637b..2d90ab361342 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -121,6 +121,24 @@ test-rust-feature-propagation: --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 +check-runtime-migration-polkadot: + stage: check + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "polkadot" + +check-runtime-migration-kusama: + stage: check + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "kusama" + check-runtime-migration-westend: stage: check extends: From 136b150f5a252631ac1f5bdb23ab9b937df0fcc5 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 11:05:01 +1200 Subject: [PATCH 03/35] pin to tag --- .gitlab/pipeline/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 2d90ab361342..ea8f2acc876f 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -115,7 +115,7 @@ test-rust-feature-propagation: - | export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Running try-runtime for ${NETWORK} ----------" - time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --rev a93c9b5abe5d31a4cf1936204f7e5c489184b521 + time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --tag v0.3.0 time cargo build --release --locked -p "$NETWORK"-runtime --features try-runtime time try-runtime \ --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ From 663b2a82107e25bc0d2c3e76ae4ce7d339dae124 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 11:11:05 +1200 Subject: [PATCH 04/35] dag --- .gitlab/pipeline/check.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index ea8f2acc876f..0df22163abdd 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -123,6 +123,10 @@ test-rust-feature-propagation: check-runtime-migration-polkadot: stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false extends: - .docker-env - .test-pr-refs @@ -132,6 +136,10 @@ check-runtime-migration-polkadot: check-runtime-migration-kusama: stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false extends: - .docker-env - .test-pr-refs From 2bff1743af6b3699a25b557a1f83c3873541298d Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:04:12 +1200 Subject: [PATCH 05/35] debug logs --- .gitlab/pipeline/check.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 0df22163abdd..59784f3f00b7 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -114,9 +114,11 @@ test-rust-feature-propagation: script: - | export RUST_LOG=remote-ext=debug,runtime=debug - echo "---------- Running try-runtime for ${NETWORK} ----------" + echo "---------- Installing try-runtime-cli ----------" time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --tag v0.3.0 + echo "---------- Building runtime for ${NETWORK} ----------" time cargo build --release --locked -p "$NETWORK"-runtime --features try-runtime + echo "---------- Running try-runtime for ${NETWORK} ----------" time try-runtime \ --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 @@ -137,9 +139,10 @@ check-runtime-migration-polkadot: check-runtime-migration-kusama: stage: check # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false + # todo: reenable this + # needs: + # - job: check-runtime-migration-westend + # artifacts: false extends: - .docker-env - .test-pr-refs From ffecc69484f2b0bbf1e6225807f25aee9a33a16b Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:04:52 +1200 Subject: [PATCH 06/35] debug: only run kusama --- .gitlab/pipeline/check.yml | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 59784f3f00b7..16bf7eaf0394 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -123,18 +123,18 @@ test-rust-feature-propagation: --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 -check-runtime-migration-polkadot: - stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "polkadot" +# check-runtime-migration-polkadot: +# stage: check +# # DAG +# needs: +# - job: check-runtime-migration-westend +# artifacts: false +# extends: +# - .docker-env +# - .test-pr-refs +# - .check-runtime-migration +# variables: +# NETWORK: "polkadot" check-runtime-migration-kusama: stage: check @@ -150,27 +150,27 @@ check-runtime-migration-kusama: variables: NETWORK: "kusama" -check-runtime-migration-westend: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "westend" +# check-runtime-migration-westend: +# stage: check +# extends: +# - .docker-env +# - .test-pr-refs +# - .check-runtime-migration +# variables: +# NETWORK: "westend" -check-runtime-migration-rococo: - stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "rococo" +# check-runtime-migration-rococo: +# stage: check +# # DAG +# needs: +# - job: check-runtime-migration-westend +# artifacts: false +# extends: +# - .docker-env +# - .test-pr-refs +# - .check-runtime-migration +# variables: +# NETWORK: "rococo" find-fail-ci-phrase: stage: check From 0ce98821747d45ca58a8ec549642d5d102e37f65 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:05:48 +1200 Subject: [PATCH 07/35] debug: only kusama --- .gitlab-ci.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 46c1057288a4..e5091c5eff13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -379,20 +379,20 @@ cancel-pipeline-build-short-benchmark: needs: - job: build-short-benchmark -cancel-pipeline-check-runtime-migration-rococo: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-rococo - -cancel-pipeline-check-runtime-migration-westend: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-westend - -cancel-pipeline-check-runtime-migration-polkadot: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-polkadot +# cancel-pipeline-check-runtime-migration-rococo: +# extends: .cancel-pipeline-template +# needs: +# - job: check-runtime-migration-rococo + +# cancel-pipeline-check-runtime-migration-westend: +# extends: .cancel-pipeline-template +# needs: +# - job: check-runtime-migration-westend + +# cancel-pipeline-check-runtime-migration-polkadot: +# extends: .cancel-pipeline-template +# needs: +# - job: check-runtime-migration-polkadot cancel-pipeline-check-runtime-migration-kusama: extends: .cancel-pipeline-template From 5826d24d052a232b332c2b81aff64a342384c72c Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:19:39 +1200 Subject: [PATCH 08/35] staging-kusama --- .gitlab/pipeline/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 16bf7eaf0394..a7c7a7b752a0 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -118,7 +118,7 @@ test-rust-feature-propagation: time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --tag v0.3.0 echo "---------- Building runtime for ${NETWORK} ----------" time cargo build --release --locked -p "$NETWORK"-runtime --features try-runtime - echo "---------- Running try-runtime for ${NETWORK} ----------" + echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------" time try-runtime \ --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 @@ -148,7 +148,7 @@ check-runtime-migration-kusama: - .test-pr-refs - .check-runtime-migration variables: - NETWORK: "kusama" + NETWORK: "staging-kusama" # check-runtime-migration-westend: # stage: check From 74d2e32de985c51b9c7f26d05d928e20e8e1cfe1 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:40:41 +1200 Subject: [PATCH 09/35] network package wasm variables --- .gitlab/pipeline/check.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index a7c7a7b752a0..23f82d985dfc 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -116,11 +116,11 @@ test-rust-feature-propagation: export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Installing try-runtime-cli ----------" time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --tag v0.3.0 - echo "---------- Building runtime for ${NETWORK} ----------" - time cargo build --release --locked -p "$NETWORK"-runtime --features try-runtime + echo "---------- Building ${PACKAGE} runtime ----------" + time cargo build --release --locked -p "$PACKAGE" --features try-runtime echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------" time try-runtime \ - --runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \ + --runtime ./target/release/wbuild/"$PACKAGE"/target/wasm32-unknown-unknown/release/"$WASM" \ on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 # check-runtime-migration-polkadot: @@ -148,7 +148,9 @@ check-runtime-migration-kusama: - .test-pr-refs - .check-runtime-migration variables: - NETWORK: "staging-kusama" + NETWORK: "kusama" + PACKAGE: "staging-kusama" + WASM: "staging_kusama_runtime.wasm" # check-runtime-migration-westend: # stage: check From f4f48437ea369e180c798c8588ce8719685ac972 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 13:48:20 +1200 Subject: [PATCH 10/35] fix package name --- .gitlab/pipeline/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 23f82d985dfc..50024a2178bf 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -149,7 +149,7 @@ check-runtime-migration-kusama: - .check-runtime-migration variables: NETWORK: "kusama" - PACKAGE: "staging-kusama" + PACKAGE: "staging-kusama-runtime" WASM: "staging_kusama_runtime.wasm" # check-runtime-migration-westend: From 6af3482a91694666cae15278103e6113b76b679f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 14:15:06 +1200 Subject: [PATCH 11/35] enable for all chains --- .gitlab-ci.yml | 73 +++++++++--- .gitlab/pipeline/check.yml | 220 ++++++++++++++++++++++++++++++------- 2 files changed, 240 insertions(+), 53 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5091c5eff13..922459ecf631 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -379,22 +379,67 @@ cancel-pipeline-build-short-benchmark: needs: - job: build-short-benchmark -# cancel-pipeline-check-runtime-migration-rococo: -# extends: .cancel-pipeline-template -# needs: -# - job: check-runtime-migration-rococo - -# cancel-pipeline-check-runtime-migration-westend: -# extends: .cancel-pipeline-template -# needs: -# - job: check-runtime-migration-westend - -# cancel-pipeline-check-runtime-migration-polkadot: -# extends: .cancel-pipeline-template -# needs: -# - job: check-runtime-migration-polkadot +# Relay chains +cancel-pipeline-check-runtime-migration-polkadot: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-polkadot cancel-pipeline-check-runtime-migration-kusama: extends: .cancel-pipeline-template needs: - job: check-runtime-migration-kusama + +cancel-pipeline-check-runtime-migration-rococo: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-rococo + +cancel-pipeline-check-runtime-migration-westend: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-westend + +# Asset hub chains +cancel-pipeline-check-runtime-migration-asset-hub-polkadot: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-asset-hub-polkadot + +cancel-pipeline-check-runtime-migration-asset-hub-kusama: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-asset-hub-kusama + +cancel-pipeline-check-runtime-migration-asset-hub-westend: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-asset-hub-westend + +# Bridge hub +cancel-pipeline-check-runtime-migration-bridge-hub-polkadot: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-bridge-hub-polkadot + +cancel-pipeline-check-runtime-migration-bridge-hub-kusama: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-bridge-hub-kusama + +cancel-pipeline-check-runtime-migration-bridge-hub-rococo: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-bridge-hub-rococo + +# Collectives +cancel-pipeline-check-runtime-migration-collectives-polkadot: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-collectives-polkadot + +# Contracts +cancel-pipeline-check-runtime-migration-contracts-rococo: + extends: .cancel-pipeline-template + needs: + - job: check-runtime-migration-contracts-rococo diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 50024a2178bf..922e9601d99b 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -121,28 +121,31 @@ test-rust-feature-propagation: echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------" time try-runtime \ --runtime ./target/release/wbuild/"$PACKAGE"/target/wasm32-unknown-unknown/release/"$WASM" \ - on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443 - -# check-runtime-migration-polkadot: -# stage: check -# # DAG -# needs: -# - job: check-runtime-migration-westend -# artifacts: false -# extends: -# - .docker-env -# - .test-pr-refs -# - .check-runtime-migration -# variables: -# NETWORK: "polkadot" + on-runtime-upgrade --checks=pre-and-post live --uri ${URI} + +# Check runtime migrations for relay chains +check-runtime-migration-polkadot: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "polkadot" + PACKAGE: "polkadot-runtime" + WASM: "polkadot_runtime.wasm" + URI: "wss://polkadot-try-runtime-node.parity-chains.parity.io:443" check-runtime-migration-kusama: stage: check # DAG - # todo: reenable this - # needs: - # - job: check-runtime-migration-westend - # artifacts: false + needs: + - job: check-runtime-migration-westend + artifacts: false extends: - .docker-env - .test-pr-refs @@ -151,28 +154,167 @@ check-runtime-migration-kusama: NETWORK: "kusama" PACKAGE: "staging-kusama-runtime" WASM: "staging_kusama_runtime.wasm" + URI: "wss://kusama-try-runtime-node.parity-chains.parity.io:443" + +check-runtime-migration-westend: + stage: check + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "westend" + PACKAGE: "kusama-runtime" + WASM: "westend_runtime.wasm" + URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443" + +check-runtime-migration-rococo: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "rococo" + PACKAGE: "rococo-runtime" + WASM: "rococo_runtime.wasm" + URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443" + +# Check runtime migrations for asset hub chains +check-runtime-migration-asset-hub-polkadot: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "asset-hub-polkadot" + PACKAGE: "asset-hub-polkadot-runtime" + WASM: "asset_hub_polkadot_runtime.wasm" + URI: "wss://polkadot-asset-hub-rpc.polkadot.io:443" + +check-runtime-migration-asset-hub-kusama: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "asset-hub-kusama" + PACKAGE: "asset-hub-kusama-runtime" + WASM: "asset_hub_kusama_runtime.wasm" + URI: "wss://kusama-asset-hub-rpc.polkadot.io:443" + +check-runtime-migration-asset-hub-westend: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "asset-hub-westend" + PACKAGE: "asset-hub-westend-runtime" + WASM: "asset_hub_westend_runtime.wasm" + URI: "wss://westend-asset-hub-rpc.polkadot.io:443" + +# Check runtime migrations for bridge hub chains +check-runtime-migration-bridge-hub-polkadot: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "bridge-hub-polkadot" + PACKAGE: "bridge-hub-polkadot-runtime" + WASM: "bridge_hub_polkadot_runtime.wasm" + URI: "wss://polkadot-bridge-hub-rpc.polkadot.io:443" -# check-runtime-migration-westend: -# stage: check -# extends: -# - .docker-env -# - .test-pr-refs -# - .check-runtime-migration -# variables: -# NETWORK: "westend" - -# check-runtime-migration-rococo: -# stage: check -# # DAG -# needs: -# - job: check-runtime-migration-westend -# artifacts: false -# extends: -# - .docker-env -# - .test-pr-refs -# - .check-runtime-migration -# variables: -# NETWORK: "rococo" +check-runtime-migration-bridge-hub-kusama: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "bridge-hub-kusama" + PACKAGE: "bridge-hub-kusama-runtime" + WASM: "bridge_hub_kusama_runtime.wasm" + URI: "wss://kusama-bridge-hub-rpc.polkadot.io:443" + +check-runtime-migration-bridge-hub-rococo: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "bridge-hub-rococo" + PACKAGE: "bridge-hub-rococo-runtime" + WASM: "bridge_hub_rococo_runtime.wasm" + URI: "wss://rococo-bridge-hub-rpc.polkadot.io:443" + +# Check runtime migrations for collective chains +check-runtime-migration-collectives-polkadot: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "collectives-polkadot" + PACKAGE: "collectives-polkadot-runtime" + WASM: "collectives_polkadot_runtime.wasm" + URI: "wss://polkadot-collectives-rpc.polkadot.io:443" + +# Check runtime migrations for contracts chains +check-runtime-migration-contracts-rococo: + stage: check + # DAG + needs: + - job: check-runtime-migration-westend + artifacts: false + extends: + - .docker-env + - .test-pr-refs + - .check-runtime-migration + variables: + NETWORK: "contracts-rococo" + PACKAGE: "contracts-rococo-runtime" + WASM: "contracts_rococo_runtime.wasm" + URI: "wss://rococo-contracts-rpc.polkadot.io:443" find-fail-ci-phrase: stage: check From 4547517210722997f1db0cffdb83b198f6e6c385 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 14:24:33 +1200 Subject: [PATCH 12/35] fix typo --- .gitlab/pipeline/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 922e9601d99b..1de2802d8e46 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -164,7 +164,7 @@ check-runtime-migration-westend: - .check-runtime-migration variables: NETWORK: "westend" - PACKAGE: "kusama-runtime" + PACKAGE: "westend-runtime" WASM: "westend_runtime.wasm" URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443" From 8f033623d1b25a2451a6686e44f871449c584f65 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 1 Sep 2023 15:06:13 +1200 Subject: [PATCH 13/35] fix uniques storage version --- substrate/frame/uniques/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/substrate/frame/uniques/src/lib.rs b/substrate/frame/uniques/src/lib.rs index 1b75d0b078ba..8334a8d943e1 100644 --- a/substrate/frame/uniques/src/lib.rs +++ b/substrate/frame/uniques/src/lib.rs @@ -69,7 +69,10 @@ pub mod pallet { use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[cfg(feature = "runtime-benchmarks")] From 52a99553614ae3b8d15c9147ff1e8f72d2045e4f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 16:10:23 +1000 Subject: [PATCH 14/35] init sp storage versions --- .../assets/asset-hub-kusama/src/lib.rs | 52 +++++++++++++++++-- .../assets/asset-hub-polkadot/src/lib.rs | 47 ++++++++++++++++- .../assets/asset-hub-westend/src/lib.rs | 40 ++++++++++++++ .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 27 +++++++++- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 37 ++++++++++++- .../collectives-polkadot/src/lib.rs | 46 ++++++++++++++++ 6 files changed, 243 insertions(+), 6 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index 828d1b4750a3..1810f001291b 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -38,7 +38,9 @@ use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, + traits::{ + AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Saturating, Verify, + }, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Permill, }; @@ -55,7 +57,7 @@ use frame_support::{ ord_parameter_types, parameter_types, traits::{ AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, - InstanceFilter, + InstanceFilter, StorageVersion, }, weights::{ConstantMultiplier, Weight}, BoundedVec, PalletId, @@ -889,7 +891,51 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); +pub type Migrations = + (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); + +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::GetStorageVersion; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Multisig::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Nfts::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(5, writes) + } +} /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index 0051af21f9a3..3ab988f2e75f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -796,7 +796,52 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); +pub type Migrations = + (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); + +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::{GetStorageVersion, StorageVersion}; + use sp_runtime::traits::Saturating; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Multisig::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Uniques::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Nfts::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(5, writes) + } +} /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 4887fce1b0a4..09dd638eb344 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -856,8 +856,48 @@ pub type Migrations = ( pallet_collator_selection::migration::v1::MigrateToV1, // unreleased migrations::NativeAssetParents0ToParents1Migration, + InitStorageVersions, ); +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::{GetStorageVersion, StorageVersion}; + use sp_runtime::traits::Saturating; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Multisig::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(4, writes) + } +} + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index 54b15e6b327b..c8ec50e13411 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -106,7 +106,32 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); +pub type Migrations = + (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); + +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::{GetStorageVersion, StorageVersion}; + use sp_runtime::traits::Saturating; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(1, writes) + } +} /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 309a5cfb0b1d..47906331f9ae 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -122,7 +122,42 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); +pub type Migrations = + (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); + +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::{GetStorageVersion, StorageVersion}; + use sp_runtime::traits::Saturating; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Balances::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Multisig::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(3, writes) + } +} /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 238db08a0c9e..2df477552a9b 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -639,8 +639,54 @@ type Migrations = ( import_kusama_fellowship::Migration, // unreleased pallet_collator_selection::migration::v1::MigrateToV1, + // unreleased + InitStorageVersions, ); +/// Migration to initialize storage versions for pallets added after genesis. +/// +/// Ideally this would be done automatically (see +/// ), but it probably won't be ready for some +/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're +/// doing it manually. +pub struct InitStorageVersions; + +impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { + fn on_runtime_upgrade() -> Weight { + use frame_support::traits::{GetStorageVersion, StorageVersion}; + use sp_runtime::traits::Saturating; + + let mut writes = 0; + + if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Multisig::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Preimage::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); + writes.saturating_inc(); + } + + if Scheduler::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(4).put::(); + writes.saturating_inc(); + } + + if FellowshipReferenda::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(4).put::(); + writes.saturating_inc(); + } + + ::DbWeight::get().reads_writes(5, writes) + } +} + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, From e1ea5db9485570010bcb64e45dc6f1420b7a1531 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 16:18:02 +1000 Subject: [PATCH 15/35] add extra args --- .gitlab/pipeline/check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index afa547f63b6a..0338cd8c4dfd 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -120,7 +120,7 @@ test-rust-feature-propagation: echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------" time try-runtime \ --runtime ./target/release/wbuild/"$PACKAGE"/target/wasm32-unknown-unknown/release/"$WASM" \ - on-runtime-upgrade --checks=pre-and-post live --uri ${URI} + on-runtime-upgrade --checks=pre-and-post ${EXTRA_ARGS} live --uri ${URI} # Check runtime migrations for relay chains check-runtime-migration-polkadot: @@ -138,6 +138,7 @@ check-runtime-migration-polkadot: PACKAGE: "polkadot-runtime" WASM: "polkadot_runtime.wasm" URI: "wss://polkadot-try-runtime-node.parity-chains.parity.io:443" + EXTRA_ARGS: "--no-weight-warnings" check-runtime-migration-kusama: stage: check @@ -154,6 +155,7 @@ check-runtime-migration-kusama: PACKAGE: "staging-kusama-runtime" WASM: "staging_kusama_runtime.wasm" URI: "wss://kusama-try-runtime-node.parity-chains.parity.io:443" + EXTRA_ARGS: "--no-weight-warnings" check-runtime-migration-westend: stage: check @@ -166,6 +168,7 @@ check-runtime-migration-westend: PACKAGE: "westend-runtime" WASM: "westend_runtime.wasm" URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443" + EXTRA_ARGS: "--no-weight-warnings" check-runtime-migration-rococo: stage: check @@ -182,6 +185,7 @@ check-runtime-migration-rococo: PACKAGE: "rococo-runtime" WASM: "rococo_runtime.wasm" URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443" + EXTRA_ARGS: "--no-weight-warnings" # Check runtime migrations for asset hub chains check-runtime-migration-asset-hub-polkadot: From f2323ba125b3e4bfa6fccb8dcbba29466da4ec26 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 16:44:08 +1000 Subject: [PATCH 16/35] remove redundant check --- substrate/frame/nfts/src/migration.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/substrate/frame/nfts/src/migration.rs b/substrate/frame/nfts/src/migration.rs index f90d332062a2..94635a96aeba 100644 --- a/substrate/frame/nfts/src/migration.rs +++ b/substrate/frame/nfts/src/migration.rs @@ -97,9 +97,6 @@ pub mod v1 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { - let current_version = Pallet::::current_storage_version(); - let onchain_version = Pallet::::on_chain_storage_version(); - ensure!(onchain_version == 0 && current_version == 1, "migration from version 0 to 1."); let prev_count = Collection::::iter().count(); Ok((prev_count as u32).encode()) } @@ -115,7 +112,7 @@ pub mod v1 { "the records count before and after the migration should be the same" ); - ensure!(Pallet::::on_chain_storage_version() == 1, "wrong storage version"); + ensure!(Pallet::::on_chain_storage_version() >= 1, "wrong storage version"); Ok(()) } From f797e33bc903de99a0ff16649f952c2b4c5ea9cc Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 16:46:08 +1000 Subject: [PATCH 17/35] remove dag --- .gitlab/pipeline/check.yml | 44 -------------------------------------- 1 file changed, 44 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 0338cd8c4dfd..161ee9820f7c 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -125,10 +125,6 @@ test-rust-feature-propagation: # Check runtime migrations for relay chains check-runtime-migration-polkadot: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -142,10 +138,6 @@ check-runtime-migration-polkadot: check-runtime-migration-kusama: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -172,10 +164,6 @@ check-runtime-migration-westend: check-runtime-migration-rococo: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -190,10 +178,6 @@ check-runtime-migration-rococo: # Check runtime migrations for asset hub chains check-runtime-migration-asset-hub-polkadot: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -206,10 +190,6 @@ check-runtime-migration-asset-hub-polkadot: check-runtime-migration-asset-hub-kusama: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -222,10 +202,6 @@ check-runtime-migration-asset-hub-kusama: check-runtime-migration-asset-hub-westend: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -239,10 +215,6 @@ check-runtime-migration-asset-hub-westend: # Check runtime migrations for bridge hub chains check-runtime-migration-bridge-hub-polkadot: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -255,10 +227,6 @@ check-runtime-migration-bridge-hub-polkadot: check-runtime-migration-bridge-hub-kusama: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -271,10 +239,6 @@ check-runtime-migration-bridge-hub-kusama: check-runtime-migration-bridge-hub-rococo: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -288,10 +252,6 @@ check-runtime-migration-bridge-hub-rococo: # Check runtime migrations for collective chains check-runtime-migration-collectives-polkadot: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs @@ -305,10 +265,6 @@ check-runtime-migration-collectives-polkadot: # Check runtime migrations for contracts chains check-runtime-migration-contracts-rococo: stage: check - # DAG - needs: - - job: check-runtime-migration-westend - artifacts: false extends: - .docker-env - .test-pr-refs From 73d94c08e4729df7ca5e24494d845b93f168a1ce Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 16:46:23 +1000 Subject: [PATCH 18/35] remove redundant check --- substrate/frame/referenda/src/migration.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/substrate/frame/referenda/src/migration.rs b/substrate/frame/referenda/src/migration.rs index 281da83d6569..a80897242eec 100644 --- a/substrate/frame/referenda/src/migration.rs +++ b/substrate/frame/referenda/src/migration.rs @@ -99,8 +99,6 @@ pub mod v1 { impl, I: 'static> OnRuntimeUpgrade for MigrateV0ToV1 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { - let onchain_version = Pallet::::on_chain_storage_version(); - ensure!(onchain_version == 0, "migration from version 0 to 1."); let referendum_count = v0::ReferendumInfoFor::::iter().count(); log::info!( target: TARGET, From 8d1c121041e26b53603ebc605dd45387813031a3 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:18:47 +1000 Subject: [PATCH 19/35] run missing migration --- .../runtimes/assets/asset-hub-kusama/src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index 1810f001291b..0d70aa4d79c1 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -891,8 +891,11 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); +pub type Migrations = ( + pallet_collator_selection::migration::v1::MigrateToV1, + pallet_multisig::migrations::v1::MigrateToV1, + InitStorageVersions, +); /// Migration to initialize storage versions for pallets added after genesis. /// @@ -918,11 +921,6 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Nfts::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { StorageVersion::new(1).put::(); writes.saturating_inc(); @@ -933,7 +931,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - ::DbWeight::get().reads_writes(5, writes) + ::DbWeight::get().reads_writes(4, writes) } } From f5469586013427d681f6d76728d1dceacd3b01fb Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:19:16 +1000 Subject: [PATCH 20/35] fix migration --- .../parachains/runtimes/assets/asset-hub-kusama/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index 0d70aa4d79c1..72991ec412aa 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -916,8 +916,8 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + if Nfts::on_chain_storage_version() == StorageVersion::new(0) { + StorageVersion::new(1).put::(); writes.saturating_inc(); } From 93980b7c4fb6f472889efbea40997c3484b8b8d4 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:28:07 +1000 Subject: [PATCH 21/35] fix multisig migration --- .../runtimes/assets/asset-hub-polkadot/src/lib.rs | 12 +++++------- .../runtimes/assets/asset-hub-westend/src/lib.rs | 10 ++++------ .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 14 ++++++-------- .../collectives/collectives-polkadot/src/lib.rs | 9 +++------ substrate/frame/multisig/src/migrations.rs | 4 ---- 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index 3ab988f2e75f..217bfa1c1dcc 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -796,8 +796,11 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); +pub type Migrations = ( + pallet_collator_selection::migration::v1::MigrateToV1, + pallet_multisig::migrations::v1::MigrateToV1, + InitStorageVersions, +); /// Migration to initialize storage versions for pallets added after genesis. /// @@ -819,11 +822,6 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - if Uniques::on_chain_storage_version() == StorageVersion::new(0) { StorageVersion::new(1).put::(); writes.saturating_inc(); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 09dd638eb344..ba1d9657a5cb 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -856,6 +856,9 @@ pub type Migrations = ( pallet_collator_selection::migration::v1::MigrateToV1, // unreleased migrations::NativeAssetParents0ToParents1Migration, + // unreleased + pallet_multisig::migrations::v1::MigrateToV1, + // unreleased InitStorageVersions, ); @@ -879,11 +882,6 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { StorageVersion::new(1).put::(); writes.saturating_inc(); @@ -894,7 +892,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - ::DbWeight::get().reads_writes(4, writes) + ::DbWeight::get().reads_writes(3, writes) } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 47906331f9ae..63bf1b522466 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -122,8 +122,11 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); +pub type Migrations = ( + pallet_collator_selection::migration::v1::MigrateToV1, + pallet_multisig::migrations::v1::MigrateToV1, + InitStorageVersions, +); /// Migration to initialize storage versions for pallets added after genesis. /// @@ -150,12 +153,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(3, writes) + ::DbWeight::get().reads_writes(2, writes) } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 2df477552a9b..93b0d1bb7489 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -640,6 +640,8 @@ type Migrations = ( // unreleased pallet_collator_selection::migration::v1::MigrateToV1, // unreleased + pallet_multisig::migrations::v1::MigrateToV1, + // unreleased InitStorageVersions, ); @@ -663,11 +665,6 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - if Multisig::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - if Preimage::on_chain_storage_version() == StorageVersion::new(0) { StorageVersion::new(1).put::(); writes.saturating_inc(); @@ -683,7 +680,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - ::DbWeight::get().reads_writes(5, writes) + ::DbWeight::get().reads_writes(4, writes) } } diff --git a/substrate/frame/multisig/src/migrations.rs b/substrate/frame/multisig/src/migrations.rs index 3be55080b240..14ced091be5f 100644 --- a/substrate/frame/multisig/src/migrations.rs +++ b/substrate/frame/multisig/src/migrations.rs @@ -45,8 +45,6 @@ pub mod v1 { fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { let onchain = Pallet::::on_chain_storage_version(); - ensure!(onchain < 1, "this migration can be deleted"); - log!(info, "Number of calls to refund and delete: {}", Calls::::iter().count()); Ok(Vec::new()) @@ -73,8 +71,6 @@ pub mod v1 { #[cfg(feature = "try-runtime")] fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { let onchain = Pallet::::on_chain_storage_version(); - ensure!(onchain < 2, "this migration needs to be removed"); - ensure!(onchain == 1, "this migration needs to be run"); ensure!( Calls::::iter().count() == 0, "there are some dangling calls that need to be destroyed and refunded" From d2126d3e46a8aa91f1f8d36a4d7cdcc5ea8b9457 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:29:13 +1000 Subject: [PATCH 22/35] fix reads --- .../parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index 217bfa1c1dcc..cd6bf3cffcb5 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -837,7 +837,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { writes.saturating_inc(); } - ::DbWeight::get().reads_writes(5, writes) + ::DbWeight::get().reads_writes(4, writes) } } From 874eb13fb92186e8f30a81a9f006c46ddd96a575 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:36:02 +1000 Subject: [PATCH 23/35] kick ci --- substrate/frame/uniques/src/migration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/uniques/src/migration.rs b/substrate/frame/uniques/src/migration.rs index 6c92b753b4ac..507e9341977e 100644 --- a/substrate/frame/uniques/src/migration.rs +++ b/substrate/frame/uniques/src/migration.rs @@ -25,7 +25,7 @@ pub fn migrate_to_v1, I: 'static, P: GetStorageVersion + PalletInfo let on_chain_storage_version =

::on_chain_storage_version(); log::info!( target: LOG_TARGET, - "Running migration storage v1 for uniques with storage version {:?}", + " Running migration storage v1 for uniques with storage version {:?}", on_chain_storage_version, ); From d6feb430a9f76f503bce6f2f8a56e82f561e7f40 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:36:13 +1000 Subject: [PATCH 24/35] kick ci --- substrate/frame/uniques/src/migration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/uniques/src/migration.rs b/substrate/frame/uniques/src/migration.rs index 507e9341977e..6c92b753b4ac 100644 --- a/substrate/frame/uniques/src/migration.rs +++ b/substrate/frame/uniques/src/migration.rs @@ -25,7 +25,7 @@ pub fn migrate_to_v1, I: 'static, P: GetStorageVersion + PalletInfo let on_chain_storage_version =

::on_chain_storage_version(); log::info!( target: LOG_TARGET, - " Running migration storage v1 for uniques with storage version {:?}", + "Running migration storage v1 for uniques with storage version {:?}", on_chain_storage_version, ); From e865aff6e880de41f178e2ee5cff3c38212d7186 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:45:23 +1000 Subject: [PATCH 25/35] remove unused vars --- substrate/frame/multisig/src/migrations.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/substrate/frame/multisig/src/migrations.rs b/substrate/frame/multisig/src/migrations.rs index 14ced091be5f..294bedae8880 100644 --- a/substrate/frame/multisig/src/migrations.rs +++ b/substrate/frame/multisig/src/migrations.rs @@ -43,8 +43,6 @@ pub mod v1 { impl OnRuntimeUpgrade for MigrateToV1 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { - let onchain = Pallet::::on_chain_storage_version(); - log!(info, "Number of calls to refund and delete: {}", Calls::::iter().count()); Ok(Vec::new()) @@ -70,7 +68,6 @@ pub mod v1 { #[cfg(feature = "try-runtime")] fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { - let onchain = Pallet::::on_chain_storage_version(); ensure!( Calls::::iter().count() == 0, "there are some dangling calls that need to be destroyed and refunded" From b199330d8048f012270b086dfb784d43b6c17f70 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 17:57:17 +1000 Subject: [PATCH 26/35] fix fellowship referenda version --- .../runtimes/collectives/collectives-polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 93b0d1bb7489..51c85b94fc3f 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -676,7 +676,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { } if FellowshipReferenda::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(4).put::(); + StorageVersion::new(1).put::(); writes.saturating_inc(); } From 43a13c3ad10582d598d64a9c528d110e5979fcb6 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Sep 2023 18:39:49 +1000 Subject: [PATCH 27/35] remove executed migration --- .../runtimes/collectives/collectives-polkadot/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 51c85b94fc3f..a7b4cc47d8d2 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -635,8 +635,6 @@ pub type UncheckedExtrinsic = /// All migrations executed on runtime upgrade as a nested tuple of types implementing /// `OnRuntimeUpgrade`. Included migrations must be idempotent. type Migrations = ( - // v9420 - import_kusama_fellowship::Migration, // unreleased pallet_collator_selection::migration::v1::MigrateToV1, // unreleased From 5c5b3e410cfeb04af593b496cf6c1ebca9703256 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Sep 2023 13:06:18 +0100 Subject: [PATCH 28/35] reset changes to fellowship runtimes --- .../assets/asset-hub-kusama/src/lib.rs | 50 ++----------------- .../assets/asset-hub-polkadot/src/lib.rs | 45 +---------------- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 27 +--------- .../collectives-polkadot/src/lib.rs | 45 +---------------- 4 files changed, 7 insertions(+), 160 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index 72991ec412aa..828d1b4750a3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -38,9 +38,7 @@ use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{ - AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Saturating, Verify, - }, + traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Permill, }; @@ -57,7 +55,7 @@ use frame_support::{ ord_parameter_types, parameter_types, traits::{ AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, - InstanceFilter, StorageVersion, + InstanceFilter, }, weights::{ConstantMultiplier, Weight}, BoundedVec, PalletId, @@ -891,49 +889,7 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = ( - pallet_collator_selection::migration::v1::MigrateToV1, - pallet_multisig::migrations::v1::MigrateToV1, - InitStorageVersions, -); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're -/// doing it manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::GetStorageVersion; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if Nfts::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(4, writes) - } -} +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index cd6bf3cffcb5..0051af21f9a3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -796,50 +796,7 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = ( - pallet_collator_selection::migration::v1::MigrateToV1, - pallet_multisig::migrations::v1::MigrateToV1, - InitStorageVersions, -); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're -/// doing it manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if Uniques::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if Nfts::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(4, writes) - } -} +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index c8ec50e13411..54b15e6b327b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -106,32 +106,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = - (pallet_collator_selection::migration::v1::MigrateToV1, InitStorageVersions); - -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're -/// doing it manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(1, writes) - } -} +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 4e608c562c99..d833c75d470c 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -667,53 +667,12 @@ pub type UncheckedExtrinsic = /// All migrations executed on runtime upgrade as a nested tuple of types implementing /// `OnRuntimeUpgrade`. Included migrations must be idempotent. type Migrations = ( + // v9420 + import_kusama_fellowship::Migration, // unreleased pallet_collator_selection::migration::v1::MigrateToV1, - // unreleased - pallet_multisig::migrations::v1::MigrateToV1, - // unreleased - InitStorageVersions, ); -/// Migration to initialize storage versions for pallets added after genesis. -/// -/// Ideally this would be done automatically (see -/// ), but it probably won't be ready for some -/// time and it's beneficial to get try-runtime-cli on-runtime-upgrade checks into the CI, so we're -/// doing it manually. -pub struct InitStorageVersions; - -impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { - fn on_runtime_upgrade() -> Weight { - use frame_support::traits::{GetStorageVersion, StorageVersion}; - use sp_runtime::traits::Saturating; - - let mut writes = 0; - - if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if Preimage::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - if Scheduler::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(4).put::(); - writes.saturating_inc(); - } - - if FellowshipReferenda::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); - writes.saturating_inc(); - } - - ::DbWeight::get().reads_writes(4, writes) - } -} - /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, From e2fc38873d18daa2f0aaa8faec583b8ebb9dc302 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Sep 2023 13:12:00 +0100 Subject: [PATCH 29/35] fix multisig migration return weight --- substrate/frame/multisig/src/migrations.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/substrate/frame/multisig/src/migrations.rs b/substrate/frame/multisig/src/migrations.rs index 294bedae8880..aec00cc42cae 100644 --- a/substrate/frame/multisig/src/migrations.rs +++ b/substrate/frame/multisig/src/migrations.rs @@ -49,6 +49,8 @@ pub mod v1 { } fn on_runtime_upgrade() -> Weight { + use sp_runtime::Saturating; + let current = Pallet::::current_storage_version(); let onchain = Pallet::::on_chain_storage_version(); @@ -57,13 +59,22 @@ pub mod v1 { return T::DbWeight::get().reads(1) } + let mut call_count = 0u64; Calls::::drain().for_each(|(_call_hash, (_data, caller, deposit))| { T::Currency::unreserve(&caller, deposit); + call_count.saturating_inc(); }); current.put::>(); - ::BlockWeights::get().max_block + T::DbWeight::get().reads_writes( + // Reads: Get Calls + Get Version + call_count.saturating_add(1), + // Writes: Drain Calls + Unreserves + Set version + call_count.saturating_mul(2).saturating_add(1), + ) + + // ::BlockWeights::get().max_block } #[cfg(feature = "try-runtime")] From c659135c289b814bac2cbf12d3706e1d4c0aa4d1 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Sep 2023 13:15:30 +0100 Subject: [PATCH 30/35] reset cancel pipelines --- .gitlab-ci.yml | 55 -------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6b4364032da..ee6b9c987333 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -380,17 +380,6 @@ cancel-pipeline-build-short-benchmark: needs: - job: build-short-benchmark -# Relay chains -cancel-pipeline-check-runtime-migration-polkadot: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-polkadot - -cancel-pipeline-check-runtime-migration-kusama: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-kusama - cancel-pipeline-check-runtime-migration-rococo: extends: .cancel-pipeline-template needs: @@ -400,47 +389,3 @@ cancel-pipeline-check-runtime-migration-westend: extends: .cancel-pipeline-template needs: - job: check-runtime-migration-westend - -# Asset hub chains -cancel-pipeline-check-runtime-migration-asset-hub-polkadot: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-asset-hub-polkadot - -cancel-pipeline-check-runtime-migration-asset-hub-kusama: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-asset-hub-kusama - -cancel-pipeline-check-runtime-migration-asset-hub-westend: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-asset-hub-westend - -# Bridge hub -cancel-pipeline-check-runtime-migration-bridge-hub-polkadot: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-bridge-hub-polkadot - -cancel-pipeline-check-runtime-migration-bridge-hub-kusama: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-bridge-hub-kusama - -cancel-pipeline-check-runtime-migration-bridge-hub-rococo: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-bridge-hub-rococo - -# Collectives -cancel-pipeline-check-runtime-migration-collectives-polkadot: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-collectives-polkadot - -# Contracts -cancel-pipeline-check-runtime-migration-contracts-rococo: - extends: .cancel-pipeline-template - needs: - - job: check-runtime-migration-contracts-rococo From 3dc6b44f38bcea6d1e467b829c31ff4050bce86a Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Sep 2023 13:15:46 +0100 Subject: [PATCH 31/35] remove checks for fellowship runtimes --- .gitlab/pipeline/check.yml | 94 ++------------------------------------ 1 file changed, 3 insertions(+), 91 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 161ee9820f7c..8b71e150fe49 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -122,33 +122,7 @@ test-rust-feature-propagation: --runtime ./target/release/wbuild/"$PACKAGE"/target/wasm32-unknown-unknown/release/"$WASM" \ on-runtime-upgrade --checks=pre-and-post ${EXTRA_ARGS} live --uri ${URI} -# Check runtime migrations for relay chains -check-runtime-migration-polkadot: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "polkadot" - PACKAGE: "polkadot-runtime" - WASM: "polkadot_runtime.wasm" - URI: "wss://polkadot-try-runtime-node.parity-chains.parity.io:443" - EXTRA_ARGS: "--no-weight-warnings" - -check-runtime-migration-kusama: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "kusama" - PACKAGE: "staging-kusama-runtime" - WASM: "staging_kusama_runtime.wasm" - URI: "wss://kusama-try-runtime-node.parity-chains.parity.io:443" - EXTRA_ARGS: "--no-weight-warnings" - +# Check runtime migrations for Parity managed relay chains check-runtime-migration-westend: stage: check extends: @@ -175,31 +149,7 @@ check-runtime-migration-rococo: URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443" EXTRA_ARGS: "--no-weight-warnings" -# Check runtime migrations for asset hub chains -check-runtime-migration-asset-hub-polkadot: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "asset-hub-polkadot" - PACKAGE: "asset-hub-polkadot-runtime" - WASM: "asset_hub_polkadot_runtime.wasm" - URI: "wss://polkadot-asset-hub-rpc.polkadot.io:443" - -check-runtime-migration-asset-hub-kusama: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "asset-hub-kusama" - PACKAGE: "asset-hub-kusama-runtime" - WASM: "asset_hub_kusama_runtime.wasm" - URI: "wss://kusama-asset-hub-rpc.polkadot.io:443" - +# Check runtime migrations for Parity managed asset hub chains check-runtime-migration-asset-hub-westend: stage: check extends: @@ -212,31 +162,6 @@ check-runtime-migration-asset-hub-westend: WASM: "asset_hub_westend_runtime.wasm" URI: "wss://westend-asset-hub-rpc.polkadot.io:443" -# Check runtime migrations for bridge hub chains -check-runtime-migration-bridge-hub-polkadot: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "bridge-hub-polkadot" - PACKAGE: "bridge-hub-polkadot-runtime" - WASM: "bridge_hub_polkadot_runtime.wasm" - URI: "wss://polkadot-bridge-hub-rpc.polkadot.io:443" - -check-runtime-migration-bridge-hub-kusama: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "bridge-hub-kusama" - PACKAGE: "bridge-hub-kusama-runtime" - WASM: "bridge_hub_kusama_runtime.wasm" - URI: "wss://kusama-bridge-hub-rpc.polkadot.io:443" - check-runtime-migration-bridge-hub-rococo: stage: check extends: @@ -249,20 +174,7 @@ check-runtime-migration-bridge-hub-rococo: WASM: "bridge_hub_rococo_runtime.wasm" URI: "wss://rococo-bridge-hub-rpc.polkadot.io:443" -# Check runtime migrations for collective chains -check-runtime-migration-collectives-polkadot: - stage: check - extends: - - .docker-env - - .test-pr-refs - - .check-runtime-migration - variables: - NETWORK: "collectives-polkadot" - PACKAGE: "collectives-polkadot-runtime" - WASM: "collectives_polkadot_runtime.wasm" - URI: "wss://polkadot-collectives-rpc.polkadot.io:443" - -# Check runtime migrations for contracts chains +# Check runtime migrations for Parity managed contract chains check-runtime-migration-contracts-rococo: stage: check extends: From ee12159491ef6da1746423d54ff7f021aba1dcd8 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 22 Sep 2023 13:33:10 +0100 Subject: [PATCH 32/35] remove redundant comment --- substrate/frame/multisig/src/migrations.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/substrate/frame/multisig/src/migrations.rs b/substrate/frame/multisig/src/migrations.rs index aec00cc42cae..330613bb3dfd 100644 --- a/substrate/frame/multisig/src/migrations.rs +++ b/substrate/frame/multisig/src/migrations.rs @@ -73,8 +73,6 @@ pub mod v1 { // Writes: Drain Calls + Unreserves + Set version call_count.saturating_mul(2).saturating_add(1), ) - - // ::BlockWeights::get().max_block } #[cfg(feature = "try-runtime")] From 08c85f14c0085e1333da6ae0f6695cc99820d454 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Mon, 25 Sep 2023 18:46:26 +0100 Subject: [PATCH 33/35] use compact compressed wasm --- .gitlab/pipeline/check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 8b71e150fe49..0cd1149d3d5d 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -132,7 +132,7 @@ check-runtime-migration-westend: variables: NETWORK: "westend" PACKAGE: "westend-runtime" - WASM: "westend_runtime.wasm" + WASM: "westend_runtime.compact.compressed.wasm" URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443" EXTRA_ARGS: "--no-weight-warnings" @@ -145,7 +145,7 @@ check-runtime-migration-rococo: variables: NETWORK: "rococo" PACKAGE: "rococo-runtime" - WASM: "rococo_runtime.wasm" + WASM: "rococo_runtime.compact.compressed.wasm" URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443" EXTRA_ARGS: "--no-weight-warnings" @@ -159,7 +159,7 @@ check-runtime-migration-asset-hub-westend: variables: NETWORK: "asset-hub-westend" PACKAGE: "asset-hub-westend-runtime" - WASM: "asset_hub_westend_runtime.wasm" + WASM: "asset_hub_westend_runtime.compact.compressed.wasm" URI: "wss://westend-asset-hub-rpc.polkadot.io:443" check-runtime-migration-bridge-hub-rococo: @@ -171,7 +171,7 @@ check-runtime-migration-bridge-hub-rococo: variables: NETWORK: "bridge-hub-rococo" PACKAGE: "bridge-hub-rococo-runtime" - WASM: "bridge_hub_rococo_runtime.wasm" + WASM: "bridge_hub_rococo_runtime.compact.compressed.wasm" URI: "wss://rococo-bridge-hub-rpc.polkadot.io:443" # Check runtime migrations for Parity managed contract chains @@ -184,7 +184,7 @@ check-runtime-migration-contracts-rococo: variables: NETWORK: "contracts-rococo" PACKAGE: "contracts-rococo-runtime" - WASM: "contracts_rococo_runtime.wasm" + WASM: "contracts_rococo_runtime.compact.compressed.wasm" URI: "wss://rococo-contracts-rpc.polkadot.io:443" find-fail-ci-phrase: From 51a731ebdec748595b233a6595dcd5efc0eb3bfd Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Mon, 25 Sep 2023 18:53:33 +0100 Subject: [PATCH 34/35] set current storage versoin --- .../parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 6 +++--- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index ba1d9657a5cb..91c29c1270d6 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -878,17 +878,17 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { let mut writes = 0; if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + PolkadotXcm::current_storage_version().put::(); writes.saturating_inc(); } if ForeignAssets::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + ForeignAssets::current_storage_version().put::(); writes.saturating_inc(); } if PoolAssets::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + PoolAssets::current_storage_version().put::(); writes.saturating_inc(); } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 60c6df1225d1..a3c1c5dc0b13 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -144,12 +144,12 @@ impl frame_support::traits::OnRuntimeUpgrade for InitStorageVersions { let mut writes = 0; if PolkadotXcm::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + PolkadotXcm::current_storage_version().put::(); writes.saturating_inc(); } if Balances::on_chain_storage_version() == StorageVersion::new(0) { - StorageVersion::new(1).put::(); + Balances::current_storage_version().put::(); writes.saturating_inc(); } From 25db9746e89e3f81254d10707dc6ae1f16ec8069 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Mon, 25 Sep 2023 20:24:55 +0100 Subject: [PATCH 35/35] fix --runtime path --- .gitlab/pipeline/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml index 0cd1149d3d5d..4f92e6c15d2b 100644 --- a/.gitlab/pipeline/check.yml +++ b/.gitlab/pipeline/check.yml @@ -119,7 +119,7 @@ test-rust-feature-propagation: time cargo build --release --locked -p "$PACKAGE" --features try-runtime echo "---------- Executing `on-runtime-upgrade` for ${NETWORK} ----------" time try-runtime \ - --runtime ./target/release/wbuild/"$PACKAGE"/target/wasm32-unknown-unknown/release/"$WASM" \ + --runtime ./target/release/wbuild/"$PACKAGE"/"$WASM" \ on-runtime-upgrade --checks=pre-and-post ${EXTRA_ARGS} live --uri ${URI} # Check runtime migrations for Parity managed relay chains