feat(DRAFT): Protobuf bindings in Barretenberg#12640
Draft
aakoshh wants to merge 10 commits intoaf/add-protocfrom
Draft
feat(DRAFT): Protobuf bindings in Barretenberg#12640aakoshh wants to merge 10 commits intoaf/add-protocfrom
aakoshh wants to merge 10 commits intoaf/add-protocfrom
Conversation
f6b2e28 to
290e36c
Compare
Contributor
Author
|
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. |
Contributor
Author
|
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 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for protobuf serialisation introduced in noir-lang/noir#7511
protocto thedevboximage used by EC2 to run the build in chore: Addprotocto the devbox image #12644serdeUnlike with the
serdebased approach, code generation is done on theaztec-packagesside instead of Noir (see noir-lang/noir#7590), but we still keep theserdebased 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.shwill generate the bindings, but it can be done explicitly with./barretenberg/cpp/scripts/codegen_dsl.shas 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
cmaketo use theFindProtobufmodule 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: