Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Enable try-runtime idempotency check #133

Merged
merged 11 commits into from
Jan 9, 2024
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 }}
Loading