librustzcash icon indicating copy to clipboard operation
librustzcash copied to clipboard

Add a crate or feature flag for gRPC bindings

Open str4d opened this issue 2 years ago • 3 comments

We currently expose Rust bindings for compact_formats.proto in the zcash_client_backend public API, because we need the types in various places. However, we've never added similar bindings for the light client gRPC service itself. The reason is mainly historic: when we were building the light client protocol for the mobile SDKs, one of their design requirements was that the SDK users MUST be able to control the network stack. So we had the compact formats being used on both the Rust and Kotlin/Swift sides of the FFI, but gRPC itself was used only in Kotlin and Swift, and never in Rust.

There are definitely use cases for pure-Rust light clients, so it would be useful to provide Rust bindings that are version-compatible with the compact_formats.proto bindings in zcash_client_backend. This could maybe be exposed via a feature flag on zcash_client_backend, or in a separate crate.

str4d avatar Jul 08 '22 20:07 str4d

It seems like the crate option is more useful for publication. Absent another consideration I will go with that.

I am considering zcash_lwd_services as a name. That's fairly tip-of-the-brain.

I am assuming that zcash_ is the standard prefix (all visible examples) and I am depending on devs to know what lwd is. Oh, also I am assuming that component indicates internals of the zcash-protocol proper.

zancas avatar Jul 08 '22 21:07 zancas

@zancas could you try out #642 and see if it suits your needs? I'm not currently sure if we'll merge it for the next crate release (as we are keeping an MSRV of 1.56 for that, and this requires 1.59+), but it seems to work in my own testing of #317.

str4d avatar Sep 16 '22 20:09 str4d

FYI: I prototyped a minimal rust bindings crate, zcash_lightwallet_proto to learn what that would look like. In the README I cautioned that this crate is likely to produce better maintained and vetted bindings in the future.

nathan-at-least avatar Oct 12 '22 15:10 nathan-at-least