-
Notifications
You must be signed in to change notification settings - Fork 182
fix: Fix voucher verification and data transfer limits in Circuit Relay v2 #698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@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. |
hi @guha-rahul nice work, I would like you to give an opinion on those TODOs since you just worked on this module. |
@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) |
There was a problem hiding this comment.
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).
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? |
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. |
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 = |
Rest of the code looks good to me. Logic is well covered and looks neat. Great work @guha-rahul. |
@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 |
LGTM. |
@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. |
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. |
@seetadev I have applied @sukhman-sukh 's changes and he agreed to the changes. |
@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. |
@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 |
@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. |
@sukhman-sukh, @guha-rahul : This looks good for a final review + merge. Wish to ask if the circuit relay issues have been resolved. |
What was wrong?
Issue #697
How was it fixed?
Summary of approach.
To-Do
Cute Animal Picture