Skip to content

Commit

Permalink
Merge branch 'main' into chore-move-to-alloy-pt4
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-aranha-cw authored Jan 31, 2025
2 parents 50bc209 + e577d1f commit 951bc9e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/eth/rpc/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -313,7 +313,7 @@ fn stratus_reset(_: Params<'_>, ctx: Arc<RpcContext>, _: Extensions) -> Result<J
Ok(to_json_value(true))
}

static MODE_CHANGE_SEMAPHORE: Lazy<Semaphore> = Lazy::new(|| Semaphore::new(1));
static MODE_CHANGE_SEMAPHORE: LazyLock<Semaphore> = LazyLock::new(|| Semaphore::new(1));

async fn stratus_change_to_leader(_: Params<'_>, ctx: Arc<RpcContext>, ext: Extensions) -> Result<JsonValue, StratusError> {
ext.authentication().auth_admin()?;
Expand Down
10 changes: 5 additions & 5 deletions src/globals.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -109,13 +109,13 @@ pub enum NodeMode {
// Global state
// -----------------------------------------------------------------------------

pub static STRATUS_SHUTDOWN_SIGNAL: Lazy<CancellationToken> = Lazy::new(CancellationToken::new);
pub static STRATUS_SHUTDOWN_SIGNAL: LazyLock<CancellationToken> = 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<Semaphore> = Lazy::new(|| Semaphore::new(Importer::TASKS_COUNT));
pub static IMPORTER_ONLINE_TASKS_SEMAPHORE: LazyLock<Semaphore> = LazyLock::new(|| Semaphore::new(Importer::TASKS_COUNT));

/// Transaction should be accepted?
static TRANSACTIONS_ENABLED: AtomicBool = AtomicBool::new(true);
Expand All @@ -126,7 +126,7 @@ static UNKNOWN_CLIENT_ENABLED: AtomicBool = AtomicBool::new(true);
/// Current node mode.
static NODE_MODE: Mutex<NodeMode> = Mutex::new(NodeMode::Follower);

static START_TIME: Lazy<DateTime<Utc>> = Lazy::new(Utc::now);
static START_TIME: LazyLock<DateTime<Utc>> = LazyLock::new(Utc::now);

#[derive(Serialize, Deserialize, Debug)]
pub struct GlobalState;
Expand Down Expand Up @@ -302,6 +302,6 @@ impl GlobalState {
}

pub fn setup_start_time() {
Lazy::force(&START_TIME);
LazyLock::force(&START_TIME);
}
}

0 comments on commit 951bc9e

Please sign in to comment.