diff --git a/Cargo.lock b/Cargo.lock index 849e52446ae..718d9e064aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10280,6 +10280,7 @@ dependencies = [ "starknet_batcher_types", "starknet_mempool_types", "starknet_sequencer_infra", + "starknet_state_sync_types", "thiserror", "tokio", "tracing", diff --git a/crates/starknet_batcher/Cargo.toml b/crates/starknet_batcher/Cargo.toml index 7f14eb059da..ad23321bc98 100644 --- a/crates/starknet_batcher/Cargo.toml +++ b/crates/starknet_batcher/Cargo.toml @@ -21,6 +21,7 @@ starknet_api.workspace = true starknet_batcher_types.workspace = true starknet_mempool_types.workspace = true starknet_sequencer_infra.workspace = true +starknet_state_sync_types.workspace = true thiserror.workspace = true tokio.workspace = true tracing.workspace = true diff --git a/crates/starknet_batcher/src/batcher.rs b/crates/starknet_batcher/src/batcher.rs index c6188a96de4..b8cf445beb5 100644 --- a/crates/starknet_batcher/src/batcher.rs +++ b/crates/starknet_batcher/src/batcher.rs @@ -30,6 +30,7 @@ use starknet_batcher_types::errors::BatcherError; use starknet_mempool_types::communication::SharedMempoolClient; use starknet_mempool_types::mempool_types::CommitBlockArgs; use starknet_sequencer_infra::component_definitions::ComponentStarter; +use starknet_state_sync_types::state_sync_types::SyncBlock; use tracing::{debug, error, info, instrument, trace}; use crate::block_builder::{ @@ -347,6 +348,11 @@ impl Batcher { }) } + // TODO(Arni): Impl add sync block + pub async fn add_sync_block(&mut self, _sync_block: SyncBlock) -> BatcherResult<()> { + todo!("Implement add sync block"); + } + #[instrument(skip(self), err)] pub async fn decision_reached(&mut self, input: DecisionReachedInput) -> BatcherResult<()> { let proposal_id = input.proposal_id; diff --git a/crates/starknet_batcher/src/communication.rs b/crates/starknet_batcher/src/communication.rs index cf13381c85c..45451e25d44 100644 --- a/crates/starknet_batcher/src/communication.rs +++ b/crates/starknet_batcher/src/communication.rs @@ -33,8 +33,9 @@ impl ComponentRequestHandler for Batcher { BatcherRequest::SendProposalContent(input) => { BatcherResponse::SendProposalContent(self.send_proposal_content(input).await) } - // TODO(alonh): fill this - BatcherRequest::AddSyncBlock(_sync_block) => BatcherResponse::AddSyncBlock(Ok(())), + BatcherRequest::AddSyncBlock(sync_block) => { + BatcherResponse::AddSyncBlock(self.add_sync_block(sync_block).await) + } } } } diff --git a/crates/starknet_batcher_types/src/communication.rs b/crates/starknet_batcher_types/src/communication.rs index 0dbca627b51..230adb8b452 100644 --- a/crates/starknet_batcher_types/src/communication.rs +++ b/crates/starknet_batcher_types/src/communication.rs @@ -69,11 +69,12 @@ pub trait BatcherClient: Send + Sync { /// From this point onwards, the batcher will accept requests only for proposals associated /// with this height. async fn start_height(&self, input: StartHeightInput) -> BatcherClientResult<()>; + /// Adds a block from the state sync. Updates the batcher's state and commits the + /// transactions to the mempool. + async fn add_sync_block(&self, sync_block: SyncBlock) -> BatcherClientResult<()>; /// Notifies the batcher that a decision has been reached. /// This closes the process of the given height, and the accepted proposal is committed. async fn decision_reached(&self, input: DecisionReachedInput) -> BatcherClientResult<()>; - - async fn add_sync_block(&self, sync_block: SyncBlock) -> BatcherClientResult<()>; } #[derive(Debug, Serialize, Deserialize, Clone)]