From 46a5b8cddff9cb2181fea3d39d2542627084158a Mon Sep 17 00:00:00 2001 From: Matthew Orris <1466844+mattheworris@users.noreply.github.com> Date: Thu, 8 Feb 2024 07:08:37 -0700 Subject: [PATCH] Remove deprecated method try_runtime_cli::TryRuntimeCmd::run (#1869) # Goal The goal of this PR is to remove deprecated code. Closes #1814 # Changes - [x] Remove `try-runtime` command-line option - [x] `cargo update -p wasmi wasmi_arena` to fix lint-audit problems - [x] Makefile updates for `try-runtime` and `.PHONY` targets # How to test - Building with `features=try-runtime` does not complain about deprecation. - Run `make try-runtime-XXX` commands and confirm they work. As runtime upgrades take quite a long time, maybe focus on the snapshots, and use the files from Google Drive:`Initiatives/Projects/Labs/Developers/Frequency Snapshots` - Are there any other places in the repo that might be affected by removing the `try-runtime` command line option? # Checklist - [ ] Chain spec updated - [ ] Custom RPC OR Runtime API added/changed? Updated js/api-augment. - [ ] Design doc(s) updated - [ ] Tests added - [ ] Benchmarks added - [ ] Weights updated --- Cargo.lock | 8 ++++---- Makefile | 42 ++++++++++++++++++++++++++--------------- node/cli/src/cli.rs | 4 ---- node/cli/src/command.rs | 22 --------------------- 4 files changed, 31 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3286c0834a..b6a9514cad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13956,9 +13956,9 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acfc1e384a36ca532d070a315925887247f3c7e23567e23e0ac9b1c5d6b8bf76" +checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" dependencies = [ "smallvec", "spin 0.9.8", @@ -13969,9 +13969,9 @@ dependencies = [ [[package]] name = "wasmi_arena" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" diff --git a/Makefile b/Makefile index f5620bda9a..1472355015 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all: build clean: cargo clean -.PHONY: start +.PHONY: start, start-relay, start-frequency, start-frequency-docker, start-manual, start-interval, start-interval-short, start-with-offchain, start-frequency-with-offchain, start-manual-with-offchain, start-interval-with-offchain start: ./scripts/init.sh start-frequency-instant @@ -41,7 +41,7 @@ start-manual-with-offchain: start-interval-with-offchain: ./scripts/init.sh start-frequency-interval with-offchain -.PHONY: stop +.PHONY: stop, stop-relay, stop-frequency-docker stop-relay: ./scripts/init.sh stop-relay-chain @@ -69,7 +69,7 @@ onboard: offboard: ./scripts/init.sh offboard-frequency-rococo-local -.PHONY: specs +.PHONY: specs-rococo-2000, specs-rococo-local specs-rococo-2000: ./scripts/generate_specs.sh 2000 rococo-2000 release @@ -80,7 +80,7 @@ specs-rococo-local: format: cargo +nightly-2023-07-13 fmt -.PHONY: lint +.PHONY: lint, lint-audit lint: cargo +nightly-2023-07-13 fmt --check SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo +nightly-2023-07-13 clippy --features runtime-benchmarks,frequency-lint-check -- -D warnings @@ -95,7 +95,7 @@ format-lint: format lint .PHONY: ci-local ci-local: check lint lint-audit test js e2e-tests -.PHONY: upgrade +.PHONY: upgrade-local, upgrade-no-relay upgrade-local: ./scripts/init.sh upgrade-frequency-rococo-local @@ -196,7 +196,7 @@ docs: docker-prune: ./scripts/prune_all.sh -.PHONY: check +.PHONY: check, check-no-relay, check-local, check-rococo, check-mainnet check: SKIP_WASM_BUILD= cargo check --features runtime-benchmarks,frequency-lint-check @@ -216,7 +216,7 @@ check-mainnet: js: ./scripts/generate_js_definitions.sh -.PHONY: build +.PHONY: build, build-benchmarks, build-no-relay, build-local, build-rococo, build-mainnet, build-rococo-release, build-mainnet-release build: cargo build --features frequency-no-relay @@ -241,7 +241,7 @@ build-rococo-release: build-mainnet-release: cargo build --locked --features frequency --release -.PHONY: test +.PHONY: test, e2e-tests, e2e-tests-serial, e2e-tests-only, e2e-tests-load, e2e-tests-load-only, e2e-tests-rococo, e2e-tests-rococo-local test: cargo test --workspace --features runtime-benchmarks,frequency-lint-check @@ -266,17 +266,29 @@ e2e-tests-rococo: e2e-tests-rococo-local: ./scripts/run_e2e_tests.sh -c rococo_local -.PHONY: try-runtime -try-runtime: - cargo run --release --features frequency-lint-check,try-runtime try-runtime --help +.PHONY: try-runtime-create-snapshot-rococo, try-runtime-create-snapshot-mainnet, try-runtime-upgrade-rococo, try-runtime-upgrade-mainnet, try-runtime-use-snapshot-rococo, try-runtime-use-snapshot-mainnet +try-runtime-create-snapshot-rococo: + try-runtime create-snapshot --uri wss://rpc.rococo.frequency.xyz:443 rococo-all-pallets.state + +# mainnet snapshot takes as many as 24 hours to complete +try-runtime-create-snapshot-mainnet: + try-runtime create-snapshot --uri wss://1.rpc.frequency.xyz:443 mainnet-all-pallets.state try-runtime-upgrade-rococo: - cargo build --release --features frequency-rococo-testnet,try-runtime - cargo run --release --features frequency-lint-check,try-runtime try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc.rococo.frequency.xyz:443 + cargo build --release --features frequency-rococo-testnet,try-runtime && \ + try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade live --uri wss://rpc.rococo.frequency.xyz:443 try-runtime-upgrade-mainnet: - cargo build --release --features frequency,try-runtime - cargo run --release --features frequency-lint-check,try-runtime try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade --checks live --uri wss://1.rpc.frequency.xyz:443 + cargo build --release --features frequency,try-runtime && \ + try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade live --uri wss://1.rpc.frequency.xyz:443 + +try-runtime-use-snapshot-rococo: + cargo build --release --features frequency-rococo-testnet,try-runtime && \ + try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade snap --path rococo-all-pallets.state + +try-runtime-use-snapshot-mainnet: + cargo build --release --features frequency,try-runtime && \ + try-runtime --runtime ./target/release/wbuild/frequency-runtime/frequency_runtime.wasm on-runtime-upgrade snap --path mainnet-all-pallets.state # Pull the Polkadot version from the polkadot-cli package in the Cargo.lock file. # This will break if the lock file format changes diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index c3d304c8f5..3b2be64ea3 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -49,10 +49,6 @@ pub enum Subcommand { #[clap(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), - /// Try some testing command against a specified runtime state. - #[cfg(feature = "try-runtime")] - TryRuntime(try_runtime_cli::TryRuntimeCmd), - /// Get current runtime spec version. ExportRuntimeVersion(ExportRuntimeVersionCmd), } diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 22536f0e0e..a9c7adf4c9 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -369,28 +369,6 @@ pub fn run() -> Result<()> { } }, - #[cfg(feature = "try-runtime")] - Some(Subcommand::TryRuntime(cmd)) => { - use common_runtime::constants::MILLISECS_PER_BLOCK; - use try_runtime_cli::block_building_info::timestamp_with_aura_info; - - let runner = cli.create_runner(cmd)?; - - type HostFunctions = - (sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions); - - // grab the task manager. - let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); - let task_manager = - sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry) - .map_err(|e| format!("Error: {:?}", e))?; - - let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK); - - runner.async_run(|_| { - Ok((cmd.run::(Some(info_provider)), task_manager)) - }) - }, Some(Subcommand::ExportRuntimeVersion(cmd)) => { let runner = cli.create_runner(cmd)?;