-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Add example for custom rlpx subprotocol #8113
feat: Add example for custom rlpx subprotocol #8113
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.
just as a quick side note, pls remember to add the example to examples/readme.md
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.
great, this is simple yet illustrates the feature perfectly
a few nits
use tokio_stream::wrappers::UnboundedReceiverStream; | ||
|
||
// Custom Rlpx Subprotocol | ||
pub mod proto { |
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.
can we move this to a separate file?
// let custom_rlpx_handler = CustomRlpxProtoHandler{ state: ProtocolState { events: node.network.events.clone()}}; | ||
// node.network.add_rlpx_sub_protocol(custom_rlpx_handler); |
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.
we can uncomment this
enum Command { | ||
/// Send a custom message to the peer | ||
CustomMessage { | ||
msg: String, | ||
/// The response will be sent to this channel. | ||
response: oneshot::Sender<String>, | ||
}, | ||
} |
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.
@mattsse this is cool -- we should demonstrate a bridge/oracle on this, and eventually build up to a full consensus example i feel?
and this is all subprotocols for commands post-establishing a connection, but what about discv? how should we do discovery of nodes that support custom subprotocols?
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.
tracking here #8017
for this we need a more sophisticated example
@owanikin I rebased this, but this still needs the required protocol trait implementations |
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.
bump -- do we want to get this over the line?
Hi @owanikin are you still on this? I d like to get it. |
I am creating this draft pr to solicit feedback on: 1) If I am on the right track. 2) pointers/direction on how to really solve the issue. Thanks for your help.
Closes #7130