From aea27a4b00d7a1c40691615b09cf52d03275c3f1 Mon Sep 17 00:00:00 2001 From: itschaindev Date: Mon, 1 Dec 2025 21:54:56 +0100 Subject: [PATCH 1/2] fix: update metric on startup --- crates/optimism/exex/src/lib.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/optimism/exex/src/lib.rs b/crates/optimism/exex/src/lib.rs index 164ac1a98e9..c30364da8b1 100644 --- a/crates/optimism/exex/src/lib.rs +++ b/crates/optimism/exex/src/lib.rs @@ -99,11 +99,18 @@ where /// Main execution loop for the ExEx pub async fn run(mut self) -> eyre::Result<()> { // Check if proofs storage is initialized - if self.storage.get_earliest_block_number().await?.is_none() { - return Err(eyre::eyre!( - "Proofs storage not initialized. Please run 'op-reth initialize-op-proofs --proofs-history.storage-path ' first." - )); - } + let earliest_block_number = match self.storage.get_earliest_block_number().await? { + Some((n, _)) => n, + None => { + return Err(eyre::eyre!( + "Proofs storage not initialized. Please run 'op-reth initialize-op-proofs --proofs-history.storage-path ' first." + )); + } + }; + + // Need to update the earliest block metric on startup as this is not called frequently and + // can show outdated info. + self.storage.metrics().block_metrics().earliest_number.set(earliest_block_number as f64); let collector = LiveTrieCollector::new( self.ctx.evm_config().clone(), From 9d510a1e30274a8102fae7f6c23e90e9e5b19c49 Mon Sep 17 00:00:00 2001 From: itschaindev Date: Tue, 2 Dec 2025 10:00:42 +0100 Subject: [PATCH 2/2] add metrics feature to resolve cargo check error --- crates/optimism/exex/Cargo.toml | 2 +- crates/optimism/exex/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/optimism/exex/Cargo.toml b/crates/optimism/exex/Cargo.toml index 12a967f37a2..3a21a4b4151 100644 --- a/crates/optimism/exex/Cargo.toml +++ b/crates/optimism/exex/Cargo.toml @@ -21,7 +21,7 @@ reth-provider.workspace = true # op-reth # proofs exex handles `TrieUpdates` in notifications -reth-optimism-trie = { workspace = true, features = ["serde-bincode-compat"] } +reth-optimism-trie = { workspace = true, features = ["serde-bincode-compat", "metrics"] } # alloy alloy-consensus.workspace = true diff --git a/crates/optimism/exex/src/lib.rs b/crates/optimism/exex/src/lib.rs index c30364da8b1..3494ebb8843 100644 --- a/crates/optimism/exex/src/lib.rs +++ b/crates/optimism/exex/src/lib.rs @@ -109,7 +109,7 @@ where }; // Need to update the earliest block metric on startup as this is not called frequently and - // can show outdated info. + // can show outdated info. When metrics are disabled, this is a no-op. self.storage.metrics().block_metrics().earliest_number.set(earliest_block_number as f64); let collector = LiveTrieCollector::new(