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
38 changes: 30 additions & 8 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=""
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"

# 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 \
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
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
./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
###"
Loading