diff --git a/crates/storage/storage-overlay/src/provider.rs b/crates/storage/storage-overlay/src/provider.rs index 617becc7d8d..08a131c70e3 100644 --- a/crates/storage/storage-overlay/src/provider.rs +++ b/crates/storage/storage-overlay/src/provider.rs @@ -150,7 +150,7 @@ where Some(self.overlay_builder.clone()), Arc::clone(&self.state_trie_overlay_cache), self.metrics.clone(), - self.proof_cursor_metrics.clone(), + Some(self.proof_cursor_metrics.clone()), self.known_storage_roots.clone(), is_v2, )) @@ -174,7 +174,9 @@ where overlay_builder: Option>, state_trie_overlay_cache: StateTrieOverlayCache, metrics: OverlayStateProviderFactoryMetrics, - proof_cursor_metrics: ProofCursorMetrics, + /// Cursor metric handles for multiproof calculators. Providers built outside a factory + /// register them on their first multiproof, so opening a provider stays cheap. + proof_cursor_metrics: Option, /// Revealed storage roots from the reused sparse trie, shared across proof workers. known_storage_roots: Arc>, state_trie_overlay: OnceCell, @@ -274,7 +276,7 @@ where overlay_builder: Option>, state_trie_overlay_cache: StateTrieOverlayCache, metrics: OverlayStateProviderFactoryMetrics, - proof_cursor_metrics: ProofCursorMetrics, + proof_cursor_metrics: Option, known_storage_roots: Arc>, is_v2: bool, ) -> Self { @@ -793,7 +795,7 @@ where self.provider().tx(), input, self.is_v2, - self.proof_cursor_metrics.clone(), + self.proof_cursor_metrics.clone().unwrap_or_default(), self.known_storage_roots.clone(), ) };