Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit d029225

Browse files
authored
Fix try-runtime with create-snapshot (#13223)
* Fix try-runtime with create-snapshot * Apply review suggestions
1 parent d22e68c commit d029225

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

utils/frame/try-runtime/cli/src/commands/create_snapshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171

7272
let executor = build_executor::<HostFns>(&shared);
7373
let _ = State::Live(command.from)
74-
.into_ext::<Block, HostFns>(&shared, &executor, Some(path.into()))
74+
.into_ext::<Block, HostFns>(&shared, &executor, Some(path.into()), false)
7575
.await?;
7676

7777
Ok(())

utils/frame/try-runtime/cli/src/commands/execute_block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ where
9999
HostFns: HostFunctions,
100100
{
101101
let executor = build_executor::<HostFns>(&shared);
102-
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None).await?;
102+
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None, true).await?;
103103

104104
// get the block number associated with this block.
105105
let block_ws_uri = command.block_ws_uri::<Block>();

utils/frame/try-runtime/cli/src/commands/follow_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ where
137137
pallet: vec![],
138138
child_tree: true,
139139
});
140-
let ext = state.into_ext::<Block, HostFns>(&shared, &executor, None).await?;
140+
let ext = state.into_ext::<Block, HostFns>(&shared, &executor, None, true).await?;
141141
maybe_state_ext = Some(ext);
142142
}
143143

utils/frame/try-runtime/cli/src/commands/offchain_worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ where
7878
{
7979
let executor = build_executor(&shared);
8080
// we first build the externalities with the remote code.
81-
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None).await?;
81+
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None, true).await?;
8282

8383
let header_ws_uri = command.header_ws_uri::<Block>();
8484

utils/frame/try-runtime/cli/src/commands/on_runtime_upgrade.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
HostFns: HostFunctions,
6363
{
6464
let executor = build_executor(&shared);
65-
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None).await?;
65+
let ext = command.state.into_ext::<Block, HostFns>(&shared, &executor, None, true).await?;
6666

6767
let (_, encoded_result) = state_machine_call_with_proof::<Block, HostFns>(
6868
&ext,

utils/frame/try-runtime/cli/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ impl State {
609609
shared: &SharedParams,
610610
executor: &WasmExecutor<HostFns>,
611611
state_snapshot: Option<SnapshotConfig>,
612+
try_runtime_check: bool,
612613
) -> sc_cli::Result<RemoteExternalities<Block>>
613614
where
614615
Block::Hash: FromStr,
@@ -707,8 +708,10 @@ impl State {
707708
}
708709

709710
// whatever runtime we have in store now must have been compiled with try-runtime feature.
710-
if !ensure_try_runtime::<Block, HostFns>(&executor, &mut ext) {
711-
return Err("given runtime is NOT compiled with try-runtime feature!".into())
711+
if try_runtime_check {
712+
if !ensure_try_runtime::<Block, HostFns>(&executor, &mut ext) {
713+
return Err("given runtime is NOT compiled with try-runtime feature!".into())
714+
}
712715
}
713716

714717
Ok(ext)

0 commit comments

Comments
 (0)