Skip to content

Commit 7abe31b

Browse files
authored
Fix TrieError(InvalidStateRoot(...)) error log when runtime upgrade PoV is empty (#77)
Closes #76
1 parent 6a126fe commit 7abe31b

6 files changed

Lines changed: 30 additions & 4 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44
members = ["cli", "core"]
55

66
[workspace.package]
7-
version = "0.5.3"
7+
version = "0.5.4"
88
authors = ["Parity Technologies <admin@parity.io>"]
99
description = "Substrate's programmatic testing framework."
1010
edition = "2021"

core/src/commands/on_runtime_upgrade.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ fn analyse_pov<H>(proof: StorageProof, pre_root: H::Out, no_weight_warnings: boo
282282
where
283283
H: Hasher,
284284
{
285+
if proof.is_empty() {
286+
log::info!(target: LOG_TARGET, "Empty PoV detected");
287+
return WeightSafety::ProbablySafe;
288+
}
289+
285290
let encoded_proof_size = proof.encoded_size();
286291
let compact_proof = proof
287292
.clone()
@@ -304,7 +309,7 @@ where
304309
);
305310
e
306311
})
307-
.unwrap_or_default();
312+
.expect("generating compressed proof should never fail if proof is valid");
308313

309314
let proof_nodes = proof.into_nodes();
310315
log::debug!(

core/tests/on_runtime_upgrade.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,25 @@ mod on_runtime_upgrade {
249249
})
250250
.await;
251251
}
252+
253+
#[tokio::test]
254+
async fn no_migrations_works() {
255+
common::run_with_timeout(Duration::from_secs(300), async move {
256+
let project_root = env!("CARGO_MANIFEST_DIR");
257+
let snap_path = format!("{}/tests/snaps/kusama-asset-hub.snap", project_root);
258+
let runtime_path = format!(
259+
"{}/tests/runtimes/asset_hub_kusama_runtime_no_migrations.compact.compressed.wasm",
260+
project_root
261+
);
262+
let child = on_runtime_upgrade(
263+
snap_path.as_str(),
264+
runtime_path.as_str(),
265+
&[],
266+
&["--disable-spec-version-check"],
267+
);
268+
let out = child.wait_with_output().await.unwrap();
269+
assert!(out.status.success());
270+
})
271+
.await;
272+
}
252273
}
Binary file not shown.
65.3 MB
Binary file not shown.

0 commit comments

Comments
 (0)