From fec1784ad57d46f21853a40bf8f67823ae80dd45 Mon Sep 17 00:00:00 2001 From: Ivan FB Date: Thu, 16 Jul 2026 17:56:34 +0200 Subject: [PATCH] feat(channels): expose channelExists through the bindings Bumps vendor to pick up channelExists, cherry-picked onto the nim-ffi 0.2.0 lineage: the chore/channel-exists branch forked before that migration, so its pre-0.2.0 {.ffi.} shape would not compile here. The typed model carries a real bool, so channel_exists_async returns Result rather than the "true"/"false" string the original would have produced. Co-Authored-By: Claude Opus 4.8 --- vendor | 2 +- waku-bindings/tests/channels.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/vendor b/vendor index 0291318..f332c13 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 0291318c95cfe6640ff2928f7cf5f2ff360d3673 +Subproject commit f332c130ed45f4766f6c9b5eb66e2f22f3145fe6 diff --git a/waku-bindings/tests/channels.rs b/waku-bindings/tests/channels.rs index 8230b88..fa22316 100644 --- a/waku-bindings/tests/channels.rs +++ b/waku-bindings/tests/channels.rs @@ -73,6 +73,14 @@ async fn channel_create_send_close() { node.start_node_async().await.expect("node should start"); + assert!( + !node + .channel_exists_async(TEST_CHANNEL_ID.to_string()) + .await + .expect("exists should answer for an unknown channel"), + "channel should not exist before it is created" + ); + let channel_id = node .channel_create_async( TEST_CHANNEL_ID.to_string(), @@ -84,6 +92,13 @@ async fn channel_create_send_close() { .expect("channel should be created"); assert_eq!(channel_id, TEST_CHANNEL_ID); + assert!( + node.channel_exists_async(TEST_CHANNEL_ID.to_string()) + .await + .expect("exists should answer after create"), + "channel should exist once created" + ); + let request_id = node .channel_send_async(TEST_CHANNEL_ID.to_string(), channel_message(CHANNEL_PAYLOAD)) .await @@ -97,6 +112,16 @@ async fn channel_create_send_close() { .await .expect("channel should close"); + // Closing drops the channel from the manager even though its SDS state is + // persisted, so this is a liveness check rather than "was it ever created". + assert!( + !node + .channel_exists_async(TEST_CHANNEL_ID.to_string()) + .await + .expect("exists should answer after close"), + "channel should not exist once closed" + ); + // Scoped so the guard is dropped before the await below. Nothing is asserted // about arrival: a lone node has no peer to confirm delivery with, so // onChannelMessageSent legitimately never fires. Delivery is covered by