From 4424f610e66535b4554939ad9cc4e3d8828975e3 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 10 May 2024 07:21:25 +0500 Subject: [PATCH] move misc logging to common --- core/src/commands/on_runtime_upgrade.rs | 12 +++++++----- core/src/{misc.rs => common/misc_logging.rs} | 0 core/src/common/mod.rs | 1 + core/src/lib.rs | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) rename core/src/{misc.rs => common/misc_logging.rs} (100%) diff --git a/core/src/commands/on_runtime_upgrade.rs b/core/src/commands/on_runtime_upgrade.rs index 50f17823936..7d2977cfa7d 100644 --- a/core/src/commands/on_runtime_upgrade.rs +++ b/core/src/commands/on_runtime_upgrade.rs @@ -27,7 +27,8 @@ use sp_runtime::traits::{Block as BlockT, HashingFor, NumberFor}; use sp_state_machine::{CompactProof, OverlayedChanges, StorageProof}; use crate::{ - build_executor, misc, + build_executor, + common::misc_logging, state::{RuntimeChecks, State}, state_machine_call_with_proof, RefTimeInfo, SharedParams, LOG_TARGET, }; @@ -106,7 +107,7 @@ where } // Run `TryRuntime_on_runtime_upgrade` with the given checks. - misc::basti_log( + misc_logging::basti_log( Level::Info, format!( "🔬 Running TryRuntime_on_runtime_upgrade with checks: {:?}", @@ -114,6 +115,7 @@ where ) .as_str(), ); + // Save the overlayed changes from the first run, so we can use them later for idempotency // checks. let mut overlayed_changes = Default::default(); @@ -135,7 +137,7 @@ where let (proof, ref_time_results) = match command.checks { UpgradeCheckSelect::None => (proof, ref_time_results), _ => { - misc::basti_log( + misc_logging::basti_log( Level::Info, "🔬 TryRuntime_on_runtime_upgrade succeeded! Running it again without checks for weight measurements.", ); @@ -160,7 +162,7 @@ where true } false => { - misc::basti_log( + misc_logging::basti_log( Level::Info, format!( "🔬 Running TryRuntime_on_runtime_upgrade again to check idempotency: {:?}", @@ -244,7 +246,7 @@ where }; if !weight_ok || !idempotency_ok { - misc::basti_log( + misc_logging::basti_log( Level::Error, "❌ Issues detected, exiting non-zero. See logs.", ); diff --git a/core/src/misc.rs b/core/src/common/misc_logging.rs similarity index 100% rename from core/src/misc.rs rename to core/src/common/misc_logging.rs diff --git a/core/src/common/mod.rs b/core/src/common/mod.rs index b3df106001b..52aecd378c5 100644 --- a/core/src/common/mod.rs +++ b/core/src/common/mod.rs @@ -1 +1,2 @@ +pub mod misc_logging; pub mod shared_parameters; diff --git a/core/src/lib.rs b/core/src/lib.rs index 56cb362724c..2199351041c 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -42,7 +42,6 @@ use sp_weights::Weight; pub mod commands; pub mod common; mod inherents; -mod misc; mod parse; pub mod state;