Skip to content

Commit

Permalink
chore(node): Replace instant crate with web-time (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique authored May 20, 2024
1 parent eea06e4 commit e0ced8d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["macros", "sync"] }
tokio-util = "0.7.9"
tracing = "0.1.37"
web-time = "1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
backoff = { version = "0.4.0", features = ["tokio"] }
Expand Down
2 changes: 1 addition & 1 deletion node/src/daser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ use celestia_tendermint::Time;
use celestia_types::ExtendedHeader;
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use instant::{Duration, Instant};
use rand::Rng;
use tokio::select;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, warn};
use web_time::{Duration, Instant};

use crate::executor::spawn;
use crate::p2p::shwap::sample_cid;
Expand Down
2 changes: 1 addition & 1 deletion node/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use celestia_types::{fraud_proof::BadEncodingFraudProof, hash::Hash};
use celestia_types::{ExtendedHeader, FraudProof, Height};
use cid::Cid;
use futures::StreamExt;
use instant::Instant;
use libp2p::{
autonat,
core::{ConnectedPoint, Endpoint},
Expand All @@ -49,6 +48,7 @@ use tokio::select;
use tokio::sync::{mpsc, oneshot, watch};
use tokio_util::sync::CancellationToken;
use tracing::{debug, info, instrument, trace, warn};
use web_time::Instant;

mod header_ex;
mod header_session;
Expand Down
2 changes: 1 addition & 1 deletion node/src/p2p/header_ex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use async_trait::async_trait;
use celestia_proto::p2p::pb::{HeaderRequest, HeaderResponse};
use celestia_types::ExtendedHeader;
use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use instant::{Duration, Instant};
use libp2p::{
core::Endpoint,
request_response::{self, Codec, InboundFailure, OutboundFailure, ProtocolSupport},
Expand All @@ -19,6 +18,7 @@ use libp2p::{
};
use prost::Message;
use tracing::{debug, instrument, warn};
use web_time::{Duration, Instant};

mod client;
mod server;
Expand Down
2 changes: 1 addition & 1 deletion node/src/p2p/swarm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use instant::Duration;
use libp2p::{identity::Keypair, swarm::NetworkBehaviour, Swarm, SwarmBuilder};
use web_time::Duration;

use crate::p2p::P2pError;

Expand Down

0 comments on commit e0ced8d

Please sign in to comment.