Skip to content

Commit

Permalink
chore(starknet_gateway): move the bench utils into the bench folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Jan 5, 2025
1 parent 77881f7 commit 9eb4575
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion crates/starknet_gateway/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
//!
//! Run the benchmarks using `cargo bench --bench gateway_bench`.
// import the Gateway test utilities.
mod utils;

use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use starknet_gateway::bench_test_utils::{BenchTestSetup, BenchTestSetupConfig};
use utils::{BenchTestSetup, BenchTestSetupConfig};

fn invoke_benchmark(criterion: &mut Criterion) {
let tx_generator_config = BenchTestSetupConfig::default();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ use starknet_api::invoke_tx_args;
use starknet_api::rpc_transaction::RpcTransaction;
use starknet_api::test_utils::invoke::rpc_invoke_tx;
use starknet_api::test_utils::NonceManager;
use starknet_gateway::compilation::GatewayCompiler;
use starknet_gateway::config::GatewayConfig;
use starknet_gateway::gateway::Gateway;
use starknet_gateway::state_reader_test_utils::local_test_state_reader_factory;
use starknet_mempool_types::communication::MockMempoolClient;
use starknet_sierra_compile::config::SierraToCasmCompilationConfig;

use crate::compilation::GatewayCompiler;
use crate::config::GatewayConfig;
use crate::gateway::Gateway;
use crate::state_reader_test_utils::local_test_state_reader_factory;

const N_TXS: usize = 100;

// TODO(Arni): Use `AccountTransactionGenerator` from `starknet_api_test_utils`.
Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_gateway/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod bench_test_utils;
pub mod communication;
pub mod compilation;
mod compiler_version;
Expand All @@ -10,7 +9,8 @@ pub mod rpc_state_reader;
#[cfg(test)]
mod rpc_state_reader_test;
pub mod state_reader;
mod state_reader_test_utils;
#[cfg(any(feature = "testing", test))]
pub mod state_reader_test_utils;
mod stateful_transaction_validator;
mod stateless_transaction_validator;
mod sync_state_reader;
Expand Down
6 changes: 3 additions & 3 deletions crates/starknet_gateway/src/state_reader_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use starknet_types_core::felt::Felt;
use crate::state_reader::{MempoolStateReader, StateReaderFactory};

#[derive(Clone)]
pub(crate) struct TestStateReader {
pub struct TestStateReader {
pub block_info: BlockInfo,
pub blockifier_state_reader: DictStateReader,
}
Expand Down Expand Up @@ -53,7 +53,7 @@ impl BlockifierStateReader for TestStateReader {
}
}

pub(crate) struct TestStateReaderFactory {
pub struct TestStateReaderFactory {
pub state_reader: TestStateReader,
}

Expand All @@ -69,7 +69,7 @@ impl StateReaderFactory for TestStateReaderFactory {
}
}

pub(crate) fn local_test_state_reader_factory(
pub fn local_test_state_reader_factory(
cairo_version: CairoVersion,
zero_balance: bool,
) -> TestStateReaderFactory {
Expand Down

0 comments on commit 9eb4575

Please sign in to comment.