Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(network): sync with upstream yamux #2030

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 45 additions & 26 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions mm2src/mm2_p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ void = "1.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
instant = "0.1.12"
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.1", default-features = false, features = ["dns", "identify", "floodsub", "gossipsub", "noise", "ping", "request-response", "secp256k1", "tcp", "tokio", "websocket", "macros", "yamux"] }
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.2", default-features = false, features = ["dns", "identify", "floodsub", "gossipsub", "noise", "ping", "request-response", "secp256k1", "tcp", "tokio", "websocket", "macros", "yamux"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocker but I am wondering why are we still using the fork!

tokio = { version = "1.20", default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.1", default-features = false, features = ["identify", "floodsub", "noise", "gossipsub", "ping", "request-response", "secp256k1", "wasm-ext", "wasm-ext-websocket", "macros", "yamux"] }
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.2", default-features = false, features = ["identify", "floodsub", "noise", "gossipsub", "ping", "request-response", "secp256k1", "wasm-ext", "wasm-ext-websocket", "macros", "yamux"] }

[dev-dependencies]
async-std = "1.6.2"
Expand Down
5 changes: 4 additions & 1 deletion mm2src/mm2_p2p/src/behaviours/peers_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ impl<'de> Deserialize<'de> for PeerIdSerde {
#[derive(Debug, Clone)]
pub enum PeersExchangeProtocol {
Version1,
Version2,
}

impl AsRef<str> for PeersExchangeProtocol {
fn as_ref(&self) -> &str {
match self {
PeersExchangeProtocol::Version1 => "/peers-exchange/1",
PeersExchangeProtocol::Version2 => "/peers-exchange/2",
}
}
}
Expand Down Expand Up @@ -205,7 +207,8 @@ impl NetworkBehaviour for PeersExchange {
#[allow(clippy::new_without_default)]
impl PeersExchange {
pub fn new(network_info: NetworkInfo) -> Self {
let protocol = iter::once((PeersExchangeProtocol::Version1, ProtocolSupport::Full));
// We don't want to support V1 since it was only used in 7777 old layer.
let protocol = iter::once((PeersExchangeProtocol::Version2, ProtocolSupport::Full));
let config = RequestResponseConfig::default();
let request_response = RequestResponse::new(protocol, config);
PeersExchange {
Expand Down
5 changes: 4 additions & 1 deletion mm2src/mm2_p2p/src/behaviours/request_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ struct PendingRequest {
#[derive(Debug, Clone)]
pub enum Protocol {
Version1,
Version2,
}

impl AsRef<str> for Protocol {
fn as_ref(&self) -> &str {
match self {
Protocol::Version1 => "/request-response/1",
Protocol::Version2 => "/request-response/2",
}
}
}
Expand Down Expand Up @@ -393,7 +395,8 @@ impl From<libp2p::request_response::Event<PeerRequest, PeerResponse>> for Reques
/// Build a request-response network behaviour.
pub fn build_request_response_behaviour() -> RequestResponseBehaviour {
let config = RequestResponseConfig::default();
let protocol = core::iter::once((Protocol::Version1, ProtocolSupport::Full));
// We don't want to support V1 since it was only used in 7777 old layer.
let protocol = core::iter::once((Protocol::Version2, ProtocolSupport::Full));
let inner = RequestResponse::new(protocol, config);

let (tx, rx) = mpsc::unbounded();
Expand Down
Loading