waku-org / waku-rust-bindings

Rust wrapper over go-waku ffi
14 stars 6 forks source link

feat: use nwaku instead of go-waku #87

Open richard-ramos opened 8 months ago

richard-ramos commented 8 months ago

This PR / branch will contain all the changes related to using nwaku instead of go-waku. Once we achieve feature parity with current master, we need to reset that branch to point to the latest commit of this PR.

In separate PRs, the following functionality needs to be implemented

richard-ramos commented 8 months ago

This PR so far compiles waku-sys succesfully generating binding.rs

cd waku-sys
cargo build

The first time does take a while because it's building nim and downloading the submodules, so maybe we can consider generating .so/.a for different architectures and uploading them to the releases, if build times become a problem.

richard-ramos commented 7 months ago

waku-bindings now compiles succesfully and runs some basic tests

cd waku-bindings
cargo test

I added rln as a dependency so nwaku can run succesfully (it seems to no longer be an optional dependency). Also linked some other libraries and had to compile a libbacktrace_wrapper.o fike to link it succesfully. This has been tested on a linux machine. We should try on other architectures.

richard-ramos commented 7 months ago

We can now invoke the relay functions to publish and subscribe. I've run into some trouble setting up the event handler, which seems to work, but in the tests it fails when we attempt to push a value to a tokio channel (fails on line 48). https://github.com/waku-org/waku-rust-bindings/blob/24d7dd840c2117634640d6c80ae246bf7164bc0c/waku-bindings/tests/node.rs#L45-L53

I'm investigating what's up with this.

richard-ramos commented 7 months ago

Thanks to @danielSanchezQ 's help, the event callback now works!

cd waku-bindings
cargo test default_echo -- --nocapture --exact

I'll now proceed to improve error handling as well as including suggestions from https://github.com/waku-org/waku-rust-bindings/pull/88

richard-ramos commented 7 months ago

This PR is mostly complete. Once https://github.com/waku-org/nwaku/pull/2461 is merged, I'll fix the waku_flow test to use a rust node instead of using the fleet. I will not add more code to the PR, since it will get too complicated to review. Missing functionality will be done on a separate PR.

richard-ramos commented 7 months ago

@danielSanchezQ @Ivansete-status @SionoiS I've marked this PR as ready for review. It contains a lot of changes (sorry!), but most of them are just deleting code or changing function signatures, with just a small section dedicated to actually use nwaku instead of go-waku

@danielSanchezQ , don't worry too much about all the deleted code. I'm going to add it back in future PRs towards this branch once the functionality is available in nwaku c-bindings :)