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: Disable runtime upgrade spec name check on Westend Asset Hub and fix Staking pallet migration #2447

Merged
merged 15 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
13 changes: 7 additions & 6 deletions .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ check-rust-feature-propagation:
export RUST_LOG=remote-ext=debug,runtime=debug

echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.3.3/try-runtime-x86_64-unknown-linux-musl -o try-runtime
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.0/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime

echo "---------- Building ${PACKAGE} runtime ----------"
time cargo build --release --locked -p "$PACKAGE" --features try-runtime

echo "---------- Executing on-runtime-upgrade for ${NETWORK} ----------"
time ./try-runtime \
time ./try-runtime ${COMMAND_EXTRA_ARGS} \
--runtime ./target/release/wbuild/"$PACKAGE"/"$WASM" \
on-runtime-upgrade --checks=pre-and-post ${EXTRA_ARGS} live --uri ${URI}
on-runtime-upgrade --disable-spec-version-check --checks=pre-and-post ${SUBCOMMAND_EXTRA_ARGS} live --uri ${URI}

# Check runtime migrations for Parity managed relay chains
check-runtime-migration-westend:
Expand All @@ -124,7 +124,7 @@ check-runtime-migration-westend:
PACKAGE: "westend-runtime"
WASM: "westend_runtime.compact.compressed.wasm"
URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443"
EXTRA_ARGS: "--no-weight-warnings"
SUBCOMMAND_EXTRA_ARGS: "--no-weight-warnings"

check-runtime-migration-rococo:
stage: check
Expand All @@ -137,7 +137,7 @@ check-runtime-migration-rococo:
PACKAGE: "rococo-runtime"
WASM: "rococo_runtime.compact.compressed.wasm"
URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443"
EXTRA_ARGS: "--no-weight-warnings"
SUBCOMMAND_EXTRA_ARGS: "--no-weight-warnings"

# Check runtime migrations for Parity managed asset hub chains
check-runtime-migration-asset-hub-westend:
Expand All @@ -151,7 +151,7 @@ check-runtime-migration-asset-hub-westend:
PACKAGE: "asset-hub-westend-runtime"
WASM: "asset_hub_westend_runtime.compact.compressed.wasm"
URI: "wss://westend-asset-hub-rpc.polkadot.io:443"

check-runtime-migration-asset-hub-rococo:
stage: check
extends:
Expand Down Expand Up @@ -214,6 +214,7 @@ check-runtime-migration-collectives-westend:
PACKAGE: "collectives-westend-runtime"
WASM: "collectives_westend_runtime.compact.compressed.wasm"
URI: "wss://westend-collectives-rpc.polkadot.io:443"
COMMAND_EXTRA_ARGS: "--disable-spec-name-check"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed after the collectives was upgraded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


find-fail-ci-phrase:
stage: check
Expand Down
12 changes: 1 addition & 11 deletions substrate/frame/staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,10 @@ pub mod v14 {
}
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
frame_support::ensure!(
Pallet::<T>::on_chain_storage_version() == 13,
"Required v13 before upgrading to v14."
);

Ok(Default::default())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), TryRuntimeError> {
frame_support::ensure!(
Pallet::<T>::on_chain_storage_version() == 14,
Pallet::<T>::on_chain_storage_version() >= 14,
"v14 not applied"
);
Ok(())
Expand Down