Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Commit 13dbcaf

Browse files
authored
Add CI job for checking missing migrations and fix the missing PolkadotXcm migration for ajuna (#397)
* add runtime-migration check (untested) * [CI] use ajuna as endpoint * [CI] add pallet-xcm (aka PolkadotXcm) migration * [para] add deprecation notice for the try runtime command * Readme.md add try-runtime explanation. * [solo-node] fix try-runtime feature flag, and make it compile with solo-node (although it seems it can't be used with the solo node. * remove obsolete try-runtime-cli from dependencies * [para] fix cherry-pick merge * run ci on branch and prs to ajuna-stable * [ajuna-solo] remove try-runtime feature * [CI] disable spec-version-check and idempotency check
1 parent fa67958 commit 13dbcaf

File tree

10 files changed

+123
-58
lines changed

10 files changed

+123
-58
lines changed

.github/workflows/check-migration.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check Migrations
2+
3+
on:
4+
push:
5+
branches: ["develop", "ajuna-stable" ]
6+
pull_request:
7+
branches: ["develop", "ajuna-stable"]
8+
workflow_dispatch:
9+
10+
# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is
11+
# triggered (ref https://stackoverflow.com/a/72408109)
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
runtime-matrix:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
runtime: ${{ steps.runtime.outputs.runtime }}
21+
name: Extract tasks from matrix
22+
steps:
23+
- uses: actions/checkout@v3
24+
- id: runtime
25+
run: |
26+
# Filter out runtimes that don't have a URI
27+
TASKS=$(jq '[.[] | select(.uri != null)]' .github/workflows/runtimes-matrix.json)
28+
SKIPPED_TASKS=$(jq '[.[] | select(.uri == null)]' .github/workflows/runtimes-matrix.json)
29+
echo --- Running the following tasks ---
30+
echo $TASKS
31+
echo --- Skipping the following tasks due to not having a uri field ---
32+
echo $SKIPPED_TASKS
33+
# Strip whitespace from Tasks now that we've logged it
34+
TASKS=$(echo $TASKS | jq -c .)
35+
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
36+
37+
check-migrations:
38+
needs: [runtime-matrix]
39+
continue-on-error: true
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
44+
steps:
45+
- name: Checkout sources
46+
uses: actions/checkout@v3
47+
48+
- name: Download try-runtime-cli
49+
run: |
50+
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.2/try-runtime-x86_64-unknown-linux-musl -o try-runtime
51+
chmod +x ./try-runtime
52+
53+
- name: Install Protoc
54+
uses: arduino/setup-protoc@v1
55+
with:
56+
version: "3.6.1"
57+
58+
- name: Add wasm32-unknown-unknown target
59+
run: rustup target add wasm32-unknown-unknown
60+
61+
- name: Build ${{ matrix.runtime.name }}
62+
run: |
63+
cargo build --release -p ${{ matrix.runtime.package }} --features try-runtime -q --locked
64+
65+
- name: Check migrations
66+
# Todo: enable spec-version-check dynamically if we are releasing
67+
run: |
68+
PACKAGE_NAME=${{ matrix.runtime.package }}
69+
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
70+
RUNTIME_BLOB_PATH=./target/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
71+
72+
./try-runtime \
73+
--runtime $RUNTIME_BLOB_PATH \
74+
on-runtime-upgrade --checks=pre-and-post \
75+
--disable-spec-version-check --disable-idempotency-checks \
76+
live --uri ${{ matrix.runtime.uri }}

.github/workflows/check-pull-request.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
branches:
66
- develop
7+
- ajuna-stable
78
paths:
89
- "**/*.rs"
910
- "**/Cargo.toml"
@@ -14,6 +15,7 @@ on:
1415
push:
1516
branches:
1617
- develop
18+
- ajuna-stable
1719

1820
# Ensures only one build is run per branch, unless pushing to develop
1921
concurrency:
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"name": "ajuna",
4+
"package": "ajuna-runtime",
5+
"path": "runtime/ajuna-runtime",
6+
"uri": "wss://rpc-parachain.ajuna.network:443"
7+
}
8+
]

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,19 @@ A game platform [parachain](https://wiki.polkadot.network/docs/learn-parachains)
6464
# parachain with rococo-local relay chain
6565
docker-compose -f docker/parachain.yml up
6666
```
67+
68+
69+
## Check state migrations
70+
71+
```bash
72+
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.2/try-runtime-x86_64-unknown-linux-musl -o try-runtime
73+
chmod +x ./try-runtime
74+
75+
# check state migrations with state fetched from the remote chain.
76+
../bin/try-runtime \
77+
--runtime ./target/release/wbuild/ajuna-solo-runtime/ajuna_solo_runtime.wasm \
78+
on-runtime-upgrade --checks=pre-and-post \
79+
live --uri wss://rpc-parachain.bajun.network:443
80+
```
81+
82+
This is also executed in the check-migration.yml CI.

node/cli/Cargo.toml

+8-5
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polk
4444
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", optional = true }
4545
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", optional = true }
4646

47-
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", optional = true }
48-
4947
# Polkadot
5048
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42", optional = true }
5149
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42", optional = true }
@@ -81,8 +79,13 @@ rococo-native = [ "polkadot-cli/rococo-native" ]
8179

8280
runtime-benchmarks = [
8381
"ajuna-service/runtime-benchmarks",
84-
"polkadot-cli/runtime-benchmarks",
82+
"polkadot-cli?/runtime-benchmarks",
8583
]
8684

87-
cli = [ "try-runtime-cli" ]
88-
try-runtime = [ "try-runtime-cli/try-runtime", "sc-executor", "sp-io" ]
85+
cli = [ ]
86+
try-runtime = [
87+
"ajuna-service/try-runtime",
88+
"polkadot-cli?/try-runtime",
89+
"sc-executor",
90+
"sp-io",
91+
]

node/cli/src/para/cli.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ pub enum Subcommand {
5252
#[clap(subcommand)]
5353
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
5454

55-
/// Try some testing command against a specified runtime state.
56-
#[cfg(feature = "try-runtime")]
57-
TryRuntime(try_runtime_cli::TryRuntimeCmd),
58-
59-
/// Errors since the binary was not build with `--features try-runtime`.
60-
#[cfg(not(feature = "try-runtime"))]
55+
/// Try-runtime has migrated to a standalone
56+
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
57+
/// deprecation notice. It will be removed entirely some time after Janurary 2024.
6158
TryRuntime,
6259
}
6360

node/cli/src/para/command.rs

+1-42
Original file line numberDiff line numberDiff line change
@@ -308,48 +308,7 @@ pub fn run() -> Result<()> {
308308
_ => Err("Benchmarking sub-command unsupported".into()),
309309
}
310310
},
311-
#[cfg(feature = "try-runtime")]
312-
Some(Subcommand::TryRuntime(cmd)) => {
313-
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
314-
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
315-
316-
let runner = cli.create_runner(cmd)?;
317-
type HostFunctionsOf<E> = ExtendedHostFunctions<
318-
sp_io::SubstrateHostFunctions,
319-
<E as NativeExecutionDispatch>::ExtendHostFunctions,
320-
>;
321-
322-
// grab the task manager.
323-
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
324-
let task_manager =
325-
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
326-
.map_err(|e| format!("Error: {:?}", e))?;
327-
328-
#[cfg(feature = "ajuna")]
329-
if cfg!(feature = "ajuna") {
330-
return runner.async_run(|_| {
331-
Ok((
332-
cmd.run::<AjunaBlock, HostFunctionsOf<AjunaRuntimeExecutor>, _>(Some(
333-
timestamp_with_aura_info::<AjunaBlock>(6000),
334-
)),
335-
task_manager,
336-
))
337-
})
338-
}
339-
#[cfg(feature = "bajun")]
340-
runner.async_run(|_| {
341-
Ok((
342-
cmd.run::<BajunBlock, HostFunctionsOf<BajunRuntimeExecutor>, _>(Some(
343-
timestamp_with_aura_info::<BajunBlock>(6000),
344-
)),
345-
task_manager,
346-
))
347-
})
348-
},
349-
#[cfg(not(feature = "try-runtime"))]
350-
Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \
351-
You can enable it with `--features try-runtime`."
352-
.into()),
311+
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.".into()),
353312
None => {
354313
let runner = cli.create_runner(&cli.run.normalize())?;
355314
let collator_options = cli.run.collator_options();

node/service/Cargo.toml

+6-4
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ polkadot-native = [ "polkadot-service/polkadot-native" ]
112112
rococo-native = [ "polkadot-service/rococo-native" ]
113113

114114
runtime-benchmarks = [
115-
"ajuna-solo-runtime/runtime-benchmarks",
116-
"bajun-runtime/runtime-benchmarks",
117-
"ajuna-runtime/runtime-benchmarks",
115+
"ajuna-solo-runtime?/runtime-benchmarks",
116+
"bajun-runtime?/runtime-benchmarks",
117+
"ajuna-runtime?/runtime-benchmarks",
118118
]
119119

120120
try-runtime = [
121-
"bajun-runtime/try-runtime",
121+
"bajun-runtime?/try-runtime",
122+
"polkadot-service?/try-runtime",
123+
"sp-runtime/try-runtime"
122124
]

runtime/ajuna/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ pub type Executive = frame_executive::Executive<
114114
frame_system::ChainContext<Runtime>,
115115
Runtime,
116116
AllPalletsWithSystem,
117+
Migrations,
117118
>;
118119

120+
type Migrations = (pallet_xcm::migration::v1::MigrateToV1<Runtime>,);
121+
119122
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
120123
/// node's balance type.
121124
///

0 commit comments

Comments
 (0)