From 0f62104e4eb64467b56c9ad0b2c77acf17432ef0 Mon Sep 17 00:00:00 2001 From: Noam Spiegelstein Date: Sun, 15 Dec 2024 11:10:23 +0200 Subject: [PATCH] feat(starknet_state_sync): use real state sync client in sequencer consensus manager --- .../starknet_sequencer_node/src/components.rs | 8 +++---- .../src/communication.rs | 21 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/crates/starknet_sequencer_node/src/components.rs b/crates/starknet_sequencer_node/src/components.rs index 7e110e1aeab..fb94119b16a 100644 --- a/crates/starknet_sequencer_node/src/components.rs +++ b/crates/starknet_sequencer_node/src/components.rs @@ -1,5 +1,3 @@ -use std::sync::Arc; - use starknet_batcher::batcher::{create_batcher, Batcher}; use starknet_consensus_manager::consensus_manager::ConsensusManager; use starknet_gateway::gateway::{create_gateway, Gateway}; @@ -14,7 +12,6 @@ use starknet_monitoring_endpoint::monitoring_endpoint::{ }; use starknet_state_sync::runner::StateSyncRunner; use starknet_state_sync::{create_state_sync_and_runner, StateSync}; -use starknet_state_sync_types::communication::EmptyStateSyncClient; use crate::clients::SequencerNodeClients; use crate::config::component_execution_config::{ @@ -54,8 +51,9 @@ pub fn create_node_components( ActiveComponentExecutionMode::Enabled => { let batcher_client = clients.get_batcher_shared_client().expect("Batcher Client should be available"); - // TODO(shahak): Use the real client once we connect state sync to the node. - let state_sync_client = Arc::new(EmptyStateSyncClient); + let state_sync_client = clients + .get_state_sync_shared_client() + .expect("State Sync Client should be available"); Some(ConsensusManager::new( config.consensus_manager_config.clone(), batcher_client, diff --git a/crates/starknet_state_sync_types/src/communication.rs b/crates/starknet_state_sync_types/src/communication.rs index d940e6d0652..feedb17d24b 100644 --- a/crates/starknet_state_sync_types/src/communication.rs +++ b/crates/starknet_state_sync_types/src/communication.rs @@ -119,24 +119,3 @@ impl StateSyncClient for RemoteStateSyncClient { ) } } - -// TODO(shahak): Remove this once we connect state sync to the node. -pub struct EmptyStateSyncClient; - -#[async_trait] -impl StateSyncClient for EmptyStateSyncClient { - async fn get_block( - &self, - _block_number: BlockNumber, - ) -> StateSyncClientResult> { - Ok(None) - } - - async fn add_new_block( - &self, - _block_number: BlockNumber, - _sync_block: SyncBlock, - ) -> StateSyncClientResult<()> { - Ok(()) - } -}