From 1b4beed2b03b4bfc4a04498e19d3ff43cb67c3cb Mon Sep 17 00:00:00 2001 From: Evgeny Snitko Date: Mon, 8 Dec 2025 12:49:59 +0400 Subject: [PATCH 1/5] (failure|cancelled) --- .github/workflows/build-misc.yml | 2 +- .github/workflows/build-publish-images.yml | 4 ++-- .github/workflows/check-cargo-check-runtimes.yml | 2 +- .github/workflows/check-frame-omni-bencher.yml | 4 ++-- .github/workflows/check-runtime-compatibility.yml | 2 +- .github/workflows/check-runtime-migration.yml | 2 +- .github/workflows/checks-quick.yml | 4 ++-- .github/workflows/checks.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/tests-evm.yml | 2 +- .github/workflows/tests-linux-stable.yml | 2 +- .github/workflows/tests-misc.yml | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-misc.yml b/.github/workflows/build-misc.yml index 017f7ef8bd6a1..68786ad956523 100644 --- a/.github/workflows/build-misc.yml +++ b/.github/workflows/build-misc.yml @@ -115,7 +115,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/build-publish-images.yml b/.github/workflows/build-publish-images.yml index 1fb0eebc5a3d7..eadde1010588e 100644 --- a/.github/workflows/build-publish-images.yml +++ b/.github/workflows/build-publish-images.yml @@ -724,7 +724,7 @@ jobs: id: check_success run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY echo "build_success=false" >> $GITHUB_OUTPUT @@ -780,7 +780,7 @@ jobs: id: check_success run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(grep -c '"result": "failure"' resultfile || true) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ "$FAILURES" -gt 0 ]; then echo "### At least one zombienet job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/check-cargo-check-runtimes.yml b/.github/workflows/check-cargo-check-runtimes.yml index b367bf0109dcd..10d0f5dccbd08 100644 --- a/.github/workflows/check-cargo-check-runtimes.yml +++ b/.github/workflows/check-cargo-check-runtimes.yml @@ -118,7 +118,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/check-frame-omni-bencher.yml b/.github/workflows/check-frame-omni-bencher.yml index 0ce3891cbc9c0..d64226064766c 100644 --- a/.github/workflows/check-frame-omni-bencher.yml +++ b/.github/workflows/check-frame-omni-bencher.yml @@ -100,7 +100,7 @@ jobs: forklift cargo build --release --locked -p $PACKAGE_NAME -p frame-omni-bencher --features=${{ matrix.runtime.bench_features }} --quiet echo "Running short $BENCH_CMD benchmarking for PACKAGE_NAME=$PACKAGE_NAME and RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" ls -lrt $RUNTIME_BLOB_PATH - + if [[ "$BENCH_CMD" == "pallet" ]]; then cmd="./target/release/frame-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1 $FLAGS" elif [[ "$BENCH_CMD" == "overhead" ]]; then @@ -127,7 +127,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/check-runtime-compatibility.yml b/.github/workflows/check-runtime-compatibility.yml index a741da5ca327d..ed7f010bae75c 100644 --- a/.github/workflows/check-runtime-compatibility.yml +++ b/.github/workflows/check-runtime-compatibility.yml @@ -100,7 +100,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/check-runtime-migration.yml b/.github/workflows/check-runtime-migration.yml index 3ca6baf49ffd0..ed90d2e90b0f8 100644 --- a/.github/workflows/check-runtime-migration.yml +++ b/.github/workflows/check-runtime-migration.yml @@ -141,7 +141,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/checks-quick.yml b/.github/workflows/checks-quick.yml index ad262db361c93..bd1fd13baaac1 100644 --- a/.github/workflows/checks-quick.yml +++ b/.github/workflows/checks-quick.yml @@ -157,7 +157,7 @@ jobs: # Extract the umbrella crate version dynamically from cargo metadata UMBRELLA_VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.manifest_path | endswith("umbrella/Cargo.toml")) | .version') - + if [ -z "$UMBRELLA_VERSION" ]; then echo "Warning: Could not determine umbrella version from cargo metadata, using fallback version 0.1.0" UMBRELLA_VERSION="0.1.0" @@ -254,7 +254,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9152e865c348a..8c2abd9ec27e5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -110,7 +110,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7afe67254d1aa..dde594508714f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -105,7 +105,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/tests-evm.yml b/.github/workflows/tests-evm.yml index 9fb417542999b..6111315074057 100644 --- a/.github/workflows/tests-evm.yml +++ b/.github/workflows/tests-evm.yml @@ -157,7 +157,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/tests-linux-stable.yml b/.github/workflows/tests-linux-stable.yml index 97c76af9f5154..67322ec1dd87d 100644 --- a/.github/workflows/tests-linux-stable.yml +++ b/.github/workflows/tests-linux-stable.yml @@ -176,7 +176,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/.github/workflows/tests-misc.yml b/.github/workflows/tests-misc.yml index 9f043d2ff4480..fcfb188beb4f6 100644 --- a/.github/workflows/tests-misc.yml +++ b/.github/workflows/tests-misc.yml @@ -143,7 +143,7 @@ jobs: shell: bash run: | # Fail the step if any command in a pipeline errors out. - set -euo pipefail + set -euo pipefail ARTIFACTS_DIR=./artifacts BENCH_TRIE_READ=::trie::read::small BENCH_NODE_IMPORT=::node::import::sr25519::transfer_keep_alive::paritydb::small @@ -424,7 +424,7 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 From 24dc67e73cfb83b86fcfdd201bc63c13a8491e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 8 Dec 2025 11:57:17 +0100 Subject: [PATCH 2/5] Fix runtime migrations check - On the scheduled run only download the snapshot and not try to run the migration checks - The job should fail when one of the migration checks was cancelled (because of timeout for example) - Increase the timeout to 120 min, because sometimes it is slower to download the snapshot --- .github/workflows/check-runtime-migration.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-runtime-migration.yml b/.github/workflows/check-runtime-migration.yml index 3ca6baf49ffd0..cbfe5010a02c3 100644 --- a/.github/workflows/check-runtime-migration.yml +++ b/.github/workflows/check-runtime-migration.yml @@ -31,7 +31,7 @@ jobs: if: ${{ needs.preflight.outputs.changes_rust }} # We need to set this to rather long to allow the snapshot to be created, but the average time # should be much lower. - timeout-minutes: 60 + timeout-minutes: 120 needs: [preflight] container: image: ${{ needs.preflight.outputs.IMAGE }} @@ -106,12 +106,14 @@ jobs: ./try-runtime create-snapshot --uri ${{ matrix.uri }} snapshot.raw - name: Build Runtime + if: ${{ github.event_name != 'schedule' }} id: required1 run: | echo "---------- Building ${{ matrix.package }} runtime ----------" forklift cargo build --release --locked -p ${{ matrix.package }} --features try-runtime -q - name: Run Check + if: ${{ github.event_name != 'schedule' }} id: required2 run: | echo "Running ${{ matrix.network }} runtime migration check" @@ -124,7 +126,7 @@ jobs: sleep 5 - name: Stop all workflows if failed - if: ${{ failure() && (steps.required1.conclusion == 'failure' || steps.required2.conclusion == 'failure') }} + if: ${{ failure() && github.event_name != 'schedule' && (steps.required1.conclusion == 'failure' || steps.required2.conclusion == 'failure') }} uses: ./.github/actions/workflow-stopper with: app-id: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_ID }} @@ -137,14 +139,18 @@ jobs: name: All runtime migrations passed # If any new job gets added, be sure to add it to this array needs: [check-runtime-migration] - if: always() && !cancelled() + if: always() && !cancelled() && github.event_name != 'schedule' steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) + CANCELLED=$(cat resultfile | grep '"result": "cancelled"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 + elif [ $CANCELLED -gt 0 ]; then + echo "### At least one required job was cancelled ❌" >> $GITHUB_STEP_SUMMARY + exit 1 else echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY fi From 8774acd065014ed449ecf285acc190af02160407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 8 Dec 2025 12:03:21 +0100 Subject: [PATCH 3/5] Use upstream solution --- .github/workflows/check-runtime-migration.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/check-runtime-migration.yml b/.github/workflows/check-runtime-migration.yml index cbfe5010a02c3..0b6f11edae61a 100644 --- a/.github/workflows/check-runtime-migration.yml +++ b/.github/workflows/check-runtime-migration.yml @@ -143,14 +143,10 @@ jobs: steps: - run: | tee resultfile <<< '${{ toJSON(needs) }}' - FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) - CANCELLED=$(cat resultfile | grep '"result": "cancelled"' | wc -l) + FAILURES=$(cat resultfile | grep -E '"result": "(failure|cancelled)"' | wc -l) if [ $FAILURES -gt 0 ]; then echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY exit 1 - elif [ $CANCELLED -gt 0 ]; then - echo "### At least one required job was cancelled ❌" >> $GITHUB_STEP_SUMMARY - exit 1 else echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY fi From ffb1c273b2c984a6c16aa3d7af222f9ee9048802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 9 Dec 2025 11:56:40 +0100 Subject: [PATCH 4/5] More detailed error reporting --- substrate/frame/assets/src/lib.rs | 10 +++++++++- substrate/frame/assets/src/tests.rs | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 471f9a144ea31..8cae8a4ece355 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -2028,7 +2028,15 @@ impl, I: 'static> Pallet { ); let calculated_approvals = Approvals::::iter_prefix((&asset_id,)).count() as u32; - ensure!(details.approvals == calculated_approvals, "Asset approvals count mismatch"); + + if details.approvals != calculated_approvals { + log::error!( + "Asset (asset_id:?) approvals count mismatch: calculated {calculated_approvals} vs expected {}", + details.approvals, + ); + + return Err("Asset approvals count mismatch".into()) + } } Ok(()) } diff --git a/substrate/frame/assets/src/tests.rs b/substrate/frame/assets/src/tests.rs index febdc3bbee123..4ea6b3cbca7de 100644 --- a/substrate/frame/assets/src/tests.rs +++ b/substrate/frame/assets/src/tests.rs @@ -355,11 +355,13 @@ fn transfer_approved_all_funds() { Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 1); + assert!(Approvals::::contains_key((0, 1, 2))); assert_eq!(Balances::reserved_balance(&1), 1); // transfer the full amount, which should trigger auto-cleanup assert_ok!(Assets::transfer_approved(RuntimeOrigin::signed(2), 0, 1, 3, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 0); + assert!(!Approvals::::contains_key((0, 1, 2))); assert_eq!(Assets::balance(0, 1), 50); assert_eq!(Assets::balance(0, 3), 50); assert_eq!(Balances::reserved_balance(&1), 0); From 6278d8100f3ae4fc304adf947160dbe10a44c71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 9 Dec 2025 20:11:42 +0100 Subject: [PATCH 5/5] Fix logging --- substrate/frame/assets/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 8cae8a4ece355..eb761be85011c 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -2031,7 +2031,7 @@ impl, I: 'static> Pallet { if details.approvals != calculated_approvals { log::error!( - "Asset (asset_id:?) approvals count mismatch: calculated {calculated_approvals} vs expected {}", + "Asset {asset_id:?} approvals count mismatch: calculated {calculated_approvals} vs expected {}", details.approvals, );