From a60e568c80923036ffc11a0f45c01c2c98dfecf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Tue, 15 Jul 2025 15:19:38 +0200 Subject: [PATCH 1/3] always enable proof recording to replay block --- substrate/client/tracing/src/block/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/substrate/client/tracing/src/block/mod.rs b/substrate/client/tracing/src/block/mod.rs index 3ebbc3d97e171..fcbdd049005f2 100644 --- a/substrate/client/tracing/src/block/mod.rs +++ b/substrate/client/tracing/src/block/mod.rs @@ -228,7 +228,19 @@ where if let Err(e) = dispatcher::with_default(&dispatch, || { let span = tracing::info_span!(target: TRACE_TARGET, "trace_block"); let _enter = span.enter(); - self.client.runtime_api().execute_block(parent_hash, block) + + let mut runtime_api = self.client.runtime_api(); + + // Enable proof recording + runtime_api.record_proof(); + let recorder = runtime_api + .proof_recorder() + .expect("Proof recording is enabled in the line above; qed."); + runtime_api.register_extension(ProofSizeExt::new(recorder)); + + + // Replay block + runtime_api.execute_block(parent_hash, block) }) { return Err(Error::Dispatch(format!( "Failed to collect traces and execute block: {}", From 482dc4d03190867a51b8b7bd7fdb17284c1ebb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= Date: Tue, 15 Jul 2025 15:28:34 +0200 Subject: [PATCH 2/3] add prdoc --- prdoc/pr_9214.prdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 prdoc/pr_9214.prdoc diff --git a/prdoc/pr_9214.prdoc b/prdoc/pr_9214.prdoc new file mode 100644 index 0000000000000..fd13d2dee8027 --- /dev/null +++ b/prdoc/pr_9214.prdoc @@ -0,0 +1,10 @@ +title: Enable proof recording in trace_block +doc: + - audience: Node Dev + description: | + The RPC method `state_traceBlock` never enables proof recording, which causes it to fail on any substrate chain that uses `StorageWeightReclaim` with a storage root mismatch error. + + This PR enables proof recording in `trace_block`. This change is transparent to users and requires no configuration changes. +crates: + - name: sc-tracing + bump: minor \ No newline at end of file From 4b54b6fd8022ba2cb58dceb1ad905b9167b28cbb Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Wed, 3 Sep 2025 10:56:06 +0100 Subject: [PATCH 3/3] format code --- substrate/client/tracing/src/block/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/client/tracing/src/block/mod.rs b/substrate/client/tracing/src/block/mod.rs index fcbdd049005f2..d034a6b035836 100644 --- a/substrate/client/tracing/src/block/mod.rs +++ b/substrate/client/tracing/src/block/mod.rs @@ -238,7 +238,6 @@ where .expect("Proof recording is enabled in the line above; qed."); runtime_api.register_extension(ProofSizeExt::new(recorder)); - // Replay block runtime_api.execute_block(parent_hash, block) }) {