Skip to content

Conversation

yashksaini-coder
Copy link
Contributor

What was wrong?

Fixes Issue #962 :

KAD-DHT tests became ~33% slower (from sub-1s to ~1.66s) after PR #892's security fix that changed bind address from 0.0.0.0 to 127.0.0.1—specifically affected the test_provide_and_find_providers test.

How was it fixed?

Implemented configurable bind addresses through LIBP2P_BIND environment variable while keeping 127.0.0.1 as secure default:

DEFAULT_BIND_ADDRESS = os.getenv("LIBP2P_BIND", "127.0.0.1")
LISTEN_MADDR = multiaddr.Multiaddr(f"/ip4/{DEFAULT_BIND_ADDRESS}/tcp/0")

This provides:

  • Security by default (127.0.0.1)
  • 33% faster tests when needed (0.0.0.0)
  • Backward compatibility
  • Comprehensive test coverage

To-Do

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

@yashksaini-coder
Copy link
Contributor Author

yashksaini-coder commented Sep 27, 2025

@seetadev @acul71 Based on the recent issue addressed in the discussion #949 I've raised this PR, along with proper issue #962 and has updated implemented the fix as per given guidelines,

The applied suggestion lead to the results here

I would like to request a review on this PR, and also have a look at the #962 issue.

@seetadev
Copy link
Contributor

@yashksaini-coder : Appreciate your great efforts. Will share feedback soon.

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.

2 participants