diff --git a/crates/papyrus_p2p_sync/src/client/header.rs b/crates/papyrus_p2p_sync/src/client/header.rs index 7eda294af78..e24fbc2cd30 100644 --- a/crates/papyrus_p2p_sync/src/client/header.rs +++ b/crates/papyrus_p2p_sync/src/client/header.rs @@ -8,10 +8,7 @@ use papyrus_storage::{StorageError, StorageReader, StorageWriter}; use starknet_api::block::{BlockHash, BlockHeader, BlockNumber, BlockSignature}; use starknet_api::hash::StarkHash; use starknet_class_manager_types::SharedClassManagerClient; -use starknet_sequencer_metrics::metric_definitions::{ - PAPYRUS_HEADER_LATENCY_SEC, - PAPYRUS_HEADER_MARKER, -}; +use starknet_sequencer_metrics::metric_definitions::{SYNC_HEADER_LATENCY_SEC, SYNC_HEADER_MARKER}; use starknet_state_sync_types::state_sync_types::SyncBlock; use tracing::debug; @@ -49,7 +46,7 @@ impl BlockData for SignedBlockHeader { .expect("Vec::first should return a value on a vector of size 1"), )? .commit()?; - PAPYRUS_HEADER_MARKER.set( + SYNC_HEADER_MARKER.set( self.block_header.block_header_without_hash.block_number.unchecked_next().0 as f64, ); // TODO(shahak): Fix code dup with central sync @@ -64,7 +61,7 @@ impl BlockData for SignedBlockHeader { let header_latency = time_delta.num_seconds(); debug!("Header latency: {}.", header_latency); if header_latency >= 0 { - PAPYRUS_HEADER_LATENCY_SEC.set(header_latency as f64); + SYNC_HEADER_LATENCY_SEC.set(header_latency as f64); } Ok(()) } diff --git a/crates/papyrus_p2p_sync/src/client/state_diff.rs b/crates/papyrus_p2p_sync/src/client/state_diff.rs index 04ac9ec3411..55cc3105d84 100644 --- a/crates/papyrus_p2p_sync/src/client/state_diff.rs +++ b/crates/papyrus_p2p_sync/src/client/state_diff.rs @@ -11,7 +11,7 @@ use papyrus_storage::{StorageError, StorageReader, StorageWriter}; use starknet_api::block::BlockNumber; use starknet_api::state::ThinStateDiff; use starknet_class_manager_types::SharedClassManagerClient; -use starknet_sequencer_metrics::metric_definitions::PAPYRUS_STATE_MARKER; +use starknet_sequencer_metrics::metric_definitions::SYNC_STATE_MARKER; use starknet_state_sync_types::state_sync_types::SyncBlock; use super::block_data_stream_builder::BadPeerError; @@ -33,7 +33,7 @@ impl BlockData for (ThinStateDiff, BlockNumber) { ) -> BoxFuture<'a, Result<(), P2pSyncClientError>> { async move { storage_writer.begin_rw_txn()?.append_state_diff(self.1, self.0)?.commit()?; - PAPYRUS_STATE_MARKER.set(self.1.unchecked_next().0 as f64); + SYNC_STATE_MARKER.set(self.1.unchecked_next().0 as f64); Ok(()) } .boxed() diff --git a/crates/papyrus_sync/src/lib.rs b/crates/papyrus_sync/src/lib.rs index 9a5a672c1ba..4a3a5749397 100644 --- a/crates/papyrus_sync/src/lib.rs +++ b/crates/papyrus_sync/src/lib.rs @@ -42,13 +42,13 @@ use starknet_api::state::{StateDiff, ThinStateDiff}; use starknet_class_manager_types::{ClassManagerClientError, SharedClassManagerClient}; use starknet_client::reader::PendingData; use starknet_sequencer_metrics::metric_definitions::{ - PAPYRUS_BASE_LAYER_MARKER, - PAPYRUS_BODY_MARKER, - PAPYRUS_CENTRAL_BLOCK_MARKER, - PAPYRUS_COMPILED_CLASS_MARKER, - PAPYRUS_HEADER_LATENCY_SEC, - PAPYRUS_HEADER_MARKER, - PAPYRUS_STATE_MARKER, + SYNC_BASE_LAYER_MARKER, + SYNC_BODY_MARKER, + SYNC_CENTRAL_BLOCK_MARKER, + SYNC_COMPILED_CLASS_MARKER, + SYNC_HEADER_LATENCY_SEC, + SYNC_HEADER_MARKER, + SYNC_STATE_MARKER, }; use tokio::sync::RwLock; use tracing::{debug, error, info, instrument, trace, warn}; @@ -446,8 +446,8 @@ impl< .append_block_signature(block_number, signature)? .append_body(block_number, block.body)? .commit()?; - PAPYRUS_HEADER_MARKER.set(block_number.unchecked_next().0 as f64); - PAPYRUS_BODY_MARKER.set(block_number.unchecked_next().0 as f64); + SYNC_HEADER_MARKER.set(block_number.unchecked_next().0 as f64); + SYNC_BODY_MARKER.set(block_number.unchecked_next().0 as f64); let time_delta = Utc::now() - Utc .timestamp_opt(block.header.block_header_without_hash.timestamp.0 as i64, 0) @@ -456,7 +456,7 @@ impl< let header_latency = time_delta.num_seconds(); debug!("Header latency: {}.", header_latency); if header_latency >= 0 { - PAPYRUS_HEADER_LATENCY_SEC.set(header_latency as f64); + SYNC_HEADER_LATENCY_SEC.set(header_latency as f64); } Ok(()) } @@ -511,8 +511,8 @@ impl< .commit()?; } let compiled_class_marker = self.reader.begin_ro_txn()?.get_compiled_class_marker()?; - PAPYRUS_STATE_MARKER.set(block_number.unchecked_next().0 as f64); - PAPYRUS_COMPILED_CLASS_MARKER.set(compiled_class_marker.0 as f64); + SYNC_STATE_MARKER.set(block_number.unchecked_next().0 as f64); + SYNC_COMPILED_CLASS_MARKER.set(compiled_class_marker.0 as f64); // Info the user on syncing the block once all the data is stored. info!("Added block {} with hash {:#064x}.", block_number, block_hash.0); @@ -536,7 +536,7 @@ impl< txn.commit()?; let compiled_class_marker = self.reader.begin_ro_txn()?.get_compiled_class_marker()?; - PAPYRUS_COMPILED_CLASS_MARKER.set(compiled_class_marker.0 as f64); + SYNC_COMPILED_CLASS_MARKER.set(compiled_class_marker.0 as f64); debug!("Added compiled class."); Ok(()) } @@ -578,7 +578,7 @@ impl< if txn.get_base_layer_block_marker()? != block_number.unchecked_next() { info!("Verified block {block_number} hash against base layer."); txn.update_base_layer_block_marker(&block_number.unchecked_next())?.commit()?; - PAPYRUS_BASE_LAYER_MARKER.set(block_number.unchecked_next().0 as f64); + SYNC_BASE_LAYER_MARKER.set(block_number.unchecked_next().0 as f64); } Ok(()) } @@ -712,7 +712,7 @@ fn stream_new_blocks< let central_block_marker = latest_central_block.map_or( BlockNumber::default(), |block_hash_and_number| block_hash_and_number.number.unchecked_next() ); - PAPYRUS_CENTRAL_BLOCK_MARKER.set(central_block_marker.0 as f64); + SYNC_CENTRAL_BLOCK_MARKER.set(central_block_marker.0 as f64); if header_marker == central_block_marker { // Only if the node have the last block and state (without casms), sync pending data. if collect_pending_data && reader.begin_ro_txn()?.get_state_marker()? == header_marker{ diff --git a/crates/starknet_sequencer_metrics/src/metric_definitions.rs b/crates/starknet_sequencer_metrics/src/metric_definitions.rs index 4cb43618cc5..0cafb98a4fe 100644 --- a/crates/starknet_sequencer_metrics/src/metric_definitions.rs +++ b/crates/starknet_sequencer_metrics/src/metric_definitions.rs @@ -85,13 +85,13 @@ define_gauge_metrics!( { STATE_SYNC_P2P_NUM_ACTIVE_OUTBOUND_SESSIONS, "apollo_sync_num_active_outbound_sessions", "The number of outbound sessions to the state sync p2p component" }, }, MetricScope::PapyrusSync => { - { PAPYRUS_HEADER_MARKER, "papyrus_header_marker", "The first block number for which the node does not have a header" }, - { PAPYRUS_BODY_MARKER, "papyrus_body_marker", "The first block number for which the node does not have a body" }, - { PAPYRUS_STATE_MARKER, "papyrus_state_marker", "The first block number for which the node does not have a state body" }, - { PAPYRUS_COMPILED_CLASS_MARKER, "papyrus_compiled_class_marker", "The first block number for which the node does not have all of the corresponding compiled classes" }, - { PAPYRUS_BASE_LAYER_MARKER, "papyrus_base_layer_marker", "The first block number for which the node does not guarantee L1 finality" }, - { PAPYRUS_CENTRAL_BLOCK_MARKER, "papyrus_central_block_marker", "The first block number that doesn't exist yet" }, - { PAPYRUS_HEADER_LATENCY_SEC, "papyrus_header_latency", "The latency, in seconds, between a block timestamp (as state in its header) and the time the node stores the header" }, + { SYNC_HEADER_MARKER, "apollo_sync_header_marker", "The first block number for which sync does not have a header" }, + { SYNC_BODY_MARKER, "apollo_sync_body_marker", "The first block number for which sync does not have a body" }, + { SYNC_STATE_MARKER, "apollo_sync_state_marker", "The first block number for which sync does not have a state body" }, + { SYNC_COMPILED_CLASS_MARKER, "apollo_sync_compiled_class_marker", "The first block number for which sync does not have all of the corresponding compiled classes" }, + { SYNC_BASE_LAYER_MARKER, "apollo_sync_base_layer_marker", "The first block number for which sync does not guarantee L1 finality" }, + { SYNC_CENTRAL_BLOCK_MARKER, "apollo_sync_central_block_marker", "The first block number that doesn't exist yet" }, + { SYNC_HEADER_LATENCY_SEC, "apollo_sync_header_latency", "The latency, in seconds, between a block timestamp (as state in its header) and the time sync stores the header" }, } );