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] add check-migrations workflow and fix some migrations #247

Merged
merged 6 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Check Migrations

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:

# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is
# triggered (ref https://stackoverflow.com/a/72408109)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
runtime-matrix:
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
name: Extract tasks from matrix
steps:
- uses: actions/checkout@v2
- id: runtime
run: |
# Filter out runtimes that don't have a URI
TASKS=$(jq '[.[] | select(.uri != null)]' .github/workflows/runtimes-matrix.json)
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/workflows/runtimes-matrix.json)
echo --- Running the following tasks ---
echo $TASKS
echo --- Skipping the following tasks due to not having a uri field ---
echo $SKIPPED_TASKS
# Strip whitespace from Tasks now that we've logged it
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT

check-migrations:
needs: [runtime-matrix]
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Download try-runtime-cli
run: |
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
uses: arduino/setup-protoc@v1
with:
version: "3.6.1"

- name: Add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown

- name: Build ${{ matrix.runtime.name }}
run: |
cargo build --release -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/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME

# When running on relay, we don't need weight checks.
EXTRA_FLAGS=""
if [[ "${{ matrix.runtime.is_relay }}" == "true" ]]; then
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 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 \
live --uri ${{ matrix.runtime.uri }}
9 changes: 9 additions & 0 deletions .github/workflows/runtimes-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "integritee",
"package": "integritee-runtime",
"path": "polkadot-parachains/integritee-runtime",
"uri": "wss://kusama.api.integritee.network:443",
"is_relay": false
}
]
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "integritee-collator"
description = "The Integritee parachain collator binary"
# align major.minor revision with the runtimes. bump patch revision ad lib. make this the github release tag
version = "1.6.4"
version = "1.6.5"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/integritee-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "integritee-runtime"
description = "The Integritee parachain runtime"
# patch revision must match runtime spec_version
version = "1.6.40"
version = "1.6.41"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
57 changes: 52 additions & 5 deletions polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ pub use pallet_teerex::Call as TeerexCall;
mod helpers;
mod weights;

// todo: temporary. remove after fixing
mod migrations_fix;

pub mod xcm_config;

pub type SessionHandlers = ();
Expand All @@ -105,7 +108,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("integritee-parachain"),
impl_name: create_runtime_str!("integritee-full"),
authoring_version: 2,
spec_version: 40,
spec_version: 41,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 6,
Expand Down Expand Up @@ -802,17 +805,61 @@ pub type UncheckedExtrinsic =
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;

/// Migrations to apply on runtime upgrade.
pub type Migrations = (
// Scheduler
// fixing the scheduler with a local migration is necessary because we have missed intermediate
// migrations. mainnet at V0, jumping to V4 here
// future: v1.6.0 is still at V4.
migrations_fix::scheduler::v4::MigrateToV4<Runtime>,
//
// XcmpQueue
// code says it's V2, but we have V3 onchain. how come?
// v1.0.0: V3 (can migrate V1/V2 to V3) from here onwards we should be consistent
// v1.4.0: V4
// Plan: upgrade to v1.0.0. then we're aligned
//cumulus_pallet_xcmp_queue::migration::migrate_to_v3<Runtime>,

// DmpQueue
// code says it's V1 but we have V2 onchain. how come?
// at spec_version 29 it was at 1. (release https://github.com/integritee-network/parachain/releases/tag/1.5.33) (polkadot-v0.9.36)
// next spec_version was v35 where it went to 2
// v35 is https://github.com/integritee-network/parachain/releases/tag/1.5.40 (polkadot-v0.9.42)
// v1.0.0: V2 (can migrate V0 and V1 to V2) from here onwards we should be consistent
// v1.6.0 is still V2
// Plan: upgrade to v1.0.0. then we're aligned

// PolkadotXcm
// mainnet is at V0. migration fails with corrupt storage because the the entries have been written with the new version already
// therefore it should be safe to just bruteforce the storageVersion to 1 and then test that we can still decode VersionNotifyTargets (only thing the original migration changes)
migrations_fix::xcm::v1::MigrateToV1<Runtime>,
// Collective
// migration changes the pallet name prefix (back in 2021). no need to touch this. I guess this has been left untouched when we migrated solo to para
// for consistency, we will bruteforce to V4
// future: v1.6.0 is still at V4.
// Plan: as we have no issues with collectives, we won't change a running system !
// migrations_fix::collective::v4::MigrateToV4<Runtime, Instance1>,
//
// Democracy
pallet_democracy::migrations::v1::Migration<Runtime>,
//
// Multisig
// this migration takes 500ms. We'll skip this until we have async backing
//pallet_multisig::migrations::v1::MigrateToV1<Runtime>,
//
// Balances: mainnet at V0. this here brings us to V1
// future: v1.6.0 is still at V1
pallet_balances::migration::MigrateToTrackInactive<Runtime, xcm_config::CheckingAccount>,
);

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem, // Solochain: AllPalletsReversedWithSystemFirst, Statemint: AllPallets. Which one to take?
(
pallet_teerex::migrations::v1::MigrateV0toV1<Runtime>,
pallet_teerex::migrations::v2::MigrateV1toV2<Runtime>,
),
Migrations,
>;

#[cfg(feature = "runtime-benchmarks")]
Expand Down
Loading
Loading