Skip to content

Commit

Permalink
chore: fix CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonLStarkWare committed Dec 10, 2024
1 parent 6d8f02a commit f87d8e8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/starknet_state_sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl ComponentRequestHandler<StateSyncRequest, StateSyncResponse> for StateSync
self.new_block_sender
.send((block_number, sync_block))
.await
.map_err(|_| StateSyncError::P2PSyncClientError),
.map_err(StateSyncError::from),
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_state_sync/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod test;
use async_trait::async_trait;
use futures::channel::mpsc::Receiver;
use futures::future::BoxFuture;
use futures::FutureExt;
use futures::{FutureExt, StreamExt};
use papyrus_network::network_manager::{self, NetworkError};
use papyrus_p2p_sync::client::{P2PSyncClient, P2PSyncClientChannels, P2PSyncClientError};
use papyrus_p2p_sync::server::{P2PSyncServer, P2PSyncServerChannels};
Expand Down Expand Up @@ -71,7 +71,7 @@ impl StateSyncRunner {
storage_reader.clone(),
storage_writer,
p2p_sync_client_channels,
Box::pin(new_block_receiver),
new_block_receiver.boxed(),
);

let header_server_receiver = network_manager
Expand Down
1 change: 1 addition & 0 deletions crates/starknet_state_sync_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ workspace = true

[dependencies]
async-trait.workspace = true
futures.workspace = true
papyrus_proc_macros.workspace = true
papyrus_storage.workspace = true
serde = { workspace = true, features = ["derive"] }
Expand Down
11 changes: 9 additions & 2 deletions crates/starknet_state_sync_types/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use futures::channel::mpsc::SendError;
use papyrus_storage::StorageError;
use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand All @@ -10,12 +11,18 @@ pub enum StateSyncError {
// We put the string of the error instead.
#[error("Unexpected storage error: {0}")]
StorageError(String),
#[error("Failed to send message to P2pSyncClient")]
P2PSyncClientError,
#[error("Error while sending SyncBlock from StateSync to P2pSyncClient")]
SendError(String),
}

impl From<StorageError> for StateSyncError {
fn from(error: StorageError) -> Self {
StateSyncError::StorageError(error.to_string())
}
}

impl From<SendError> for StateSyncError {
fn from(error: SendError) -> Self {
StateSyncError::SendError(error.to_string())
}
}

0 comments on commit f87d8e8

Please sign in to comment.