-
Notifications
You must be signed in to change notification settings - Fork 159
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
Refactor RPC and implement hello protocol #246
Conversation
node/forest_libp2p/src/rpc/mod.rs
Outdated
@@ -51,3 +50,36 @@ impl std::fmt::Display for RPCEvent { | |||
} | |||
} | |||
} | |||
|
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.
For consistency should this be its own file error.rs
?
Blocksync(BlockSyncResponse), | ||
Hello(HelloResponse), | ||
} | ||
|
||
/// Protocol upgrade for inbound RPC requests. Currently supports Blocksync. |
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.
Comment should be updated to include mention of hello protocol?
impl RPCRequest { | ||
pub fn supported_protocols(&self) -> Vec<&'static [u8]> { | ||
match self { | ||
// add more protocols when versions/encodings are supported |
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.
maybe add a TODO here
node/forest_libp2p/src/service.rs
Outdated
swarm_stream.get_mut().send_rpc(peer_id, RPCEvent::Response(1, RPCResponse::Blocksync(BlockSyncResponse { | ||
chain: vec![], | ||
status: 203, | ||
message: "handling requests not implemented".to_owned(), | ||
}))); | ||
} | ||
RPCEvent::Request(req_id, RPCRequest::Hello(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.
nit: remove spacing
This should also close #194 |
It has that in the PR description already :) |
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.
Lvvvvvgtm
Summary of changes
Changes introduced in this pull request:
The hello protocol matches the spec definition but does not match lotus, lotus has only one Hello message type and has optional map fields that they serialize for both the request and response. It was a huge pain to try to retrieve their exact format so I will leave this for now but will probably have to switch it to match lotus to test our syncing functionality.
Reference issue to close (if applicable)
Closes #194
Other information and links