Skip to content
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

RPC-Libp2p Determining Request/Response data #861

Closed
AgeManning opened this issue Mar 31, 2019 · 4 comments
Closed

RPC-Libp2p Determining Request/Response data #861

AgeManning opened this issue Mar 31, 2019 · 4 comments

Comments

@AgeManning
Copy link
Contributor

Currently Requests/Responses are encoded with SSZ and sent across the wire.

SSZ requires a known schema in order to decode the serialized message.

For a message received on the libp2p-RPC stream, one needs to know whether the message is a request or response to decode the message appropriately. Messages could include a prefix bit, specifying which object should be decoded.

Is there a better way to handle this? Should we specify this in the spec?

@djrtwo
Copy link
Contributor

djrtwo commented Apr 7, 2019

Another alternative is to put requests and responses on a different libp2p protocol -- /eth/serenity/beacon/rpc/requests/1 vs /eth/serenity/beacon/rpc/responses/1.

What do you think @mslipper

@mslipper
Copy link
Contributor

mslipper commented Apr 8, 2019

Hmm this is true. I'm kind of in favor of exploring alternative serialization formats/a message envelope to get around this issue. Having alternative libp2p protocols seems like a hack to get around a self-imposed limitation IMO.

@AgeManning
Copy link
Contributor Author

I agree with @mslipper . Currently we (lighthouse) are building an SSZ req/resp object which has a prepended boolean which specifies whether its a request/response.
I think in our discussions we seem to favour pre-pending a byte/bit in the serialization to distinguish the two?

@AgeManning
Copy link
Contributor Author

Closing to keep discussion in #871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants