Skip to content

Commit

Permalink
refactor(node): Remove some dead code (#2130)
Browse files Browse the repository at this point in the history
## What ❔

- Removes a no longer needed CLI flag.
- Removes an undocumented configuration option that was deprecated [long
ago](#793).

## Why ❔

Less dead code.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `zk spellcheck`.
popzxc authored Jun 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e9bab95 commit 3ac0f58
Showing 3 changed files with 2 additions and 26 deletions.
2 changes: 0 additions & 2 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -222,8 +222,6 @@ pub(crate) struct OptionalENConfig {
/// Max number of cache misses during one VM execution. If the number of cache misses exceeds this value, the API server panics.
/// This is a temporary solution to mitigate API request resulting in thousands of DB queries.
pub vm_execution_cache_misses_limit: Option<usize>,
/// Note: Deprecated option, no longer in use. Left to display a warning in case someone used them.
pub transactions_per_sec_limit: Option<u32>,
/// Limit for fee history block range.
#[serde(default = "OptionalENConfig::default_fee_history_limit")]
pub fee_history_limit: u64,
23 changes: 1 addition & 22 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ use zksync_concurrency::{ctx, scope};
use zksync_config::configs::{api::MerkleTreeApiConfig, database::MerkleTreeMode};
use zksync_consistency_checker::ConsistencyChecker;
use zksync_core_leftovers::setup_sigint_handler;
use zksync_dal::{metrics::PostgresMetrics, ConnectionPool, Core, CoreDal};
use zksync_dal::{metrics::PostgresMetrics, ConnectionPool, Core};
use zksync_db_connection::{
connection_pool::ConnectionPoolBuilder, healthcheck::ConnectionPoolHealthCheck,
};
@@ -436,10 +436,6 @@ async fn run_api(
let tx_sender_builder =
TxSenderBuilder::new(config.into(), connection_pool.clone(), Arc::new(tx_proxy));

if config.optional.transactions_per_sec_limit.is_some() {
tracing::warn!("`transactions_per_sec_limit` option is deprecated and ignored");
};

let max_concurrency = config.optional.vm_concurrency_limit;
let (vm_concurrency_limiter, vm_barrier) = VmConcurrencyLimiter::new(max_concurrency);
let mut storage_caches = PostgresStorageCaches::new(
@@ -696,9 +692,6 @@ async fn shutdown_components(
#[derive(Debug, Parser)]
#[command(author = "Matter Labs", version)]
struct Cli {
/// Revert the pending L1 batch and exit.
#[arg(long)]
revert_pending_l1_batch: bool,
/// Enables consensus-based syncing instead of JSON-RPC based one. This is an experimental and incomplete feature;
/// do not use unless you know what you're doing.
#[arg(long)]
@@ -966,20 +959,6 @@ async fn run_node(
}
Err(err) => return Err(err).context("reorg_detector.check_consistency()"),
}
if opt.revert_pending_l1_batch {
tracing::info!("Reverting pending L1 batch");
let mut connection = connection_pool.connection().await?;
let sealed_l1_batch_number = connection
.blocks_dal()
.get_sealed_l1_batch_number()
.await?
.context("Cannot revert pending L1 batch since there are no L1 batches in Postgres")?;
drop(connection);

tracing::info!("Reverting to l1 batch number {sealed_l1_batch_number}");
reverter.roll_back(sealed_l1_batch_number).await?;
tracing::info!("Revert successfully completed");
}

app_health.insert_component(reorg_detector.health_check().clone())?;
task_handles.push(tokio::spawn({
3 changes: 1 addition & 2 deletions core/bin/external_node/src/tests.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
use assert_matches::assert_matches;
use test_casing::test_casing;
use zksync_dal::CoreDal;
use zksync_eth_client::clients::MockEthereum;
use zksync_node_genesis::{insert_genesis_batch, GenesisParams};
use zksync_types::{
@@ -153,7 +154,6 @@ async fn external_node_basics(components_str: &'static str) {
let components: ComponentsToRun = components_str.parse().unwrap();
let expected_health_components = expected_health_components(&components);
let opt = Cli {
revert_pending_l1_batch: false,
enable_consensus: false,
components,
};
@@ -262,7 +262,6 @@ async fn node_reacts_to_stop_signal_during_initial_reorg_detection() {
drop(storage);

let opt = Cli {
revert_pending_l1_batch: false,
enable_consensus: false,
components: "core".parse().unwrap(),
};

0 comments on commit 3ac0f58

Please sign in to comment.