Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More improvements #67

Merged
merged 5 commits into from
Jan 19, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/rust-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
version: "3.6.1"
- name: cargo doc
run: RUSTFLAGS="-D warnings" cargo doc
run: RUSTFLAGS="-D warnings" cargo doc --locked

lint:
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ env_logger = { workspace = true }
parity-scale-codec = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["full"] }

sc-executor = { workspace = true }

sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-state-machine = { workspace = true }
sp-storage = { workspace = true }

node-executor = { workspace = true }
node-primitives = { workspace = true }

try-runtime-core = { workspace = true }
Expand Down
11 changes: 3 additions & 8 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@
use std::env;

use clap::Parser;
use node_executor::ExecutorDispatch;
use node_primitives::Block;
use try_runtime_core::commands::TryRuntime;

Expand All @@ -315,12 +314,8 @@ fn init_env() {
async fn main() {
init_env();

use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
let cmd = TryRuntime::parse();
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>>()
.await
.unwrap();
cmd.run::<Block, sp_io::SubstrateHostFunctions>()
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
.await
.unwrap();
}
3 changes: 3 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ pub(crate) fn build_executor<H: HostFunctions>(shared: &SharedParams) -> WasmExe
))
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
// There is not that much we can do if someone is using unknown host functions.
// They would need to fork the `cli` to add their custom host functions.
.with_allow_missing_host_functions(true)
.build()
}

Expand Down
23 changes: 4 additions & 19 deletions core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ impl LiveState {
pub enum State {
/// Use a state snapshot as the source of runtime state.
Snap {
/// DEPRECATED: use `--path` instead.
#[arg(short, long)]
snapshot_path: Option<PathBuf>,

#[clap(short = 'p', long = "path")]
#[clap(short = 'p', long = "path", alias = "snapshot-path")]
path: Option<PathBuf>,
},

Expand Down Expand Up @@ -168,22 +164,11 @@ impl State {
<Block::Hash as FromStr>::Err: Debug,
{
let builder = match self {
State::Snap {
snapshot_path,
path,
} => {
// we allow both `--snapshot-path` and `--path` for now, but `--snapshot-path` is
// deprecated.
if snapshot_path.is_some() {
log::warn!(
target: LOG_TARGET,
"`--snapshot-path` is deprecated and will be removed some time after Jan 2024. Use `--path` instead."
);
}
let path = snapshot_path
State::Snap { path } => {
let path = path
.as_ref()
.or(path.as_ref())
.ok_or_else(|| "no snapshot path provided".to_string())?;

Builder::<Block>::new().mode(Mode::Offline(OfflineConfig {
state_snapshot: SnapshotConfig::new(path),
}))
Expand Down