From 6b6dae87c92325d88b4ec4af9619b3db94fe9ed2 Mon Sep 17 00:00:00 2001
From: Qiwei Yang <yangqiwei97@gmail.com>
Date: Tue, 18 Feb 2025 02:46:06 +0800
Subject: [PATCH] Remove `yamux_window_size` from network config (#7014)

# Description

resolve #6468



# Checklist

* [x] My PR includes a detailed description as outlined in the
"Description" and its two subsections above.
* [x] My PR follows the [labeling requirements](

https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
) of this project (at minimum one label for `T` required)
* External contributors: ask maintainers to put the right label on your
PR.
* [x] I have made corresponding changes to the documentation (if
applicable)
* [x] I have added tests that prove my fix is effective or that my
feature works (if applicable)

---------

Co-authored-by: command-bot <>
---
 prdoc/pr_7014.prdoc                           | 24 +++++++++++++++++++
 .../client/cli/src/params/network_params.rs   |  1 -
 substrate/client/network/src/config.rs        | 22 -----------------
 substrate/client/network/src/litep2p/mod.rs   |  4 ----
 4 files changed, 24 insertions(+), 27 deletions(-)
 create mode 100644 prdoc/pr_7014.prdoc

diff --git a/prdoc/pr_7014.prdoc b/prdoc/pr_7014.prdoc
new file mode 100644
index 00000000000..e4e0214480a
--- /dev/null
+++ b/prdoc/pr_7014.prdoc
@@ -0,0 +1,24 @@
+title: Remove `yamux_window_size` from network config
+doc:
+- audience: Node Dev
+  description: |-
+    # Description
+
+    resolve #6468
+
+
+
+    # Checklist
+
+    * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above.
+    * [ ] My PR follows the [labeling requirements](
+    https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process
+    ) of this project (at minimum one label for `T` required)
+        * External contributors: ask maintainers to put the right label on your PR.
+    * [ ] I have made corresponding changes to the documentation (if applicable)
+    * [ ] I have added tests that prove my fix is effective or that my feature works (if applicable)
+crates:
+- name: sc-cli
+  bump: major
+- name: sc-network
+  bump: major
diff --git a/substrate/client/cli/src/params/network_params.rs b/substrate/client/cli/src/params/network_params.rs
index 748b84a50d2..c9be0b48d34 100644
--- a/substrate/client/cli/src/params/network_params.rs
+++ b/substrate/client/cli/src/params/network_params.rs
@@ -275,7 +275,6 @@ impl NetworkParams {
 			allow_non_globals_in_dht,
 			kademlia_disjoint_query_paths: self.kademlia_disjoint_query_paths,
 			kademlia_replication_factor: self.kademlia_replication_factor,
-			yamux_window_size: None,
 			ipfs_server: self.ipfs_server,
 			sync_mode: self.sync.into(),
 			network_backend: self.network_backend.into(),
diff --git a/substrate/client/network/src/config.rs b/substrate/client/network/src/config.rs
index 327f79fe6c1..1a64f06e74c 100644
--- a/substrate/client/network/src/config.rs
+++ b/substrate/client/network/src/config.rs
@@ -650,27 +650,6 @@ pub struct NetworkConfiguration {
 	/// Enable serving block data over IPFS bitswap.
 	pub ipfs_server: bool,
 
-	/// Size of Yamux receive window of all substreams. `None` for the default (256kiB).
-	/// Any value less than 256kiB is invalid.
-	///
-	/// # Context
-	///
-	/// By design, notifications substreams on top of Yamux connections only allow up to `N` bytes
-	/// to be transferred at a time, where `N` is the Yamux receive window size configurable here.
-	/// This means, in practice, that every `N` bytes must be acknowledged by the receiver before
-	/// the sender can send more data. The maximum bandwidth of each notifications substream is
-	/// therefore `N / round_trip_time`.
-	///
-	/// It is recommended to leave this to `None`, and use a request-response protocol instead if
-	/// a large amount of data must be transferred. The reason why the value is configurable is
-	/// that some Substrate users mis-use notification protocols to send large amounts of data.
-	/// As such, this option isn't designed to stay and will likely get removed in the future.
-	///
-	/// Note that configuring a value here isn't a modification of the Yamux protocol, but rather
-	/// a modification of the way the implementation works. Different nodes with different
-	/// configured values remain compatible with each other.
-	pub yamux_window_size: Option<u32>,
-
 	/// Networking backend used for P2P communication.
 	pub network_backend: NetworkBackendType,
 }
@@ -703,7 +682,6 @@ impl NetworkConfiguration {
 			kademlia_disjoint_query_paths: false,
 			kademlia_replication_factor: NonZeroUsize::new(DEFAULT_KADEMLIA_REPLICATION_FACTOR)
 				.expect("value is a constant; constant is non-zero; qed."),
-			yamux_window_size: None,
 			ipfs_server: false,
 			network_backend: NetworkBackendType::Libp2p,
 		}
diff --git a/substrate/client/network/src/litep2p/mod.rs b/substrate/client/network/src/litep2p/mod.rs
index e8e132228ca..4f105936ac5 100644
--- a/substrate/client/network/src/litep2p/mod.rs
+++ b/substrate/client/network/src/litep2p/mod.rs
@@ -321,10 +321,6 @@ impl Litep2pNetworkBackend {
 			yamux_config.set_window_update_mode(litep2p::yamux::WindowUpdateMode::OnRead);
 			yamux_config.set_max_buffer_size(yamux_maximum_buffer_size);
 
-			if let Some(yamux_window_size) = config.network_config.yamux_window_size {
-				yamux_config.set_receive_window(yamux_window_size);
-			}
-
 			yamux_config
 		};
 
-- 
GitLab