Skip to content

Conversation

guha-rahul
Copy link
Contributor

What was wrong?

Issue #697

How was it fixed?

Summary of approach.

To-Do

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

Cute Animal Picture

put a cute animal picture link inside the parentheses

@guha-rahul guha-rahul marked this pull request as ready for review June 26, 2025 17:03
@guha-rahul guha-rahul marked this pull request as draft June 26, 2025 17:03
@guha-rahul guha-rahul marked this pull request as ready for review June 30, 2025 00:16
@seetadev
Copy link
Contributor

@guha-rahul : Nice work on the PR, Rahul. Appreciate the initiative and your efforts.

Circuit Relay v2 is a very important module of NAT traversal. Wish to recommend some tests that would enable verification of the voucher verification and data transfer limit enforcement in a relay protocol.

Please visit #715

Also, CCing @Winter-Soren and @sukhman-sukh if they would like to share feedback and thoughts on both the tests added and the PR itself. They have been collaborating on NAT traversal efforts and will be bootstrapping webrtc transport layer using NAT traversal soon.

@acul71
Copy link
Contributor

acul71 commented Jun 30, 2025

hi @guha-rahul nice work, I would like you to give an opinion on those TODOs since you just worked on this module.
Thanks
#720

@guha-rahul
Copy link
Contributor Author

@acul71 sure will give you some feedback in the coming days.

@@ -569,45 +610,81 @@ async def _handle_connect(self, stream: INetStream, msg: Any) -> None:
"""Handle a connect request."""
peer_id = ID(msg.peer)
dst_stream: INetStream | None = None
logger.debug("Handling connect request to peer %s", peer_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a suggestion. Can we have a self.resource_manager._reservations.get(peer_id) check at start, and if it fails, then we can directly reject the request with NO_RESERVATION = 204 status. (similar to other implementations).

@sukhman-sukh
Copy link
Contributor

Also, one doubt. Does the current implementation handle the refresh of the reservation? I mean, if a connection is already made between a relay and a device, it refreshes the reservation to maintain connectivity and stability. Is that present in our version of the circuit relay?

@sukhman-sukh
Copy link
Contributor

Interestingly, I found one thing in other implementations(go and js): they are issuing vouchers but not verifying them, but out implementation does. Nice to see that.

@sukhman-sukh
Copy link
Contributor

Also, https://github.com/libp2p/go-libp2p/blob/7b7c3ed4ce048c99a865d4349b5f7484a6a93c04/p2p/protocol/circuitv2/relay/relay.go#L265-L269 here, they are denying the connection from relays with response = STATUS.PERMISSION_DENIED. I am not sure why they did this? Any thoughts on this @Winter-Soren @guha-rahul?
They are denying multi-hop relay and allows only single-hop where connection is from client to relay directly. So, should we also keep this check? @seetadev @acul71

@sukhman-sukh
Copy link
Contributor

Rest of the code looks good to me. Logic is well covered and looks neat. Great work @guha-rahul.

@guha-rahul
Copy link
Contributor Author

guha-rahul commented Jul 6, 2025

@sukhman-sukh https://github.com/libp2p/specs/blob/master/relay/circuit-v2.md#connection-initiation I think the note above this should be the reason aka to prevent multi-hop relay chaining. Thanks for the catch
added the fix. Would appreciate a review . cc : @seetadev @sukhman-sukh

@sukhman-sukh
Copy link
Contributor

sukhman-sukh commented Jul 7, 2025

LGTM.

@seetadev
Copy link
Contributor

@guha-rahul : Hi Rahul. This PR is getting close to review + merge. Please discuss with @sukhman-sukh on his feedback and pointers. Also, CCIng @Winter-Soren if he wishes to share some tests or improvements.

This is indeed an important PR. Wish if you could also add developer docs, additional tests and screencasts for reference.

Will review and merge soon. Appreciate your great efforts and initiative.

@sukhman-sukh
Copy link
Contributor

sukhman-sukh commented Jul 12, 2025

Hey @seetadev @guha-rahul, I have a request. Can we complete this PR now but wait to merge it to main till the circuit-relay gets fixed. I think, let's first fix the circuit relay (which is taking time as we are not able to reach the root cause. P.S.: @guha-rahul, I would like you to join ongoing debugging effort. Maybe a fresh review can help). Once the main branch has a fixed circuit relay, we can then rebase, thoroughly test, and merge this feature update on the circuit relay.
What do you think?

@guha-rahul
Copy link
Contributor Author

@seetadev I have applied @sukhman-sukh 's changes and he agreed to the changes.
Also @sukhman-sukh , sure lets fix the circuit relay and fix my pr accordingly. Although if you can share with me some of the problems you are facing, i can get started.

@seetadev
Copy link
Contributor

@guha-rahul , @sukhman-sukh : Great, thank you for sharing the update. Appreciate it.

I'll review and merge the PR once you have fixed the circuit relay issues and shared an update here.

@seetadev
Copy link
Contributor

seetadev commented Aug 9, 2025

@guha-rahul , @sukhman-sukh : This looks good for a final review + merge. Wish to ask if the circuit relay issues have been resolved.

@sukhman-sukh
Copy link
Contributor

@guha-rahul , @sukhman-sukh : This looks good for a final review + merge. Wish to ask if the circuit relay issues have been resolved.

Hey @seetadev, No. Circuit relay not fixed yet. Rahul has some insights and I will also start from Monday to look into this. Will fix this on priority

@seetadev
Copy link
Contributor

@sukhman-sukh : Thank you Sukhman for the update. Appreciate your and @guha-rahul's efforts to arrive at a good conclusion on the circuit relay issues.

@seetadev
Copy link
Contributor

@sukhman-sukh, @guha-rahul : This looks good for a final review + merge. Wish to ask if the circuit relay issues have been resolved.

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.

4 participants