From e502a3f97cb021a96c691ce95f437c5032a2254a Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Thu, 29 Jun 2023 17:44:07 -0500 Subject: [PATCH 01/20] add try-runtime feature build --- .github/workflows/check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6db71ced..1a0244c6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,6 +49,9 @@ jobs: - name: Check Build Trappist node run: | SKIP_WASM_BUILD=1 cargo check --release --locked + - name: Check try-runtime feature + run: | + cargo check --locked --features try-runtime --all test: needs: lint From b18a3c66b62f06562c1bd8d2a9671a2db351038b Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 30 Jun 2023 11:15:12 -0500 Subject: [PATCH 02/20] fix not found in scope issue --- node/src/command.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/node/src/command.rs b/node/src/command.rs index 7a6ea0f2..b808f0c3 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -30,6 +30,7 @@ use sc_cli::{ use sc_service::config::{BasePath, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; +use crate::service::{ TrappistRuntimeExecutor, StoutRuntimeExecutor }; use crate::{ benchmarking::{inherent_benchmark_data, RemarkBuilder}, From ce314d4b5abc211daa604b51eef84f8d890e47a8 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 30 Jun 2023 11:30:50 -0500 Subject: [PATCH 03/20] fix cargo fmt issue --- node/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/command.rs b/node/src/command.rs index b808f0c3..a6b23816 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,6 +17,7 @@ use std::{net::SocketAddr, path::PathBuf}; +use crate::service::{StoutRuntimeExecutor, TrappistRuntimeExecutor}; use cumulus_client_cli::generate_genesis_block; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; @@ -30,7 +31,6 @@ use sc_cli::{ use sc_service::config::{BasePath, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; -use crate::service::{ TrappistRuntimeExecutor, StoutRuntimeExecutor }; use crate::{ benchmarking::{inherent_benchmark_data, RemarkBuilder}, From 9ee35e9736b9b54444077a9168d24ecd8725a1d2 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 30 Jun 2023 12:36:19 -0500 Subject: [PATCH 04/20] add executor on try-runtime feature --- node/src/command.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node/src/command.rs b/node/src/command.rs index a6b23816..f893917e 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,7 +17,6 @@ use std::{net::SocketAddr, path::PathBuf}; -use crate::service::{StoutRuntimeExecutor, TrappistRuntimeExecutor}; use cumulus_client_cli::generate_genesis_block; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; @@ -39,6 +38,9 @@ use crate::{ service::{new_partial, Block}, }; +#[cfg(not(feature = "try-runtime"))] +use crate::service::{StoutRuntimeExecutor, TrappistRuntimeExecutor}; + /// Dispatches the code to the currently selected runtime. macro_rules! dispatch_runtime { ($runtime:expr, |$alias: ident| $code:expr) => { From 1ce0b4c72445f89cf3bcf07a615bc6d886298677 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 30 Jun 2023 12:51:19 -0500 Subject: [PATCH 05/20] inline import --- node/src/command.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index f893917e..1645fa20 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -38,9 +38,6 @@ use crate::{ service::{new_partial, Block}, }; -#[cfg(not(feature = "try-runtime"))] -use crate::service::{StoutRuntimeExecutor, TrappistRuntimeExecutor}; - /// Dispatches the code to the currently selected runtime. macro_rules! dispatch_runtime { ($runtime:expr, |$alias: ident| $code:expr) => { @@ -407,9 +404,11 @@ pub fn run() -> Result<()> { match runner.config().chain_spec.runtime() { Runtime::Trappist => runner.async_run(|_| { + use crate::service::TrappistRuntimeExecutor; Ok((cmd.run::>(), task_manager)) }), Runtime::Stout => runner.async_run(|_| { + use crate::service::StoutRuntimeExecutor; Ok((cmd.run::>(), task_manager)) }), } From 21d97113e6cb0bbc2886fcfd2b20e4a24a971e10 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 30 Jun 2023 17:54:20 -0500 Subject: [PATCH 06/20] add try-runtime workflow for storage migrations --- .github/workflows/try-runtime.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/try-runtime.yml diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml new file mode 100644 index 00000000..ed0c692a --- /dev/null +++ b/.github/workflows/try-runtime.yml @@ -0,0 +1,41 @@ +name: Run try-runtime on storage migration label + +on: + pull_request: + issues: + types: + - labeled + +jobs: + run_if_label_matches: + if: github.event.label.name == 'migration' + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Setup worker + uses: "./.github/templates/setup-worker" + + - name: Cache Build artefacts + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} + + - run: + echo "Found label runtime_migration. Running tests" + export RUST_LOG=remote-ext=debug,runtime=debug + echo "---------- Running try-runtime for Trappist ----------" + time cargo build --locked --release -p trappist-runtime + time cargo run --locked --release --features try-runtime try-runtime \ + --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \ + -lruntime=debug \ + --chain=trappist-dev \ + on-runtime-upgrade live --uri wss://rococo-trappist-try-runtime-node.parity-chains.parity.io:443 \ No newline at end of file From d3f72ef32780f0266c6c1e82afce8d67b2f21917 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Mon, 3 Jul 2023 15:05:17 -0500 Subject: [PATCH 07/20] update workflow --- .github/workflows/try-runtime.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index ed0c692a..0ae39f4d 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -2,7 +2,6 @@ name: Run try-runtime on storage migration label on: pull_request: - issues: types: - labeled From d29a2ba996e7fb9c6ebbfa1e4685a68eb5e4f676 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 14 Jul 2023 18:05:24 -0500 Subject: [PATCH 08/20] remove time --- .github/workflows/try-runtime.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 0ae39f4d..04dea76f 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -32,8 +32,8 @@ jobs: echo "Found label runtime_migration. Running tests" export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Running try-runtime for Trappist ----------" - time cargo build --locked --release -p trappist-runtime - time cargo run --locked --release --features try-runtime try-runtime \ + cargo build --locked --release -p trappist-runtime + cargo run --locked --release --features try-runtime try-runtime \ --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \ -lruntime=debug \ --chain=trappist-dev \ From 12c3f54cb4930363eca9032582868ca546eab960 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 14 Jul 2023 19:06:53 -0500 Subject: [PATCH 09/20] use cache restore --- .github/workflows/try-runtime.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 04dea76f..192048dd 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -17,7 +17,8 @@ jobs: uses: "./.github/templates/setup-worker" - name: Cache Build artefacts - uses: actions/cache@v3 + uses: actions/cache/restore@v3 + id: cargo-cache with: path: | ~/.cargo/bin/ From f7947450a54fd944044c627fd3c733b4d32cbb35 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 14 Jul 2023 19:08:44 -0500 Subject: [PATCH 10/20] We do not need to check try-runtime feature on every PR --- .github/workflows/check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1a0244c6..6db71ced 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,9 +49,6 @@ jobs: - name: Check Build Trappist node run: | SKIP_WASM_BUILD=1 cargo check --release --locked - - name: Check try-runtime feature - run: | - cargo check --locked --features try-runtime --all test: needs: lint From 225b9dfc62e505db32b4aaf03ac0acfab8147bc0 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Fri, 14 Jul 2023 23:28:48 -0500 Subject: [PATCH 11/20] missing symbol --- .github/workflows/try-runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 192048dd..f8452a3b 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -29,7 +29,7 @@ jobs: key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }} - - run: + - run: | echo "Found label runtime_migration. Running tests" export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Running try-runtime for Trappist ----------" From 9330ca3ca0e258c2701fcee1d665e5fe0353bc15 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Mon, 17 Jul 2023 15:12:19 -0500 Subject: [PATCH 12/20] workflow should work on subsequent pushes --- .github/workflows/try-runtime.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index f8452a3b..35401915 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -1,6 +1,9 @@ name: Run try-runtime on storage migration label on: + push: + branches: + - '*' pull_request: types: - labeled From e5ad35dc86b0b67f40f879df00500090dff26464 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Mon, 17 Jul 2023 15:21:47 -0500 Subject: [PATCH 13/20] update workflow --- .github/workflows/try-runtime.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 35401915..251debbd 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -1,4 +1,4 @@ -name: Run try-runtime on storage migration label +name: Test storage migration on: push: @@ -9,7 +9,7 @@ on: - labeled jobs: - run_if_label_matches: + try_runtime: if: github.event.label.name == 'migration' runs-on: ubuntu-latest steps: From 0c3e55629bf5d20b9992485f670c9d4b6398cc1d Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Mon, 17 Jul 2023 15:36:21 -0500 Subject: [PATCH 14/20] add `paths-ignore` --- .github/workflows/try-runtime.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 251debbd..d0d1b7bd 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -4,6 +4,8 @@ on: push: branches: - '*' + paths-ignore: + - '**' pull_request: types: - labeled From 71dda00a092fb9b085c78a3f714d0e268bd26927 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Mon, 17 Jul 2023 15:37:56 -0500 Subject: [PATCH 15/20] remove `cargo build` --- .github/workflows/try-runtime.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index d0d1b7bd..dd1f6d31 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -38,7 +38,6 @@ jobs: echo "Found label runtime_migration. Running tests" export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Running try-runtime for Trappist ----------" - cargo build --locked --release -p trappist-runtime cargo run --locked --release --features try-runtime try-runtime \ --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \ -lruntime=debug \ From 2eb3ed420e6d3192549c0ea6ba971c22f7c7b767 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Wed, 19 Jul 2023 14:24:58 -0500 Subject: [PATCH 16/20] update Github action --- .github/workflows/try-runtime.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index dd1f6d31..c0f438a6 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -1,14 +1,8 @@ name: Test storage migration on: - push: - branches: - - '*' - paths-ignore: - - '**' pull_request: - types: - - labeled + types: [labeled, synchronize] jobs: try_runtime: @@ -38,7 +32,7 @@ jobs: echo "Found label runtime_migration. Running tests" export RUST_LOG=remote-ext=debug,runtime=debug echo "---------- Running try-runtime for Trappist ----------" - cargo run --locked --release --features try-runtime try-runtime \ + cargo run -p trappist --locked --release --no-default-features --features trappist/trappist-runtime,try-runtime try-runtime \ --runtime ./target/release/wbuild/trappist-runtime/target/wasm32-unknown-unknown/release/trappist_runtime.wasm \ -lruntime=debug \ --chain=trappist-dev \ From 37a96b3e5b7661f7e09d2758c11763b679e8588b Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Wed, 19 Jul 2023 14:32:54 -0500 Subject: [PATCH 17/20] update Github action --- .github/workflows/try-runtime.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index c0f438a6..cb1e1d20 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -3,6 +3,8 @@ name: Test storage migration on: pull_request: types: [labeled, synchronize] + push: + branches: '*' jobs: try_runtime: From 7ef3e32cd7e101b0f4f30b1075525c0fa6183815 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Wed, 19 Jul 2023 14:48:29 -0500 Subject: [PATCH 18/20] update to use contains --- .github/workflows/try-runtime.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index cb1e1d20..64bfa096 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -4,11 +4,11 @@ on: pull_request: types: [labeled, synchronize] push: - branches: '*' + branches: [ main ] jobs: try_runtime: - if: github.event.label.name == 'migration' + if: contains(github.event.pull_request.labels.*.name, 'migration') runs-on: ubuntu-latest steps: - name: Check out the repo From bc54dd9059360e4c4a14f141b8e00ac052a9f243 Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Thu, 20 Jul 2023 09:40:10 -0500 Subject: [PATCH 19/20] Update Github Action --- .github/workflows/try-runtime.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 64bfa096..4300b291 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -1,4 +1,5 @@ name: Test storage migration +# Test storage migration on PRs with label "migration" on: pull_request: From 8b5d77523c9de4e7517c5f3e4ad7bc0c75fef3ba Mon Sep 17 00:00:00 2001 From: Bruno Galvao Date: Thu, 20 Jul 2023 09:42:05 -0500 Subject: [PATCH 20/20] Update Github Action --- .github/workflows/try-runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 4300b291..f0c81238 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -1,5 +1,5 @@ name: Test storage migration -# Test storage migration on PRs with label "migration" +# Test storage migration using try-runtume on PRs with label "migration" on: pull_request: