Skip to content

Commit

Permalink
make_benchmark_block_proposals now returns BlockProposals
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-ds committed Feb 6, 2025
1 parent 9d2a160 commit e0c17fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions linera-client/src/client_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ where
key_pairs: &HashMap<ChainId, KeyPair>,
transactions_per_block: usize,
fungible_application_id: Option<ApplicationId>,
) -> Vec<RpcMessage> {
) -> Vec<BlockProposal> {
let mut proposals = Vec::new();
let mut previous_chain_id = *key_pairs
.iter()
Expand Down Expand Up @@ -887,7 +887,7 @@ where
block.clone(),
key_pair,
);
proposals.push(RpcMessage::BlockProposal(Box::new(proposal)));
proposals.push(proposal);
previous_chain_id = chain.chain_id;
}
proposals
Expand Down
24 changes: 16 additions & 8 deletions linera-service/src/linera/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,16 +809,24 @@ impl Runnable for Job {
let num_proposal = proposals.len();
let mut values = HashMap::new();

for rpc_msg in &proposals {
if let RpcMessage::BlockProposal(proposal) = rpc_msg {
let executed_block = context
.stage_block_execution(proposal.content.block.clone(), None)
.await?;
let value = Hashed::new(ConfirmedBlock::new(executed_block));
values.insert(value.hash(), value);
}
let start = Instant::now();
for proposal in &proposals {
let executed_block = context
.stage_block_execution(proposal.content.block.clone(), None)
.await?;
let value = Hashed::new(ConfirmedBlock::new(executed_block));
values.insert(value.hash(), value);
}
info!(
"Staged {} block proposals in {} ms",
num_proposal,
start.elapsed().as_millis()
);

let proposals = proposals
.into_iter()
.map(|proposal| RpcMessage::BlockProposal(Box::new(proposal)))
.collect::<Vec<_>>();
let responses = context.mass_broadcast("block proposals", proposals).await;
let votes = responses
.into_iter()
Expand Down

0 comments on commit e0c17fe

Please sign in to comment.