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

error with codification #50

Open
joticajulian opened this issue May 10, 2023 · 1 comment
Open

error with codification #50

joticajulian opened this issue May 10, 2023 · 1 comment

Comments

@joticajulian
Copy link

This is my proto file

syntax = "proto3";

package mytest;

message ab {
   uint64 amount = 1 [jstype = JS_STRING];
}

message cd {
   ab value = 1;
   uint64 num = 2 [jstype = JS_STRING];
}

Then I'm trying to encode and decode this object:

const x = new mytest.ab(30000000000);
const y = new mytest.cd(x, 1);
const encoded = Protobuf.encode(y, mytest.cd.encode);
// encoded: 0x0a070880d88ee16f100100
Protobuf.decode<mytest.cd>(encoded, mytest.cd.decode);

and it fails with the error RuntimeError: unreachable

I just tried the same codification with protobufjs and I get a slightly different result:

0x0a070880d88ee16f100100 - as-proto
0x0a060880d88ee16f1001 - protobufjs

If I use the encoded value generated by protobufjs then as-proto is able to decode it. So the issue is with the codification. In particular the extra 00 that is added at the end.

I'm using as-proto@1.3.0

@piotr-oles
Copy link
Owner

Thanks for reporting that, I don't have a bandwidth to look at this in the next 2 weeks, but feel free to debug this and send a fix :)

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

No branches or pull requests

2 participants