Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sync): add p2p sync server logs #2221

Closed
wants to merge 1 commit into from
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
3 changes: 0 additions & 3 deletions crates/papyrus_network/src/network_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ impl<SwarmT: SwarmTrait> GenericNetworkManager<SwarmT> {
peer_id: _,
protocol_name,
} => {
info!(
"Received new inbound query: {query:?} for session id: {inbound_session_id:?}"
);
self.num_active_inbound_sessions += 1;
gauge!(
papyrus_metrics::PAPYRUS_NUM_ACTIVE_INBOUND_SESSIONS,
Expand Down
5 changes: 4 additions & 1 deletion crates/papyrus_p2p_sync/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use starknet_api::block::BlockNumber;
use starknet_api::core::ClassHash;
use starknet_api::state::ThinStateDiff;
use starknet_api::transaction::{Event, Transaction, TransactionHash, TransactionOutput};
use tracing::error;
use tracing::{error, info};

#[cfg(test)]
mod test;
Expand Down Expand Up @@ -204,6 +204,7 @@ where
Sender: Sink<DataOrFin<Data>> + Unpin + Send + 'static,
P2PSyncServerError: From<<Sender as Sink<DataOrFin<Data>>>::Error>,
{
info!("Sync server received a new inbound query {query:?}");
let storage_reader_clone = self.storage_reader.clone();
tokio::task::spawn(async move {
let result = send_data_for_query(storage_reader_clone, query.clone(), sender).await;
Expand Down Expand Up @@ -401,6 +402,7 @@ where
{
// If this function fails, we still want to send fin before failing.
let result = send_data_without_fin_for_query(&storage_reader, query, &mut sender).await;
info!("Sending fin message for inbound sync query");
sender.feed(DataOrFin(None)).await?;
result
}
Expand Down Expand Up @@ -432,6 +434,7 @@ where
let data_vec = Data::fetch_block_data_from_db(block_number, &txn)?;
for data in data_vec {
// TODO: consider implement retry mechanism.
info!("Sending response for inbound sync query");
sender.feed(DataOrFin(Some(data))).await?;
}
}
Expand Down
Loading