From 997b0edb095b3b303be5ef9b2c70cecb6f63097e Mon Sep 17 00:00:00 2001 From: eitanm-starkware Date: Sun, 12 Jan 2025 10:28:56 +0200 Subject: [PATCH] refactor(papyrus_p2p_sync): rename stream builder --- crates/papyrus_p2p_sync/src/client/class.rs | 4 ++-- crates/papyrus_p2p_sync/src/client/header.rs | 4 ++-- crates/papyrus_p2p_sync/src/client/mod.rs | 2 +- crates/papyrus_p2p_sync/src/client/state_diff.rs | 4 ++-- crates/papyrus_p2p_sync/src/client/stream_builder.rs | 2 +- crates/papyrus_p2p_sync/src/client/transaction.rs | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/papyrus_p2p_sync/src/client/class.rs b/crates/papyrus_p2p_sync/src/client/class.rs index cf93e49487..f87813f100 100644 --- a/crates/papyrus_p2p_sync/src/client/class.rs +++ b/crates/papyrus_p2p_sync/src/client/class.rs @@ -17,8 +17,8 @@ use super::stream_builder::{ BadPeerError, BlockData, BlockNumberLimit, - DataStreamBuilder, ParseDataError, + StreamBuilder, }; use super::{P2PSyncClientError, NETWORK_DATA_TIMEOUT}; @@ -44,7 +44,7 @@ impl BlockData for (DeclaredClasses, DeprecatedDeclaredClasses, BlockNumber) { pub(crate) struct ClassStreamBuilder; -impl DataStreamBuilder<(ApiContractClass, ClassHash)> for ClassStreamBuilder { +impl StreamBuilder<(ApiContractClass, ClassHash)> for ClassStreamBuilder { type Output = (DeclaredClasses, DeprecatedDeclaredClasses, BlockNumber); const TYPE_DESCRIPTION: &'static str = "classes"; diff --git a/crates/papyrus_p2p_sync/src/client/header.rs b/crates/papyrus_p2p_sync/src/client/header.rs index c74948ea95..6f502d00bd 100644 --- a/crates/papyrus_p2p_sync/src/client/header.rs +++ b/crates/papyrus_p2p_sync/src/client/header.rs @@ -16,8 +16,8 @@ use super::stream_builder::{ BadPeerError, BlockData, BlockNumberLimit, - DataStreamBuilder, ParseDataError, + StreamBuilder, }; use super::{P2PSyncClientError, ALLOWED_SIGNATURES_LENGTH, NETWORK_DATA_TIMEOUT}; @@ -65,7 +65,7 @@ impl BlockData for SignedBlockHeader { pub(crate) struct HeaderStreamBuilder; -impl DataStreamBuilder for HeaderStreamBuilder { +impl StreamBuilder for HeaderStreamBuilder { type Output = SignedBlockHeader; const TYPE_DESCRIPTION: &'static str = "headers"; diff --git a/crates/papyrus_p2p_sync/src/client/mod.rs b/crates/papyrus_p2p_sync/src/client/mod.rs index 53646f748d..49c59726cf 100644 --- a/crates/papyrus_p2p_sync/src/client/mod.rs +++ b/crates/papyrus_p2p_sync/src/client/mod.rs @@ -44,7 +44,7 @@ use starknet_api::core::ClassHash; use starknet_api::transaction::FullTransaction; use starknet_state_sync_types::state_sync_types::SyncBlock; use state_diff::StateDiffStreamBuilder; -use stream_builder::{DataStreamBuilder, DataStreamResult}; +use stream_builder::{StreamBuilder, DataStreamResult}; use tokio_stream::StreamExt; use tracing::{info, instrument}; use transaction::TransactionStreamFactory; diff --git a/crates/papyrus_p2p_sync/src/client/state_diff.rs b/crates/papyrus_p2p_sync/src/client/state_diff.rs index 362daca121..08a34a75eb 100644 --- a/crates/papyrus_p2p_sync/src/client/state_diff.rs +++ b/crates/papyrus_p2p_sync/src/client/state_diff.rs @@ -18,7 +18,7 @@ use super::stream_builder::BadPeerError; use crate::client::stream_builder::{ BlockData, BlockNumberLimit, - DataStreamBuilder, + StreamBuilder, ParseDataError, }; use crate::client::{P2PSyncClientError, NETWORK_DATA_TIMEOUT}; @@ -38,7 +38,7 @@ impl BlockData for (ThinStateDiff, BlockNumber) { pub(crate) struct StateDiffStreamBuilder; -impl DataStreamBuilder for StateDiffStreamBuilder { +impl StreamBuilder for StateDiffStreamBuilder { type Output = (ThinStateDiff, BlockNumber); const TYPE_DESCRIPTION: &'static str = "state diffs"; diff --git a/crates/papyrus_p2p_sync/src/client/stream_builder.rs b/crates/papyrus_p2p_sync/src/client/stream_builder.rs index c785cdc2e4..97092a4766 100644 --- a/crates/papyrus_p2p_sync/src/client/stream_builder.rs +++ b/crates/papyrus_p2p_sync/src/client/stream_builder.rs @@ -36,7 +36,7 @@ pub(crate) enum BlockNumberLimit { StateDiffMarker, } -pub(crate) trait DataStreamBuilder +pub(crate) trait StreamBuilder where InputFromNetwork: Send + 'static, DataOrFin: TryFrom, Error = ProtobufConversionError>, diff --git a/crates/papyrus_p2p_sync/src/client/transaction.rs b/crates/papyrus_p2p_sync/src/client/transaction.rs index deea071ae3..a3f3076e19 100644 --- a/crates/papyrus_p2p_sync/src/client/transaction.rs +++ b/crates/papyrus_p2p_sync/src/client/transaction.rs @@ -14,7 +14,7 @@ use super::stream_builder::{ BadPeerError, BlockData, BlockNumberLimit, - DataStreamBuilder, + StreamBuilder, ParseDataError, }; use super::{P2PSyncClientError, NETWORK_DATA_TIMEOUT}; @@ -30,7 +30,7 @@ impl BlockData for (BlockBody, BlockNumber) { pub(crate) struct TransactionStreamFactory; -impl DataStreamBuilder for TransactionStreamFactory { +impl StreamBuilder for TransactionStreamFactory { // TODO(Eitan): Add events protocol to BlockBody or split their write to storage type Output = (BlockBody, BlockNumber);