diff --git a/Cargo.lock b/Cargo.lock index 4fb93ba707b8a..759da6164059e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13244,7 +13244,6 @@ dependencies = [ "axum 0.7.5", "bcs", "bytes", - "chrono", "clap", "consensus-config", "consensus-core", @@ -13262,9 +13261,7 @@ dependencies = [ "fs_extra", "futures", "im", - "indexmap 2.2.6", "itertools 0.13.0", - "jsonrpsee", "lru 0.10.0", "mockall", "moka", @@ -13298,7 +13295,6 @@ dependencies = [ "serde_with 3.9.0", "serde_yaml 0.8.26", "shared-crypto", - "signature 1.6.4", "static_assertions", "sui-archival", "sui-authority-aggregation", @@ -13325,12 +13321,10 @@ dependencies = [ "test-fuzz", "thiserror 1.0.64", "tokio", - "tokio-retry", "tokio-stream", "tracing", "twox-hash", "typed-store", - "zeroize", ] [[package]] @@ -16573,17 +16567,6 @@ dependencies = [ "x509-certificate", ] -[[package]] -name = "tokio-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" -dependencies = [ - "pin-project", - "rand 0.8.5", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" diff --git a/crates/sui-core/Cargo.toml b/crates/sui-core/Cargo.toml index 1724bf0e8ca67..532b6ea3fb5a1 100644 --- a/crates/sui-core/Cargo.toml +++ b/crates/sui-core/Cargo.toml @@ -16,7 +16,6 @@ async-trait.workspace = true axum.workspace = true bcs.workspace = true bytes.workspace = true -chrono.workspace = true consensus-core.workspace = true consensus-config.workspace = true count-min-sketch.workspace = true @@ -27,9 +26,7 @@ enum_dispatch.workspace = true eyre.workspace = true futures.workspace = true im.workspace = true -indexmap.workspace = true itertools.workspace = true -jsonrpsee.workspace = true lru.workspace = true mockall.workspace = true num_cpus.workspace = true @@ -45,13 +42,11 @@ scopeguard.workspace = true serde.workspace = true serde_json.workspace = true serde_with.workspace = true -signature.workspace = true static_assertions.workspace = true tap.workspace = true tempfile.workspace = true thiserror.workspace = true tokio = { workspace = true, features = ["full", "tracing", "test-util"] } -tokio-retry.workspace = true tokio-stream.workspace = true tracing.workspace = true twox-hash.workspace = true @@ -89,7 +84,6 @@ sui-simulator.workspace = true sui-storage.workspace = true sui-tls.workspace = true sui-types.workspace = true -zeroize.workspace = true nonempty.workspace = true [dev-dependencies] @@ -113,9 +107,6 @@ sui-move.workspace = true pprof.workspace = true test-fuzz.workspace = true -sui-macros.workspace = true -sui-protocol-config.workspace = true - # moka uses `quanta` by default for timing, which is not compatible with the simulator [target.'cfg(msim)'.dependencies] moka = { workspace = true, default-features = false, features = [ diff --git a/crates/sui-core/src/authority.rs b/crates/sui-core/src/authority.rs index cde9c5bc67231..0065f970200e7 100644 --- a/crates/sui-core/src/authority.rs +++ b/crates/sui-core/src/authority.rs @@ -13,7 +13,6 @@ use anyhow::anyhow; use arc_swap::{ArcSwap, Guard}; use async_trait::async_trait; use authority_per_epoch_store::CertLockGuard; -use chrono::prelude::*; use fastcrypto::encoding::Base58; use fastcrypto::encoding::Encoding; use fastcrypto::hash::MultisetHash; @@ -38,6 +37,8 @@ use std::io::Write; use std::path::{Path, PathBuf}; use std::sync::atomic::Ordering; use std::time::Duration; +use std::time::SystemTime; +use std::time::UNIX_EPOCH; use std::{ collections::{HashMap, HashSet}, fs, @@ -2667,8 +2668,11 @@ impl AuthorityState { } pub fn unixtime_now_ms() -> u64 { - let ts_ms = Utc::now().timestamp_millis(); - u64::try_from(ts_ms).expect("Travelling in time machine") + let now = SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("Time went backwards") + .as_millis(); + u64::try_from(now).expect("Travelling in time machine") } // TODO(fastpath): update this handler for Mysticeti fastpath. diff --git a/crates/sui-core/src/checkpoints/mod.rs b/crates/sui-core/src/checkpoints/mod.rs index 34659c2911a35..5903a9ba6004c 100644 --- a/crates/sui-core/src/checkpoints/mod.rs +++ b/crates/sui-core/src/checkpoints/mod.rs @@ -31,7 +31,6 @@ use sui_types::sui_system_state::epoch_start_sui_system_state::EpochStartSystemS use crate::authority::authority_per_epoch_store::AuthorityPerEpochStore; use crate::consensus_handler::SequencedConsensusTransactionKey; -use chrono::Utc; use rand::rngs::OsRng; use rand::seq::SliceRandom; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; @@ -40,7 +39,7 @@ use std::io::Write; use std::path::Path; use std::sync::Arc; use std::sync::Weak; -use std::time::Duration; +use std::time::{Duration, SystemTime}; use sui_protocol_config::ProtocolVersion; use sui_types::base_types::{AuthorityName, EpochId, TransactionDigest}; use sui_types::committee::StakeUnit; @@ -2011,7 +2010,7 @@ async fn diagnose_split_brain( checkpoint_seq = local_summary.sequence_number, "Running split brain diagnostics..." ); - let time = Utc::now(); + let time = SystemTime::now(); // collect one random disagreeing validator per differing digest let digest_to_validator = all_unique_values .iter() @@ -2163,7 +2162,8 @@ async fn diagnose_split_brain( let header = format!( "Checkpoint Fork Dump - Authority {local_validator:?}: \n\ - Datetime: {time}", + Datetime: {:?}", + time ); let fork_logs_text = format!("{header}\n\n{diff_patches}\n\n"); let path = tempfile::tempdir()