Skip to content

protobuf/abci/p2p: Length delimiter encoding differs between ABCI and P2P #5783

@thanethomson

Description

@thanethomson

In looking into ABCI for Tendermint in Rust, I see that, in the Go code, the serialization for ABCI Protobuf messages is subtly different to that used by the P2P layer: the ABCI serialization uses int64-based length delimiters and the P2P serialization uses uint64-based length delimiters.

The practical impact here is that the length delimiters aren't compatible (not that they need to be, of course, but our chosen Rust lib that handles our Protobuf de/serialization only supports the uint64 kind). For example, a length of 15 bytes when using binary.PutVarint is encoded as 30, whereas when using binary.PutUvarint it's encoded as 15. (See this example for a comparison)

See here for the ABCI encoding and here for the encoding that looks like it's used for the P2P layer.

As per conversation with @marbar3778, both the P2P layer and ABCI should make use of the encoding provided by the protoio package.

Tendermint version: master

Metadata

Metadata

Assignees

Labels

C:abciComponent: Application Blockchain Interface

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions