From 4aec64555c45a925a7295c2b9968a6fb29188f0d Mon Sep 17 00:00:00 2001 From: Guy Nir Date: Sun, 8 Dec 2024 10:02:19 +0200 Subject: [PATCH] chore(sequencing): remove ProposalWrapper --- Cargo.lock | 1 - crates/papyrus_protobuf/Cargo.toml | 1 - crates/papyrus_protobuf/src/consensus.rs | 52 ------------------------ 3 files changed, 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7bee816fec..d8e6866529 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7607,7 +7607,6 @@ dependencies = [ name = "papyrus_protobuf" version = "0.0.0" dependencies = [ - "futures", "indexmap 2.6.0", "lazy_static", "papyrus_common", diff --git a/crates/papyrus_protobuf/Cargo.toml b/crates/papyrus_protobuf/Cargo.toml index 071928db6f..1fe9091503 100644 --- a/crates/papyrus_protobuf/Cargo.toml +++ b/crates/papyrus_protobuf/Cargo.toml @@ -10,7 +10,6 @@ testing = ["papyrus_test_utils", "rand", "rand_chacha"] [dependencies] # TODO(Guy): Remove after implementing broadcast streams. -futures.workspace = true indexmap.workspace = true lazy_static.workspace = true primitive-types.workspace = true diff --git a/crates/papyrus_protobuf/src/consensus.rs b/crates/papyrus_protobuf/src/consensus.rs index ae2f2abebd..2a092e6fed 100644 --- a/crates/papyrus_protobuf/src/consensus.rs +++ b/crates/papyrus_protobuf/src/consensus.rs @@ -1,7 +1,5 @@ -use futures::channel::{mpsc, oneshot}; use starknet_api::block::{BlockHash, BlockNumber}; use starknet_api::core::ContractAddress; -use starknet_api::executable_transaction::Transaction as ExecutableTransaction; use starknet_api::transaction::{Transaction, TransactionHash}; use crate::converters::ProtobufConversionError; @@ -148,53 +146,3 @@ where } } } - -// TODO(Guy): Remove after implementing broadcast streams. -#[allow(missing_docs)] -pub struct ProposalWrapper(pub Proposal); - -impl From - for (ProposalInit, mpsc::Receiver, oneshot::Receiver) -{ - fn from(val: ProposalWrapper) -> Self { - let transactions: Vec = val.0.transactions.into_iter().collect(); - let proposal_init = ProposalInit { - height: BlockNumber(val.0.height), - round: val.0.round, - proposer: val.0.proposer, - valid_round: val.0.valid_round, - }; - let (mut content_sender, content_receiver) = mpsc::channel(transactions.len()); - for tx in transactions { - content_sender.try_send(tx).expect("Send should succeed"); - } - content_sender.close_channel(); - - let (fin_sender, fin_receiver) = oneshot::channel(); - fin_sender.send(val.0.block_hash).expect("Send should succeed"); - - (proposal_init, content_receiver, fin_receiver) - } -} - -impl From - for (ProposalInit, mpsc::Receiver>, oneshot::Receiver) -{ - fn from(val: ProposalWrapper) -> Self { - let proposal_init = ProposalInit { - height: BlockNumber(val.0.height), - round: val.0.round, - proposer: val.0.proposer, - valid_round: val.0.valid_round, - }; - - let (_, content_receiver) = mpsc::channel(0); - // This should only be used for Milestone 1, and then removed once streaming is supported. - println!("Cannot build ExecutableTransaction from Transaction."); - - let (fin_sender, fin_receiver) = oneshot::channel(); - fin_sender.send(val.0.block_hash).expect("Send should succeed"); - - (proposal_init, content_receiver, fin_receiver) - } -}