Skip to content

Commit 2371922

Browse files
authored
feat(gossipsub): introduce backpressure
superseeds #4914 with some changes and improvements, namely: - introduce a `Delay` for `Forward` and `Publish` messages, messages that take more than the configured delay to be sent are discarded - introduce scoring and penalize slow peers - remove control pool - report slow peers with the number of failed messages Pull-Request: #5595.
1 parent 00588a5 commit 2371922

File tree

15 files changed

+2201
-1058
lines changed

15 files changed

+2201
-1058
lines changed

Cargo.lock

Lines changed: 55 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protocols/gossipsub/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
- Attempt to publish to at least mesh_n peers when flood publish is disabled.
1414
See [PR 5578](https://github.com/libp2p/rust-libp2p/pull/5578).
1515

16+
- Introduce back pressure and penalize slow peers. Drop stale messages that timeout before being
17+
delivered.
18+
See [PR 5595](https://github.com/libp2p/rust-libp2p/pull/5595).
19+
- Change `Behaviour::unsubscribe` and `Behaviour::report_message_validation_result`
20+
to `bool` they don't need to be a `Result`.
21+
See [PR 5595](https://github.com/libp2p/rust-libp2p/pull/5595).
22+
1623
## 0.47.0
1724

1825
<!-- Update to libp2p-swarm v0.45.0 -->

protocols/gossipsub/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ categories = ["network-programming", "asynchronous"]
1414
wasm-bindgen = ["getrandom/js", "futures-timer/wasm-bindgen"]
1515

1616
[dependencies]
17+
async-channel = "2.3.1"
1718
asynchronous-codec = { workspace = true }
1819
base64 = "0.22.1"
1920
byteorder = "1.5.0"
2021
bytes = "1.6"
2122
either = "1.11"
2223
fnv = "1.0.7"
2324
futures = { workspace = true }
25+
futures-timer = "3.0.2"
2426
getrandom = "0.2.15"
2527
hex_fmt = "0.3.0"
2628
web-time = { workspace = true }
@@ -38,7 +40,6 @@ tracing = { workspace = true }
3840

3941
# Metrics dependencies
4042
prometheus-client = { workspace = true }
41-
futures-timer = "3.0.3"
4243

4344
[dev-dependencies]
4445
hex = "0.4.2"
@@ -48,7 +49,7 @@ libp2p-noise = { workspace = true }
4849
libp2p-swarm-test = { path = "../../swarm-test" }
4950
quickcheck = { workspace = true }
5051
tracing-subscriber = { workspace = true, features = ["env-filter"] }
51-
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time"] }
52+
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] }
5253

5354
# Passing arguments to the docsrs builder in order to properly document cfg's.
5455
# More information: https://docs.rs/about/builds#cross-compiling

0 commit comments

Comments
 (0)