diff --git a/core/node/node_framework/src/implementations/layers/batch_status_updater.rs b/core/node/node_framework/src/implementations/layers/batch_status_updater.rs index ba328facc8a3..a54950b1f95d 100644 --- a/core/node/node_framework/src/implementations/layers/batch_status_updater.rs +++ b/core/node/node_framework/src/implementations/layers/batch_status_updater.rs @@ -11,6 +11,17 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `BatchStatusUpdater`, part of the external node. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `MainNodeClientResource` +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `BatchStatusUpdater` #[derive(Debug)] pub struct BatchStatusUpdaterLayer; diff --git a/core/node/node_framework/src/implementations/layers/circuit_breaker_checker.rs b/core/node/node_framework/src/implementations/layers/circuit_breaker_checker.rs index 52e72519110b..808ac7f57774 100644 --- a/core/node/node_framework/src/implementations/layers/circuit_breaker_checker.rs +++ b/core/node/node_framework/src/implementations/layers/circuit_breaker_checker.rs @@ -14,11 +14,13 @@ use crate::{ /// [`zksync_circuit_breaker::CircuitBreakers`] collection using [`CircuitBreakersResource`]. /// The added task periodically runs checks for all inserted circuit breakers. /// -/// ## Adds resources -/// - [`CircuitBreakersResource`] +/// ## Requests resources +/// +/// - `CircuitBreakersResource` /// /// ## Adds tasks -/// - [`CircuitBreakerCheckerTask`] (as [`UnconstrainedTask`]) +/// +/// - `CircuitBreakerCheckerTask` #[derive(Debug)] pub struct CircuitBreakerCheckerLayer(pub CircuitBreakerConfig); diff --git a/core/node/node_framework/src/implementations/layers/commitment_generator.rs b/core/node/node_framework/src/implementations/layers/commitment_generator.rs index ccbafba1d717..19b74a3676cc 100644 --- a/core/node/node_framework/src/implementations/layers/commitment_generator.rs +++ b/core/node/node_framework/src/implementations/layers/commitment_generator.rs @@ -18,11 +18,13 @@ use crate::{ /// Responsible for initialization and running [`CommitmentGenerator`]. /// /// ## Requests resources -/// - [`PoolResource`] for [`MasterPool`] -/// - [`AppHealthCheckResource`] (to add new health check) +/// +/// - `PoolResource` +/// - `AppHealthCheckResource` (adds a health check) /// /// ## Adds tasks -/// - [`CommitmentGeneratorTask`] (as [`Task`]) +/// +/// - `CommitmentGeneratorTask` #[derive(Debug)] pub struct CommitmentGeneratorLayer { mode: L1BatchCommitmentMode, diff --git a/core/node/node_framework/src/implementations/layers/consensus.rs b/core/node/node_framework/src/implementations/layers/consensus.rs index 8cc7ea4098de..421e13115ef2 100644 --- a/core/node/node_framework/src/implementations/layers/consensus.rs +++ b/core/node/node_framework/src/implementations/layers/consensus.rs @@ -24,6 +24,20 @@ pub enum Mode { External, } +/// Wiring layer for consensus component. +/// Can work in either "main" or "external" mode. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `MainNodeClientResource` (if `Mode::External`) +/// - `SyncStateResource` (if `Mode::External`) +/// - `ActionQueueSenderResource` (if `Mode::External`) +/// +/// ## Adds tasks +/// +/// - `MainNodeConsensusTask` (if `Mode::Main`) +/// - `FetcherTask` (if `Mode::External`) #[derive(Debug)] pub struct ConsensusLayer { pub mode: Mode, diff --git a/core/node/node_framework/src/implementations/layers/consistency_checker.rs b/core/node/node_framework/src/implementations/layers/consistency_checker.rs index fb4b6d8f5eed..165bcf690b00 100644 --- a/core/node/node_framework/src/implementations/layers/consistency_checker.rs +++ b/core/node/node_framework/src/implementations/layers/consistency_checker.rs @@ -12,6 +12,17 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for the `ConsistencyChecker` (used by the external node). +/// +/// ## Requests resources +/// +/// - `EthInterfaceResource` +/// - `PoolResource` +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `ConsistencyChecker` #[derive(Debug)] pub struct ConsistencyCheckerLayer { diamond_proxy_addr: Address, diff --git a/core/node/node_framework/src/implementations/layers/contract_verification_api.rs b/core/node/node_framework/src/implementations/layers/contract_verification_api.rs index 3d26333c00a8..519df8e76268 100644 --- a/core/node/node_framework/src/implementations/layers/contract_verification_api.rs +++ b/core/node/node_framework/src/implementations/layers/contract_verification_api.rs @@ -13,11 +13,13 @@ use crate::{ /// Responsible for initialization of the contract verification server. /// /// ## Requests resources -/// - [`PoolResource`] for [`MasterPool`] -/// - [`PoolResource`] for [`ReplicaPool`] +/// +/// - `PoolResource` +/// - `PoolResource` /// /// ## Adds tasks -/// - [`ContractVerificationApiTask`] (as [`Task`]) +/// +/// - `ContractVerificationApiTask` #[derive(Debug)] pub struct ContractVerificationApiLayer(pub ContractVerifierConfig); diff --git a/core/node/node_framework/src/implementations/layers/eth_sender.rs b/core/node/node_framework/src/implementations/layers/eth_sender.rs index 677d86560737..16ab8b8135e3 100644 --- a/core/node/node_framework/src/implementations/layers/eth_sender.rs +++ b/core/node/node_framework/src/implementations/layers/eth_sender.rs @@ -24,15 +24,17 @@ use crate::{ /// of `eth_txs`(such as `CommitBlocks`, `PublishProofBlocksOnchain` or `ExecuteBlock` ) to L1. /// /// ## Requests resources -/// - [`PoolResource`] for [`MasterPool`] -/// - [`PoolResource`] for [`ReplicaPool`] -/// - [`BoundEthInterfaceResource`] -/// - [`BoundEthInterfaceForBlobsResource`] -/// - [`L1TxParamsResource`] -/// - [`CircuitBreakersResource`] (to add new circuit breaker) +/// +/// - `PoolResource` +/// - `PoolResource` +/// - `BoundEthInterfaceResource` +/// - `BoundEthInterfaceForBlobsResource` (optional) +/// - `L1TxParamsResource` +/// - `CircuitBreakersResource` (adds a circuit breaker) /// /// ## Adds tasks -/// - [`EthTxManagerTask`] (as [`Task`]) +/// +/// - `EthTxManager` #[derive(Debug)] pub struct EthTxManagerLayer { eth_sender_config: EthConfig, @@ -79,9 +81,7 @@ impl WiringLayer for EthTxManagerLayer { eth_client_blobs, ); - context.add_task(Box::new(EthTxManagerTask { - eth_tx_manager_actor, - })); + context.add_task(Box::new(eth_tx_manager_actor)); // Insert circuit breaker. let CircuitBreakersResource { breakers } = context.get_resource_or_default().await; @@ -100,15 +100,17 @@ impl WiringLayer for EthTxManagerLayer { /// These `eth_txs` will be used as a queue for generating signed txs and will be sent later on L1. /// /// ## Requests resources -/// - [`PoolResource`] for [`MasterPool`] -/// - [`PoolResource`] for [`ReplicaPool`] -/// - [`BoundEthInterfaceResource`] -/// - [`BoundEthInterfaceForBlobsResource`] -/// - [`ObjectStoreResource`] -/// - [`CircuitBreakersResource`] (to add new circuit breaker) +/// +/// - `PoolResource` +/// - `PoolResource` +/// - `BoundEthInterfaceResource` +/// - `BoundEthInterfaceForBlobsResource` (optional) +/// - `ObjectStoreResource` +/// - `CircuitBreakersResource` (adds a circuit breaker) /// /// ## Adds tasks -/// - [`EthTxAggregatorTask`] (as [`Task`]) +/// +/// - `EthTxAggregator` #[derive(Debug)] pub struct EthTxAggregatorLayer { eth_sender_config: EthConfig, @@ -183,9 +185,7 @@ impl WiringLayer for EthTxAggregatorLayer { ) .await; - context.add_task(Box::new(EthTxAggregatorTask { - eth_tx_aggregator_actor, - })); + context.add_task(Box::new(eth_tx_aggregator_actor)); // Insert circuit breaker. let CircuitBreakersResource { breakers } = context.get_resource_or_default().await; @@ -197,34 +197,24 @@ impl WiringLayer for EthTxAggregatorLayer { } } -#[derive(Debug)] -struct EthTxAggregatorTask { - eth_tx_aggregator_actor: EthTxAggregator, -} - #[async_trait::async_trait] -impl Task for EthTxAggregatorTask { +impl Task for EthTxAggregator { fn id(&self) -> TaskId { "eth_tx_aggregator".into() } async fn run(self: Box, stop_receiver: StopReceiver) -> anyhow::Result<()> { - self.eth_tx_aggregator_actor.run(stop_receiver.0).await + (*self).run(stop_receiver.0).await } } -#[derive(Debug)] -struct EthTxManagerTask { - eth_tx_manager_actor: EthTxManager, -} - #[async_trait::async_trait] -impl Task for EthTxManagerTask { +impl Task for EthTxManager { fn id(&self) -> TaskId { "eth_tx_manager".into() } async fn run(self: Box, stop_receiver: StopReceiver) -> anyhow::Result<()> { - self.eth_tx_manager_actor.run(stop_receiver.0).await + (*self).run(stop_receiver.0).await } } diff --git a/core/node/node_framework/src/implementations/layers/eth_watch.rs b/core/node/node_framework/src/implementations/layers/eth_watch.rs index 809da037d97a..d498064a4358 100644 --- a/core/node/node_framework/src/implementations/layers/eth_watch.rs +++ b/core/node/node_framework/src/implementations/layers/eth_watch.rs @@ -22,11 +22,13 @@ use crate::{ /// such as priority operations (aka L1 transactions), protocol upgrades etc. /// /// ## Requests resources -/// - [`PoolResource`] for [`MasterPool`] -/// - [`EthInterfaceResource`] +/// +/// - `PoolResource` +/// - `EthInterfaceResource` /// /// ## Adds tasks -/// - [`EthWatchTask`] (as [`Task`]) +/// +/// - `EthWatchTask` #[derive(Debug)] pub struct EthWatchLayer { eth_watch_config: EthWatchConfig, diff --git a/core/node/node_framework/src/implementations/layers/healtcheck_server.rs b/core/node/node_framework/src/implementations/layers/healtcheck_server.rs index 1ae2b1f54736..10f98d8f9e5a 100644 --- a/core/node/node_framework/src/implementations/layers/healtcheck_server.rs +++ b/core/node/node_framework/src/implementations/layers/healtcheck_server.rs @@ -17,11 +17,13 @@ use crate::{ /// into [`AppHealthCheck`] aggregating heath using [`AppHealthCheckResource`]. /// The added task spawns a health check server that only exposes the state provided by other tasks. /// -/// ## Adds resources -/// - [`AppHealthCheckResource`] +/// ## Requests resources +/// +/// - `AppHealthCheckResource` /// /// ## Adds tasks -/// - [`HealthCheckTask`] (as [`UnconstrainedTask`]) +/// +/// - `HealthCheckTask` #[derive(Debug)] pub struct HealthCheckLayer(pub HealthCheckConfig); diff --git a/core/node/node_framework/src/implementations/layers/house_keeper.rs b/core/node/node_framework/src/implementations/layers/house_keeper.rs index 416d80691a31..feaee5ed2e3b 100644 --- a/core/node/node_framework/src/implementations/layers/house_keeper.rs +++ b/core/node/node_framework/src/implementations/layers/house_keeper.rs @@ -20,6 +20,26 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `HouseKeeper` - a component responsible for managing prover jobs +/// and auxiliary server activities. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `PoolResource` +/// +/// ## Adds tasks +/// +/// - `L1BatchMetricsReporterTask` +/// - `FriProverJobRetryManagerTask` +/// - `FriWitnessGeneratorJobRetryManagerTask` +/// - `WaitingToQueuedFriWitnessJobMoverTask` +/// - `FriProverJobArchiverTask` +/// - `FriProverGpuArchiverTask` +/// - `FriWitnessGeneratorStatsReporterTask` +/// - `FriProverStatsReporterTask` +/// - `FriProofCompressorStatsReporterTask` +/// - `FriProofCompressorJobRetryManagerTask` #[derive(Debug)] pub struct HouseKeeperLayer { house_keeper_config: HouseKeeperConfig, @@ -54,14 +74,14 @@ impl WiringLayer for HouseKeeperLayer { } async fn wire(self: Box, mut context: ServiceContext<'_>) -> Result<(), WiringError> { - // initialize resources + // Initialize resources let replica_pool_resource = context.get_resource::>().await?; let replica_pool = replica_pool_resource.get().await?; let prover_pool_resource = context.get_resource::>().await?; let prover_pool = prover_pool_resource.get().await?; - // initialize and add tasks + // Initialize and add tasks let l1_batch_metrics_reporter = L1BatchMetricsReporter::new( self.house_keeper_config .l1_batch_metrics_reporting_interval_ms, diff --git a/core/node/node_framework/src/implementations/layers/l1_batch_commitment_mode_validation.rs b/core/node/node_framework/src/implementations/layers/l1_batch_commitment_mode_validation.rs index e333eda51192..b9a83cc06cb6 100644 --- a/core/node/node_framework/src/implementations/layers/l1_batch_commitment_mode_validation.rs +++ b/core/node/node_framework/src/implementations/layers/l1_batch_commitment_mode_validation.rs @@ -9,6 +9,16 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for a prerequisite that checks if the L1 batch commitment mode is valid +/// against L1. +/// +/// ## Requests resources +/// +/// - `EthInterfaceResource` +/// +/// ## Adds preconditions +/// +/// - `L1BatchCommitmentModeValidationTask` #[derive(Debug)] pub struct L1BatchCommitmentModeValidationLayer { diamond_proxy_addr: Address, diff --git a/core/node/node_framework/src/implementations/layers/l1_gas.rs b/core/node/node_framework/src/implementations/layers/l1_gas.rs index d465510eff5d..c8b51d62c34e 100644 --- a/core/node/node_framework/src/implementations/layers/l1_gas.rs +++ b/core/node/node_framework/src/implementations/layers/l1_gas.rs @@ -18,6 +18,21 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for sequencer L1 gas interfaces. +/// Adds several resources that depend on L1 gas price. +/// +/// ## Requests resources +/// +/// - `EthInterfaceResource` +/// +/// ## Adds resources +/// +/// - `FeeInputResource` +/// - `L1TxParamsResource` +/// +/// ## Adds tasks +/// +/// - `GasAdjusterTask` (only runs if someone uses the resourced listed above). #[derive(Debug)] pub struct SequencerL1GasLayer { gas_adjuster_config: GasAdjusterConfig, diff --git a/core/node/node_framework/src/implementations/layers/main_node_client.rs b/core/node/node_framework/src/implementations/layers/main_node_client.rs index a694eb831330..a07b0eaaec7b 100644 --- a/core/node/node_framework/src/implementations/layers/main_node_client.rs +++ b/core/node/node_framework/src/implementations/layers/main_node_client.rs @@ -13,6 +13,15 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for main node client. +/// +/// ## Requests resources +/// +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds resources +/// +/// - `MainNodeClientResource` #[derive(Debug)] pub struct MainNodeClientLayer { url: SensitiveUrl, diff --git a/core/node/node_framework/src/implementations/layers/main_node_fee_params_fetcher.rs b/core/node/node_framework/src/implementations/layers/main_node_fee_params_fetcher.rs index 11bfab18a4c6..79596c0f8cf7 100644 --- a/core/node/node_framework/src/implementations/layers/main_node_fee_params_fetcher.rs +++ b/core/node/node_framework/src/implementations/layers/main_node_fee_params_fetcher.rs @@ -11,6 +11,20 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for main node fee params fetcher -- a fee input resource used on +/// the external node. +/// +/// ## Requests resources +/// +/// - `MainNodeClientResource` +/// +/// ## Adds resources +/// +/// - `FeeInputResource` +/// +/// ## Adds tasks +/// +/// - `MainNodeFeeParamsFetcherTask` #[derive(Debug)] pub struct MainNodeFeeParamsFetcherLayer; diff --git a/core/node/node_framework/src/implementations/layers/metadata_calculator.rs b/core/node/node_framework/src/implementations/layers/metadata_calculator.rs index 9fe954c91e4f..1d0164c5f518 100644 --- a/core/node/node_framework/src/implementations/layers/metadata_calculator.rs +++ b/core/node/node_framework/src/implementations/layers/metadata_calculator.rs @@ -23,15 +23,23 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Builder for a metadata calculator. +/// Wiring layer for /// -/// ## Effects +/// ## Requests resources /// -/// - Resolves `PoolResource`. -/// - Resolves `PoolResource`. -/// - Resolves `ObjectStoreResource` (optional). -/// - Adds `tree_health_check` to the `ResourceCollection`. -/// - Adds `metadata_calculator` to the node. +/// - `PoolResource` +/// - `PoolResource` +/// - `ObjectStoreResource` (only for `MerkleTreeMode::Full`) +/// - `AppHealthCheckResource` (adds several health checks) +/// +/// ## Adds resources +/// +/// - `TreeApiClientResource` +/// +/// ## Adds tasks +/// +/// - `MetadataCalculatorTask` +/// - `TreeApiTask` (if requested) #[derive(Debug)] pub struct MetadataCalculatorLayer { config: MetadataCalculatorConfig, diff --git a/core/node/node_framework/src/implementations/layers/object_store.rs b/core/node/node_framework/src/implementations/layers/object_store.rs index e5a4b19c6b56..6803ccfb55b7 100644 --- a/core/node/node_framework/src/implementations/layers/object_store.rs +++ b/core/node/node_framework/src/implementations/layers/object_store.rs @@ -7,6 +7,11 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for object store. +/// +/// ## Adds resources +/// +/// - `ObjectStoreResource` #[derive(Debug)] pub struct ObjectStoreLayer { config: ObjectStoreConfig, diff --git a/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs b/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs index cc93498e0f2b..c923780e9098 100644 --- a/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs +++ b/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs @@ -14,6 +14,16 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for [`PKSigningClient`]. +/// +/// ## Requests resources +/// +/// - `EthInterfaceResource` +/// +/// ## Adds resources +/// +/// - `BoundEthInterfaceResource` +/// - `BoundEthInterfaceForBlobsResource` (if key for blob operator is provided) #[derive(Debug)] pub struct PKSigningEthClientLayer { eth_sender_config: EthConfig, diff --git a/core/node/node_framework/src/implementations/layers/pools_layer.rs b/core/node/node_framework/src/implementations/layers/pools_layer.rs index cf26ad4d9326..b4cde04c6192 100644 --- a/core/node/node_framework/src/implementations/layers/pools_layer.rs +++ b/core/node/node_framework/src/implementations/layers/pools_layer.rs @@ -13,6 +13,7 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Builder for the [`PoolsLayer`]. #[derive(Debug)] pub struct PoolsLayerBuilder { config: PostgresConfig, @@ -23,6 +24,8 @@ pub struct PoolsLayerBuilder { } impl PoolsLayerBuilder { + /// Creates a new builder with the provided configuration and secrets. + /// By default, no pulls are enabled. pub fn empty(config: PostgresConfig, database_secrets: DatabaseSecrets) -> Self { Self { config, @@ -33,21 +36,25 @@ impl PoolsLayerBuilder { } } + /// Allows to enable the master pool. pub fn with_master(mut self, with_master: bool) -> Self { self.with_master = with_master; self } + /// Allows to enable the replica pool. pub fn with_replica(mut self, with_replica: bool) -> Self { self.with_replica = with_replica; self } + /// Allows to enable the prover pool. pub fn with_prover(mut self, with_prover: bool) -> Self { self.with_prover = with_prover; self } + /// Builds the [`PoolsLayer`] with the provided configuration. pub fn build(self) -> PoolsLayer { PoolsLayer { config: self.config, @@ -59,6 +66,18 @@ impl PoolsLayerBuilder { } } +/// Wiring layer for connection pools. +/// During wiring, also prepares the global configuration for the connection pools. +/// +/// ## Requests resources +/// +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds resources +/// +/// - `PoolResource::` (if master pool is enabled) +/// - `PoolResource::` (if replica pool is enabled) +/// - `PoolResource::` (if prover pool is enabled) #[derive(Debug)] pub struct PoolsLayer { config: PostgresConfig, diff --git a/core/node/node_framework/src/implementations/layers/postgres_metrics.rs b/core/node/node_framework/src/implementations/layers/postgres_metrics.rs index 09d81844dd5a..a0c80d4e9d42 100644 --- a/core/node/node_framework/src/implementations/layers/postgres_metrics.rs +++ b/core/node/node_framework/src/implementations/layers/postgres_metrics.rs @@ -11,6 +11,15 @@ use crate::{ const SCRAPE_INTERVAL: Duration = Duration::from_secs(60); +/// Wiring layer for the Postgres metrics exporter. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// +/// ## Adds tasks +/// +/// - `PostgresMetricsScrapingTask` #[derive(Debug)] pub struct PostgresMetricsLayer; diff --git a/core/node/node_framework/src/implementations/layers/prometheus_exporter.rs b/core/node/node_framework/src/implementations/layers/prometheus_exporter.rs index 3cfa6e0d5427..4684a1d709ba 100644 --- a/core/node/node_framework/src/implementations/layers/prometheus_exporter.rs +++ b/core/node/node_framework/src/implementations/layers/prometheus_exporter.rs @@ -8,12 +8,15 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Builder for a prometheus exporter. +/// Wiring layer for Prometheus exporter server. /// -/// ## Effects +/// ## Requests resources /// -/// - Adds prometheus health check to the `ResourceCollection`. -/// - Adds `prometheus_exporter` to the node. +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `PrometheusExporterTask` #[derive(Debug)] pub struct PrometheusExporterLayer(pub PrometheusExporterConfig); diff --git a/core/node/node_framework/src/implementations/layers/proof_data_handler.rs b/core/node/node_framework/src/implementations/layers/proof_data_handler.rs index 7952ca6a585f..07213edb18cf 100644 --- a/core/node/node_framework/src/implementations/layers/proof_data_handler.rs +++ b/core/node/node_framework/src/implementations/layers/proof_data_handler.rs @@ -15,13 +15,16 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Builder for a proof data handler. +/// Wiring layer for proof data handler server. /// -/// ## Effects +/// ## Requests resources /// -/// - Resolves `PoolResource`. -/// - Resolves `ObjectStoreResource`. -/// - Adds `proof_data_handler` to the node. +/// - `PoolResource` +/// - `ObjectStoreResource` +/// +/// ## Adds tasks +/// +/// - `ProofDataHandlerTask` #[derive(Debug)] pub struct ProofDataHandlerLayer { proof_data_handler_config: ProofDataHandlerConfig, diff --git a/core/node/node_framework/src/implementations/layers/pruning.rs b/core/node/node_framework/src/implementations/layers/pruning.rs index 3ad52606083b..8747901dc9d8 100644 --- a/core/node/node_framework/src/implementations/layers/pruning.rs +++ b/core/node/node_framework/src/implementations/layers/pruning.rs @@ -12,6 +12,16 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for node pruning layer. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `DbPruner` #[derive(Debug)] pub struct PruningLayer { pruning_removal_delay: Duration, diff --git a/core/node/node_framework/src/implementations/layers/query_eth_client.rs b/core/node/node_framework/src/implementations/layers/query_eth_client.rs index 0e4be369db48..36f0c8176609 100644 --- a/core/node/node_framework/src/implementations/layers/query_eth_client.rs +++ b/core/node/node_framework/src/implementations/layers/query_eth_client.rs @@ -8,6 +8,11 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for Ethereum client. +/// +/// ## Adds resources +/// +/// - `EthInterfaceResource` #[derive(Debug)] pub struct QueryEthClientLayer { chain_id: L1ChainId, diff --git a/core/node/node_framework/src/implementations/layers/reorg_detector_checker.rs b/core/node/node_framework/src/implementations/layers/reorg_detector_checker.rs index eee63e6763b1..31b93a1b566e 100644 --- a/core/node/node_framework/src/implementations/layers/reorg_detector_checker.rs +++ b/core/node/node_framework/src/implementations/layers/reorg_detector_checker.rs @@ -17,8 +17,17 @@ use crate::{ const REORG_DETECTED_SLEEP_INTERVAL: Duration = Duration::from_secs(1); -/// The layer is responsible for integrating reorg checking into the system. -/// When a reorg is detected, the system will not start running until it is fixed. +/// Wiring layer for [`ReorgDetector`] checker. +/// This layer is responsible for detecting reorgs and preventing the node from starting if it occurs. +/// +/// ## Requests resources +/// +/// - `MainNodeClientResource` +/// - `PoolResource` +/// +/// ## Adds preconditions +/// +/// - `CheckerPrecondition` #[derive(Debug)] pub struct ReorgDetectorCheckerLayer; diff --git a/core/node/node_framework/src/implementations/layers/reorg_detector_runner.rs b/core/node/node_framework/src/implementations/layers/reorg_detector_runner.rs index 55ee621c15b0..2ffc33d3145b 100644 --- a/core/node/node_framework/src/implementations/layers/reorg_detector_runner.rs +++ b/core/node/node_framework/src/implementations/layers/reorg_detector_runner.rs @@ -15,7 +15,18 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for [`ReorgDetector`] runner. /// Layer responsible for detecting reorg and reverting blocks in case it was found. +/// +/// ## Requests resources +/// +/// - `MainNodeClientResource` +/// - `PoolResource` +/// - `BlockReverterResource` +/// +/// ## Adds oneshot tasks +/// +/// - `RunnerUnconstrainedOneshotTask` #[derive(Debug)] pub struct ReorgDetectorRunnerLayer; diff --git a/core/node/node_framework/src/implementations/layers/sigint.rs b/core/node/node_framework/src/implementations/layers/sigint.rs index 255305629c64..c3200139aba9 100644 --- a/core/node/node_framework/src/implementations/layers/sigint.rs +++ b/core/node/node_framework/src/implementations/layers/sigint.rs @@ -6,8 +6,12 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Layer that changes the handling of SIGINT signal, preventing an immediate shutdown. +/// Wiring layer that changes the handling of SIGINT signal, preventing an immediate shutdown. /// Instead, it would propagate the signal to the rest of the node, allowing it to shut down gracefully. +/// +/// ## Adds tasks +/// +/// - `SigintHandlerTask` #[derive(Debug)] pub struct SigintHandlerLayer; diff --git a/core/node/node_framework/src/implementations/layers/state_keeper/external_io.rs b/core/node/node_framework/src/implementations/layers/state_keeper/external_io.rs index 1ec80fef4272..c875ff10b0ea 100644 --- a/core/node/node_framework/src/implementations/layers/state_keeper/external_io.rs +++ b/core/node/node_framework/src/implementations/layers/state_keeper/external_io.rs @@ -18,6 +18,19 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `ExternalIO`, an IO part of state keeper used by the external node. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `MainNodeClientResource` +/// +/// ## Adds resources +/// +/// - `SyncStateResource` +/// - `ActionQueueSenderResource` +/// - `StateKeeperIOResource` +/// - `ConditionalSealerResource` #[derive(Debug)] pub struct ExternalIOLayer { chain_id: L2ChainId, diff --git a/core/node/node_framework/src/implementations/layers/state_keeper/main_batch_executor.rs b/core/node/node_framework/src/implementations/layers/state_keeper/main_batch_executor.rs index 82e6e52274aa..796b147d1c60 100644 --- a/core/node/node_framework/src/implementations/layers/state_keeper/main_batch_executor.rs +++ b/core/node/node_framework/src/implementations/layers/state_keeper/main_batch_executor.rs @@ -7,6 +7,11 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `MainBatchExecutor`, part of the state keeper responsible for running the VM. +/// +/// ## Adds resources +/// +/// - `MainBatchExecutor` #[derive(Debug)] pub struct MainBatchExecutorLayer { save_call_traces: bool, diff --git a/core/node/node_framework/src/implementations/layers/state_keeper/mempool_io.rs b/core/node/node_framework/src/implementations/layers/state_keeper/mempool_io.rs index 1a913fd990bf..2951d5edc9e9 100644 --- a/core/node/node_framework/src/implementations/layers/state_keeper/mempool_io.rs +++ b/core/node/node_framework/src/implementations/layers/state_keeper/mempool_io.rs @@ -20,6 +20,24 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `MempoolIO`, an IO part of state keeper used by the main node. +/// +/// ## Requests resources +/// +/// - `FeeInputResource` +/// - `PoolResource` +/// +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds resources +/// +/// - `StateKeeperIOResource` +/// - `ConditionalSealerResource` +/// +/// ## Adds tasks +/// +/// - `MempoolFetcherTask` +/// - `TaskTypeName2` #[derive(Debug)] pub struct MempoolIOLayer { zksync_network_id: L2ChainId, diff --git a/core/node/node_framework/src/implementations/layers/state_keeper/mod.rs b/core/node/node_framework/src/implementations/layers/state_keeper/mod.rs index 46e56eca0e65..3627779c8695 100644 --- a/core/node/node_framework/src/implementations/layers/state_keeper/mod.rs +++ b/core/node/node_framework/src/implementations/layers/state_keeper/mod.rs @@ -29,11 +29,20 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Requests: +/// Wiring layer for the state keeper. +/// +/// ## Requests resources +/// /// - `StateKeeperIOResource` /// - `BatchExecutorResource` +/// - `OutputHandlerResource` /// - `ConditionalSealerResource` +/// - `PoolResource` +/// +/// ## Adds tasks /// +/// - `RocksdbCatchupTask` +/// - `StateKeeperTask` #[derive(Debug)] pub struct StateKeeperLayer { state_keeper_db_path: String, diff --git a/core/node/node_framework/src/implementations/layers/state_keeper/output_handler.rs b/core/node/node_framework/src/implementations/layers/state_keeper/output_handler.rs index 3213cfb29b13..3d27dfdcd608 100644 --- a/core/node/node_framework/src/implementations/layers/state_keeper/output_handler.rs +++ b/core/node/node_framework/src/implementations/layers/state_keeper/output_handler.rs @@ -17,6 +17,21 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for the state keeper output handler. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `SyncStateResource` (optional) +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds resources +/// +/// - `OutputHandlerResource` +/// +/// ## Adds tasks +/// +/// - `L2BlockSealerTask` #[derive(Debug)] pub struct OutputHandlerLayer { l2_shared_bridge_addr: Address, diff --git a/core/node/node_framework/src/implementations/layers/sync_state_updater.rs b/core/node/node_framework/src/implementations/layers/sync_state_updater.rs index fcbe51f581e1..0c7c04e45d2e 100644 --- a/core/node/node_framework/src/implementations/layers/sync_state_updater.rs +++ b/core/node/node_framework/src/implementations/layers/sync_state_updater.rs @@ -13,8 +13,21 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Runs the dynamic sync state updater for `SyncState` if no `SyncState` was provided before. -/// This layer may be used as a fallback for EN API if API server runs without the core component. +/// Wiring layer for [`SyncState`] maintenance. +/// If [`SyncStateResource`] is already provided by another layer, this layer does nothing. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `MainNodeClientResource` +/// +/// ## Adds resources +/// +/// - `SyncStateResource` +/// +/// ## Adds tasks +/// +/// - `SyncStateUpdater` #[derive(Debug)] pub struct SyncStateUpdaterLayer; diff --git a/core/node/node_framework/src/implementations/layers/tee_verifier_input_producer.rs b/core/node/node_framework/src/implementations/layers/tee_verifier_input_producer.rs index 76ae0b26971f..00b5ab4d9795 100644 --- a/core/node/node_framework/src/implementations/layers/tee_verifier_input_producer.rs +++ b/core/node/node_framework/src/implementations/layers/tee_verifier_input_producer.rs @@ -12,6 +12,15 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for [`TeeVerifierInputProducer`]. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// +/// ## Adds tasks +/// +/// - `TeeVerifierInputProducer` #[derive(Debug)] pub struct TeeVerifierInputProducerLayer { l2_chain_id: L2ChainId, @@ -40,23 +49,19 @@ impl WiringLayer for TeeVerifierInputProducerLayer { let tee = TeeVerifierInputProducer::new(pool_resource, object_store.0, self.l2_chain_id).await?; - context.add_task(Box::new(TeeVerifierInputProducerTask { tee })); + context.add_task(Box::new(tee)); Ok(()) } } -pub struct TeeVerifierInputProducerTask { - tee: TeeVerifierInputProducer, -} - #[async_trait::async_trait] -impl Task for TeeVerifierInputProducerTask { +impl Task for TeeVerifierInputProducer { fn id(&self) -> TaskId { "tee_verifier_input_producer".into() } async fn run(self: Box, stop_receiver: StopReceiver) -> anyhow::Result<()> { - self.tee.run(stop_receiver.0, None).await + (*self).run(stop_receiver.0, None).await } } diff --git a/core/node/node_framework/src/implementations/layers/tree_data_fetcher.rs b/core/node/node_framework/src/implementations/layers/tree_data_fetcher.rs index c45071ce418b..7a54b1332037 100644 --- a/core/node/node_framework/src/implementations/layers/tree_data_fetcher.rs +++ b/core/node/node_framework/src/implementations/layers/tree_data_fetcher.rs @@ -13,6 +13,18 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for [`TreeDataFetcher`]. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `MainNodeClientResource` +/// - `EthInterfaceResource` +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `TreeDataFetcher` #[derive(Debug)] pub struct TreeDataFetcherLayer { diamond_proxy_addr: Address, diff --git a/core/node/node_framework/src/implementations/layers/validate_chain_ids.rs b/core/node/node_framework/src/implementations/layers/validate_chain_ids.rs index 0f04a35d484a..a9f5a61c65f1 100644 --- a/core/node/node_framework/src/implementations/layers/validate_chain_ids.rs +++ b/core/node/node_framework/src/implementations/layers/validate_chain_ids.rs @@ -11,6 +11,17 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for chain ID validation precondition for external node. +/// Ensures that chain IDs are consistent locally, on main node, and on L1. +/// +/// ## Requests resources +/// +/// - `EthInterfaceResource` +/// - `MainNodeClientResource +/// +/// ## Adds preconditions +/// +/// - `ValidateChainIdsTask` #[derive(Debug)] pub struct ValidateChainIdsLayer { l1_chain_id: L1ChainId, diff --git a/core/node/node_framework/src/implementations/layers/vm_runner/protective_reads.rs b/core/node/node_framework/src/implementations/layers/vm_runner/protective_reads.rs index a55f8dd7ac85..dfc17a342af9 100644 --- a/core/node/node_framework/src/implementations/layers/vm_runner/protective_reads.rs +++ b/core/node/node_framework/src/implementations/layers/vm_runner/protective_reads.rs @@ -9,6 +9,17 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for protective reads writer. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// +/// ## Adds tasks +/// +/// - `StorageSyncTask` +/// - `ConcurrentOutputHandlerFactoryTask` +/// - `ProtectiveReadsWriterTask` #[derive(Debug)] pub struct ProtectiveReadsWriterLayer { protective_reads_writer_config: ProtectiveReadsWriterConfig, diff --git a/core/node/node_framework/src/implementations/layers/web3_api/caches.rs b/core/node/node_framework/src/implementations/layers/web3_api/caches.rs index c01a62748fa4..cc62d2ebd4c5 100644 --- a/core/node/node_framework/src/implementations/layers/web3_api/caches.rs +++ b/core/node/node_framework/src/implementations/layers/web3_api/caches.rs @@ -12,6 +12,19 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for API mempool cache. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// +/// ## Adds resources +/// +/// - `MempoolCacheResource` +/// +/// ## Adds tasks +/// +/// - `MempoolCacheUpdateTask` #[derive(Debug)] pub struct MempoolCacheLayer { capacity: usize, diff --git a/core/node/node_framework/src/implementations/layers/web3_api/server.rs b/core/node/node_framework/src/implementations/layers/web3_api/server.rs index 428e5c88503d..2ae4c34da34e 100644 --- a/core/node/node_framework/src/implementations/layers/web3_api/server.rs +++ b/core/node/node_framework/src/implementations/layers/web3_api/server.rs @@ -67,6 +67,22 @@ enum Transport { Ws, } +/// Wiring layer for Web3 JSON RPC server. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// - `TxSenderResource` +/// - `SyncStateResource` (optional) +/// - `TreeApiClientResource` (optional) +/// - `MempoolCacheResource` +/// - `CircuitBreakersResource` (adds a circuit breaker) +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds tasks +/// +/// - `Web3ApiTask` -- wrapper for all the tasks spawned by the API. +/// - `ApiTaskGarbageCollector` -- maintenance task that manages API tasks. #[derive(Debug)] pub struct Web3ServerLayer { transport: Transport, diff --git a/core/node/node_framework/src/implementations/layers/web3_api/tree_api_client.rs b/core/node/node_framework/src/implementations/layers/web3_api/tree_api_client.rs index 42166e16b1dd..492893a3b7f2 100644 --- a/core/node/node_framework/src/implementations/layers/web3_api/tree_api_client.rs +++ b/core/node/node_framework/src/implementations/layers/web3_api/tree_api_client.rs @@ -10,10 +10,18 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; -/// Layer that inserts the `TreeApiHttpClient` into the `ServiceContext` resources, if there is no +/// Wiring layer that provides the `TreeApiHttpClient` into the `ServiceContext` resources, if there is no /// other client already inserted. /// -/// In case a client is already provided in the contest, the layer does nothing. +/// In case a client is already provided in the context, this layer does nothing. +/// +/// ## Requests resources +/// +/// - `AppHealthCheckResource` (adds a health check) +/// +/// ## Adds resources +/// +/// - `TreeApiClientResource` (if no such resource already exists) #[derive(Debug)] pub struct TreeApiClientLayer { url: Option, diff --git a/core/node/node_framework/src/implementations/layers/web3_api/tx_sender.rs b/core/node/node_framework/src/implementations/layers/web3_api/tx_sender.rs index 010778315e58..209d6d995bb1 100644 --- a/core/node/node_framework/src/implementations/layers/web3_api/tx_sender.rs +++ b/core/node/node_framework/src/implementations/layers/web3_api/tx_sender.rs @@ -33,6 +33,25 @@ pub struct PostgresStorageCachesConfig { pub latest_values_cache_size: u64, } +/// Wiring layer for the `TxSender`. +/// Prepares the `TxSender` itself, as well as the tasks required for its maintenance. +/// +/// ## Requests resources +/// +/// - `TxSinkResource` +/// - `PoolResource` +/// - `ConditionalSealerResource` (optional) +/// - `FeeInputResource` +/// +/// ## Adds resources +/// +/// - `TxSenderResource` +/// +/// ## Adds tasks +/// +/// - `PostgresStorageCachesTask` +/// - `VmConcurrencyBarrierTask` +/// - `WhitelistedTokensForAaUpdateTask` (optional) #[derive(Debug)] pub struct TxSenderLayer { tx_sender_config: TxSenderConfig, diff --git a/core/node/node_framework/src/implementations/layers/web3_api/tx_sink.rs b/core/node/node_framework/src/implementations/layers/web3_api/tx_sink.rs index 98ed50ba9e45..6ce5b47513f7 100644 --- a/core/node/node_framework/src/implementations/layers/web3_api/tx_sink.rs +++ b/core/node/node_framework/src/implementations/layers/web3_api/tx_sink.rs @@ -16,6 +16,19 @@ use crate::{ wiring_layer::{WiringError, WiringLayer}, }; +/// Wiring layer for `TxSink` -- an abstraction that handles outputs from `TxSender`. +/// +/// ## Requests resources +/// +/// - `PoolResource` +/// +/// ## Adds resources +/// +/// - `TxSinkResource` +/// +/// ## Adds tasks +/// +/// - `AccountNonceSweeperTask` (only for `ProxySink`) #[derive(Debug)] #[non_exhaustive] pub enum TxSinkLayer { diff --git a/core/node/node_framework/src/implementations/resources/action_queue.rs b/core/node/node_framework/src/implementations/resources/action_queue.rs index 164f8dca3109..b0f70828018b 100644 --- a/core/node/node_framework/src/implementations/resources/action_queue.rs +++ b/core/node/node_framework/src/implementations/resources/action_queue.rs @@ -2,6 +2,8 @@ use zksync_node_sync::ActionQueueSender; use crate::resource::{Resource, Unique}; +/// A resource that provides [`ActionQueueSender`] to the service. +/// This resource is unique, e.g. it's expected to be consumed by a single service. #[derive(Debug, Clone)] pub struct ActionQueueSenderResource(pub Unique); diff --git a/core/node/node_framework/src/implementations/resources/circuit_breakers.rs b/core/node/node_framework/src/implementations/resources/circuit_breakers.rs index 6b9eebb7b96e..038d03a31eb0 100644 --- a/core/node/node_framework/src/implementations/resources/circuit_breakers.rs +++ b/core/node/node_framework/src/implementations/resources/circuit_breakers.rs @@ -4,6 +4,7 @@ use zksync_circuit_breaker::CircuitBreakers; use crate::resource::Resource; +/// A resource that provides [`CircuitBreakers`] to the service. #[derive(Debug, Clone, Default)] pub struct CircuitBreakersResource { pub breakers: Arc, diff --git a/core/node/node_framework/src/implementations/resources/eth_interface.rs b/core/node/node_framework/src/implementations/resources/eth_interface.rs index 7a72abd11a9a..cf470c0379da 100644 --- a/core/node/node_framework/src/implementations/resources/eth_interface.rs +++ b/core/node/node_framework/src/implementations/resources/eth_interface.rs @@ -3,6 +3,7 @@ use zksync_web3_decl::client::{DynClient, L1}; use crate::resource::Resource; +/// A resource that provides L1 interface object to the service. #[derive(Debug, Clone)] pub struct EthInterfaceResource(pub Box>); @@ -12,6 +13,7 @@ impl Resource for EthInterfaceResource { } } +/// A resource that provides L1 interface with signing capabilities to the service. #[derive(Debug, Clone)] pub struct BoundEthInterfaceResource(pub Box); @@ -21,6 +23,7 @@ impl Resource for BoundEthInterfaceResource { } } +/// Same as `BoundEthInterfaceResource`, but for managing EIP-4844 blobs. #[derive(Debug, Clone)] pub struct BoundEthInterfaceForBlobsResource(pub Box); diff --git a/core/node/node_framework/src/implementations/resources/fee_input.rs b/core/node/node_framework/src/implementations/resources/fee_input.rs index fbbf6be3db8c..e3204510c58e 100644 --- a/core/node/node_framework/src/implementations/resources/fee_input.rs +++ b/core/node/node_framework/src/implementations/resources/fee_input.rs @@ -4,7 +4,7 @@ use zksync_node_fee_model::BatchFeeModelInputProvider; use crate::resource::Resource; -/// Wrapper for the batch fee model input provider. +/// A resource that provides [`BatchFeeModelInputProvider`] implementation to the service. #[derive(Debug, Clone)] pub struct FeeInputResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/healthcheck.rs b/core/node/node_framework/src/implementations/resources/healthcheck.rs index e1df3ada8f30..b4810eba46be 100644 --- a/core/node/node_framework/src/implementations/resources/healthcheck.rs +++ b/core/node/node_framework/src/implementations/resources/healthcheck.rs @@ -6,6 +6,7 @@ pub use zksync_health_check::{CheckHealth, ReactiveHealthCheck}; use crate::resource::Resource; +/// A resource that provides [`AppHealthCheck`] to the service. #[derive(Debug, Clone, Default)] pub struct AppHealthCheckResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/l1_tx_params.rs b/core/node/node_framework/src/implementations/resources/l1_tx_params.rs index 57ba1f4af165..8fd962480b9d 100644 --- a/core/node/node_framework/src/implementations/resources/l1_tx_params.rs +++ b/core/node/node_framework/src/implementations/resources/l1_tx_params.rs @@ -4,7 +4,7 @@ use zksync_node_fee_model::l1_gas_price::L1TxParamsProvider; use crate::resource::Resource; -/// Wrapper for the l1 tx params provider. +/// A resource that provides [`L1TxParamsProvider`] implementation to the service. #[derive(Debug, Clone)] pub struct L1TxParamsResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/main_node_client.rs b/core/node/node_framework/src/implementations/resources/main_node_client.rs index 903a6ce9b9be..64a0ac85bef6 100644 --- a/core/node/node_framework/src/implementations/resources/main_node_client.rs +++ b/core/node/node_framework/src/implementations/resources/main_node_client.rs @@ -2,6 +2,7 @@ use zksync_web3_decl::client::{DynClient, L2}; use crate::resource::Resource; +/// A resource that provides L2 interface object to the service. #[derive(Debug, Clone)] pub struct MainNodeClientResource(pub Box>); diff --git a/core/node/node_framework/src/implementations/resources/object_store.rs b/core/node/node_framework/src/implementations/resources/object_store.rs index d53c7540c793..fbfc20d93180 100644 --- a/core/node/node_framework/src/implementations/resources/object_store.rs +++ b/core/node/node_framework/src/implementations/resources/object_store.rs @@ -4,7 +4,7 @@ use zksync_object_store::ObjectStore; use crate::resource::Resource; -/// Wrapper for the object store. +/// A resource that provides [`ObjectStore`] to the service. #[derive(Debug, Clone)] pub struct ObjectStoreResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/reverter.rs b/core/node/node_framework/src/implementations/resources/reverter.rs index 2a2bdb142a85..2d24f8fbbaf7 100644 --- a/core/node/node_framework/src/implementations/resources/reverter.rs +++ b/core/node/node_framework/src/implementations/resources/reverter.rs @@ -4,7 +4,7 @@ use zksync_block_reverter::BlockReverter; use crate::resource::Resource; -/// Wrapper for the block reverter. +/// A resource that provides [`BlockReverter`] to the service. #[derive(Debug, Clone)] pub struct BlockReverterResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/state_keeper.rs b/core/node/node_framework/src/implementations/resources/state_keeper.rs index 804822154497..860332f26293 100644 --- a/core/node/node_framework/src/implementations/resources/state_keeper.rs +++ b/core/node/node_framework/src/implementations/resources/state_keeper.rs @@ -6,6 +6,8 @@ use zksync_state_keeper::{ use crate::resource::{Resource, Unique}; +/// A resource that provides [`StateKeeperIO`] implementation to the service. +/// This resource is unique, e.g. it's expected to be consumed by a single service. #[derive(Debug, Clone)] pub struct StateKeeperIOResource(pub Unique>); @@ -15,6 +17,8 @@ impl Resource for StateKeeperIOResource { } } +/// A resource that provides [`BatchExecutor`] implementation to the service. +/// This resource is unique, e.g. it's expected to be consumed by a single service. #[derive(Debug, Clone)] pub struct BatchExecutorResource(pub Unique>); @@ -24,6 +28,8 @@ impl Resource for BatchExecutorResource { } } +/// A resource that provides [`OutputHandler`] implementation to the service. +/// This resource is unique, e.g. it's expected to be consumed by a single service. #[derive(Debug, Clone)] pub struct OutputHandlerResource(pub Unique); @@ -33,6 +39,7 @@ impl Resource for OutputHandlerResource { } } +/// A resource that provides [`ConditionalSealer`] implementation to the service. #[derive(Debug, Clone)] pub struct ConditionalSealerResource(pub Arc); diff --git a/core/node/node_framework/src/implementations/resources/sync_state.rs b/core/node/node_framework/src/implementations/resources/sync_state.rs index 87eb565ac077..25df1d94d99f 100644 --- a/core/node/node_framework/src/implementations/resources/sync_state.rs +++ b/core/node/node_framework/src/implementations/resources/sync_state.rs @@ -2,6 +2,7 @@ use zksync_node_sync::SyncState; use crate::resource::Resource; +/// A resource that provides [`SyncState`] to the service. #[derive(Debug, Clone)] pub struct SyncStateResource(pub SyncState); diff --git a/core/node/node_framework/src/implementations/resources/web3_api.rs b/core/node/node_framework/src/implementations/resources/web3_api.rs index ba555ccca0ef..9b3716721261 100644 --- a/core/node/node_framework/src/implementations/resources/web3_api.rs +++ b/core/node/node_framework/src/implementations/resources/web3_api.rs @@ -8,6 +8,7 @@ use zksync_node_api_server::{ use crate::resource::Resource; +/// A resource that provides [`TxSender`] to the service. #[derive(Debug, Clone)] pub struct TxSenderResource(pub TxSender); @@ -17,6 +18,7 @@ impl Resource for TxSenderResource { } } +/// A resource that provides [`TxSink`] implementation to the service. #[derive(Debug, Clone)] pub struct TxSinkResource(pub Arc); @@ -26,6 +28,7 @@ impl Resource for TxSinkResource { } } +/// A resource that provides [`TreeApiClient`] implementation to the service. #[derive(Debug, Clone)] pub struct TreeApiClientResource(pub Arc); @@ -35,6 +38,7 @@ impl Resource for TreeApiClientResource { } } +/// A resource that provides [`MempoolCache`] to the service. #[derive(Debug, Clone)] pub struct MempoolCacheResource(pub MempoolCache);