-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix(proto): use 64 bit chan_id ints as strings #747
Conversation
@@ -162,6 +162,7 @@ | |||
"nodemon": "^1.17.5", | |||
"sinon": "^7.1.1", | |||
"ts-node": "^6.0.2", | |||
"ts-protoc-gen": "^0.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this new plugin being used? it supposed to replace grpc_tools_node_protoc_plugin/bin/protoc-gen-ts
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does replace it, it's used in the proto
scripts, but it has the same filename which is why the scripts didn't change. I'd have removed the grpc-tools
package but we still need it for the grpc_tools_node_protoc_plugin
plugin to generate the service definitions.
Good news - The change is working fine. Side effect - when I checkout (on my mac) this branch and run I see this
I recall that we had this problem in the past and it was solved by removing this package..... |
Nice! |
053678e
to
382513a
Compare
@offerm I removed the |
@daniel, you did I took the last branch. Also, there are many many changes. please check, mainly in the lock file. |
@offerm Yes I did to keep it in one commit - all I did was remove that package but I'll keep commits separate going forward until this is approved. Can you try running If you're seeing changes in the lock file after installing, can you make sure you're on at least npm 6.4? (Also I think you tagged the wrong person in the last comment) |
@sangaman I removed the node_modules directory and run
The fix itself is working. You can see the proto problem on XUD1 or XUD3:
|
Thanks @offerm, I didn't notice that the linux/mac scripts point to the sepcific package directory rather than the general |
@sangaman Mac is OK now but Linux still has a problem:
|
That suggests to me that you're either missing the |
Sounds good to me, I've gotten this to work on linux so I'm comfortable merging and yes as you say if we see any more issues we can fix separately. Thanks. |
This adds `jstype = JS_STRING` annotations on the channel ids in the lnd proto definition so that they use `string` types instead of numbers. Javascript does not natively support 64 bit numbers and precision can be lost, and the channel ids are known to cause issues because of this. This also adds a new package to generate type definitions from the `.proto` files. This is because of a known bug in the previously used plugin, agreatfool/grpc_tools_node_protoc_ts#10, which does not update the generated type definition when `jstype = JS_STRING` is used. Fixes #745.
7a8f991
to
5a9a518
Compare
Great, testing this now in my demo |
This adds
jstype = JS_STRING
annotations on the channel ids in the lnd proto definition so that they usestring
types instead of numbers. Javascript does not natively support 64 bit numbers and precision can be lost, and the channel ids are known to cause issues because of this.This also adds a new package to generate type definitions from the
.proto
files. This is because of a known bug in the previously used plugin, agreatfool/grpc_tools_node_protoc_ts#10, which does not update the generated type definition whenjstype = JS_STRING
is used.I hit a wall with my first approach of generating code and type definitions using the protobuf.js package. I found out the hard way that does not support generating the grpc server/client code and type definitions, as discussed in grpc/grpc-node#528 and protobufjs/protobuf.js#1017. Fortunately I found this other plugin for generating type definitions from proto files, and that seems to work.
Having to update the lnd proto definition manually to add
jstype = JS_STRING
is not ideal, but it's at least a temporary solution until the grpc/protobuf tools and packages for javascript come up with a better approach. I may also open a PR with lnd to add these annotations tochan_id
at least.Fixes #745.