diff --git a/Cargo.lock b/Cargo.lock index 10e16d9ffcb..d32e9667b18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11049,7 +11049,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "try-runtime-cli" -version = "0.5.3" +version = "0.5.4" dependencies = [ "clap", "env_logger", @@ -11102,7 +11102,7 @@ dependencies = [ [[package]] name = "try-runtime-core" -version = "0.5.3" +version = "0.5.4" dependencies = [ "assert_cmd", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 552a33ddc7a..5f8f10a6343 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" members = ["cli", "core"] [workspace.package] -version = "0.5.3" +version = "0.5.4" authors = ["Parity Technologies "] description = "Substrate's programmatic testing framework." edition = "2021" diff --git a/core/src/commands/on_runtime_upgrade.rs b/core/src/commands/on_runtime_upgrade.rs index 7db7064f6d1..4e1298f55af 100644 --- a/core/src/commands/on_runtime_upgrade.rs +++ b/core/src/commands/on_runtime_upgrade.rs @@ -282,6 +282,11 @@ fn analyse_pov(proof: StorageProof, pre_root: H::Out, no_weight_warnings: boo where H: Hasher, { + if proof.is_empty() { + log::info!(target: LOG_TARGET, "Empty PoV detected"); + return WeightSafety::ProbablySafe; + } + let encoded_proof_size = proof.encoded_size(); let compact_proof = proof .clone() @@ -304,7 +309,7 @@ where ); e }) - .unwrap_or_default(); + .expect("generating compressed proof should never fail if proof is valid"); let proof_nodes = proof.into_nodes(); log::debug!( diff --git a/core/tests/on_runtime_upgrade.rs b/core/tests/on_runtime_upgrade.rs index 2a3d1aa6174..d0985b08433 100644 --- a/core/tests/on_runtime_upgrade.rs +++ b/core/tests/on_runtime_upgrade.rs @@ -249,4 +249,25 @@ mod on_runtime_upgrade { }) .await; } + + #[tokio::test] + async fn no_migrations_works() { + common::run_with_timeout(Duration::from_secs(300), async move { + let project_root = env!("CARGO_MANIFEST_DIR"); + let snap_path = format!("{}/tests/snaps/kusama-asset-hub.snap", project_root); + let runtime_path = format!( + "{}/tests/runtimes/asset_hub_kusama_runtime_no_migrations.compact.compressed.wasm", + project_root + ); + let child = on_runtime_upgrade( + snap_path.as_str(), + runtime_path.as_str(), + &[], + &["--disable-spec-version-check"], + ); + let out = child.wait_with_output().await.unwrap(); + assert!(out.status.success()); + }) + .await; + } } diff --git a/core/tests/runtimes/asset_hub_kusama_runtime_no_migrations.compact.compressed.wasm b/core/tests/runtimes/asset_hub_kusama_runtime_no_migrations.compact.compressed.wasm new file mode 100644 index 00000000000..4d392563b71 Binary files /dev/null and b/core/tests/runtimes/asset_hub_kusama_runtime_no_migrations.compact.compressed.wasm differ diff --git a/core/tests/snaps/kusama-asset-hub.snap b/core/tests/snaps/kusama-asset-hub.snap new file mode 100644 index 00000000000..a96495fee87 Binary files /dev/null and b/core/tests/snaps/kusama-asset-hub.snap differ