Skip to content

Conversation

@vedhavyas
Copy link
Contributor

@vedhavyas vedhavyas commented Jan 8, 2026

This PR upgrades our libp2p fork from 0.54.2 to 0.56.0.

Libp2p fork changes(https://github.com/autonomys/rust-libp2p/commits/subspace-v10/)

Inbound stream timeouts

We recently patched our fork to have inbound streams to have timeout like outbound.
Our fork has following patches for this

Upstream PR libp2p/rust-libp2p#6009 is still unmerged as we need to confirm if the fix worked. Will handle this to get the PR merged and we dont need to pull our changes in next upgrade hopefully.

BandwidthSinks

Unfortunately, polkadot-sdk is not yet migrated to 0.56.0 and still at 0.54.1.
Reason being substrate uses with_bandwidth_logging to measure the overall bandwidth usage distinct between inbound and outbound. There was deprecation notice and this was mentioned by Nazar in the libp2p upgrade pr paritytech/polkadot-sdk#6248

With 0.56.0, the entire bandwith module is removed. Migrating the same on substrate side would like a bit more changes and felt out of scope for our fork. So I instead reverted the changes into our fork.
Once substrate upgrades to 0.56.0, we would not need this change. Either we upgrade substrate with latest libp2p ourselves or wait for community.

The changes on our end is quiet straight forward. Main change is coming from this libp2p/rust-libp2p#5938

As usual, this PR will be draft until I confirm the changes are compatible with chronos and mainnet.

  • Test on Chronos
  • Test on mainnet

Code contributor checklist:

idle connection timout is no longer 0 which was instant earlier but instead changed to 10 seconds libp2p/rust-libp2p@f4edafb
updated tests to ensure atleast 10 seconds has passed before we check for peer connections
@vedhavyas vedhavyas marked this pull request as ready for review January 12, 2026 02:29
@vedhavyas vedhavyas requested a review from nazar-pc as a code owner January 12, 2026 02:29
@immunefi-magnus
Copy link

🛡️ Immunefi PR Reviews

We noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below:

🔗 Send this PR in for review

Once submitted, we'll take care of assigning a reviewer and follow up here.

nazar-pc
nazar-pc previously approved these changes Jan 12, 2026
Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

Looks fine to me overall

async fn test_connection_breaks_after_timeout_without_reservation() {
let connection_timeout = Duration::from_millis(300);
let long_delay = Duration::from_millis(1000);
let long_delay = Duration::from_millis(12000);
Copy link
Member

Choose a reason for hiding this comment

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

Why though? Seems excessive for tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default earlier was 0 secs and delay did not matter. Recent changed made it a default 10 seconds.
This is configurable if we build the Swarm manually but the tests uses swarm builder where default is set through macro without configurability. So just make it more than 10 seconds rather than reconstructing the swarm builder for tests

@vedhavyas
Copy link
Contributor Author

@nazar-pc going to merge this once CI gives green assuming you have no objections

@vedhavyas vedhavyas merged commit f33c2b6 into main Jan 13, 2026
14 checks passed
@vedhavyas vedhavyas deleted the libp2p-upgrade branch January 13, 2026 11:30
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