From b0b4583cb7e3f81f9d7358bed09b79fe7eb4da59 Mon Sep 17 00:00:00 2001 From: Guy Nir Date: Sun, 8 Dec 2024 17:36:27 +0200 Subject: [PATCH] fix(sequencing): make repropose use the proper channel --- .../src/papyrus_consensus_context.rs | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs index ff1ae68828e..d773a674e47 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs @@ -258,18 +258,50 @@ impl ConsensusContext for PapyrusConsensusContext { .unwrap_or_else(|| panic!("No proposal found for height {} and id {}", init.height, id)) .clone(); - let proposal = Proposal { - height: init.height.0, - round: init.round, - proposer: init.proposer, - transactions, - block_hash: id, - valid_round: init.valid_round, - }; - self.network_broadcast_client - .broadcast_message(ConsensusMessage::Proposal(proposal)) + let (mut proposal_sender, proposal_receiver) = mpsc::channel(CHANNEL_SIZE); + self.network_proposal_sender + .send((init.height.0, proposal_receiver)) .await - .expect("Failed to send proposal"); + .expect("Failed to send proposal receiver"); + proposal_sender + .send(ProposalPart::Init(init.clone())) + .await + .expect("Failed to send proposal init"); + proposal_sender + .send(ProposalPart::Transactions(TransactionBatch { + transactions: transactions.clone(), + tx_hashes: vec![], + })) + .await + .expect("Failed to send transactions"); + proposal_sender + .send(ProposalPart::Fin(ProposalFin { proposal_content_id: id })) + .await + .expect("Failed to send fin"); + + // self.network_proposal_sender.send( + // (init.height.0, futures::stream::iter(vec![ + // ProposalPart::Init(init.clone()), + // ProposalPart::Transactions(TransactionBatch { + // transactions, + // tx_hashes: vec![], + // }), + // ProposalPart::Fin(ProposalFin { proposal_content_id: id }), + // ])) + // ).await.expect("Failed to send proposal"); + + // let proposal = Proposal { + // height: init.height.0, + // round: init.round, + // proposer: init.proposer, + // transactions, + // block_hash: id, + // valid_round: init.valid_round, + // }; + // self.network_broadcast_client + // .broadcast_message(ConsensusMessage::Proposal(proposal)) + // .await + // .expect("Failed to send proposal"); } async fn validators(&self, _height: BlockNumber) -> Vec {