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

Protobuf encoding & decoding not compatible with different references #1208

Open
AYAHASSAN287 opened this issue Oct 3, 2024 · 2 comments
Open

Comments

@AYAHASSAN287
Copy link

Problem

proc decodeRpcMsg() and encodeRpcMsg don't behave as protocol buffer behaves

Impact

encoding & decoding might be wrong

To reproduce

1-call encodeRpcMsg(rpcmsg) where rpmsg=(
control: some(
ControlMessage(
ihave: @[ControlIHave(topicID: "foobar", messageIDs: @[id])],
iwant: @[ControlIWant(messageIDs: @[id])],
graft: @[ControlGraft(topicID: "foobar")],
prune: @[ControlPrune(topicID: "foobar", backoff: backofftime)],
idontwant: @[ControlIWant(messageIDs: @[id])],
)
)
)

2-encode the same message using protocbuf cmd tool version "libprotoc 3.21.12"
command in terminal " cat data.txt |protoc --deterministic_output --encode=RPC schema.proto > result.bin "
data.txt contains rpcmsg
schema.proto contains the schema defined in the spec here

Expected behavior

encoded message should = expectedmsg generated from protoc cmd line tool.

Screenshots/logs

Image

.

version/commit hash

branch master
commit:5d48776b0250741b10c3ed7df7a61f3f315b96fe

addiitonal notes

protobuf used in python with same message format and the result was same one generated from protoc cmd tool

@AlejandroCabeza
Copy link
Collaborator

I'd encourage using the three backticks ``` at the beginning and end of a codeblock. Makes reading it much easier :)

@AlbertoSoutullo
Copy link

I just saw this by mere coincidence, and I think this might help :)

https://protobuf.dev/programming-guides/serialization-not-canonical/

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

No branches or pull requests

3 participants