-
Notifications
You must be signed in to change notification settings - Fork 53
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
[Networking] Add a hook for application messages #3759
Conversation
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.
I think the main change looked good to me, just had some comments
)) | ||
.await | ||
.unwrap(); | ||
|
||
// See whether or not we should be DA | ||
let is_da = node_id < config.da_staked_committee_size as u64; |
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.
is it possible to take this from config.known_da_nodes
instead?
I feel like it would be better to have config.known_da_nodes
initialized to the first da_staked_committee_size
nodes, and take directly from that here (otherwise we have da nodes getting set independently in two different places, which might lead to surprising behaviour down the line)
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.
Yeah we should do this. However the code is like this all over the test suites, I'll create an issue for this one and follow up since it might be a bigger change.
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.
This all looks good, but I feel like I don't understand the motivation. Why not just use the external network? Is this basically allowing the application (i.e. sequencer) to talk back to us?
@@ -160,11 +163,14 @@ impl<TYPES: NodeType> NetworkMessageTaskState<TYPES> { | |||
|
|||
// Handle external messages | |||
MessageKind::External(data) => { | |||
if sender == self.public_key { |
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.
Does this essentially prevent loops with processing messages that we sent?
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.
It's basically so we don't broadcast messages to ourselves. I feel like it's unexpected behavior from the applications perspective to get it's own message
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 good to me
What is the external network in this case? The change is allow the sequencer to communicate through the hotshot layer because it's much more flexible and efficient. For example if a sequencer wanted to get a DA block from another node it sends a web request to a configured url. If non of the configured query nodes have it then it's hosed. Instead the sequencer could use this api to send a request to any HS public key it knows is on the DA committee to get the info. |
This PR:
This adds a way for the application layer to send arbitrary messages to other participants via the HotShot networking layer. It's not perfect as it'll do double de/serialization and all messages are fire and forget within hotshot.
This PR does not:
Key places to review:
Changes to
SystemContextHandle
Test added to the newtorking tests