Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Migrate to `localtime` from `nakamoto`
Alexis Sellier committed 3 years ago
commit 3bc07195f5cee586cd9949ad9414807f4fcce726
parent d25c47ad0ebc0a9c7618f17378ba284a38b6e8f0
11 files changed +16 -30
modified Cargo.lock
@@ -1571,6 +1571,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"

[[package]]
+
name = "localtime"
+
version = "1.0.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "b58b1a2626b0920eec1d591e94c4feb3d1353695faad25c38f2a3c3efaf3db19"
+

+
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1646,17 +1652,6 @@ dependencies = [
]

[[package]]
-
name = "nakamoto-net"
-
version = "0.3.0"
-
source = "git+https://github.com/cloudhead/nakamoto?rev=90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
-
dependencies = [
-
 "crossbeam-channel",
-
 "fastrand",
-
 "log",
-
 "thiserror",
-
]
-

-
[[package]]
name = "netservices"
version = "0.1.0"
source = "git+https://github.com/cyphernet-dao/rust-netservices#50944dfcf1593ca568b8a1c3ee4b44fc05deb8ca"
@@ -2290,8 +2285,8 @@ dependencies = [
 "git-ref-format",
 "io-reactor",
 "lexopt",
+
 "localtime",
 "log",
-
 "nakamoto-net",
 "netservices",
 "nonempty 0.8.1",
 "qcheck",
modified Cargo.toml
@@ -28,11 +28,6 @@ inherits = "release"
debug = true
incremental = false

-
[patch.crates-io.nakamoto-net]
-
git = "https://github.com/cloudhead/nakamoto"
-
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
-
version = "0.3.0"
-

[patch.crates-io.io-reactor]
git = "https://github.com/rust-amplify/io-reactor"
rev = "6148aec926c82f08373687d1a9da07a2bca67ea3"
modified radicle-node/Cargo.toml
@@ -21,7 +21,7 @@ fastrand = { version = "1.8.0" }
git-ref-format = { version = "0", features = ["serde", "macro"] }
lexopt = { version = "0.2.1" }
log = { version = "0.4.17", features = ["std"] }
-
nakamoto-net = { version = "0.3.0" }
+
localtime = { version = "1" }
netservices = { version = "0", features = ["io-reactor", "socket2", "log"] }
nonempty = { version = "0.8.1", features = ["serialize"] }
io-reactor = { version = "0", features = ["popol", "socket2"] }
modified radicle-node/src/client.rs
@@ -46,9 +46,6 @@ pub enum Error {
    /// An I/O error.
    #[error("i/o error: {0}")]
    Io(#[from] io::Error),
-
    /// A networking error.
-
    #[error("network error: {0}")]
-
    Net(#[from] nakamoto_net::error::Error),
    /// A control socket error.
    #[error("control socket error: {0}")]
    Control(#[from] control::Error),
modified radicle-node/src/lib.rs
@@ -14,7 +14,7 @@ pub mod tests;
pub mod wire;
pub mod worker;

-
pub use nakamoto_net::{Io, LocalDuration, LocalTime};
+
pub use localtime::{LocalDuration, LocalTime};
pub use netservices::LinkDirection as Link;
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};

modified radicle-node/src/main.rs
@@ -2,7 +2,7 @@ use std::{env, net, process};

use anyhow::Context as _;
use cyphernet::addr::PeerAddr;
-
use nakamoto_net::LocalDuration;
+
use localtime::LocalDuration;

use radicle::profile;
use radicle_node::client::Runtime;
modified radicle-node/src/service.rs
@@ -16,9 +16,8 @@ use std::{fmt, io, net, str};

use crossbeam_channel as chan;
use fastrand::Rng;
+
use localtime::{LocalDuration, LocalTime};
use log::*;
-
use nakamoto::{LocalDuration, LocalTime};
-
use nakamoto_net as nakamoto;
use nonempty::NonEmpty;
use radicle::node::{Address, Features};
use radicle::storage::{Namespaces, ReadStorage};
@@ -395,7 +394,7 @@ where
        Ok(())
    }

-
    pub fn tick(&mut self, now: nakamoto::LocalTime) {
+
    pub fn tick(&mut self, now: LocalTime) {
        trace!("Tick +{}", now - self.start_time);

        self.clock = now;
modified radicle-node/src/service/config.rs
@@ -1,4 +1,4 @@
-
use super::nakamoto::LocalDuration;
+
use localtime::LocalDuration;

use radicle::node::Address;

modified radicle-node/src/service/routing.rs
@@ -196,7 +196,7 @@ impl Store for Table {

#[cfg(test)]
mod test {
-
    use nakamoto_net::LocalTime;
+
    use localtime::LocalTime;

    use super::*;
    use crate::test::arbitrary;
modified radicle-node/src/test/simulator.rs
@@ -9,8 +9,8 @@ use std::rc::Rc;
use std::sync::Arc;
use std::{fmt, io};

+
use localtime::{LocalDuration, LocalTime};
use log::*;
-
use nakamoto_net::{LocalDuration, LocalTime};

use crate::crypto::Signer;
use crate::prelude::Address;
modified radicle-node/src/wire/protocol.rs
@@ -12,7 +12,7 @@ use std::{fmt, io, net};
use amplify::Wrapper as _;
use crossbeam_channel as chan;
use cyphernet::{Cert, Digest, EcSign, Sha256};
-
use nakamoto_net::LocalTime;
+
use localtime::LocalTime;
use netservices::resource::{ListenerEvent, NetAccept, NetTransport, SessionEvent};
use netservices::session::ProtocolArtifact;
use netservices::session::{CypherReader, CypherSession, CypherWriter};