-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Expose PING and FINDNODE rpc to public API #90
Comments
I'd be curious to know a bit more about the purpose of these. In a way, you already have access to these, just not via the The design currently has been split into layers, from top down:
I'm not sure about your exact needs, but the design was such that anyone can come along and just spawn a For example you can run the service and call this function: https://github.com/sigp/discv5/blob/master/src/handler/mod.rs#L452 and set the request to be either a |
Hey @AgeManning, thank you for the thoughtful examples! The layered architecture looks really cool! Although, I'm afraid that we want to use all DIscovery v5 functionalities including discovery protocol, the service for managing the DHT, and to have the possibility to send raw PING and FINDNODE messages. To accomplish this, I guess we need to spawn at least a service and a handler. It looks like Is there any workaround I'm missing here to spawn a custom handler with a service for managing the DHT? |
The current thread model is: discv5 <-> service <-> handler <-> socket. So there are usually 4 long-running tasks. The <-> represent channels between the async tasks. The There's a few issues with doing this:
We could still do it however, with not too much effort. An alternative would be to spawn a separate handler. Although this would likely be on a separate UDP port. I'm not sure if you need to to look like a single node identity. If you explain the use-case a bit more, maybe there are some alternative options also |
Another thing we need to be careful of is that exposing a public function like For a discovery mechanism, users should not be finding or using results from a Perhaps we gate this functionality behind a feature flag so the average user doesn't have these raw functions exposed |
Thanks for the discussion, it is really helpful! It seems our use cases are not very clear right now. The next milestone for Portal Network is running a test network on top of discv5 protocol and our assumption is that we may need to send raw PING and FINDNODE base layer discv5 RPCs mainly for testing and development purposes. Maybe we should wait and see if we will really need those raw base layer RPCs and then look for a way to implement them. |
Sure. It sounds to me like if you need them in conjunction with all the DHT logic and everything provided in the service, then we can add it, but we should do it via a compile-time feature flag, such that they are not exposed to regular users. Let's re-open this when you need. |
We at Trin would benefit greatly if we have public API access to raw
PING
andFINDNODE
RPC via Discv5 pub struct. For example, something likesend_ping(enr: Enr)
andsend_findnode(enr: Enr, distances: Vec<u64>)
would be great.Are you guys open to such a change? If you agree, we can discuss the implementation approach and I can work on a PR to commit this upstream?
The text was updated successfully, but these errors were encountered: