Skip to content

Commit

Permalink
chore: move ClientError definition to component client module
Browse files Browse the repository at this point in the history
commit-id:d2d71f66
  • Loading branch information
Itay-Tsabary-Starkware committed Jun 6, 2024
1 parent cd07308 commit b0b1b47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 7 additions & 0 deletions crates/mempool_infra/src/component_client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use thiserror::Error;
use tokio::sync::mpsc::{channel, Sender};

use crate::component_definitions::ComponentRequestAndResponseSender;
Expand Down Expand Up @@ -30,3 +31,9 @@ where
res_rx.recv().await.expect("Inbound connection should be open.")
}
}

#[derive(Debug, Error)]
pub enum ClientError {
#[error("Got an unexpected response type.")]
UnexpectedResponse,
}
7 changes: 1 addition & 6 deletions crates/mempool_types/src/mempool_types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use starknet_api::core::{ContractAddress, Nonce};
use starknet_api::transaction::{Tip, TransactionHash};
use starknet_mempool_infra::component_client::ComponentClient;
use starknet_mempool_infra::component_client::{ClientError, ComponentClient};
use starknet_mempool_infra::component_definitions::ComponentRequestAndResponseSender;
use thiserror::Error;

Expand Down Expand Up @@ -46,11 +46,6 @@ pub enum MempoolClientError {
pub type MempoolClientResult<T> = Result<T, MempoolClientError>;

// TODO(Tsabary, 1/6/2024): Move communication-related definitions to a separate file.
#[derive(Debug, Error)]
pub enum ClientError {
#[error("Got an unexpected response type.")]
UnexpectedResponse,
}

/// Serves as the mempool's shared interface. Requires `Send + Sync` to allow transferring and
/// sharing resources (inputs, futures) across threads.
Expand Down

0 comments on commit b0b1b47

Please sign in to comment.