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
Add overlay service to dispatch and handle requests #160
Conversation
@@ -166,7 +166,7 @@ impl Discovery { | |||
Ok(()) | |||
} | |||
|
|||
pub async fn send_talkreq( | |||
pub async fn send_talk_req( |
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.
Note that this renaming was done to be consistent with discv5
.
|
||
/// A node in the overlay network routing table. | ||
#[derive(Clone)] | ||
pub struct Node { |
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.
Not sure if it would be better for this to go in types.rs
.
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.
Personally, I'm not a big fan of using types.rs
and think this makes sense to belong here.
|
||
/// A general overlay error. | ||
#[derive(Error, Debug)] | ||
pub enum OverlayError { |
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.
@jacobkaufmann Do you mind rebasing this off master, and I'll dig into it tomorrow |
@njgheorghita sure, no problem. I'm not sure if you see anything that appears out of scope for this PR. I tried to keep it small, but overlay touches a lot of things. |
@jacobkaufmann Yeah, it's a bit large but also sometimes that's unavoidable. It also seem like it covers some of the same territory as #163, #164 - so maybe wait until those land (which should be soon) and then either rebase off them, or leave your changes here if you feel like it's a more suitable error structure (which very well might be the case). |
36f62cb
to
e9df7e8
Compare
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.
Looks great! Nice work, just one question, so it's mentioned that the overlay routing table maintenance / liveness tasks are done autonomously - which I interpret as handled within discv5
- so my understanding here is that the maintenance / liveness tasks are done over the base discv5 protocol? This seems fine for PING
, but are FINDNODES
lookup/bootstrapping messages part of the autonomous management at all? If so, and those are going out over the base discv5 protocol, that would be corrupt the routing table
|
||
/// A node in the overlay network routing table. | ||
#[derive(Clone)] | ||
pub struct Node { |
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.
Personally, I'm not a big fan of using types.rs
and think this makes sense to belong here.
@njgheorghita I think you are referring to the comment above These processes are considered "autonomous" because we do not need to invoke a method on I hope this clarifies things. If the autonomous comment is confusing without the implementation of those processes, then I'm happy to remove it. And if anything else deserves some further elaboration, then I can add additional comments. |
@jacobkaufmann Ahh cool, yeah that makes perfect sense, thanks! |
@@ -49,14 +46,26 @@ impl PortalnetEvents { | |||
match std::str::from_utf8(request.protocol()) { | |||
Ok(protocol) => match protocol { |
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.
FYI this match will not work with the latest ProtocolId update in #162. I'll create an issue to fix this in a separate PR.
e9df7e8
to
ef69ce4
Compare
ef69ce4
to
1f3c954
Compare
Related to #135. Move message dispatch and handling into
OverlayService
. TheOverlay
communicates with the associatedOverlayService
via a channel.Motivation: Autonomous routing table management requires a separate task where the task must have a mutable reference to the overlay structure. We create a new overlay structure,
OverlayService
, and communication between this structure andOverlay
occurs over a channel, which does not require a reference.