From 404027e59d0f2eb9d12ba6248e5c086f95a3bc40 Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Wed, 15 May 2024 20:51:13 +0800 Subject: [PATCH] Fix extrinsics count logging in frame-system (#4461) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The storage item ExtrinsicIndex is already taken before the `finalize()` in `note_finished_extrinsics()`, rendering it's always 0 in the log. This commit fixes it by using the proper API for extrinsics count. --------- Co-authored-by: Bastian Köcher Co-authored-by: Oliver Tale-Yazdi --- prdoc/pr_4461.prdoc | 10 ++++++++++ substrate/frame/system/src/lib.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 prdoc/pr_4461.prdoc diff --git a/prdoc/pr_4461.prdoc b/prdoc/pr_4461.prdoc new file mode 100644 index 000000000000..2dafa3812878 --- /dev/null +++ b/prdoc/pr_4461.prdoc @@ -0,0 +1,10 @@ +title: Fix extrinsics count logging in frame-system + +doc: + - audience: Runtime Dev + description: | + Fixes the issue of the number of extrinsics in the block always being 0 in the log of frame-system. + +crates: + - name: frame-system + bump: patch diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 30df4dcfd43e..7ed954d83aa8 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -1780,7 +1780,7 @@ impl Pallet { "[{:?}] {} extrinsics, length: {} (normal {}%, op: {}%, mandatory {}%) / normal weight:\ {} ({}%) op weight {} ({}%) / mandatory weight {} ({}%)", Self::block_number(), - Self::extrinsic_index().unwrap_or_default(), + Self::extrinsic_count(), Self::all_extrinsics_len(), sp_runtime::Percent::from_rational( Self::all_extrinsics_len(),