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 ba328facc8a..a54950b1f95 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 52e72519110..808ac7f5777 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 ccbafba1d71..19b74a3676c 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 8cc7ea4098d..421e13115ef 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 fb4b6d8f5ee..165bcf690b0 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 3d26333c00a..519df8e7626 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 677d8656073..16ab8b8135e 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 809da037d97..d498064a435 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 1ae2b1f5473..10f98d8f9e5 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 416d80691a3..feaee5ed2e3 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 e333eda5119..b9a83cc06cb 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 d465510eff5..c8b51d62c34 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 a694eb83133..a07b0eaaec7 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 11bfab18a4c..79596c0f8cf 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 9fe954c91e4..1d0164c5f51 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 e5a4b19c6b5..6803ccfb55b 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 cc93498e0f2..c923780e909 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 cf26ad4d932..b4cde04c619 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 09d81844dd5..a0c80d4e9d4 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 3cfa6e0d542..4684a1d709b 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 7952ca6a585..07213edb18c 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 3ad52606083..8747901dc9d 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 0e4be369db4..36f0c817660 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 eee63e6763b..31b93a1b566 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 55ee621c15b..2ffc33d3145 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 255305629c6..c3200139aba 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 1ec80fef427..c875ff10b0e 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 82e6e52274a..796b147d1c6 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 1a913fd990b..2951d5edc9e 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 46e56eca0e6..3627779c869 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 3213cfb29b1..3d27dfdcd60 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 fcbe51f581e..0c7c04e45d2 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 76ae0b26971..00b5ab4d979 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 c45071ce418..7a54b133203 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 0f04a35d484..a9f5a61c65f 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 a55f8dd7ac8..dfc17a342af 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 c01a62748fa..cc62d2ebd4c 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 428e5c88503..2ae4c34da34 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 42166e16b1d..492893a3b7f 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 010778315e5..209d6d995bb 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 98ed50ba9e4..6ce5b47513f 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 164f8dca310..b0f70828018 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 6b9eebb7b96..038d03a31eb 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 7a72abd11a9..cf470c0379d 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 fbbf6be3db8..e3204510c58 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 e1df3ada8f3..b4810eba46b 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 57ba1f4af16..8fd962480b9 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 903a6ce9b9b..64a0ac85bef 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 d53c7540c79..fbfc20d9318 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 2a2bdb142a8..2d24f8fbbaf 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 80482215449..860332f2629 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 87eb565ac07..25df1d94d99 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 ba555ccca0e..9b371672126 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);