From 9cb4c7b7a919e3889f58c1583c40f322d8d87b6f Mon Sep 17 00:00:00 2001 From: Andrei Kashin Date: Fri, 3 Feb 2023 10:11:33 +0000 Subject: [PATCH] Prettify weight printing --- core/primitives/res/runtime_configs/parameters.snap | 2 +- core/primitives/src/runtime/parameter_table.rs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/primitives/res/runtime_configs/parameters.snap b/core/primitives/res/runtime_configs/parameters.snap index 6eb29bf3556..95a51d295e4 100644 --- a/core/primitives/res/runtime_configs/parameters.snap +++ b/core/primitives/res/runtime_configs/parameters.snap @@ -123,7 +123,7 @@ wasm_storage_iter_create_to_byte 0 wasm_storage_iter_next_base 0 wasm_storage_iter_next_key_byte 0 wasm_storage_iter_next_value_byte 0 -wasm_touching_trie_node 16_101_955_926 +wasm_touching_trie_node 16_101_955_926, weight: 2 / 3 wasm_read_cached_trie_node 2_280_000_000 wasm_promise_and_base 1_465_013_400 wasm_promise_and_per_promise 5_452_176 diff --git a/core/primitives/src/runtime/parameter_table.rs b/core/primitives/src/runtime/parameter_table.rs index 8b19e26e287..bbcdec22024 100644 --- a/core/primitives/src/runtime/parameter_table.rs +++ b/core/primitives/src/runtime/parameter_table.rs @@ -173,11 +173,9 @@ impl core::fmt::Display for ParameterValue { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { match self { ParameterValue::U64(v) => write!(f, "{:>20}", format_number(*v)), - ParameterValue::Rational(r) => { - write!(f, "{r}") - } + ParameterValue::Rational(r) => write!(f, "{r}"), ParameterValue::WeightedGas { base, weight } => { - write!(f, "base: {base}, weight: {weight}") + write!(f, "{:>20}, weight: {weight}", format_number(*base)) } ParameterValue::Fee { send_sir, send_not_sir, execution } => { write!(