Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions prdoc/pr_9214.prdoc
Original file line number Diff line number Diff line change
@@ -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
13 changes: 12 additions & 1 deletion substrate/client/tracing/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,18 @@
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();

Check failure on line 235 in substrate/client/tracing/src/block/mod.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

no method named `record_proof` found for struct `ApiRef<'_, <Client as ProvideRuntimeApi<Block>>::Api>` in the current scope
let recorder = runtime_api
.proof_recorder()

Check failure on line 237 in substrate/client/tracing/src/block/mod.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

no method named `proof_recorder` found for struct `ApiRef<'_, <Client as ProvideRuntimeApi<Block>>::Api>` in the current scope
.expect("Proof recording is enabled in the line above; qed.");
runtime_api.register_extension(ProofSizeExt::new(recorder));

Check failure on line 239 in substrate/client/tracing/src/block/mod.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

failed to resolve: use of undeclared type `ProofSizeExt`

Check failure on line 239 in substrate/client/tracing/src/block/mod.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

no method named `register_extension` found for struct `ApiRef<'_, <Client as ProvideRuntimeApi<Block>>::Api>` in the current scope

// Replay block
runtime_api.execute_block(parent_hash, block)
}) {
return Err(Error::Dispatch(format!(
"Failed to collect traces and execute block: {}",
Expand Down
Loading