Skip to content

Commit

Permalink
test: use only block builder instead of block producer
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasArrachea committed Jan 16, 2025
1 parent afec921 commit 387d95d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
18 changes: 8 additions & 10 deletions bin/stress-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ use miden_lib::{
transaction::TransactionKernel,
};
use miden_node_block_producer::{
batch_builder::TransactionBatch, config::BlockProducerConfig, server::BlockProducer,
batch_builder::TransactionBatch, block_builder::BlockBuilder, store::StoreClient,
test_utils::MockProvenTxBuilder,
};
use miden_node_proto::generated::store::api_client::ApiClient;
use miden_node_store::{config::StoreConfig, server::Store};
use miden_objects::{
accounts::{AccountBuilder, AccountIdAnchor, AccountStorageMode, AccountType},
Expand All @@ -22,20 +23,17 @@ use tokio::task::JoinSet;

#[tokio::main]
async fn main() {
let block_producer_config = BlockProducerConfig::default();
let store_config = StoreConfig::default();
let mut join_set = JoinSet::new();

// Start store
let store = Store::init(store_config).await.context("Loading store").unwrap();
let store = Store::init(store_config.clone()).await.context("Loading store").unwrap();
let _ = join_set.spawn(async move { store.serve().await.context("Serving store") }).id();

// Start block-producer
// TODO: is the full the BlockProducer needed? we should instantiate only a BlockBuilder
let block_producer = BlockProducer::init(block_producer_config)
.await
.context("Loading block-producer")
.unwrap();
// Start block builder
let store_client =
StoreClient::new(ApiClient::connect(store_config.endpoint.to_string()).await.unwrap());
let block_builder = BlockBuilder::new(store_client);

println!("Creating new faucet account...");
let coin_seed: [u64; 4] = rand::thread_rng().gen();
Expand Down Expand Up @@ -112,6 +110,6 @@ async fn main() {
}
println!("Building block {}...", block_num);
// Inserts the block into the store sending it via StoreClient (RPC)
block_producer.block_builder.build_block(&batches).await.unwrap();
block_builder.build_block(&batches).await.unwrap();
}
}
2 changes: 1 addition & 1 deletion crates/block-producer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod block_builder;
mod domain;
mod errors;
mod mempool;
mod store;
pub mod store;

pub mod block;
pub mod config;
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{
/// components.
pub struct BlockProducer {
batch_builder: BatchBuilder,
pub block_builder: BlockBuilder,
block_builder: BlockBuilder,
batch_budget: BatchBudget,
block_budget: BlockBudget,
state_retention: usize,
Expand Down

0 comments on commit 387d95d

Please sign in to comment.