From 13a09447140cb794547dde0252286088602c2cac Mon Sep 17 00:00:00 2001 From: guy-starkware Date: Tue, 10 Dec 2024 06:08:05 -0800 Subject: [PATCH] chore(sequencing): remove ProposalChunk (#2512) --- crates/sequencing/papyrus_consensus/src/manager_test.rs | 2 -- crates/sequencing/papyrus_consensus/src/test_utils.rs | 1 - crates/sequencing/papyrus_consensus/src/types.rs | 6 ++---- .../src/papyrus_consensus_context.rs | 1 - .../src/sequencer_consensus_context.rs | 3 --- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/crates/sequencing/papyrus_consensus/src/manager_test.rs b/crates/sequencing/papyrus_consensus/src/manager_test.rs index e186c23f0e..7d16c370db 100644 --- a/crates/sequencing/papyrus_consensus/src/manager_test.rs +++ b/crates/sequencing/papyrus_consensus/src/manager_test.rs @@ -22,7 +22,6 @@ use papyrus_protobuf::consensus::{ }; use papyrus_test_utils::{get_rng, GetTestInstance}; use starknet_api::block::{BlockHash, BlockNumber}; -use starknet_api::transaction::Transaction; use starknet_types_core::felt::Felt; use super::{run_consensus, MultiHeightManager}; @@ -52,7 +51,6 @@ mock! { #[async_trait] impl ConsensusContext for TestContext { - type ProposalChunk = Transaction; type ProposalPart = ProposalPart; async fn build_proposal( diff --git a/crates/sequencing/papyrus_consensus/src/test_utils.rs b/crates/sequencing/papyrus_consensus/src/test_utils.rs index 32ea37b75f..8ee68c1427 100644 --- a/crates/sequencing/papyrus_consensus/src/test_utils.rs +++ b/crates/sequencing/papyrus_consensus/src/test_utils.rs @@ -64,7 +64,6 @@ mock! { #[async_trait] impl ConsensusContext for TestContext { - type ProposalChunk = u32; type ProposalPart = MockProposalPart; async fn build_proposal( diff --git a/crates/sequencing/papyrus_consensus/src/types.rs b/crates/sequencing/papyrus_consensus/src/types.rs index 797100b6f4..561aabd5e0 100644 --- a/crates/sequencing/papyrus_consensus/src/types.rs +++ b/crates/sequencing/papyrus_consensus/src/types.rs @@ -30,10 +30,8 @@ pub const DEFAULT_VALIDATOR_ID: u64 = 100; /// Interface for consensus to call out to the node. #[async_trait] pub trait ConsensusContext { - /// The chunks of content returned when iterating the proposal. - // In practice I expect this to match the type sent to the network - // (papyrus_protobuf::ConsensusMessage), and not to be specific to just the block's content. - type ProposalChunk; // TODO(guyn): deprecate this (and replace by ProposalPart) + /// The parts of the proposal that are streamed in. + /// Must contain at least the ProposalInit and ProposalFin. type ProposalPart: TryFrom, Error = ProtobufConversionError> + Into> + TryInto 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 9a34d1af07..5581abac18 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs @@ -82,7 +82,6 @@ impl PapyrusConsensusContext { #[async_trait] impl ConsensusContext for PapyrusConsensusContext { - type ProposalChunk = Transaction; type ProposalPart = ProposalPart; async fn build_proposal( diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs index 293d53414e..92e45cd85d 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -40,7 +40,6 @@ use starknet_api::block::{ NonzeroGasPrice, }; use starknet_api::executable_transaction::Transaction as ExecutableTransaction; -use starknet_api::transaction::Transaction; use starknet_batcher_types::batcher_types::{ DecisionReachedInput, GetProposalContent, @@ -134,8 +133,6 @@ impl SequencerConsensusContext { #[async_trait] impl ConsensusContext for SequencerConsensusContext { - // TODO(guyn): Switch to ProposalPart when done with the streaming integration. - type ProposalChunk = Vec; type ProposalPart = ProposalPart; async fn build_proposal(