Skip to content

Commit

Permalink
Remove deprecated method try_runtime_cli::TryRuntimeCmd::run (#1869)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
mattheworris authored Feb 8, 2024
1 parent 33e541c commit 46a5b8c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 45 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 27 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
22 changes: 0 additions & 22 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Block, HostFunctions, _>(Some(info_provider)), task_manager))
})
},
Some(Subcommand::ExportRuntimeVersion(cmd)) => {
let runner = cli.create_runner(cmd)?;

Expand Down

0 comments on commit 46a5b8c

Please sign in to comment.