35 Commits

Author SHA1 Message Date
Ivan FB
dfedf2ba15
fix: rebuild when the vendor's Nim sources change
build.rs only invalidated on the generated rust_bindings, so editing any
Nim source left the linked archive stale and the tests silently ran
against the previous build -- which cost an hour of debugging a channel
failure against instrumentation that was never in the binary.

Also corrects channel_message_reaches_peer's ignore reason. The message
is not lost in SDS: Persistency is a process-wide singleton that refuses
re-targeting, so two in-process nodes share one SDS job whose rows are
keyed by channel id alone. The receiver loads the sender's history and
SDS rightly calls the message a replay. The channels API is fine; the
test needs two processes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 09:07:04 +02:00
Ivan FB
aade2ed4d8
test: validate the channels API against a real peer
The channel test only checked that create/send/close returned values, so
it passed while every send failed downstream: channel_send returns a
request id immediately and reports the outcome asynchronously, and with
no listener on onChannelMessageError there was nothing to notice. Asking
the question properly -- two nodes, one channel, does the payload arrive
-- surfaced three things, none of them caused by the nim-ffi migration.

Encryption was never installed, so no segment could ever be sent; that is
fixed in the vendor by naming the mechanism at channel creation.

Autosharding could not be switched on from here at all. A channel's shard
is derived from its content topic, so without it the send cannot even
auto-subscribe. num-shards-in-network exists on the kernel conf but
WakuNodeConfig never exposed it, so it is added here.

Ingress is still dropped below this layer, so channel_message_reaches_peer
is #[ignore]d with the evidence in its doc comment rather than deleted or
weakened into a test that cannot fail. The single-node test keeps its
narrow scope and now says why it asserts nothing about arrival.

The error listeners stay: a send that fails silently is exactly how this
went unnoticed, and they turn a timeout into a diagnosis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 08:40:26 +02:00
Ivan FB
6a107e66cc
fix(test): let the echo's Result decide default_echo
The select arm discarded test_echo_messages' Result, so the test passed
whenever that future finished -- including the path where the message
never arrived and it returned Err. Only the 1000s timeout could fail it,
which made the assertion close to vacuous for the case it exists to
cover.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 01:09:34 +02:00
Ivan FB
430ebc0bda
feat!: expose the generated bindings, drop the hand-written FFI tier
The generated crate already provides what this tier existed to build:
CBOR marshalling, the callback dance, and a typed method per proc. So
macros.rs (trampoline, handle_ffi_call) and libwaku_response.rs
(RET_OK/RET_ERR, LibwakuResponse) are deleted rather than ported, and
node/events.rs goes with them -- its WakuEvent enum is now one generated
payload struct per event, which is what the typed listeners hand back.

What survives is what the generated crate does not give us: the domain
layer (WakuMessage, WakuContentTopic, MessageHash, pubsubtopic) and
WakuNodeConfig, which still serialises to the JSON create_node takes --
that JSON is unchanged, only its transport moved to CBOR.

BREAKING CHANGE: WakuNodeHandle and its Initialized/Running typestate,
waku_new, and waku_destroy are gone; callers use LogosDeliveryCtx::create
and let Drop tear the node down. set_event_callback is gone too: events
are per-name now, so a whole-stream callback has no equivalent -- use the
typed add_on_*_listener methods, which deliver a payload struct instead
of a JSON string to match on.

Tests and the example move with the API. The event handling gets shorter
rather than longer: no from_str, no matching five variants, no panicking
on Unrecognized -- a listener only receives the event it registered for.
Callers now base64-decode payloads themselves, since that was WakuMessage's
serde doing it before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 01:08:23 +02:00
Ivan FB
96499cc735
feat: reliable channels bindings and vendor bump
Exposes the reliable-channel surface: channel_create / channel_send /
channel_close on WakuNodeHandle, backed by the logosdelivery_channel_*
FFI calls. Channel state is persisted, so re-creating a closed channel
resumes it rather than starting fresh, and send payloads travel
base64-encoded.

Adds the three channel lifecycle events (received / sent / error) to
WakuEvent, plus the messaging events (sent, error, propagated, received)
and connection status change, so callers can observe delivery rather
than only firing and hoping.

build.rs resolves the nimble package dirs and librln by scanning rather
than hardcoding, since their names carry versions and hashes that move
whenever nimble.lock does. It also checks make's exit status: a failed
build previously passed silently and the crate linked a stale library
from an earlier run.

Bumps the vendor submodule to master.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 00:44:30 +02:00
Darshan K
4ec20e2ebe
chore: upgrade to V0.36.0 (#123) 2025-11-13 00:12:21 +05:30
Ivan FB
0c0b834aa0
Recover toy chat app powered by libwaku/nwaku (#105)
* bump nwaku to the current master branch ( commit: 625c8ee5 )
* make the waku crate to behave tokio-asynchronously
* use of store
* use of lightpush and filter
* add waku-bindings/src/general/messagehash.rs
* add waku-bindings/src/general/time.rs
* add waku-bindings/src/general/waku_decode.rs
* add WakuEvent management (WakuMessage, ConnectionChange, TopicHealthChange.)
* add waku-bindings/src/macros.rs
2025-01-10 15:19:31 +01:00
Ivan FB
fd7e73a7f0
Tic tac toe example (#104)
* update nwaku vendor to v0.33.1
* build.rs: add negentropy dependency and cmdCount cmdLine dependencies
* fix: call waku_setup when instantiating waku_new
* Properly decode a Vec<Multiaddr>
* First commit tic-tac-toe
* adding some simple game logic to coordinate the turns a little
* some logic to panic if a proper event callback hasn't been set
* restoring back the type state pattern introduced by Richard
* new PubsubTopic type
* fix clippy issues

---------

Co-authored-by: Richard Ramos <info@richardramos.me>
2024-11-28 10:35:41 +01:00
richΛrd
201a38a64e
feat: example app (#99) 2024-03-11 12:00:30 -04:00
richΛrd
69a48725ca
refactor: node handle constructor and messageHash on publish (#98)
* refactor: node handle constructor and messageId on publish
* refactor: add back typestate
* chore: rename messageId to messageHash
2024-03-01 11:31:00 -04:00
richΛrd
a10a5c2d22
refactor: use a enum for handling the responses, and don't ignore the return code (#97)
* refactor: handle return code and use an enum to handle responses
* fix: nwaku does not return an envelope hash on publish
2024-03-01 11:25:02 -04:00
richΛrd
646f6f0080
refactor: hide *mut c_void behind WakunodeContext (#96) 2024-02-26 11:13:30 -04:00
Richard Ramos
c434e9ebf5
refactor: remove getters 2024-02-22 10:57:02 -04:00
Richard Ramos
ac96b834a0
chore: use rust node address instead of fleet node in tests 2024-02-21 14:07:42 -04:00
Richard Ramos
9c696e6097
feat: expose waku_version 2024-02-20 16:06:03 -04:00
Richard Ramos
685a6aef0a
fix: event handler 2024-02-16 10:45:20 -04:00
Richard Ramos
5687e2585c
chore: make sure waku_new, waku_start and waku_stop work 2024-02-13 16:18:16 -04:00
Richard Ramos
1d8626b110
chore: remove code no longer needed (for now) 2024-02-12 20:13:49 -04:00
richΛrd
5aaafc7c20
fix: content topic should accept strings (#84) 2023-12-08 17:30:30 -04:00
richΛrd
dc32f22f4a
feat: add filterv2 functions (#75) 2023-11-07 15:50:35 -04:00
richΛrd
32bd05c6fc
feat: update go-waku version (#70)
- removes encoding functions from relay and lightpush
- adds `encode_symmetric` and `encode_asymmetric` to `WakuMessage`
- don't panic when unserializing json
2023-09-27 19:19:59 -04:00
RichΛrd
ce9f71a592
Add new changes from go-waku (#58)
* feat: add ephemeral and meta fields
* feat: seenTTL
* feat: expose list of topics
2023-05-10 10:13:50 -04:00
gusto
54a80f83cc
Pass gossipsub params to go-waku node (#50)
* Pass gossipsub params to go-waku node

* Make gossipsub conf test run by default

* Use merge commit to master for go-waku

* Add tests for info logs
2023-03-13 10:51:15 +02:00
Daniel Sanchez
d1a467edcc
Free strings (#46)
* Free strings on discovery

* Free strings on filter

* Free strings on lightpush

* Added missing linking flags

* Free strings on management

* Fix management inner calls

* Free strings on peers

* Free strings on relay

* Free strings on store

* Free strings on decrypt

* Fix toychat example

* Fix tests

* Added decode_response method

* Use decode response

* Rename decode response util

* Use decode response in decrypt
2023-02-14 18:30:08 +01:00
gusto
48300c15a2
Smoke tests for waku node (#41)
* Fix for codecov branch names

* Codecov with all tests included

* Add tokio to node tests

* Run echo tests as seperate processes

* Add token to evade GH limiter

* Discv5 and default test for node
2023-01-27 11:35:07 +02:00
Daniel Sanchez
67e5aef69a
Beta3 (#42)
* Update waku to the latest main

* Update beta version

* Update deps

* Add relay topics config entry

* Update test config
2023-01-26 12:58:45 +01:00
al8n
f9b8c8eb43 remove discv5 apis 2023-01-05 22:53:30 +13:00
al8n
d7a1afcaad fix hanging test 2022-12-22 06:21:46 +13:00
al8n
8089defcad try to fix discv5 test case 2022-12-22 04:40:06 +13:00
al8n
2171f6c69e add discv5 stuff in test 2022-12-22 01:57:05 +13:00
al8n
7983add1ca embed discv5 functions to node initialized 2022-12-21 01:13:01 +13:00
al8n
eafecdfc92 fix #32: add discv5 functions 2022-12-21 00:23:19 +13:00
Daniel Sanchez
aa06fcc969
Make topics const initializable (#28)
* Make topics const initializable

* Fix test

* Derive Eq, PartialEq for topics
2022-12-05 18:42:55 +01:00
Daniel Sanchez Quiros
718c28725d Refactor waku crate to waku-bindings 2022-11-29 10:28:32 +01:00
Daniel Sanchez
d006ef4ecd
Crates publish setup (#17)
* Added config.toml to waku crate

* Update gitignore

* Update readme

* Remove private items docs

* Fix docs links

* Refactor waku to waku-bindings crate
Added badges

* Fix links

* Add usage
2022-11-02 08:21:15 -07:00