From a152e85284760ba25967fa506049d3f5aeb4b2f1 Mon Sep 17 00:00:00 2001 From: liamaharon Date: Tue, 26 Sep 2023 19:22:52 +0000 Subject: [PATCH] deploy: 5cd368619b2065042fcb8975e86ec7b208d6a576 --- .../commands/on_runtime_upgrade.rs.html | 58 ++++++++++++++++++- .../commands/on_runtime_upgrade/fn.run.html | 2 +- .../commands/on_runtime_upgrade/index.html | 2 +- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/src/try_runtime_core/commands/on_runtime_upgrade.rs.html b/src/try_runtime_core/commands/on_runtime_upgrade.rs.html index 2d3c2fe906b..4cf5839065b 100644 --- a/src/try_runtime_core/commands/on_runtime_upgrade.rs.html +++ b/src/try_runtime_core/commands/on_runtime_upgrade.rs.html @@ -218,6 +218,33 @@ 218 219 220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247
// This file is part of try-runtime-cli.
 
 // Copyright (C) Parity Technologies (UK) Ltd.
@@ -307,16 +334,43 @@
         );
     }
 
-    let pre_root = ext.backend.root();
+    // Run `TryRuntime_on_runtime_upgrade` with the given checks.
+    log::info!(
+        "🔬 Running TryRuntime_on_runtime_upgrade with checks: {:?}",
+        command.checks
+    );
     let (_, proof, ref_time_results) = state_machine_call_with_proof::<Block, HostFns>(
         &ext,
         &executor,
         "TryRuntime_on_runtime_upgrade",
         command.checks.encode().as_ref(),
         Default::default(), // we don't really need any extensions here.
-        shared.export_proof,
+        shared.export_proof.clone(),
     )?;
 
+    // If the above call ran with checks then we need to run the call again without checks to
+    // measure PoV correctly.
+    // Otherwise, storage lookups from try-runtime logic like pre/post hooks are included in the PoV
+    // calculation.
+    let (proof, ref_time_results) = match command.checks {
+        UpgradeCheckSelect::None => (proof, ref_time_results),
+        _ => {
+            log::info!(
+                "🔬 TryRuntime_on_runtime_upgrade succeeded! Running it again without checks for weight measurements."
+            );
+            let (_, proof, ref_time_results) = state_machine_call_with_proof::<Block, HostFns>(
+                &ext,
+                &executor,
+                "TryRuntime_on_runtime_upgrade",
+                UpgradeCheckSelect::None.encode().as_ref(),
+                Default::default(), // we don't really need any extensions here.
+                shared.export_proof,
+            )?;
+            (proof, ref_time_results)
+        }
+    };
+
+    let pre_root = ext.backend.root();
     let pov_safety = analyse_pov::<HashingFor<Block>>(proof, *pre_root, command.no_weight_warnings);
     let ref_time_safety = analyse_ref_time(ref_time_results, command.no_weight_warnings);
 
diff --git a/try_runtime_core/commands/on_runtime_upgrade/fn.run.html b/try_runtime_core/commands/on_runtime_upgrade/fn.run.html
index 00985886445..bb1c3c6806f 100644
--- a/try_runtime_core/commands/on_runtime_upgrade/fn.run.html
+++ b/try_runtime_core/commands/on_runtime_upgrade/fn.run.html
@@ -1,4 +1,4 @@
-run in try_runtime_core::commands::on_runtime_upgrade - Rust
pub async fn run<Block, HostFns>(
+run in try_runtime_core::commands::on_runtime_upgrade - Rust
pub async fn run<Block, HostFns>(
     shared: SharedParams,
     command: Command
 ) -> Result<()>where
diff --git a/try_runtime_core/commands/on_runtime_upgrade/index.html b/try_runtime_core/commands/on_runtime_upgrade/index.html
index 37814d9c3cd..a79d45d9f14 100644
--- a/try_runtime_core/commands/on_runtime_upgrade/index.html
+++ b/try_runtime_core/commands/on_runtime_upgrade/index.html
@@ -1 +1 @@
-try_runtime_core::commands::on_runtime_upgrade - Rust
\ No newline at end of file +try_runtime_core::commands::on_runtime_upgrade - Rust
\ No newline at end of file