Skip to content

Commit b0e1c10

Browse files
apollo_node: integrate proof manager client into node
1 parent c074acc commit b0e1c10

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
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
@@ -42,6 +42,7 @@ apollo_mempool_p2p_types.workspace = true
4242
apollo_mempool_types.workspace = true
4343
apollo_monitoring_endpoint.workspace = true
4444
apollo_proof_manager.workspace = true
45+
apollo_proof_manager_types.workspace = true
4546
apollo_signature_manager.workspace = true
4647
apollo_signature_manager_types.workspace = true
4748
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
@@ -73,6 +73,14 @@ use apollo_mempool_types::communication::{
7373
};
7474
use apollo_node_config::component_execution_config::ReactiveComponentExecutionMode;
7575
use apollo_node_config::node_config::SequencerNodeConfig;
76+
use apollo_proof_manager::metrics::PROOF_MANAGER_INFRA_METRICS;
77+
use apollo_proof_manager_types::{
78+
LocalProofManagerClient,
79+
ProofManagerRequest,
80+
ProofManagerResponse,
81+
RemoteProofManagerClient,
82+
SharedProofManagerClient,
83+
};
7684
use apollo_signature_manager::metrics::SIGNATURE_MANAGER_INFRA_METRICS;
7785
use apollo_signature_manager_types::{
7886
LocalSignatureManagerClient,
@@ -104,6 +112,7 @@ pub struct SequencerNodeClients {
104112
mempool_client: Client<MempoolRequest, MempoolResponse>,
105113
mempool_p2p_propagator_client:
106114
Client<MempoolP2pPropagatorRequest, MempoolP2pPropagatorResponse>,
115+
proof_manager_client: Client<ProofManagerRequest, ProofManagerResponse>,
107116
sierra_compiler_client: Client<SierraCompilerRequest, SierraCompilerResponse>,
108117
signature_manager_client: Client<SignatureManagerRequest, SignatureManagerResponse>,
109118
state_sync_client: Client<StateSyncRequest, StateSyncResponse>,
@@ -239,6 +248,16 @@ impl SequencerNodeClients {
239248
get_shared_client!(self, mempool_p2p_propagator_client)
240249
}
241250

251+
pub fn get_proof_manager_local_client(
252+
&self,
253+
) -> Option<LocalComponentClient<ProofManagerRequest, ProofManagerResponse>> {
254+
self.proof_manager_client.get_local_client()
255+
}
256+
257+
pub fn get_proof_manager_shared_client(&self) -> Option<SharedProofManagerClient> {
258+
get_shared_client!(self, proof_manager_client)
259+
}
260+
242261
pub fn get_sierra_compiler_local_client(
243262
&self,
244263
) -> Option<LocalComponentClient<SierraCompilerRequest, SierraCompilerResponse>> {
@@ -460,6 +479,17 @@ pub fn create_node_clients(
460479
&MEMPOOL_P2P_INFRA_METRICS.get_remote_client_metrics()
461480
);
462481

482+
let proof_manager_client = create_client!(
483+
&config.components.proof_manager.execution_mode,
484+
LocalProofManagerClient,
485+
RemoteProofManagerClient,
486+
channels.take_proof_manager_tx(),
487+
&config.components.proof_manager.remote_client_config,
488+
&config.components.proof_manager.url,
489+
config.components.proof_manager.port,
490+
&PROOF_MANAGER_INFRA_METRICS.get_local_client_metrics(),
491+
&PROOF_MANAGER_INFRA_METRICS.get_remote_client_metrics()
492+
);
463493
let sierra_compiler_client = create_client!(
464494
&config.components.sierra_compiler.execution_mode,
465495
LocalSierraCompilerClient,
@@ -507,6 +537,7 @@ pub fn create_node_clients(
507537
mempool_client,
508538
mempool_p2p_propagator_client,
509539
sierra_compiler_client,
540+
proof_manager_client,
510541
signature_manager_client,
511542
state_sync_client,
512543
}

crates/apollo_node/src/communication.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use apollo_mempool_p2p_types::communication::MempoolP2pPropagatorRequestWrapper;
1111
use apollo_mempool_types::communication::MempoolRequestWrapper;
1212
use apollo_node_config::component_execution_config::ExpectedComponentConfig;
1313
use apollo_node_config::node_config::SequencerNodeConfig;
14+
use apollo_proof_manager_types::ProofManagerRequestWrapper;
1415
use apollo_signature_manager_types::SignatureManagerRequestWrapper;
1516
use apollo_state_sync_types::communication::StateSyncRequestWrapper;
1617
use tokio::sync::mpsc::{channel, Receiver, Sender};
@@ -26,6 +27,7 @@ pub struct SequencerNodeCommunication {
2627
l1_gas_price_channel: ComponentCommunication<L1GasPriceRequestWrapper>,
2728
mempool_channel: ComponentCommunication<MempoolRequestWrapper>,
2829
mempool_p2p_propagator_channel: ComponentCommunication<MempoolP2pPropagatorRequestWrapper>,
30+
proof_manager_channel: ComponentCommunication<ProofManagerRequestWrapper>,
2931
sierra_compiler_channel: ComponentCommunication<SierraCompilerRequestWrapper>,
3032
signature_manager_channel: ComponentCommunication<SignatureManagerRequestWrapper>,
3133
state_sync_channel: ComponentCommunication<StateSyncRequestWrapper>,
@@ -104,6 +106,14 @@ impl SequencerNodeCommunication {
104106
self.mempool_channel.take_rx()
105107
}
106108

109+
pub fn take_proof_manager_tx(&mut self) -> Sender<ProofManagerRequestWrapper> {
110+
self.proof_manager_channel.take_tx()
111+
}
112+
113+
pub fn take_proof_manager_rx(&mut self) -> Receiver<ProofManagerRequestWrapper> {
114+
self.proof_manager_channel.take_rx()
115+
}
116+
107117
pub fn take_sierra_compiler_tx(&mut self) -> Sender<SierraCompilerRequestWrapper> {
108118
self.sierra_compiler_channel.take_tx()
109119
}
@@ -285,6 +295,23 @@ pub fn create_node_channels(config: &SequencerNodeConfig) -> SequencerNodeCommun
285295
false => (None, None),
286296
};
287297

298+
let (tx_proof_manager, rx_proof_manager) =
299+
match config.components.proof_manager.execution_mode.is_running_locally() {
300+
true => {
301+
let (tx_proof_manager, rx_proof_manager) = channel::<ProofManagerRequestWrapper>(
302+
config
303+
.components
304+
.proof_manager
305+
.local_server_config
306+
.as_ref()
307+
.expect("Proof manager local server config should be available.")
308+
.inbound_requests_channel_capacity,
309+
);
310+
(Some(tx_proof_manager), Some(rx_proof_manager))
311+
}
312+
false => (None, None),
313+
};
314+
288315
let (tx_sierra_compiler, rx_sierra_compiler) =
289316
match config.components.sierra_compiler.execution_mode.is_running_locally() {
290317
true => {
@@ -351,6 +378,7 @@ pub fn create_node_channels(config: &SequencerNodeConfig) -> SequencerNodeCommun
351378
tx_mempool_p2p_propagator,
352379
rx_mempool_p2p_propagator,
353380
),
381+
proof_manager_channel: ComponentCommunication::new(tx_proof_manager, rx_proof_manager),
354382
sierra_compiler_channel: ComponentCommunication::new(
355383
tx_sierra_compiler,
356384
rx_sierra_compiler,

crates/apollo_proof_manager/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ workspace = true
1313

1414
[dependencies]
1515
apollo_infra.workspace = true
16-
apollo_proof_manager_config.workspace = true
1716
apollo_metrics.workspace = true
17+
apollo_proof_manager_config.workspace = true
1818
apollo_proof_manager_types.workspace = true
1919
async-trait.workspace = true
2020
hex.workspace = true

0 commit comments

Comments
 (0)