diff --git a/Cargo.lock b/Cargo.lock index 56d35da3c..93c795d53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5372,14 +5372,12 @@ dependencies = [ "itertools 0.13.0", "jsonrpsee", "keccak-hasher", - "lazy_static", "log", "metrics", "metrics-exporter-prometheus", "nanoid", "nom", "nonempty", - "once_cell", "oneshot", "opentelemetry", "opentelemetry-otlp", diff --git a/Cargo.toml b/Cargo.toml index 6c676c243..5fb06ca3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,10 +25,8 @@ hex-literal = "=0.4.1" humantime = "=2.1.0" indexmap = { version = "=2.7.1", features = ["serde"] } itertools = "=0.13.0" -lazy_static = "=1.4.0" nanoid = "=0.4.0" nonempty = { version = "=0.10.0", features = ["serialize"] } -once_cell = "=1.19.0" oneshot = "=0.1.8" parking_lot = "=0.12.3" paste = "=1.0.15" diff --git a/src/eth/rpc/rpc_server.rs b/src/eth/rpc/rpc_server.rs index 87c035fe2..67190ab5b 100644 --- a/src/eth/rpc/rpc_server.rs +++ b/src/eth/rpc/rpc_server.rs @@ -4,6 +4,7 @@ use std::collections::HashMap; use std::ops::Deref; use std::str::FromStr; use std::sync::Arc; +use std::sync::LazyLock; use std::time::Duration; use alloy_rpc_types_trace::geth::GethDebugTracingOptions; @@ -21,7 +22,6 @@ use jsonrpsee::types::Params; use jsonrpsee::Extensions; use jsonrpsee::IntoSubscriptionCloseResponse; use jsonrpsee::PendingSubscriptionSink; -use once_cell::sync::Lazy; use serde_json::json; use tokio::runtime::Handle; use tokio::select; @@ -313,7 +313,7 @@ fn stratus_reset(_: Params<'_>, ctx: Arc, _: Extensions) -> Result = Lazy::new(|| Semaphore::new(1)); +static MODE_CHANGE_SEMAPHORE: LazyLock = LazyLock::new(|| Semaphore::new(1)); async fn stratus_change_to_leader(_: Params<'_>, ctx: Arc, ext: Extensions) -> Result { ext.authentication().auth_admin()?; diff --git a/src/globals.rs b/src/globals.rs index 0fe3fe474..10acf321d 100644 --- a/src/globals.rs +++ b/src/globals.rs @@ -1,10 +1,10 @@ use std::fmt::Debug; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; +use std::sync::LazyLock; use chrono::DateTime; use chrono::Utc; -use once_cell::sync::Lazy; use parking_lot::Mutex; use sentry::ClientInitGuard; use serde::Deserialize; @@ -109,13 +109,13 @@ pub enum NodeMode { // Global state // ----------------------------------------------------------------------------- -pub static STRATUS_SHUTDOWN_SIGNAL: Lazy = Lazy::new(CancellationToken::new); +pub static STRATUS_SHUTDOWN_SIGNAL: LazyLock = LazyLock::new(CancellationToken::new); /// Importer is running or being shut-down? static IMPORTER_SHUTDOWN: AtomicBool = AtomicBool::new(true); /// A guard that is taken when importer is running. -pub static IMPORTER_ONLINE_TASKS_SEMAPHORE: Lazy = Lazy::new(|| Semaphore::new(Importer::TASKS_COUNT)); +pub static IMPORTER_ONLINE_TASKS_SEMAPHORE: LazyLock = LazyLock::new(|| Semaphore::new(Importer::TASKS_COUNT)); /// Transaction should be accepted? static TRANSACTIONS_ENABLED: AtomicBool = AtomicBool::new(true); @@ -126,7 +126,7 @@ static UNKNOWN_CLIENT_ENABLED: AtomicBool = AtomicBool::new(true); /// Current node mode. static NODE_MODE: Mutex = Mutex::new(NodeMode::Follower); -static START_TIME: Lazy> = Lazy::new(Utc::now); +static START_TIME: LazyLock> = LazyLock::new(Utc::now); #[derive(Serialize, Deserialize, Debug)] pub struct GlobalState; @@ -302,6 +302,6 @@ impl GlobalState { } pub fn setup_start_time() { - Lazy::force(&START_TIME); + LazyLock::force(&START_TIME); } }