Conversation
|
protobuf (de)serialization isn't deterministic, meaning that a given memory layout can have multiple valid serialized representations. This is fine for the node's API RPC & database-related serialization, but less good for p2p networking, and bad for crypto-related serialization (hashing / signing). It can be turned deterministic by applying a stricter set of rules (example: node/libs/protobuf/src/proto_fmt.rs), but I'm not sure if such implementation is available in Go. Also, using gRPC for p2p networking can be problematic. Although most things are doable on the the HTTP/2 connection, It's probably better to either go with plain TCP for full control, or use libp2p. |
|
May be wort reaching out to the Farcaster team. They use gRPC and libp2p and the network size is ~10,000 nodes. |
|
Thanks @moshababo
I'm aware of the serialisation aspects, though haven't heard about the impact on networking? I would guess that one aspect of the dynamically sized encoding is that it might impact benchmarks re: networking. |
Can you elaborate / link some references? libp2p definitely on my radar, for their TURN/NAT holepunching. |
|
Ugh I have accidentally closed this while deleting some old branches, github UX is a bit shite. Will try fix, still curious on comments above. |
Exploring using protocol buffers and gRPC.
netpeer.goCurrently the RPC interface is implemented as a simple HTTP server, with a set of RPC message types that are serialised using JSON, and peers just send messages and some messages have responses.
Some immediate benefit to using protobufs:
Some benefits to using gRPC:
service PeerService {definition format. Makes the wire protocol more readable.Things I still gotta work out: