Skip to content

Commit

Permalink
CI: Enable try-runtime idempotency check (polkadot-fellows#133)
Browse files Browse the repository at this point in the history
Enable one more check in the CI to ensure that our migrations are
idempotent. Can only merge after
polkadot-fellows#118

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez authored Jan 9, 2024
1 parent 98872cb commit fa59883
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -60,21 +60,43 @@ 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=""
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.
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
# 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"
# 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 ./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=pre-and-post \
$EXTRA_FLAGS \
live --uri ${{ matrix.runtime.uri }}

0 comments on commit fa59883

Please sign in to comment.