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

feat: use try-runtime-cli instead of command #270

Merged
merged 3 commits into from
Sep 7, 2023
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
16 changes: 9 additions & 7 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test storage migration using try-runtime on PRs with label "migration"
name: Test storage migration
# Test storage migration using try-runtume on PRs with label "migration"

on:
pull_request:
Expand Down Expand Up @@ -31,12 +31,14 @@ jobs:
key: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-${{ env.POLKA_VERSION }}

- name: Install try-runtime
run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked

- run: |
echo "Found label runtime_migration. Running tests"
export RUST_LOG=remote-ext=debug,runtime=debug
echo "---------- Running try-runtime for Trappist ----------"
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 \
on-runtime-upgrade live --uri wss://rococo-trappist-try-runtime-node.parity-chains.parity.io:443
cargo build -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 \
on-runtime-upgrade live --uri wss://rococo-trappist-try-runtime-node.parity-chains.parity.io:443
env:
RUST_LOG: remote-ext=debug,runtime=debug
8 changes: 0 additions & 8 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ pub enum Subcommand {
/// The pallet benchmarking moved to the `pallet` sub-command.
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some testing command against a specified runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Errors since the binary was not build with `--features try-runtime`.
#[cfg(not(feature = "try-runtime"))]
TryRuntime,
}

#[derive(Debug, clap::Parser)]
Expand Down
25 changes: 0 additions & 25 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ use crate::{
service::{new_partial, Block},
};

#[cfg(feature = "try-runtime")]
use crate::service::RuntimeExecutor;

/// Dispatches the code to the currently selected runtime.
macro_rules! dispatch_runtime {
($runtime:expr, |$alias: ident| $code:expr) => {
Expand Down Expand Up @@ -387,28 +384,6 @@ pub fn run() -> Result<()> {
}
})
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use try_runtime_cli::block_building_info::timestamp_with_aura_info;

type HostFunctionsOf<E> = ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<E as NativeExecutionDispatch>::ExtendHostFunctions,
>;

let info_provider = timestamp_with_aura_info(6000);

construct_async_run!(|components, cli, cmd, _config, runtime| {
Ok(cmd.run::<Block, HostFunctionsOf<RuntimeExecutor<runtime::Runtime>>, _>(Some(
info_provider,
)))
})
},
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \
You can enable it with `--features try-runtime`."
.into()),
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
Expand Down
7 changes: 1 addition & 6 deletions runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(
migrations::SetStorageVersions,
pallet_xcm::migration::v1::MigrateToV1<Runtime>,
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
pallet_contracts::Migration<Runtime>,
),
(),
>;

impl_opaque_keys! {
Expand Down