Skip to content

Commit 4677c9c

Browse files
authored
More improvements (#67)
See the commit messages for more information.
1 parent 75b4252 commit 4677c9c

6 files changed

Lines changed: 13 additions & 35 deletions

File tree

.github/workflows/rust-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
version: "3.6.1"
3434
- name: cargo doc
35-
run: RUSTFLAGS="-D warnings" cargo doc
35+
run: RUSTFLAGS="-D warnings" cargo doc --locked
3636

3737
lint:
3838
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ env_logger = { workspace = true }
2121
parity-scale-codec = { workspace = true, features = ["derive"] }
2222
tokio = { workspace = true, features = ["full"] }
2323

24-
sc-executor = { workspace = true }
25-
2624
sp-io = { workspace = true }
2725
sp-runtime = { workspace = true }
2826
sp-state-machine = { workspace = true }
2927
sp-storage = { workspace = true }
3028

31-
node-executor = { workspace = true }
3229
node-primitives = { workspace = true }
3330

3431
try-runtime-core = { workspace = true }

cli/main.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@
300300
use std::env;
301301

302302
use clap::Parser;
303-
use node_executor::ExecutorDispatch;
304303
use node_primitives::Block;
305304
use try_runtime_core::commands::TryRuntime;
306305

@@ -315,12 +314,8 @@ fn init_env() {
315314
async fn main() {
316315
init_env();
317316

318-
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
319317
let cmd = TryRuntime::parse();
320-
cmd.run::<Block, ExtendedHostFunctions<
321-
sp_io::SubstrateHostFunctions,
322-
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
323-
>>()
324-
.await
325-
.unwrap();
318+
cmd.run::<Block, sp_io::SubstrateHostFunctions>()
319+
.await
320+
.unwrap();
326321
}

core/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ pub(crate) fn build_executor<H: HostFunctions>(shared: &SharedParams) -> WasmExe
7474
))
7575
.with_onchain_heap_alloc_strategy(heap_pages)
7676
.with_offchain_heap_alloc_strategy(heap_pages)
77+
// There is not that much we can do if someone is using unknown host functions.
78+
// They would need to fork the `cli` to add their custom host functions.
79+
.with_allow_missing_host_functions(true)
7780
.build()
7881
}
7982

core/src/state.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,7 @@ impl LiveState {
127127
pub enum State {
128128
/// Use a state snapshot as the source of runtime state.
129129
Snap {
130-
/// DEPRECATED: use `--path` instead.
131-
#[arg(short, long)]
132-
snapshot_path: Option<PathBuf>,
133-
134-
#[clap(short = 'p', long = "path")]
130+
#[clap(short = 'p', long = "path", alias = "snapshot-path")]
135131
path: Option<PathBuf>,
136132
},
137133

@@ -168,22 +164,11 @@ impl State {
168164
<Block::Hash as FromStr>::Err: Debug,
169165
{
170166
let builder = match self {
171-
State::Snap {
172-
snapshot_path,
173-
path,
174-
} => {
175-
// we allow both `--snapshot-path` and `--path` for now, but `--snapshot-path` is
176-
// deprecated.
177-
if snapshot_path.is_some() {
178-
log::warn!(
179-
target: LOG_TARGET,
180-
"`--snapshot-path` is deprecated and will be removed some time after Jan 2024. Use `--path` instead."
181-
);
182-
}
183-
let path = snapshot_path
167+
State::Snap { path } => {
168+
let path = path
184169
.as_ref()
185-
.or(path.as_ref())
186170
.ok_or_else(|| "no snapshot path provided".to_string())?;
171+
187172
Builder::<Block>::new().mode(Mode::Offline(OfflineConfig {
188173
state_snapshot: SnapshotConfig::new(path),
189174
}))

0 commit comments

Comments
 (0)