From 265f3cb50b3eb12785f3c85e0d47d6887615ebe9 Mon Sep 17 00:00:00 2001 From: Andre da Silva Date: Tue, 11 Feb 2025 18:49:11 -0300 Subject: [PATCH] [benchmark] Respect current Epoch and Committee on block proposal creation --- linera-client/src/client_context.rs | 3 ++- linera-service/src/linera/main.rs | 31 +++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/linera-client/src/client_context.rs b/linera-client/src/client_context.rs index 00c0717b8e99..b8d198a2b403 100644 --- a/linera-client/src/client_context.rs +++ b/linera-client/src/client_context.rs @@ -569,13 +569,14 @@ where blocks_infos_iter: impl Iterator, KeyPair)>, clients: Vec, 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(), diff --git a/linera-service/src/linera/main.rs b/linera-service/src/linera/main.rs index 152471229676..3475f88681c0 100644 --- a/linera-service/src/linera/main.rs +++ b/linera-service/src/linera/main.rs @@ -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::>(); 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?; } }