Skip to content

feat(p2p): implement Kademlia DHT routing table with XOR metric and alpha-concurrency lookup - #8058

Merged
github-actions[bot] merged 1 commit into
SatyamPandey-07:mainfrom
riteshbonthalakoti:feat/kademlia-routing-table
Nov 16, 2026
Merged

github-actions[bot] merged 1 commit into
SatyamPandey-07:mainfrom
riteshbonthalakoti:feat/kademlia-routing-table

Conversation

@riteshbonthalakoti

Copy link
Copy Markdown
Contributor

Closes #8057

Summary of Changes

  • 256-Bit XOR Metric Engine: Implemented NodeDistance calculating symmetric XOR metric distance d(x, y) = x ^ y and determining highest differing bit bucket indices (0 to 255).
  • K-Bucket Architecture (k=20): Implemented KBucket with Least-Recently-Seen (LRS) policy, replacement cache for full buckets, and automatic eviction upon reaching failed ping thresholds.
  • Routing Table Management: Implemented KademliaRoutingTable holding 256 k-buckets with contact addition, removal, health status tracking, and findClosest returning k closest contacts to any 256-bit target key.
  • Alpha-Concurrent Iterative Lookup (alpha=3): Implemented IterativeNodeLookup coordinating parallel queries with shortlist convergence.
  • Comprehensive Unit Tests: Full test suite in src/__tests__/p2p/KademliaRoutingTable.test.ts with 100% test pass rate.
  • Barrel Exports: Unified export via src/core/p2p/index.ts and re-exported in src/core/index.ts.

…lpha-concurrency lookup

- 256-bit NodeId space with cryptographic SHA-256 key hashing
- XOR distance metric calculation with highest differing bit bucket mapping
- 256 k-buckets with k=20 and Least-Recently-Seen (LRS) replacement cache
- Health tracking and eviction on failed ping threshold
- Alpha-concurrent (alpha=3) iterative node lookup with shortlist convergence
- Full unit test coverage in src/__tests__/p2p/KademliaRoutingTable.test.ts
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

@riteshbonthalakoti is attempting to deploy a commit to the pandeysatyam1802-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

🎉 Thank you for contributing to WorkSphere!
Please ensure:

  • ✅ Tests pass
  • ✅ No secrets committed
  • ✅ Documentation updated

💡 Connect & Support:

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Auto-approved! This PR properly references assigned issue(s): #8057.

@github-actions github-actions Bot added good-pr level 3 WOCS Level 3 contribution (11 points) wocs Winter of Code Social 2026 contribution labels Nov 16, 2026
@github-actions
github-actions Bot merged commit b732a28 into SatyamPandey-07:main Nov 16, 2026
9 of 10 checks passed

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Auto-approved! This PR properly references assigned issue(s): #8057.

@github-actions

Copy link
Copy Markdown

🚀 Auto-merge complete!

This pull request is linked to issue(s) #8057 and has been automatically squash-merged into main with co-author credit! 🎉

Thank you for contributing to WorkSphere! ✨

1 similar comment
@github-actions

Copy link
Copy Markdown

🚀 Auto-merge complete!

This pull request is linked to issue(s) #8057 and has been automatically squash-merged into main with co-author credit! 🎉

Thank you for contributing to WorkSphere! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good-pr level 3 WOCS Level 3 contribution (11 points) needs-review wocs Winter of Code Social 2026 contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(p2p): implement Kademlia DHT routing table with XOR metric distance and alpha-concurrency node lookup in KademliaRoutingTable.ts

1 participant