Skip to content

Commit 1088ef4

Browse files
apollo_node: integrate proof manager client into node
1 parent 278f955 commit 1088ef4

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ apollo_mempool_p2p_types.workspace = true
4444
apollo_mempool_types.workspace = true
4545
apollo_monitoring_endpoint.workspace = true
4646
apollo_proof_manager.workspace = true
47+
apollo_proof_manager_types.workspace = true
4748
apollo_signature_manager.workspace = true
4849
apollo_signature_manager_types.workspace = true
4950
apollo_state_sync.workspace = true

crates/apollo_node/src/clients.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ use apollo_mempool_types::communication::{
8383
};
8484
use apollo_node_config::component_execution_config::ReactiveComponentExecutionMode;
8585
use apollo_node_config::node_config::SequencerNodeConfig;
86+
use apollo_proof_manager::metrics::PROOF_MANAGER_INFRA_METRICS;
87+
use apollo_proof_manager_types::{
88+
LocalProofManagerClient,
89+
ProofManagerRequest,
90+
ProofManagerResponse,
91+
RemoteProofManagerClient,
92+
SharedProofManagerClient,
93+
};
8694
use apollo_signature_manager::metrics::SIGNATURE_MANAGER_INFRA_METRICS;
8795
use apollo_signature_manager_types::{
8896
LocalSignatureManagerClient,
@@ -115,6 +123,7 @@ pub struct SequencerNodeClients {
115123
mempool_client: Client<MempoolRequest, MempoolResponse>,
116124
mempool_p2p_propagator_client:
117125
Client<MempoolP2pPropagatorRequest, MempoolP2pPropagatorResponse>,
126+
proof_manager_client: Client<ProofManagerRequest, ProofManagerResponse>,
118127
sierra_compiler_client: Client<SierraCompilerRequest, SierraCompilerResponse>,
119128
signature_manager_client: Client<SignatureManagerRequest, SignatureManagerResponse>,
120129
state_sync_client: Client<StateSyncRequest, StateSyncResponse>,
@@ -260,6 +269,16 @@ impl SequencerNodeClients {
260269
get_shared_client!(self, mempool_p2p_propagator_client)
261270
}
262271

272+
pub fn get_proof_manager_local_client(
273+
&self,
274+
) -> Option<LocalComponentClient<ProofManagerRequest, ProofManagerResponse>> {
275+
self.proof_manager_client.get_local_client()
276+
}
277+
278+
pub fn get_proof_manager_shared_client(&self) -> Option<SharedProofManagerClient> {
279+
get_shared_client!(self, proof_manager_client)
280+
}
281+
263282
pub fn get_sierra_compiler_local_client(
264283
&self,
265284
) -> Option<LocalComponentClient<SierraCompilerRequest, SierraCompilerResponse>> {
@@ -493,6 +512,17 @@ pub fn create_node_clients(
493512
&MEMPOOL_P2P_INFRA_METRICS.get_remote_client_metrics()
494513
);
495514

515+
let proof_manager_client = create_client!(
516+
&config.components.proof_manager.execution_mode,
517+
LocalProofManagerClient,
518+
RemoteProofManagerClient,
519+
channels.take_proof_manager_tx(),
520+
&config.components.proof_manager.remote_client_config,
521+
&config.components.proof_manager.url,
522+
config.components.proof_manager.port,
523+
&PROOF_MANAGER_INFRA_METRICS.get_local_client_metrics(),
524+
&PROOF_MANAGER_INFRA_METRICS.get_remote_client_metrics()
525+
);
496526
let sierra_compiler_client = create_client!(
497527
&config.components.sierra_compiler.execution_mode,
498528
LocalSierraCompilerClient,
@@ -541,6 +571,7 @@ pub fn create_node_clients(
541571
mempool_client,
542572
mempool_p2p_propagator_client,
543573
sierra_compiler_client,
574+
proof_manager_client,
544575
signature_manager_client,
545576
state_sync_client,
546577
}

crates/apollo_node/src/communication.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use apollo_mempool_p2p_types::communication::MempoolP2pPropagatorRequestWrapper;
1212
use apollo_mempool_types::communication::MempoolRequestWrapper;
1313
use apollo_node_config::component_execution_config::ExpectedComponentConfig;
1414
use apollo_node_config::node_config::SequencerNodeConfig;
15+
use apollo_proof_manager_types::ProofManagerRequestWrapper;
1516
use apollo_signature_manager_types::SignatureManagerRequestWrapper;
1617
use apollo_state_sync_types::communication::StateSyncRequestWrapper;
1718
use tokio::sync::mpsc::{channel, Receiver, Sender};
@@ -28,6 +29,7 @@ pub struct SequencerNodeCommunication {
2829
l1_gas_price_channel: ComponentCommunication<L1GasPriceRequestWrapper>,
2930
mempool_channel: ComponentCommunication<MempoolRequestWrapper>,
3031
mempool_p2p_propagator_channel: ComponentCommunication<MempoolP2pPropagatorRequestWrapper>,
32+
proof_manager_channel: ComponentCommunication<ProofManagerRequestWrapper>,
3133
sierra_compiler_channel: ComponentCommunication<SierraCompilerRequestWrapper>,
3234
signature_manager_channel: ComponentCommunication<SignatureManagerRequestWrapper>,
3335
state_sync_channel: ComponentCommunication<StateSyncRequestWrapper>,
@@ -114,6 +116,14 @@ impl SequencerNodeCommunication {
114116
self.mempool_channel.take_rx()
115117
}
116118

119+
pub fn take_proof_manager_tx(&mut self) -> Sender<ProofManagerRequestWrapper> {
120+
self.proof_manager_channel.take_tx()
121+
}
122+
123+
pub fn take_proof_manager_rx(&mut self) -> Receiver<ProofManagerRequestWrapper> {
124+
self.proof_manager_channel.take_rx()
125+
}
126+
117127
pub fn take_sierra_compiler_tx(&mut self) -> Sender<SierraCompilerRequestWrapper> {
118128
self.sierra_compiler_channel.take_tx()
119129
}
@@ -313,6 +323,23 @@ pub fn create_node_channels(config: &SequencerNodeConfig) -> SequencerNodeCommun
313323
false => (None, None),
314324
};
315325

326+
let (tx_proof_manager, rx_proof_manager) =
327+
match config.components.proof_manager.execution_mode.is_running_locally() {
328+
true => {
329+
let (tx_proof_manager, rx_proof_manager) = channel::<ProofManagerRequestWrapper>(
330+
config
331+
.components
332+
.proof_manager
333+
.local_server_config
334+
.as_ref()
335+
.expect("Proof manager local server config should be available.")
336+
.inbound_requests_channel_capacity,
337+
);
338+
(Some(tx_proof_manager), Some(rx_proof_manager))
339+
}
340+
false => (None, None),
341+
};
342+
316343
let (tx_sierra_compiler, rx_sierra_compiler) =
317344
match config.components.sierra_compiler.execution_mode.is_running_locally() {
318345
true => {
@@ -383,6 +410,7 @@ pub fn create_node_channels(config: &SequencerNodeConfig) -> SequencerNodeCommun
383410
tx_mempool_p2p_propagator,
384411
rx_mempool_p2p_propagator,
385412
),
413+
proof_manager_channel: ComponentCommunication::new(tx_proof_manager, rx_proof_manager),
386414
sierra_compiler_channel: ComponentCommunication::new(
387415
tx_sierra_compiler,
388416
rx_sierra_compiler,

0 commit comments

Comments
 (0)