pub fn build(mut self, mut components: Vec<Component>) -> anyhow::Result<ZkStackService> {
        // Add "base" layers (resources and helper tasks).
        self = self
            .add_sigint_handler_layer()?
            .add_pools_layer()?
            .add_object_store_layer()?
            .add_circuit_breaker_checker_layer()?
            .add_healthcheck_layer()?
            .add_prometheus_exporter_layer()?
            .add_query_eth_client_layer()?
            .add_settlement_mode_data()?
            .add_gateway_migrator_layer()?
            .add_gas_adjuster_layer()?;

        #[cfg(not(target_env = "msvc"))]
        {
            self = self.add_jemalloc_monitor_layer()?;
        }

        // Add preconditions for all the components.
        self = self
            .add_l1_batch_commitment_mode_validation_layer()?
            .add_storage_initialization_layer(LayerKind::Precondition)?;

        // Sort the components, so that the components they may depend on each other are added in the correct order.
        components.sort_unstable_by_key(|component| match component {
            // API consumes the resources provided by other layers (multiple ones), so it has to come the last.
            Component::HttpApi | Component::WsApi => 1,
            // Default priority.
            _ => 0,
        });

        if components.contains(&Component::EthTxAggregator)
            | components.contains(&Component::EthTxManager)
        {
            self = self.add_pk_signing_client_layer()?;
        }

        // Add "component-specific" layers.
        // Note that the layers are added only once, so it's fine to add the same layer multiple times.
        for component in &components {
            match component {
                Component::StateKeeper => {
                    // State keeper is the core component of the sequencer,
                    // which is why we consider it to be responsible for the storage initialization.
                    self = self
                        .add_allow_list_task_layer()?
                        .add_l1_gas_layer()?
                        .add_storage_initialization_layer(LayerKind::Task)?
                        .add_state_keeper_layer()?
                        .add_logs_bloom_backfill_layer()?;
                }
                Component::HttpApi => {
                    self = self
                        .add_allow_list_task_layer()?
                        .add_bridge_addresses_updater_layer()?
                        .add_l1_gas_layer()?
                        .add_tx_sender_layer()?
                        .add_tree_api_client_layer()?
                        .add_api_caches_layer()?
                        .add_http_web3_api_layer()?;
                }
                Component::WsApi => {
                    self = self
                        .add_allow_list_task_layer()?
                        .add_bridge_addresses_updater_layer()?
                        .add_l1_gas_layer()?
                        .add_tx_sender_layer()?
                        .add_tree_api_client_layer()?
                        .add_api_caches_layer()?
                        .add_ws_web3_api_layer()?;
                }
                Component::ContractVerificationApi => {
                    self = self.add_contract_verification_api_layer()?;
                }
                Component::Tree => {
                    let with_tree_api = components.contains(&Component::TreeApi);
                    self = self.add_metadata_calculator_layer(with_tree_api)?;
                }
                Component::TreeApi => {
                    anyhow::ensure!(
                        components.contains(&Component::Tree),
                        "Merkle tree API cannot be started without a tree component"
                    );
                    // Do nothing, will be handled by the `Tree` component.
                }
                Component::EthWatcher => {
                    self = self.add_eth_watch_layer()?;
                }
                Component::EthTxAggregator => {
                    self = self.add_eth_tx_aggregator_layer()?;
                }
                Component::EthTxManager => {
                    self = self.add_eth_tx_manager_layer()?;
                }
                Component::Housekeeper => {
                    self = self.add_house_keeper_layer()?.add_postgres_layer()?;
                }
                Component::ProofDataHandler => {
                    self = self.add_proof_data_handler_layer()?;
                }
                Component::TeeProofDataHandler => {
                    self = self.add_tee_proof_data_handler_layer()?;
                }
                Component::Consensus => {
                    self = self.add_consensus_layer()?;
                }
                Component::CommitmentGenerator => {
                    self = self.add_commitment_generator_layer()?;
                }
                Component::DADispatcher => {
                    self = self.add_da_client_layer()?.add_da_dispatcher_layer()?;
                }
                Component::VmRunnerProtectiveReads => {
                    self = self.add_vm_runner_protective_reads_layer()?;
                }
                Component::BaseTokenRatioPersister => {
                    self = self
                        .add_l1_gas_layer()?
                        .add_external_api_client_layer()?
                        .add_base_token_ratio_persister_layer()?;
                }
                Component::VmRunnerBwip => {
                    self = self.add_vm_runner_bwip_layer()?;
                }
                Component::VmPlayground => {
                    self = self.add_vm_playground_layer()?;
                }
                Component::ExternalProofIntegrationApi => {
                    self = self.add_external_proof_integration_api_layer()?;
                }
            }
        }
        Ok(self.node.build())
    }
Builds the node with the specified components.
core/bin/zksync_server/src/node_builder.rs