From ece6939e44045d32c898d16b8bdce5ce9f8ac730 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 13:44:15 +0100 Subject: [PATCH 1/8] CI: Enable try-runtime idempotency check Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 75a0d14db1..1ea168cf65 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -71,10 +71,7 @@ jobs: if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings" fi - # Disable idempotency checks for now because the Scheduler pallet MigrateToV1 migration is - # non-idempotent at its root in Polkadot SDK V1.2.0. In V1.3.0 we can re-enable - # idempotency checks. - EXTRA_ARGS="--disable-spec-version-check --disable-idempotency-checks" + EXTRA_ARGS="--disable-spec-version-check" ./try-runtime \ --runtime ./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME \ on-runtime-upgrade --checks=pre-and-post $EXTRA_ARGS $NO_WEIGHT_WARNINGS_FLAG live --uri ${{ matrix.runtime.uri }} From 54c76d5e7dd42abf0bcd3f122062ded32b990d9f Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 13:55:19 +0100 Subject: [PATCH 2/8] Update to try-runtime-cli 0.5.2 Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 1ea168cf65..a60feab935 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -47,7 +47,7 @@ jobs: - name: Download try-runtime-cli run: | - curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime + curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.2/try-runtime-x86_64-unknown-linux-musl -o try-runtime chmod +x ./try-runtime - name: Install Protoc From 6ae71ef06b62d85a8b06f33349e7b286752e7517 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 14:11:19 +0100 Subject: [PATCH 3/8] Also enable spec version check Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index a60feab935..b735140ef4 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -71,7 +71,6 @@ jobs: if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings" fi - EXTRA_ARGS="--disable-spec-version-check" ./try-runtime \ --runtime ./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME \ on-runtime-upgrade --checks=pre-and-post $EXTRA_ARGS $NO_WEIGHT_WARNINGS_FLAG live --uri ${{ matrix.runtime.uri }} From 1c0a4799146a82e9558b7fb70622d8b1871fa7d1 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 18:46:13 +0100 Subject: [PATCH 4/8] Also check try-state invariants Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 33 +++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index b735140ef4..cf8d906683 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -60,17 +60,44 @@ jobs: - name: Build ${{ matrix.runtime.name }} run: | - cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime + cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked - name: Check migrations run: | PACKAGE_NAME=${{ matrix.runtime.package }} RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm + RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME + # When running on relay, we don't need weight checks. NO_WEIGHT_WARNINGS_FLAG="" if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings" fi + + # Disable the spec version check when we dont want to release. + EXTRA_FLAGS="" + if ! .github/changelog-processor.py CHANGELOG.md --should-release ; then + EXTRA_FLAGS="--disable-spec-version-check" + fi + + # First create a snapshot that we can re-use for the two other commands: + ./try-runtime \ + --runtime $RUNTIME_BLOB_PATH \ + create-snapshot --uri ${{ matrix.runtime.uri }} \ + onchain.snap + + # Check with pre-and-post + ./try-runtime \ + --runtime $RUNTIME_BLOB_PATH \ + on-runtime-upgrade --checks=pre-and-post \ + $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG \ + snap -p onchain.snap + + # Optional: also check try-state invariants ./try-runtime \ - --runtime ./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME \ - on-runtime-upgrade --checks=pre-and-post $EXTRA_ARGS $NO_WEIGHT_WARNINGS_FLAG live --uri ${{ matrix.runtime.uri }} + --runtime $RUNTIME_BLOB_PATH \ + on-runtime-upgrade --checks=all \ + $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG \ + snap -p onchain.snap || echo "### + DECODING FAILED + ###" From 07401ff4de1856a00494acc37ee3df024b307b70 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 19:47:44 +0100 Subject: [PATCH 5/8] Fix ci command Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index cf8d906683..1c6323b907 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -82,7 +82,6 @@ jobs: # First create a snapshot that we can re-use for the two other commands: ./try-runtime \ - --runtime $RUNTIME_BLOB_PATH \ create-snapshot --uri ${{ matrix.runtime.uri }} \ onchain.snap From 3f4ba3bb694a70892a4c5d519d5db531dc34ca69 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 4 Jan 2024 22:47:16 +0100 Subject: [PATCH 6/8] remove snapshotting Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 1c6323b907..5ab54bd48d 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -80,23 +80,8 @@ jobs: EXTRA_FLAGS="--disable-spec-version-check" fi - # First create a snapshot that we can re-use for the two other commands: - ./try-runtime \ - create-snapshot --uri ${{ matrix.runtime.uri }} \ - onchain.snap - - # Check with pre-and-post ./try-runtime \ --runtime $RUNTIME_BLOB_PATH \ on-runtime-upgrade --checks=pre-and-post \ $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG \ - snap -p onchain.snap - - # Optional: also check try-state invariants - ./try-runtime \ - --runtime $RUNTIME_BLOB_PATH \ - on-runtime-upgrade --checks=all \ - $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG \ - snap -p onchain.snap || echo "### - DECODING FAILED - ###" + live --uri ${{ matrix.runtime.uri }} From ca98e4a8a1b8f1b9e699e0d93665e4a23bb0f047 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 5 Jan 2024 13:12:46 +0100 Subject: [PATCH 7/8] Debug polkadot migration check Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 5ab54bd48d..0444c43e4e 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -78,8 +78,13 @@ jobs: EXTRA_FLAGS="" if ! .github/changelog-processor.py CHANGELOG.md --should-release ; then EXTRA_FLAGS="--disable-spec-version-check" + echo "Disabling the spec version check since we are not releasing" + else + echo "Enabling the spec version check since we are releasing" fi + echo $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG + ./try-runtime \ --runtime $RUNTIME_BLOB_PATH \ on-runtime-upgrade --checks=pre-and-post \ From 18d9e16563418cd1fbc57d8f4f5ac1819e43b534 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 5 Jan 2024 13:48:19 +0100 Subject: [PATCH 8/8] Selectively disable the idempotency check on polkadot Signed-off-by: Oliver Tale-Yazdi --- .github/workflows/check-migrations.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 0444c43e4e..412bbc7f25 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -69,24 +69,34 @@ jobs: RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME # When running on relay, we don't need weight checks. - NO_WEIGHT_WARNINGS_FLAG="" + EXTRA_FLAGS="" if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then - NO_WEIGHT_WARNINGS_FLAG="--no-weight-warnings" + EXTRA_FLAGS+="--no-weight-warnings" + echo "Disabling weight checks since we are on a relay" + else + echo "Enabling weight checks since we are not on a relay" fi # Disable the spec version check when we dont want to release. - EXTRA_FLAGS="" if ! .github/changelog-processor.py CHANGELOG.md --should-release ; then - EXTRA_FLAGS="--disable-spec-version-check" + EXTRA_FLAGS+=" --disable-spec-version-check" echo "Disabling the spec version check since we are not releasing" else echo "Enabling the spec version check since we are releasing" fi - echo $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG + # Disable idemepotency checks on Polkadot until we enact them. + if [[ "${{ matrix.runtime.name }}" == "polkadot" ]]; then + echo "Disabling the idempotency check since we are on Polkadot" + EXTRA_FLAGS+=" --disable-idempotency-checks" + else + echo "Enabling the idempotency check since we are not on Polkadot" + fi + + echo "Flags: $EXTRA_FLAGS" ./try-runtime \ --runtime $RUNTIME_BLOB_PATH \ on-runtime-upgrade --checks=pre-and-post \ - $EXTRA_FLAGS $NO_WEIGHT_WARNINGS_FLAG \ + $EXTRA_FLAGS \ live --uri ${{ matrix.runtime.uri }}