Skip to content

Commit

Permalink
[benchmark] Respect current Epoch and Committee on block proposal cre…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
ndr-ds committed Feb 13, 2025
1 parent 3599e8c commit 265f3cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
3 changes: 2 additions & 1 deletion linera-client/src/client_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,14 @@ where
blocks_infos_iter: impl Iterator<Item = &(ChainId, Vec<Operation>, KeyPair)>,
clients: Vec<linera_rpc::Client>,
transactions_per_block: usize,
epoch: Epoch,
) -> Result<(), Error> {
let mut num_sent_proposals = 0;
let mut start = Instant::now();
for (chain_id, operations, key_pair) in blocks_infos_iter {
let chain = self.wallet.get(*chain_id).expect("should have chain");
let block = ProposedBlock {
epoch: Epoch::ZERO,
epoch,
chain_id: *chain_id,
incoming_bundles: Vec::new(),
operations: operations.clone(),
Expand Down
31 changes: 27 additions & 4 deletions linera-service/src/linera/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,26 +778,49 @@ impl Runnable for Job {
);
}

let default_chain_id = context
.wallet
.default_chain()
.expect("should have default chain");
let chain_client = context.make_chain_client(default_chain_id)?;
let (epoch, committees) =
chain_client.epoch_and_committees(default_chain_id).await?;
let epoch = epoch.expect("default chain should have an epoch");
let committee = committees
.get(&epoch)
.expect("current epoch should have a committee");
let blocks_infos = context.make_benchmark_block_info(
key_pairs,
transactions_per_block,
fungible_application_id,
);
let committee = context.wallet.genesis_config().create_committee();

let clients = context
.make_node_provider()
.make_nodes(&committee)?
.make_nodes(committee)?
.map(|(_, node)| node)
.collect::<Vec<_>>();
let blocks_infos_iter = blocks_infos.iter();
if bps.is_some() {
let blocks_infos_iter = blocks_infos_iter.cycle();
context
.run_benchmark(bps, blocks_infos_iter, clients, transactions_per_block)
.run_benchmark(
bps,
blocks_infos_iter,
clients,
transactions_per_block,
epoch,
)
.await?;
} else {
context
.run_benchmark(bps, blocks_infos_iter, clients, transactions_per_block)
.run_benchmark(
bps,
blocks_infos_iter,
clients,
transactions_per_block,
epoch,
)
.await?;
}
}
Expand Down

0 comments on commit 265f3cb

Please sign in to comment.