-
Notifications
You must be signed in to change notification settings - Fork 327
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
feat(DRAFT): Protobuf bindings in Barretenberg #12640
base: af/add-protoc
Are you sure you want to change the base?
Conversation
f6b2e28
to
290e36c
Compare
These are the issues I'm facing:
There seems to be a dearth of information about building protobuf for wasm in C++. There is https://github.com/dsyer/protobuf-wasm as an alternative set of libraries to use, but it's old, not sure it's still maintained, or how to get it into the build. |
We discussed a bit with Adam and he suggested that since Barretenberg already uses MessagePack for backwards compatible message exchange in its "napi API", and it's also used between the AVM and TypeScript, that we could try that instead of adding Protobuf as a dependency. CBOR started as a fork of MessagePack, so the performance should be similar to this |
Add support for protobuf serialisation introduced in noir-lang/noir#7511
protoc
to thedevbox
image used by EC2 to run the build in chore: Addprotoc
to the devbox image #12644serde
Unlike with the
serde
based approach, code generation is done on theaztec-packages
side instead of Noir (see noir-lang/noir#7590), but we still keep theserde
based classes as well as they are what we actually work with in Rust, whereas the protobuf are just DTOs for backwards compatibility.WIP
Currently
./barretenberg/cpp/bootstrap.sh
will generate the bindings, but it can be done explicitly with./barretenberg/cpp/scripts/codegen_dsl.sh
as well.After that think the native build succeeds:
I think these are just warnings, as the first one was already like it is.
The WASM build fails:
The files it's looking for should be there after
apt install protobuf-compiler
, but maybe for wasm they are not included:I tried to instruct
cmake
to use theFindProtobuf
module to set the variables, needed for inclusion, but it doesn't work. Some suggest that's because I did not install Protobuf from source, so I tried to do that like so:And using this
protobuf.cmake
:Unfortunately it looks like the version I installed can't be used by Wasm because of 32bit vs 64bit arch: