Skip to content

fix(kademlia): align DHT message and provider limits for interop#2788

Queued
richard-ramos wants to merge 2 commits into
masterfrom
kad
Queued

fix(kademlia): align DHT message and provider limits for interop#2788
richard-ramos wants to merge 2 commits into
masterfrom
kad

Conversation

@richard-ramos

@richard-ramos richard-ramos commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Raises the Kademlia RPC frame limit from 4 KiB to 4 MiB so larger /ipfs/kad/1.0.0 responses, such as peer lists with multiple multiaddrs, are not rejected before decoding.

Also updates the default provider record expiration interval to 48 hours and keeps stored value records independently bounded by DefaultMaxValueSize.

Service discovery now uses its own ServiceDiscoveryMaxMsgSize constant, preserving the existing 4 KiB limit for those extension messages instead of inheriting the larger Kademlia RPC cap.

Affected Areas

  • Peer Management / Discovery

    • Kademlia provider record expiration defaults
    • Kademlia RPC message size limit
  • Protocol Logic

    • Service discovery frame-size handling remains explicitly capped at 4 KiB

Impact on Library Users

Kademlia nodes can accept larger DHT replies from go-libp2p DHT peers. Provider records are retained for 48 hours by default instead of 30 minutes.

No API migration is required for existing users.

Risk Assessment

The larger Kademlia read cap increases the maximum accepted RPC frame size. Stored value records remain separately limited by DefaultMaxValueSize, and service discovery keeps its previous 4 KiB cap.

References

@richard-ramos richard-ramos marked this pull request as ready for review July 8, 2026 16:01
@richard-ramos richard-ramos requested review from a team, gmelodie and vladopajic July 8, 2026 16:01
@github-project-automation github-project-automation Bot moved this from new to In Progress in nim-libp2p Jul 8, 2026
@richard-ramos richard-ramos added this pull request to the merge queue Jul 8, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants