Commit Graph

28 Commits

Author SHA1 Message Date
gabrielmer 361fe2cdc7
chore: moving node initialization code to node_factory.nim (#2479) 2024-03-02 18:59:53 -06:00
Ivan FB 560f949a8b
chore: Postgres migrations (#2477)
* Add postgres_driver/migrations.nim
* Postgres and archive logic adaptation to the migration implementation
* libwaku: adapt node_lifecycle_request.nim to migration refactoring
* test_app.nim: add more detail for test that only fails in CI
* postgres migrations: store the migration scripts inside the resulting wakunode binary instead of external .sql files.
2024-03-01 12:05:27 +01:00
richΛrd 045091a9f2
fix: return message id on `waku_relay_publish` (#2485)
* fix: return message id on `waku_relay_publish`
* fix: remove unneeded cast and handle 0 len seqs
* chore: rename messageId to messageHash
2024-02-29 20:58:35 -04:00
Ivan FB 7aea145efe
chore: bindings return multiaddress array (#2461)
* waku_example.c: adapt signature to new parameter 'void* userData'
* libwaku: add new DEBUG request handler to retrieve the list of listened multiaddresses
* waku_example.c: use example the new 'waku_listen_addresses'
* add debug_node_request.nim file
2024-02-21 12:06:05 +01:00
richΛrd d01585e9fa
fix(bindings): base64 payload and key for content topic (#2435)
* fix(bindings): base64 payload and key for content topic
* fix(bindings): store userData for event callback
* fix(bindings): json message serialization
* fix(bindings): add messageHash to the event callback
* fix(bindings): add meta field
* refactor(bindings): simplify error handling
* fix: handle undefined keys
2024-02-20 16:00:03 -04:00
richΛrd 56ff30ca75
feat(bindings): generate a random private key (#2446) 2024-02-20 11:18:03 -04:00
Aaryamann Challani 22026b7e89
fix(rln-relay): graceful shutdown with non-zero exit code (#2429)
* fix(rln-relay): graceful shutdown with non-zero exit code

* fix: missed args

* fix: exception str

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

* fix: remove old comment

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-02-15 16:55:08 +05:30
richΛrd 707f3e8bf0
feat: `eventCallback` per wakunode and `userData` (#2418)
* feat: store event callback in `Context`
* feat: add userData to callbacks
2024-02-13 10:22:22 -04:00
richΛrd d58aca01a7
chore: add stdef.h to libwaku.h (#2409) 2024-02-13 10:21:31 -04:00
Ivan FB a81092e952
libwaku: simpler ctx mgmt. Param now receiving void* instead of void** (#2398)
This change is needed so that interoperability with other languages becomes simpler.
Particularly, this simplification is needed from the Python point of view,
where it is tricky to pass a void** as a parameter to an FFI function.
2024-02-07 15:24:03 +01:00
Ivan FB 701cb7032b
libwaku: avoid using waku_init. Only use waku_new to create node and context (#2282) 2023-12-15 13:32:12 +01:00
Ivan FB 385daf16be
chore: vendor bump for 0.23.0 (#2274)
* on_chain/group_manager: use .async: (raises:[Exception]).
* bump nim-dnsdisc
* update nim-chronos to the latest state
* chat2.nim: catch any possible exception when stopping
* chat2bridge.nim: make it to compile after vendor bump
* ValidIpAddress (deprecated) -> IpAddress
* vendor/nim-libp2p additional bump
* libwaku: adapt to vendor bump
* testlib/wakunode.nim: adapt to vendor bump (ValidIpAddress -> IpAddress)
* waku_node: avoid throwing any exception from stop*(node: WakuNode)
* test_confutils_envvar.nim: ValidIpAddress -> IpAddress
* test_jsonrpc_store: capture exception
* test_rln*: handling exceptions
* adaptation to make test_rln_* to work properly
* signature enhancement of group_manager methods
2023-12-14 07:16:39 +01:00
Ivan FB 45b0be8e75
waku_thread_response.nim: use correct alloc() proc to allocate response correctly (#2277) 2023-12-11 08:50:03 +01:00
Ivan FB 28142f40b6
chore: Cbindings allow mounting the Store protocol from libwaku (#2276)
* libwaku: add changes to mount store in self-node
* libwaku: remove unnecessary code for store
2023-12-11 08:49:13 +01:00
gabrielmer b9563ae0b5
chore: upgrade dependencies v0.22 (#2185) 2023-11-06 13:30:34 +02:00
Ivan FB 1e8f577104
chore(cbindings): avoid using global var in libwaku.nim (#2118)
* libwaku: Avoid global variable and changing callback signature

* Better signature for the callback. Two new parameters have been added:
  one aimed to allow passing the caller result code; the other
  param is to pass an optional userData pointer that might need
  to be linked locally with the Context object. For example, this is needed
  in Rust to make the passed closures live as
  long as the Context.

* waku_example.c: adaptation to the latest changes

* libwaku.h: removing 'waku_set_user_data' function

* libwaku.nim: renaming parameter in WakuCallBack (isOk -> callerRet)
2023-10-23 08:37:28 +02:00
Ivan Folgueira Bande 8455b8dd17
chore(cbindings): Adding cpp example that integrates the 'libwaku' (#2079)
* Adding cpp example that integrates the `libwaku`

---------

Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com>
2023-09-28 11:10:42 +02:00
Ivan Folgueira Bande 3264a4f587
fix: libwaku.nim: unsubscribe -> unsubscribeAll to make it build properly (#2082)
* libwaku.nim: unsubscribe -> unsubscribeAll to make it build properly

We introduced a change in the next PR
https://github.com/waku-org/nwaku/pull/1983/
that made the `libwaku` to stop building properly
(make libwaku) because a signature change in the
`unsubscribe` proc of waku/waku_relay/protocol.nim.

This commit is a temporary workaround to make it work,
and not block any ongoing PR tests,
although not exactly as it is expected because we are
unsubscribing from all topics.

* ci.yml: adds library/** to force tests when changes under that folder
2023-09-26 16:32:51 +02:00
Ivan Folgueira Bande 6cea737109
waku_thread.nim: Using 'ThreadSignalPtr' instead of loop to handle req/resp (#2045) 2023-09-22 16:36:31 +02:00
Ivan Folgueira Bande 72f90663cd
refactor(cbindings): Thread-safe communication between the main thread and the Waku Thread (#1978)
* Thread-safe comms between main thread & Waku Thread - ChannelSPSCSingle.
* Renaming procs from 'new' to 'createShared'. They use the shared allocator.
* peer_manager_request: no need to use ptr WakuNode.
* waku_thread: moving the 'waitFor' to upper layer.
* waku_thread: `poll()` -> `waitFor sleepAsync(1)` to avoid risk of blocking.
* libwaku: thread-safe "sub-objects" in an inter-thread requests.
  When two threads send data each other, that data cannot contain any
  GC'ed type (string, seq, ref, closures) at any level.
* Allocating the 'configJson' in main thread and deallocating in Waku Thread.
2023-09-18 09:21:50 +02:00
Ivan Folgueira Bande 68e8d9a79c
chore(cbindings): Thread-safe libwaku. WakuNode instance created directly from the Waku Thread (#1957)
* libwaku: create the WakuNode in the Waku thread. Not in the main thread
* node_lifecycle_request.nim: moving hard-coded value to a const item
* libwaku.nim: start using 'isOkOr' instead of 'isErr()'-approach
* node_lifecycle_request.nim: better 'async' & 'await' usage. Not block the runtime
2023-09-01 08:37:02 +02:00
Hanno Cornelius b9d5d28af5
chore: remove references to v2 (#1898)
* chore: remove references to v2

* fix: lingering rln-relay import path
2023-08-09 18:11:50 +01:00
Ivan Folgueira Bande be5dc8f379
Adding example on how to integrate a Waku node in NodeJs (#1751) 2023-08-02 10:45:15 +02:00
Ivan Folgueira Bande 069c1ad2a5
refactor(cbindings): libwaku - run waku node in a secondary working thread (#1865)
* Refactoring to have a working waku_thread
2023-07-31 09:52:04 +02:00
Ivan Folgueira Bande 29614e2e52
Refactoring of libwaku to export only C types (#1845)
* Simplifying libwaku.nim by extracting config parser to config.nim
* Adding json_base_event.nim
* Starting to control-version the libwaku.h

  We are creating this libwaku.h inspired by the one that is automatically
  generated by the nim compiler when `make libwaku` is invoked. Therefore,
  the self-generated header is then placed in:

  nimcache/release/libwaku/libwaku.h

* Better waku_example.c organization
* libwaku.nim: better memory management

  We need to create a 'cstring' internally from the 'const char*' passed
  from outside the library.

  We invoke 'allocShared' in order to create the internal 'cstring',
  and invoke 'deallocShared' in order to manually free the memory.
2023-07-07 10:53:00 +02:00
Ivan Folgueira Bande 97d3b9f79f
chore(refactor): Move record creation & fix libwaku compilation (#1833)
* Move record creation & fix libwaku

* app,external_config,internal_config,libwaku,sharding: refactorgin to make it compile

---------

Co-authored-by: SionoiS <simvivier@status.im>
2023-06-29 21:59:53 +02:00
Ivan Folgueira Bande 665484c17b
refactor: proper use of setupNat (#1740)
Notice that I had to adapt to use 'rlpx_connected_peers' instead
of 'connected_peers' in 'wakunode1.nim' because due to the update
of the 'vendor/nim-eth', which adds the dependency-break with
'confutils' but also includes another changes.

Aside note: we cannot have 'confutils' dependency in 'nim-eth' because
that will prevent the generation of any waku dynamic library.
2023-05-17 18:32:53 +02:00
Ivan Folgueira Bande 2defbd2301
feat(cbindings): first commit - waku relay (#1632) (#1714)
* feat(cbindings): first commit - waku relay (#1632)

* test_app.nim: fix compilation issue. App.init(..) -> App.new(..)

* Simplifying library name (libwaku) and standardizing function names (waku_*)

* Proper wrapper of the waku_node API and creation of the libwaku.a

* Rolling back changes that are not needed

* Rolling back changes that are out of the scope of this task

* wakunode.nim: Removing unnecessary import

* Aplying PR suggestions

* Renaming 'waku.h' -> 'libwaku.h'

* Use of 'isNil' instead of '== nil'

* libwaku.nim: explicitly setting waku_poll() as gcsafe
2023-05-12 18:08:41 +02:00