Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/worktrees/config_manager_client
Submodule config_manager_client added at 2b57fc
1 change: 1 addition & 0 deletions .claude/worktrees/gateway_dyn_config
Submodule gateway_dyn_config added at 0c716d
1 change: 1 addition & 0 deletions .claude/worktrees/mempool-worktree
Submodule mempool-worktree added at 354275
12 changes: 8 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/apollo_batcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ validator.workspace = true
apollo_class_manager_types = { workspace = true, features = ["testing"] }
apollo_committer_types = { workspace = true, features = ["testing"] }
apollo_config_manager_types = { workspace = true, features = ["testing"] }
apollo_node_config.workspace = true
apollo_infra_utils.workspace = true
apollo_l1_events_types = { workspace = true, features = ["testing"] }
apollo_mempool_types = { workspace = true, features = ["testing"] }
Expand Down
13 changes: 8 additions & 5 deletions crates/apollo_batcher/src/batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ use apollo_batcher_types::errors::BatcherError;
use apollo_class_manager_types::SharedClassManagerClient;
use apollo_committer_types::committer_types::RevertBlockResponse;
use apollo_committer_types::communication::SharedCommitterClient;
use apollo_config_manager_types::communication::SharedConfigManagerReaderClient;
use apollo_config_manager_types::communication::{
ConfigManagerReaderClient,
LocalConfigManagerReaderClient,
};
use apollo_infra::component_definitions::{default_component_start_fn, ComponentStarter};
use apollo_l1_events_types::errors::{L1EventsProviderClientError, L1EventsProviderError};
use apollo_l1_events_types::{SessionState, SharedL1EventsProviderClient};
Expand Down Expand Up @@ -158,7 +161,7 @@ pub struct Batcher {
pub committer_client: SharedCommitterClient,
pub l1_events_provider_client: SharedL1EventsProviderClient,
pub mempool_client: Option<SharedMempoolClient>,
pub config_manager_client: SharedConfigManagerReaderClient,
pub config_manager_client: LocalConfigManagerReaderClient,

/// Used to create block builders.
/// Using the factory pattern to allow for easier testing.
Expand Down Expand Up @@ -213,7 +216,7 @@ impl Batcher {
committer_client: SharedCommitterClient,
l1_events_provider_client: SharedL1EventsProviderClient,
mempool_client: Option<SharedMempoolClient>,
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
block_builder_factory: Box<dyn BlockBuilderFactoryTrait>,
pre_confirmed_block_writer_factory: Box<dyn PreconfirmedBlockWriterFactoryTrait>,
commitment_manager: ApolloCommitmentManager,
Expand Down Expand Up @@ -1409,7 +1412,7 @@ fn log_txs_execution_result(
}

struct BatcherDynamicConfigProvider {
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
}

#[async_trait]
Expand All @@ -1434,7 +1437,7 @@ pub async fn create_batcher(
class_manager_client: SharedClassManagerClient,
pre_confirmed_cende_client: Arc<dyn PreconfirmedCendeClientTrait>,
proof_manager_client: SharedProofManagerClient,
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
) -> Batcher {
let storage_reader_server_config = ServerConfig {
static_config: config.static_config.storage_reader_server_static_config.clone(),
Expand Down
25 changes: 14 additions & 11 deletions crates/apollo_batcher/src/batcher_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use apollo_batcher_types::batcher_types::{
};
use apollo_batcher_types::errors::BatcherError;
use apollo_committer_types::committer_types::CommitBlockRequest;
use apollo_config_manager_types::communication::MockConfigManagerReaderClient;
use apollo_config_manager_types::communication::LocalConfigManagerReaderClient;
use apollo_infra::component_client::ClientError;
use apollo_infra::component_definitions::ComponentStarter;
use apollo_l1_events_types::errors::{L1EventsProviderClientError, L1EventsProviderError};
Expand All @@ -39,6 +39,7 @@ use apollo_mempool_types::communication::{
SharedMempoolClient,
};
use apollo_mempool_types::mempool_types::CommitBlockArgs;
use apollo_node_config::node_config::NodeDynamicConfig;
use apollo_state_sync_types::state_sync_types::SyncBlock;
use apollo_storage::db::DbError;
use apollo_storage::test_utils::get_test_storage;
Expand Down Expand Up @@ -273,10 +274,11 @@ async fn create_batcher_impl<R: BatcherStorageReader + 'static>(
)
.await;

let mut mock_config_manager = MockConfigManagerReaderClient::new();
mock_config_manager
.expect_get_batcher_dynamic_config()
.returning(|| Ok(BatcherDynamicConfig::default()));
let (_, config_rx) = tokio::sync::watch::channel(NodeDynamicConfig {
batcher_dynamic_config: Some(BatcherDynamicConfig::default()),
..Default::default()
});
let config_manager_client = LocalConfigManagerReaderClient::new(config_rx);

let mut batcher = Batcher::new(
config,
Expand All @@ -285,7 +287,7 @@ async fn create_batcher_impl<R: BatcherStorageReader + 'static>(
committer_client,
Arc::new(clients.l1_provider_client),
mempool_client,
Arc::new(mock_config_manager),
config_manager_client,
Box::new(clients.block_builder_factory),
Box::new(clients.pre_confirmed_block_writer_factory),
commitment_manager,
Expand Down Expand Up @@ -314,18 +316,19 @@ async fn new_batcher_with_mempool_override(
committer_client.clone(),
)
.await;
let mut mock_config_manager = MockConfigManagerReaderClient::new();
mock_config_manager
.expect_get_batcher_dynamic_config()
.returning(|| Ok(BatcherDynamicConfig::default()));
let (_, config_rx) = tokio::sync::watch::channel(NodeDynamicConfig {
batcher_dynamic_config: Some(BatcherDynamicConfig::default()),
..Default::default()
});
let config_manager_client = LocalConfigManagerReaderClient::new(config_rx);
Batcher::new(
deps.batcher_config,
storage_reader,
Box::new(deps.storage_writer),
committer_client,
Arc::new(deps.clients.l1_provider_client),
mempool_client,
Arc::new(mock_config_manager),
config_manager_client,
Box::new(deps.clients.block_builder_factory),
Box::new(deps.clients.pre_confirmed_block_writer_factory),
commitment_manager,
Expand Down
1 change: 1 addition & 0 deletions crates/apollo_batcher/src/communication.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use apollo_batcher_types::communication::{BatcherRequest, BatcherResponse};
use apollo_config_manager_types::communication::ConfigManagerReaderClient;
use apollo_infra::component_definitions::ComponentRequestHandler;
use apollo_infra::component_server::{LocalComponentServer, RemoteComponentServer};
use async_trait::async_trait;
Expand Down
1 change: 1 addition & 0 deletions crates/apollo_class_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tracing.workspace = true
[dev-dependencies]
apollo_compile_to_casm_types = { workspace = true, features = ["testing"] }
apollo_config_manager_types = { workspace = true, features = ["testing"] }
apollo_node_config.workspace = true
assert_matches.workspace = true
mockall.workspace = true
starknet_api = { workspace = true, features = ["testing"] }
Expand Down
13 changes: 8 additions & 5 deletions crates/apollo_class_manager/src/class_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ use apollo_compile_to_casm_types::{
SharedSierraCompilerClient,
SierraCompilerClientError,
};
use apollo_config_manager_types::communication::SharedConfigManagerReaderClient;
use apollo_config_manager_types::communication::{
ConfigManagerReaderClient,
LocalConfigManagerReaderClient,
};
use apollo_infra::component_definitions::{default_component_start_fn, ComponentStarter};
use apollo_storage::storage_reader_server::{
DynamicConfigError,
Expand All @@ -39,7 +42,7 @@ pub struct ClassManager<S: ClassStorage> {
pub config: FsClassManagerConfig,
pub compiler: SharedSierraCompilerClient,
pub classes: CachedClassStorage<S>,
pub config_manager_client: SharedConfigManagerReaderClient,
pub config_manager_client: LocalConfigManagerReaderClient,
}

impl<S> ClassManager<S>
Expand All @@ -51,7 +54,7 @@ where
config: FsClassManagerConfig,
compiler: SharedSierraCompilerClient,
storage: S,
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
) -> Self {
let cached_class_storage_config =
config.static_config.class_manager_config.cached_class_storage_config.clone();
Expand Down Expand Up @@ -190,7 +193,7 @@ where
}

struct ClassManagerDynamicConfigProvider {
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
}

#[async_trait]
Expand All @@ -209,7 +212,7 @@ impl DynamicConfigProvider for ClassManagerDynamicConfigProvider {
pub fn create_class_manager(
config: FsClassManagerConfig,
compiler_client: SharedSierraCompilerClient,
config_manager_client: SharedConfigManagerReaderClient,
config_manager_client: LocalConfigManagerReaderClient,
) -> FsClassManager {
let dynamic_config_provider: SharedDynamicConfigProvider =
Arc::new(ClassManagerDynamicConfigProvider {
Expand Down
8 changes: 5 additions & 3 deletions crates/apollo_class_manager/src/class_manager_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use apollo_class_manager_config::config::{
};
use apollo_class_manager_types::{ClassHashes, ClassManagerError};
use apollo_compile_to_casm_types::{MockSierraCompilerClient, RawClass, RawExecutableClass};
use apollo_config_manager_types::communication::MockConfigManagerReaderClient;
use apollo_config_manager_types::communication::LocalConfigManagerReaderClient;
use apollo_node_config::node_config::NodeDynamicConfig;
use assert_matches::assert_matches;
use mockall::predicate::eq;
use starknet_api::contract_class::ContractClass;
Expand Down Expand Up @@ -39,13 +40,14 @@ impl ClassManager<FsClassStorage> {
dynamic_config: ClassManagerDynamicConfig::default(),
};

let mock_config_manager_client = Arc::new(MockConfigManagerReaderClient::new());
let (_, config_rx) = tokio::sync::watch::channel(NodeDynamicConfig::default());
let config_manager_client = LocalConfigManagerReaderClient::new(config_rx);

ClassManager::new(
fs_class_manager_config,
Arc::new(compiler),
storage,
mock_config_manager_client,
config_manager_client,
)
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/apollo_class_manager/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use apollo_class_manager_types::{
ClassManagerRequestLabelValue,
ClassManagerResponse,
};
use apollo_config_manager_types::communication::ConfigManagerReaderClient;
use apollo_infra::component_definitions::ComponentRequestHandler;
use apollo_infra::component_server::{ConcurrentLocalComponentServer, RemoteComponentServer};
use apollo_infra::requests::LABEL_NAME_REQUEST_VARIANT;
Expand Down
2 changes: 0 additions & 2 deletions crates/apollo_config_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ workspace = true
[dependencies]
apollo_config.workspace = true
apollo_config_manager_config.workspace = true
apollo_config_manager_types.workspace = true
apollo_consensus_config.workspace = true
apollo_infra.workspace = true
apollo_metrics.workspace = true
Expand All @@ -28,7 +27,6 @@ tracing.workspace = true

[dev-dependencies]
apollo_config.workspace = true
apollo_config_manager_types = { workspace = true, features = ["testing"] }
apollo_node_config = { workspace = true, features = ["testing"] }
starknet_api.workspace = true
tempfile.workspace = true
Expand Down
12 changes: 1 addition & 11 deletions crates/apollo_config_manager/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
use apollo_config_manager_types::communication::CONFIG_MANAGER_REQUEST_LABELS;
use apollo_infra::metrics::{
InfraMetrics,
LocalClientMetrics,
LocalServerMetrics,
RemoteClientMetrics,
RemoteServerMetrics,
};
use apollo_metrics::{define_infra_metrics, define_metrics};

define_infra_metrics!(config_manager);
use apollo_metrics::define_metrics;

define_metrics!(
ConfigManager => {
Expand Down
3 changes: 0 additions & 3 deletions crates/apollo_config_manager_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ apollo_http_server_config.workspace = true
apollo_infra.workspace = true
apollo_mempool_config.workspace = true
paste.workspace = true
apollo_metrics.workspace = true
apollo_node_config.workspace = true
apollo_staking_config.workspace = true
apollo_state_sync_config.workspace = true
async-trait.workspace = true
mockall = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
strum = { workspace = true, features = ["derive"] }
thiserror.workspace = true

[dev-dependencies]
Expand Down
Loading
Loading