Skip to content

Commit

Permalink
feat(network)!: move network versioning away from sn_protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and maqi committed May 27, 2024
1 parent 2bf9430 commit f3453f0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions sn_networking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ encrypt-records = []


[dependencies]
lazy_static = "~1.4.0"
libp2p = { version = "0.53", features = [
"tokio",
"dns",
Expand Down Expand Up @@ -53,6 +54,7 @@ rand = { version = "~0.8.5", features = ["small_rng"] }
rayon = "1.8.0"
rmp-serde = "1.1.1"
serde = { version = "1.0.133", features = ["derive", "rc"] }
sn_build_info = { path="../sn_build_info", version = "0.1.7" }
sn_protocol = { path = "../sn_protocol", version = "0.16.7" }
sn_transfers = { path = "../sn_transfers", version = "0.18.1" }
sn_registers = { path = "../sn_registers", version = "0.3.13" }
Expand Down
8 changes: 4 additions & 4 deletions sn_networking/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ use crate::{
relay_manager::RelayManager,
replication_fetcher::ReplicationFetcher,
target_arch::{interval, spawn, Instant},
version::{
IDENTIFY_CLIENT_VERSION_STR, IDENTIFY_NODE_VERSION_STR, IDENTIFY_PROTOCOL_STR,
REQ_RESPONSE_VERSION_STR,
},
GetRecordError, Network, CLOSE_GROUP_SIZE,
};
use crate::{transport, NodeIssue};
Expand All @@ -48,10 +52,6 @@ use prometheus_client::registry::Registry;
use sn_protocol::{
messages::{ChunkProof, Nonce, Request, Response},
storage::RetryStrategy,
version::{
IDENTIFY_CLIENT_VERSION_STR, IDENTIFY_NODE_VERSION_STR, IDENTIFY_PROTOCOL_STR,
REQ_RESPONSE_VERSION_STR,
},
NetworkAddress, PrettyPrintKBucketKey, PrettyPrintRecordKey,
};
use sn_transfers::PaymentQuote;
Expand Down
14 changes: 8 additions & 6 deletions sn_networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
// permissions and limitations relating to use of the SAFE Network Software.

use crate::{
cmd::SwarmCmd, event::NodeEvent, multiaddr_is_global, multiaddr_strip_p2p,
relay_manager::is_a_relayed_peer, target_arch::Instant, NetworkEvent, Result, SwarmDriver,
cmd::SwarmCmd,
event::NodeEvent,
multiaddr_is_global, multiaddr_strip_p2p,
relay_manager::is_a_relayed_peer,
target_arch::Instant,
version::{IDENTIFY_NODE_VERSION_STR, IDENTIFY_PROTOCOL_STR},
NetworkEvent, Result, SwarmDriver,
};
use itertools::Itertools;
#[cfg(feature = "local-discovery")]
Expand All @@ -24,10 +29,7 @@ use libp2p::{
},
Multiaddr, PeerId, TransportError,
};
use sn_protocol::{
get_port_from_multiaddr,
version::{IDENTIFY_NODE_VERSION_STR, IDENTIFY_PROTOCOL_STR},
};
use sn_protocol::get_port_from_multiaddr;
use std::collections::HashSet;
use tokio::time::Duration;

Expand Down
1 change: 1 addition & 0 deletions sn_networking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mod spends;
pub mod target_arch;
mod transfers;
mod transport;
pub mod version;

// re-export arch dependent deps for use in the crate, or above
pub use target_arch::{interval, sleep, spawn, Instant, Interval};
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sn_peers_acquisition/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lazy_static = "~1.4.0"
libp2p = { version="0.53", features = [] }
rand = "0.8.5"
reqwest = { version="0.12.2", default-features=false, features = ["rustls-tls"], optional = true }
sn_protocol = { path = "../sn_protocol", version = "0.16.7" }
sn_networking = { path = "../sn_networking", version = "0.15.3" }
thiserror = "1.0.23"
tokio = { version = "1.32.0", optional = true, default-features = false}
tracing = { version = "~0.1.26" }
Expand Down
2 changes: 1 addition & 1 deletion sn_peers_acquisition/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use lazy_static::lazy_static;
use libp2p::{multiaddr::Protocol, Multiaddr};
use rand::{seq::SliceRandom, thread_rng};
#[cfg(feature = "network-contacts")]
use sn_protocol::version::get_network_version;
use sn_networking::version::get_network_version;
use tracing::*;
#[cfg(feature = "network-contacts")]
use url::Url;
Expand Down
2 changes: 0 additions & 2 deletions sn_protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ crdts = { version = "7.3", default-features = false, features = ["merkle"] }
custom_debug = "~0.6.1"
dirs-next = "~2.0.0"
hex = "~0.4.3"
lazy_static = "~1.4.0"
libp2p = { version="0.53", features = ["identify", "kad"] }
rmp-serde = "1.1.1"
serde = { version = "1.0.133", features = [ "derive", "rc" ]}
serde_json = "1.0"
sha2 = "0.10.7"
sn_build_info = { path="../sn_build_info", version = "0.1.7" }
sn_transfers = { path = "../sn_transfers", version = "0.18.1" }
sn_registers = { path = "../sn_registers", version = "0.3.13" }
thiserror = "1.0.23"
Expand Down
2 changes: 0 additions & 2 deletions sn_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub mod node;
pub mod node_rpc;
/// Storage types for spends, chunks and registers.
pub mod storage;
/// The network versioning logic
pub mod version;

// this includes code generated from .proto files
#[allow(clippy::unwrap_used)]
Expand Down

0 comments on commit f3453f0

Please sign in to comment.