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: move ClientError definition to component client module #223

Merged
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
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
Loading