From ca07ce4d6455583794558c076e2719660abb46b2 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 26 Aug 2022 07:08:33 +0200 Subject: [PATCH] swarm/behaviour: Remove deprecated NetworkBehaviourEventProcess (#2840) Removes the `NetworkBehaviourEventProcess` and all its associated logic. See deprecation pull request https://github.com/libp2p/rust-libp2p/pull/2784. Find rational in https://github.com/libp2p/rust-libp2p/pull/2751. --- CHANGELOG.md | 22 ++++++++++ Cargo.toml | 30 +++++++------- misc/metrics/CHANGELOG.md | 14 +++++++ misc/metrics/Cargo.toml | 16 ++++---- protocols/autonat/CHANGELOG.md | 6 +++ protocols/autonat/Cargo.toml | 6 +-- protocols/dcutr/CHANGELOG.md | 4 ++ protocols/dcutr/Cargo.toml | 4 +- protocols/floodsub/CHANGELOG.md | 4 ++ protocols/floodsub/Cargo.toml | 4 +- protocols/gossipsub/CHANGELOG.md | 4 ++ protocols/gossipsub/Cargo.toml | 4 +- protocols/identify/CHANGELOG.md | 4 ++ protocols/identify/Cargo.toml | 4 +- protocols/kad/CHANGELOG.md | 4 ++ protocols/kad/Cargo.toml | 4 +- protocols/mdns/CHANGELOG.md | 4 ++ protocols/mdns/Cargo.toml | 4 +- protocols/ping/CHANGELOG.md | 4 ++ protocols/ping/Cargo.toml | 4 +- protocols/relay/CHANGELOG.md | 4 ++ protocols/relay/Cargo.toml | 4 +- protocols/rendezvous/CHANGELOG.md | 4 ++ protocols/rendezvous/Cargo.toml | 4 +- protocols/request-response/CHANGELOG.md | 4 ++ protocols/request-response/Cargo.toml | 4 +- swarm-derive/CHANGELOG.md | 4 ++ swarm-derive/Cargo.toml | 2 +- swarm-derive/src/lib.rs | 53 ++----------------------- swarm-derive/tests/test.rs | 35 ---------------- swarm/CHANGELOG.md | 7 ++++ swarm/Cargo.toml | 2 +- swarm/src/behaviour.rs | 18 --------- swarm/src/behaviour/either.rs | 17 -------- swarm/src/behaviour/toggle.rs | 14 ------- swarm/src/lib.rs | 2 - 36 files changed, 145 insertions(+), 183 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbbc8fb1d8..b9d574ea35f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,28 @@ # `libp2p` facade crate +# 0.48.0 [unreleased] + +- Update to [`libp2p-dcutr` `v0.6.0`](protocols/dcutr/CHANGELOG.md#060). + +- Update to [`libp2p-rendezvous` `v0.9.0`](protocols/rendezvous/CHANGELOG.md#090). + +- Update to [`libp2p-ping` `v0.39.0`](protocols/ping/CHANGELOG.md#0390). + +- Update to [`libp2p-identify` `v0.39.0`](protocols/identify/CHANGELOG.md#0390). + +- Update to [`libp2p-floodsub` `v0.39.0`](protocols/floodsub/CHANGELOG.md#0390). + +- Update to [`libp2p-relay` `v0.12.0`](protocols/relay/CHANGELOG.md#0120). + +- Update to [`libp2p-metrics` `v0.9.0`](misc/metrics/CHANGELOG.md#090). + +- Update to [`libp2p-kad` `v0.40.0`](protocols/kad/CHANGELOG.md#0400). + +- Update to [`libp2p-autonat` `v0.7.0`](protocols/autonat/CHANGELOG.md#070). + +- Update to [`libp2p-request-response` `v0.21.0`](protocols/request-response/CHANGELOG.md#0210). + # 0.47.0 - Update to [`libp2p-dcutr` `v0.5.0`](protocols/dcutr/CHANGELOG.md#050). diff --git a/Cargo.toml b/Cargo.toml index 75867ddbf4f..b64c2f68756 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = "1.60.0" description = "Peer-to-peer networking library" -version = "0.47.0" +version = "0.48.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -77,23 +77,23 @@ getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature instant = "0.1.11" # Explicit dependency to be used in `wasm-bindgen` feature lazy_static = "1.2" -libp2p-autonat = { version = "0.6.0", path = "protocols/autonat", optional = true } +libp2p-autonat = { version = "0.7.0", path = "protocols/autonat", optional = true } libp2p-core = { version = "0.35.0", path = "core", default-features = false } -libp2p-dcutr = { version = "0.5.0", path = "protocols/dcutr", optional = true } -libp2p-floodsub = { version = "0.38.0", path = "protocols/floodsub", optional = true } -libp2p-identify = { version = "0.38.0", path = "protocols/identify", optional = true } -libp2p-kad = { version = "0.39.0", path = "protocols/kad", optional = true } -libp2p-metrics = { version = "0.8.0", path = "misc/metrics", optional = true } +libp2p-dcutr = { version = "0.6.0", path = "protocols/dcutr", optional = true } +libp2p-floodsub = { version = "0.39.0", path = "protocols/floodsub", optional = true } +libp2p-identify = { version = "0.39.0", path = "protocols/identify", optional = true } +libp2p-kad = { version = "0.40.0", path = "protocols/kad", optional = true } +libp2p-metrics = { version = "0.9.0", path = "misc/metrics", optional = true } libp2p-mplex = { version = "0.35.0", path = "muxers/mplex", optional = true } libp2p-noise = { version = "0.38.0", path = "transports/noise", optional = true } -libp2p-ping = { version = "0.38.0", path = "protocols/ping", optional = true } +libp2p-ping = { version = "0.39.0", path = "protocols/ping", optional = true } libp2p-plaintext = { version = "0.35.0", path = "transports/plaintext", optional = true } libp2p-pnet = { version = "0.22.0", path = "transports/pnet", optional = true } -libp2p-relay = { version = "0.11.0", path = "protocols/relay", optional = true } -libp2p-rendezvous = { version = "0.8.0", path = "protocols/rendezvous", optional = true } -libp2p-request-response = { version = "0.20.0", path = "protocols/request-response", optional = true } -libp2p-swarm = { version = "0.38.0", path = "swarm" } -libp2p-swarm-derive = { version = "0.29.0", path = "swarm-derive" } +libp2p-relay = { version = "0.12.0", path = "protocols/relay", optional = true } +libp2p-rendezvous = { version = "0.9.0", path = "protocols/rendezvous", optional = true } +libp2p-request-response = { version = "0.21.0", path = "protocols/request-response", optional = true } +libp2p-swarm = { version = "0.39.0", path = "swarm" } +libp2p-swarm-derive = { version = "0.30.0", path = "swarm-derive" } libp2p-uds = { version = "0.34.0", path = "transports/uds", optional = true } libp2p-wasm-ext = { version = "0.35.0", path = "transports/wasm-ext", default-features = false, optional = true } libp2p-yamux = { version = "0.39.0", path = "muxers/yamux", optional = true } @@ -106,12 +106,12 @@ smallvec = "1.6.1" [target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] libp2p-deflate = { version = "0.35.0", path = "transports/deflate", optional = true } libp2p-dns = { version = "0.35.0", path = "transports/dns", optional = true, default-features = false } -libp2p-mdns = { version = "0.39.0", path = "protocols/mdns", optional = true } +libp2p-mdns = { version = "0.40.0", path = "protocols/mdns", optional = true } libp2p-tcp = { version = "0.35.0", path = "transports/tcp", default-features = false, optional = true } libp2p-websocket = { version = "0.37.0", path = "transports/websocket", optional = true } [target.'cfg(not(target_os = "unknown"))'.dependencies] -libp2p-gossipsub = { version = "0.40.0", path = "protocols/gossipsub", optional = true } +libp2p-gossipsub = { version = "0.41.0", path = "protocols/gossipsub", optional = true } [dev-dependencies] async-std = { version = "1.6.2", features = ["attributes"] } diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index 8618e0b7130..72007e39c8b 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -1,3 +1,17 @@ +# 0.9.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + +- Update to `libp2p-dcutr` `v0.6.0`. + +- Update to `libp2p-ping` `v0.39.0`. + +- Update to `libp2p-identify` `v0.39.0`. + +- Update to `libp2p-relay` `v0.12.0`. + +- Update to `libp2p-kad` `v0.40.0`. + # 0.8.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index 4bfeb7aa481..fe2e4f3ec85 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-metrics" edition = "2021" rust-version = "1.56.1" description = "Metrics for libp2p" -version = "0.8.0" +version = "0.9.0" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -20,16 +20,16 @@ dcutr = ["libp2p-dcutr"] [dependencies] libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-dcutr = { version = "0.5.0", path = "../../protocols/dcutr", optional = true } -libp2p-identify = { version = "0.38.0", path = "../../protocols/identify", optional = true } -libp2p-kad = { version = "0.39.0", path = "../../protocols/kad", optional = true } -libp2p-ping = { version = "0.38.0", path = "../../protocols/ping", optional = true } -libp2p-relay = { version = "0.11.0", path = "../../protocols/relay", optional = true } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-dcutr = { version = "0.6.0", path = "../../protocols/dcutr", optional = true } +libp2p-identify = { version = "0.39.0", path = "../../protocols/identify", optional = true } +libp2p-kad = { version = "0.40.0", path = "../../protocols/kad", optional = true } +libp2p-ping = { version = "0.39.0", path = "../../protocols/ping", optional = true } +libp2p-relay = { version = "0.12.0", path = "../../protocols/relay", optional = true } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } prometheus-client = "0.18.0" [target.'cfg(not(target_os = "unknown"))'.dependencies] -libp2p-gossipsub = { version = "0.40.0", path = "../../protocols/gossipsub", optional = true } +libp2p-gossipsub = { version = "0.41.0", path = "../../protocols/gossipsub", optional = true } [dev-dependencies] log = "0.4.0" diff --git a/protocols/autonat/CHANGELOG.md b/protocols/autonat/CHANGELOG.md index 5856a6a3c82..f6c4b9d619c 100644 --- a/protocols/autonat/CHANGELOG.md +++ b/protocols/autonat/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.7.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + +- Update to `libp2p-request-response` `v0.21.0`. + # 0.6.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/autonat/Cargo.toml b/protocols/autonat/Cargo.toml index 6ec668e4fdc..e6818a74817 100644 --- a/protocols/autonat/Cargo.toml +++ b/protocols/autonat/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-autonat" edition = "2021" rust-version = "1.56.1" description = "NAT and firewall detection for libp2p" -version = "0.6.0" +version = "0.7.0" authors = ["David Craven ", "Elena Frank "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -19,8 +19,8 @@ futures = "0.3" futures-timer = "3.0" instant = "0.1" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } -libp2p-request-response = { version = "0.20.0", path = "../request-response" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } +libp2p-request-response = { version = "0.21.0", path = "../request-response" } log = "0.4" rand = "0.8" prost = "0.11" diff --git a/protocols/dcutr/CHANGELOG.md b/protocols/dcutr/CHANGELOG.md index 8c8837d0d02..a572d84bcf0 100644 --- a/protocols/dcutr/CHANGELOG.md +++ b/protocols/dcutr/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.6.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.5.1 - Make default features of `libp2p-core` optional. See [PR 2836]. diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index c82b5e5274f..08d2815c6d9 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-dcutr" edition = "2021" rust-version = "1.56.1" description = "Direct connection upgrade through relay" -version = "0.5.1" +version = "0.6.0" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -18,7 +18,7 @@ futures = "0.3.1" futures-timer = "3.0" instant = "0.1.11" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4" prost-codec = { version = "0.2", path = "../../misc/prost-codec" } prost = "0.11" diff --git a/protocols/floodsub/CHANGELOG.md b/protocols/floodsub/CHANGELOG.md index 2e02a7ded1f..cbe061e6959 100644 --- a/protocols/floodsub/CHANGELOG.md +++ b/protocols/floodsub/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.39.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.38.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/floodsub/Cargo.toml b/protocols/floodsub/Cargo.toml index 8c2631e5ce8..2b9ef8ee402 100644 --- a/protocols/floodsub/Cargo.toml +++ b/protocols/floodsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-floodsub" edition = "2021" rust-version = "1.56.1" description = "Floodsub protocol for libp2p" -version = "0.38.0" +version = "0.39.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -15,7 +15,7 @@ cuckoofilter = "0.5.0" fnv = "1.0" futures = "0.3.1" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4" prost = "0.11" rand = "0.7" diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 2c55be28e85..dad83493795 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.41.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.40.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 42b21e41a97..c551d59cb14 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-gossipsub" edition = "2021" rust-version = "1.56.1" description = "Gossipsub protocol for libp2p" -version = "0.40.0" +version = "0.41.0" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -11,7 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } bytes = "1.0" byteorder = "1.3.4" diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 8821bca3507..47af0838ae8 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.39.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.38.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 9db09cd1bf2..d0bc65379ad 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-identify" edition = "2021" rust-version = "1.56.1" description = "Nodes identifcation protocol for libp2p" -version = "0.38.0" +version = "0.39.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -15,7 +15,7 @@ asynchronous-codec = "0.6" futures = "0.3.1" futures-timer = "3.0.2" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4.1" lru = "0.7.2" prost-codec = { version = "0.2", path = "../../misc/prost-codec" } diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 09f2035ef2b..4fef2057008 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.40.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.39.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index d1910dccbbb..bf7d0957bd3 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-kad" edition = "2021" rust-version = "1.56.1" description = "Kademlia protocol for libp2p" -version = "0.39.0" +version = "0.40.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -19,7 +19,7 @@ asynchronous-codec = "0.6" futures = "0.3.1" log = "0.4" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } prost = "0.11" rand = "0.7.2" sha2 = "0.10.0" diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index c6541f7eccc..a6b05044fa5 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.40.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.39.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index bb060c9ed1f..306f052cc69 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-mdns" edition = "2021" rust-version = "1.56.1" -version = "0.39.0" +version = "0.40.0" description = "Implementation of the libp2p mDNS discovery method" authors = ["Parity Technologies "] license = "MIT" @@ -18,7 +18,7 @@ futures = "0.3.13" if-watch = "1.1.1" lazy_static = "1.4.0" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4.14" rand = "0.8.3" smallvec = "1.6.1" diff --git a/protocols/ping/CHANGELOG.md b/protocols/ping/CHANGELOG.md index d163839733a..cf1f2fedf42 100644 --- a/protocols/ping/CHANGELOG.md +++ b/protocols/ping/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.39.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.38.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index 14984332db7..568f8f83aac 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-ping" edition = "2021" rust-version = "1.56.1" description = "Ping protocol for libp2p" -version = "0.38.0" +version = "0.39.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -15,7 +15,7 @@ futures = "0.3.1" futures-timer = "3.0.2" instant = "0.1.11" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4.1" rand = "0.7.2" void = "1.0" diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 537abff7edc..e02a3ef8b82 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.12.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.11.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 4a7396f938b..ee059d02d50 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-relay" edition = "2021" rust-version = "1.56.1" description = "Communications relaying for libp2p" -version = "0.11.0" +version = "0.12.0" authors = ["Parity Technologies ", "Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -18,7 +18,7 @@ futures = "0.3.1" futures-timer = "3" instant = "0.1.11" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4" pin-project = "1" prost-codec = { version = "0.2", path = "../../misc/prost-codec" } diff --git a/protocols/rendezvous/CHANGELOG.md b/protocols/rendezvous/CHANGELOG.md index 728a1538c9e..f2ba00df164 100644 --- a/protocols/rendezvous/CHANGELOG.md +++ b/protocols/rendezvous/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.8.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index 833fee1f19d..a21dd300447 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-rendezvous" edition = "2021" rust-version = "1.56.1" description = "Rendezvous protocol for libp2p" -version = "0.8.0" +version = "0.9.0" authors = ["The COMIT guys "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] asynchronous-codec = "0.6" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } prost = "0.11" void = "1" log = "0.4" diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 0008f1a1d01..aef9f49f72f 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.21.0 [unreleased] + +- Update to `libp2p-swarm` `v0.39.0`. + # 0.20.0 - Update to `libp2p-swarm` `v0.38.0`. diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index 91f95484f73..c2649de6012 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-request-response" edition = "2021" rust-version = "1.56.1" description = "Generic Request/Response Protocols" -version = "0.20.0" +version = "0.21.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -16,7 +16,7 @@ bytes = "1" futures = "0.3.1" instant = "0.1.11" libp2p-core = { version = "0.35.0", path = "../../core", default-features = false } -libp2p-swarm = { version = "0.38.0", path = "../../swarm" } +libp2p-swarm = { version = "0.39.0", path = "../../swarm" } log = "0.4.11" rand = "0.7" smallvec = "1.6.1" diff --git a/swarm-derive/CHANGELOG.md b/swarm-derive/CHANGELOG.md index f9056f6093a..5cf840c331c 100644 --- a/swarm-derive/CHANGELOG.md +++ b/swarm-derive/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.30.0 - [unreleased] + +- Remove support for removed `NetworkBehaviourEventProcess`. + # 0.29.0 - Generate `NetworkBehaviour::OutEvent` if not provided through `#[behaviour(out_event = diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index 05ed063257d..89ee54447fc 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-swarm-derive" edition = "2021" rust-version = "1.56.1" description = "Procedural macros of libp2p-core" -version = "0.29.0" +version = "0.30.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm-derive/src/lib.rs b/swarm-derive/src/lib.rs index 51305e38190..0369a67c5ea 100644 --- a/swarm-derive/src/lib.rs +++ b/swarm-derive/src/lib.rs @@ -48,7 +48,6 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { let (_, ty_generics, where_clause) = ast.generics.split_for_impl(); let multiaddr = quote! {::libp2p::core::Multiaddr}; let trait_to_impl = quote! {::libp2p::swarm::NetworkBehaviour}; - let net_behv_event_proc = quote! {::libp2p::swarm::NetworkBehaviourEventProcess}; let either_ident = quote! {::libp2p::core::either::EitherOutput}; let network_behaviour_action = quote! {::libp2p::swarm::NetworkBehaviourAction}; let into_connection_handler = quote! {::libp2p::swarm::IntoConnectionHandler}; @@ -71,28 +70,6 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { quote! {<#(#lf,)* #(#tp,)* #(#cst,)*>} }; - // Whether or not we require the `NetworkBehaviourEventProcess` trait to be implemented. - let event_process = { - let mut event_process = false; - - for meta_items in ast.attrs.iter().filter_map(get_meta_items) { - for meta_item in meta_items { - match meta_item { - syn::NestedMeta::Meta(syn::Meta::NameValue(ref m)) - if m.path.is_ident("event_process") => - { - if let syn::Lit::Bool(ref b) = m.lit { - event_process = b.value - } - } - _ => (), - } - } - } - - event_process - }; - // The fields of the struct we are interested in (no ignored fields). let data_struct_fields = data_struct .fields @@ -121,9 +98,9 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { }) .next(); - match (user_provided_out_event_name, event_process) { + match user_provided_out_event_name { // User provided `OutEvent`. - (Some(name), false) => { + Some(name) => { let definition = None; let from_clauses = data_struct_fields .iter() @@ -135,7 +112,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { (name, definition, from_clauses) } // User did not provide `OutEvent`. Generate it. - (None, false) => { + None => { let name: syn::Type = syn::parse_str(&(ast.ident.to_string() + "Event")).unwrap(); let definition = { let fields = data_struct_fields @@ -170,22 +147,6 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { let from_clauses = vec![]; (name, definition, from_clauses) } - // User uses `NetworkBehaviourEventProcess`. - (name, true) => { - let definition = None; - let from_clauses = data_struct_fields - .iter() - .map(|field| { - let ty = &field.ty; - quote! {Self: #net_behv_event_proc<<#ty as #trait_to_impl>::OutEvent>} - }) - .collect::>(); - ( - name.unwrap_or_else(|| syn::parse_str("()").unwrap()), - definition, - from_clauses, - ) - } } }; @@ -545,13 +506,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { out_handler.unwrap_or(quote! {()}) // TODO: See test `empty`. }; - let generate_event_match_arm = if event_process { - quote! { - std::task::Poll::Ready(#network_behaviour_action::GenerateEvent(event)) => { - #net_behv_event_proc::inject_event(self, event) - } - } - } else { + let generate_event_match_arm = { // If the `NetworkBehaviour`'s `OutEvent` is generated by the derive macro, wrap the sub // `NetworkBehaviour` `OutEvent` in the variant of the generated `OutEvent`. If the // `NetworkBehaviour`'s `OutEvent` is provided by the user, use the corresponding `From` diff --git a/swarm-derive/tests/test.rs b/swarm-derive/tests/test.rs index f4a313198a9..61c95cd8aaa 100644 --- a/swarm-derive/tests/test.rs +++ b/swarm-derive/tests/test.rs @@ -460,41 +460,6 @@ fn mixed_field_order() { } } -#[test] -fn event_process() { - #[allow(dead_code)] - #[derive(NetworkBehaviour)] - #[behaviour(event_process = true)] - struct Foo { - ping: libp2p::ping::Ping, - identify: libp2p::identify::Identify, - } - - impl libp2p::swarm::NetworkBehaviourEventProcess for Foo { - fn inject_event(&mut self, _: libp2p::identify::IdentifyEvent) {} - } - - impl libp2p::swarm::NetworkBehaviourEventProcess for Foo { - fn inject_event(&mut self, _: libp2p::ping::PingEvent) {} - } - - #[allow(dead_code, unreachable_code)] - fn bar() { - require_net_behaviour::(); - - let mut _swarm: libp2p::Swarm = unimplemented!(); - - let _ = async { - loop { - match _swarm.select_next_some().await { - SwarmEvent::Behaviour(()) => break, - _ => {} - } - } - }; - } -} - #[test] fn generated_out_event_derive_debug() { #[allow(dead_code)] diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 61175ae0762..75add0d524a 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,3 +1,10 @@ +# 0.39.0 - [unreleased] + +- Remove deprecated `NetworkBehaviourEventProcess`. See [libp2p-swarm v0.38.0 changelog entry] for + migration path. + +[libp2p-swarm v0.38.0 changelog entry]: https://github.com/libp2p/rust-libp2p/blob/master/swarm/CHANGELOG.md#0380 + # 0.38.0 - Deprecate `NetworkBehaviourEventProcess`. When deriving `NetworkBehaviour` on a custom `struct` users diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index e2829f80093..6f4a87adb0d 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-swarm" edition = "2021" rust-version = "1.56.1" description = "The libp2p swarm" -version = "0.38.0" +version = "0.39.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm/src/behaviour.rs b/swarm/src/behaviour.rs index c0ac597680c..9c4a10b56cd 100644 --- a/swarm/src/behaviour.rs +++ b/swarm/src/behaviour.rs @@ -321,24 +321,6 @@ pub trait PollParameters { fn local_peer_id(&self) -> &PeerId; } -/// When deriving [`NetworkBehaviour`] this trait must by default be implemented for all the -/// possible event types generated by the inner behaviours. -/// -/// You can opt out of this behaviour through `#[behaviour(event_process = false)]`. See the -/// documentation of [`NetworkBehaviour`] for details. -#[deprecated( - since = "0.38.0", - note = "Use `#[behaviour(out_event = \"MyBehaviourEvent\")]` instead. See \ - https://github.com/libp2p/rust-libp2p/blob/master/swarm/CHANGELOG.md#0380 \ - for instructions on how to migrate. Will be removed with \ - https://github.com/libp2p/rust-libp2p/pull/2751." -)] -pub trait NetworkBehaviourEventProcess { - /// Called when one of the fields of the type you're deriving `NetworkBehaviour` on generates - /// an event. - fn inject_event(&mut self, event: TEvent); -} - /// An action that a [`NetworkBehaviour`] can trigger in the [`Swarm`] /// in whose context it is executing. /// diff --git a/swarm/src/behaviour/either.rs b/swarm/src/behaviour/either.rs index fc4c50e63ef..6bb1d95a519 100644 --- a/swarm/src/behaviour/either.rs +++ b/swarm/src/behaviour/either.rs @@ -19,8 +19,6 @@ // DEALINGS IN THE SOFTWARE. use crate::handler::{either::IntoEitherHandler, ConnectionHandler, IntoConnectionHandler}; -#[allow(deprecated)] -pub use crate::NetworkBehaviourEventProcess; use crate::{DialError, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use either::Either; use libp2p_core::{ @@ -235,18 +233,3 @@ where Poll::Ready(event) } } - -#[allow(deprecated)] -impl NetworkBehaviourEventProcess - for Either -where - TBehaviourLeft: NetworkBehaviourEventProcess, - TBehaviourRight: NetworkBehaviourEventProcess, -{ - fn inject_event(&mut self, event: TEvent) { - match self { - Either::Left(a) => a.inject_event(event), - Either::Right(b) => b.inject_event(event), - } - } -} diff --git a/swarm/src/behaviour/toggle.rs b/swarm/src/behaviour/toggle.rs index 64ebdf779e5..07a15d56da9 100644 --- a/swarm/src/behaviour/toggle.rs +++ b/swarm/src/behaviour/toggle.rs @@ -23,8 +23,6 @@ use crate::handler::{ KeepAlive, SubstreamProtocol, }; use crate::upgrade::{InboundUpgradeSend, OutboundUpgradeSend, SendWrapper}; -#[allow(deprecated)] -pub use crate::NetworkBehaviourEventProcess; use crate::{DialError, NetworkBehaviour, NetworkBehaviourAction, PollParameters}; use either::Either; use libp2p_core::{ @@ -232,18 +230,6 @@ where } } -#[allow(deprecated)] -impl NetworkBehaviourEventProcess for Toggle -where - TBehaviour: NetworkBehaviourEventProcess, -{ - fn inject_event(&mut self, event: TEvent) { - if let Some(inner) = self.inner.as_mut() { - inner.inject_event(event); - } - } -} - /// Implementation of `IntoConnectionHandler` that can be in the disabled state. pub struct ToggleIntoConnectionHandler { inner: Option, diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index 38df855cff5..230de4631db 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -63,8 +63,6 @@ pub mod behaviour; pub mod dial_opts; pub mod handler; -#[allow(deprecated)] -pub use behaviour::NetworkBehaviourEventProcess; pub use behaviour::{ CloseConnection, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, };