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(mempool_types): add testing feature, use automock only as test #2157

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
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.

1 change: 1 addition & 0 deletions crates/starknet_batcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ mockall.workspace = true
rstest.workspace = true
starknet-types-core.workspace = true
starknet_api = { workspace = true, features = ["testing"] }
starknet_mempool_types = { workspace = true, features = ["testing"] }
1 change: 1 addition & 0 deletions crates/starknet_gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ papyrus_test_utils.workspace = true
pretty_assertions.workspace = true
rstest.workspace = true
starknet_mempool.workspace = true
starknet_mempool_types = { workspace = true, features = ["testing"] }
tracing-test.workspace = true
9 changes: 8 additions & 1 deletion crates/starknet_mempool_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ version.workspace = true
[lints]
workspace = true

[features]
testing = ["mockall"]

[dependencies]
async-trait.workspace = true
mockall.workspace = true
mockall = { workspace = true, optional = true }
papyrus_network_types.workspace = true
papyrus_proc_macros.workspace = true
serde = { workspace = true, features = ["derive"] }
starknet_api.workspace = true
starknet_sequencer_infra.workspace = true
thiserror.workspace = true

[dev-dependencies]
# Enable self with "testing" feature in tests.
starknet_mempool_types = { workspace = true, features = ["testing"] }
6 changes: 3 additions & 3 deletions crates/starknet_mempool_types/src/communication.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;

use async_trait::async_trait;
use mockall::predicate::*;
use mockall::*;
#[cfg(any(feature = "testing", test))]
use mockall::automock;
use papyrus_network_types::network_types::BroadcastedMessageMetadata;
use papyrus_proc_macros::handle_response_variants;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -37,7 +37,7 @@ pub struct AddTransactionArgsWrapper {

/// Serves as the mempool's shared interface. Requires `Send + Sync` to allow transferring and
/// sharing resources (inputs, futures) across threads.
#[automock]
#[cfg_attr(any(feature = "testing", test), automock)]
#[async_trait]
pub trait MempoolClient: Send + Sync {
// TODO: Add Option<BroadcastedMessageMetadata> as an argument for add_transaction
Expand Down
Loading