Skip to content

chore: sc-network full update to 0.55.1#413

Merged
illuzen merged 27 commits intomainfrom
chore/sc-network-full-update
Apr 21, 2026
Merged

chore: sc-network full update to 0.55.1#413
illuzen merged 27 commits intomainfrom
chore/sc-network-full-update

Conversation

@czareko
Copy link
Copy Markdown
Collaborator

@czareko czareko commented Mar 11, 2026

No description provided.

@czareko
Copy link
Copy Markdown
Collaborator Author

czareko commented Mar 11, 2026

@codex review this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 423af7bf75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// NOTE: 24 is somewhat arbitrary and should be tuned in the future if
// necessary. See <https://github.com/paritytech/substrate/pull/6080>
.with_per_connection_event_buffer_size(24)
.with_max_negotiating_inbound_streams(2048)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore inbound stream negotiation limit for busy bootnodes

The swarm config now sets .with_max_negotiating_inbound_streams(2048), which reverts the earlier higher cap used in this fork to absorb large bursts of concurrent inbound substream opens (DHT, sync, notifications). On high-fan-in nodes (especially bootnodes), hitting this lower ceiling can drop negotiations and degrade peer connectivity/discovery under load. Please keep the higher limit (or make it configurable) to avoid a production reliability regression.

Useful? React with 👍 / 👎.

@@ -250,7 +246,6 @@ impl DiscoveryConfig {
config.set_kbucket_inserts(BucketInserts::Manual);
config.disjoint_query_paths(kademlia_disjoint_query_paths);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep enlarged Kademlia packet size in discovery setup

DiscoveryConfig::finish no longer applies an explicit max Kademlia packet size before enabling provider settings. This removes the fork-specific protection that allowed large FIND_NODE responses from bootnodes; falling back to the library default can cause oversized responses to be discarded, which hurts peer discovery in larger networks. Reintroducing the packet-size override (or equivalent) avoids that regression.

Useful? React with 👍 / 👎.

@czareko czareko requested a review from n13 April 21, 2026 01:07
@czareko czareko requested a review from illuzen April 21, 2026 01:07
@n13
Copy link
Copy Markdown
Collaborator

n13 commented Apr 21, 2026

I have everything I need. Let me compile the review.

PR #413 Review — Impact on the Peer‑Ban Tolerance Fix

Short answer

Your "don't immediately ban peers on timeout" fix is not affected by this PR. The tolerance logic lives in client/network-sync/, which PR 413 does not touch.

Where the fix lives

let threshold = self.strategy.peer_drop_threshold();

let should_drop_peer = !should_gate || *entry >= threshold;
...
RequestFailure::Network(OutboundFailure::Timeout) =>
    if should_drop_peer {
        debug!(target: LOG_TARGET, "dropping peer after timeout! {:?}", peer_id);
        ...
        self.network_service.disconnect_peer(

Plus the block‑request back‑off in client/network-sync/src/strategy/chain_sync.rs and the --max-timeouts / block‑request‑timeout CLI flags in node/src/cli.rs. PR 413's file list:

  • client/network/Cargo.toml, build.rs, benches/*
  • client/network/src/{bitswap,config,discovery,event,lib,service,service/metrics,service/signature}.rs
  • client/network/src/protocol/{message,notifications}.rs, notifications/{behaviour,tests}.rs

Nothing under client/network-sync/, and none of the sc-network public symbols the fix depends on (OutboundFailure, RequestFailure, NetworkService::disconnect_peer, PeerStoreProvider) change.

BUT — two sibling hardenings ARE being silently reverted

These live in the very file set the PR rewrites and are in the same spirit as the ban‑tolerance fix (helping slow / overloaded bootnodes). They matter because tighter buffers produce more timeouts, which — even with your threshold — eventually trip drops.

1. Inbound stream budget cut 8x in client/network/src/service.rs:

const NOTIFY_HANDLER_BUFFER_SIZE: usize = 32;
...
const PER_CONNECTION_EVENT_BUFFER_SIZE: usize = 24;
...
/// Maximum number of negotiating inbound streams.
/// Increased from 2048 to handle many peers simultaneously opening substreams
/// for DHT queries, sync requests, etc. on bootnodes.
const MAX_NEGOTIATING_INBOUND_STREAMS: usize = 16384;

PR 413 inlines literals and reverts 16384 → 2048 (the 32 and 24 values are preserved, just un‑named). That 8× reduction is exactly what caused pile‑ups on bootnodes under load.

2. Kademlia packet size limit removed in client/network/src/discovery.rs:

const KAD_MAX_PACKET_SIZE: usize = 2 * 1024 * 1024;
			config.set_max_packet_size(KAD_MAX_PACKET_SIZE);

PR 413 deletes both the const and the set_max_packet_size call, falling back to libp2p's default. Large FIND_NODE responses from bootnodes with long peer lists will be truncated/dropped.

Other things worth flagging (not related to the peer‑ban fix)

  • Default backend flip: NetworkBackendType::default() goes Libp2p → Litep2p, while the code still errors "This build only supports the Libp2p network backend" if Litep2p is selected. Confirm the CLI path in node/src/command.rs explicitly passes Libp2p on every spawn, otherwise new binaries will fail at startup.
  • Notifications tests deleted: client/network/src/protocol/notifications/tests.rs (≈220 lines) is removed. Not a runtime concern, but weakens coverage for future notification‑protocol changes.
  • Benches stubbed out (acknowledged in the file comments as libp2p‑only in the Quantus fork).
  • Keypair/PublicKey wrapped in a new service::signature::{Keypair, PublicKey} enum with a single Libp2p variant. Internal refactor; no behavioural impact on ban logic.

Recommendation

Approve the ban‑tolerance part — it's untouched and the APIs it calls are stable. Before merging, ask the author to either:

  1. Restore MAX_NEGOTIATING_INBOUND_STREAMS = 16384 and the set_max_packet_size(2 MiB) call (preserving the original rationale comments), or
  2. Explicitly justify dropping them in the PR description so the decision is tracked.

Also confirm NetworkBackendType is pinned to Libp2p at every instantiation site now that the default has flipped.

@n13
Copy link
Copy Markdown
Collaborator

n13 commented Apr 21, 2026

"Restore MAX_NEGOTIATING_INBOUND_STREAMS = 16384 and the set_max_packet_size(2 MiB) call (preserving the original rationale comments), or
"

I do not recall changing these values

@illuzen illuzen merged commit 8c7bf8d into main Apr 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants