Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c7df426
fix(libwaku): waku_relay_unsubscribe (#3207)
richard-ramos Dec 12, 2024
99eb708
feat: allowing configuration of application level callbacks (#3206)
gabrielmer Dec 13, 2024
6de05c1
chore: update prepare_release.md (#3218)
Ivansete-status Dec 18, 2024
e6467fa
feat: topic health tracking (#3212)
gabrielmer Dec 24, 2024
898ea1c
extend rust example with waku_start (#3224)
Ivansete-status Dec 26, 2024
dd55e4d
chore: enhance libwaku store protocol and more (#3223)
Ivansete-status Jan 3, 2025
5883934
chore: add comment to clarify where contract.nim comes from (#3226)
Ivansete-status Jan 3, 2025
877f4cb
libwaku invoke callback within waku_destroy (#3228)
Ivansete-status Jan 3, 2025
b540394
test: test_wakunode_rln_relay use waitForNullifierLog in all tests av…
Ivansete-status Jan 6, 2025
ae5df41
Update prepare_release.md add waku-rust-bindings step (#3229)
Ivansete-status Jan 6, 2025
67d729a
feat(libwaku): add protected topic (#3211)
richard-ramos Jan 7, 2025
5be9078
feat: connection change event (#3225)
gabrielmer Jan 8, 2025
2ae5595
chore: libwaku tweaks (#3233)
Ivansete-status Jan 8, 2025
503223c
chore: golang example end using negentropy dependency plus simple rea…
Ivansete-status Jan 15, 2025
b4b7505
chore: optimize libwaku size (#3242)
Ivansete-status Jan 16, 2025
27fcfeb
chore: adding extra migration to sqlite and improving error message (…
gabrielmer Jan 16, 2025
cfc5ff4
dosc: fix wakudev hostname
yakimant Jan 17, 2025
a0358ad
group_manager: adapt smart contract param types
Ivansete-status Jan 19, 2025
10dcb81
update web3 vendor
Ivansete-status Jan 19, 2025
1c65e29
bump vendors for v0.35.0
Ivansete-status Jan 24, 2025
ba23044
protobuf.nim: fix compilation error after nim-libp2p bump
Ivansete-status Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/prepare_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ All items below are to be completed by the owner of the given release.
- [ ] Review possible update of [config-options](https://github.com/waku-org/docs.waku.org/blob/develop/docs/guides/nwaku/config-options.md)
- [ ] _End user impact_: Summarize impact of changes on Status end users (can be a comment in this issue).
- [ ] **Validate release candidate**
- [ ] Bump nwaku dependency in [waku-rust-bindings](https://github.com/waku-org/waku-rust-bindings) and make sure all examples and tests work

- [ ] Automated testing
- [ ] Ensures js-waku tests are green against release candidate
- [ ] Ask Vac-QA and Vac-DST to perform available tests against release candidate
- [ ] Vac-QA
- [ ] Vac-DST (we need additional report. see [this](https://www.notion.so/DST-Reports-1228f96fb65c80729cd1d98a7496fe6f))

- [ ] **On Waku fleets**
- [ ] Lock `waku.test` fleet to release candidate version
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:

export MAKEFLAGS="-j1"
export NIMFLAGS="--colors:off -d:chronicles_colors:none"
export USE_LIBBACKTRACE=0

make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 POSTGRES=$postgres_enabled test testwakunode2

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor
LINK_PCRE := 0
LOG_LEVEL := TRACE
FORMAT_MSG := "\\x1B[95mFormatting:\\x1B[39m"
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
Expand Down
10 changes: 5 additions & 5 deletions docs/benchmarks/postgres-adoption.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The following diagram shows the topology used:

For that, the next apps were used:

1. [Waku-publisher.](https://github.com/alrevuelta/waku-publisher/tree/9fb206c14a17dd37d20a9120022e86475ce0503f) This app can publish Relay messages with different numbers of clients
1. [Waku-publisher.](https://github.com/alrevuelta/waku-publisher/tree/9fb206c14a17dd37d20a9120022e86475ce0503f) This app can publish Relay messages with different numbers of clients
2. [Waku-store-query-generator](https://github.com/Ivansete-status/waku-store-query-generator/tree/19e6455537b6d44199cf0c8558480af5c6788b0d). This app is based on the Waku-publisher but in this case, it can spawn concurrent go-waku Store clients.

That topology is defined in [this](https://github.com/waku-org/test-waku-query/blob/7090cd125e739306357575730d0e54665c279670/docker/docker-compose-manual-binaries.yml) docker-compose file.
Expand All @@ -109,7 +109,7 @@ Notice that the two `nwaku` nodes run the very same version, which is compiled l

#### Comparing archive SQLite & Postgres performance in [nwaku-b6dd6899](https://github.com/waku-org/nwaku/tree/b6dd6899030ee628813dfd60ad1ad024345e7b41)

The next results were obtained by running the docker-compose-manual-binaries.yml from [test-waku-query-c078075](https://github.com/waku-org/test-waku-query/tree/c07807597faa781ae6c8c32eefdf48ecac03a7ba) in the sandbox machine (metal-01.he-eu-hel1.wakudev.misc.status.im.)
The next results were obtained by running the docker-compose-manual-binaries.yml from [test-waku-query-c078075](https://github.com/waku-org/test-waku-query/tree/c07807597faa781ae6c8c32eefdf48ecac03a7ba) in the sandbox machine (metal-01.he-eu-hel1.misc.wakudev.status.im.)

**Scenario 1**

Expand Down Expand Up @@ -155,7 +155,7 @@ In this case, the performance is similar regarding the timings. The store rate i

This nwaku commit is after a few **Postgres** optimizations were applied.

The next results were obtained by running the docker-compose-manual-binaries.yml from [test-waku-query-c078075](https://github.com/waku-org/test-waku-query/tree/c07807597faa781ae6c8c32eefdf48ecac03a7ba) in the sandbox machine (metal-01.he-eu-hel1.wakudev.misc.status.im.)
The next results were obtained by running the docker-compose-manual-binaries.yml from [test-waku-query-c078075](https://github.com/waku-org/test-waku-query/tree/c07807597faa781ae6c8c32eefdf48ecac03a7ba) in the sandbox machine (metal-01.he-eu-hel1.misc.wakudev.status.im.)

**Scenario 1**

Expand All @@ -181,7 +181,7 @@ It cannot be appreciated but the average *****Store***** time was 11ms.

**Scenario 3**

**Store rate:** 25 users generating 1 store-req/sec. Notice that the current Store query used generates pagination which provokes more subsequent queries than the 25 req/sec that would be expected without pagination.
**Store rate:** 25 users generating 1 store-req/sec. Notice that the current Store query used generates pagination which provokes more subsequent queries than the 25 req/sec that would be expected without pagination.

**Relay rate:** 1 user generating 10msg/sec, 10KB each.

Expand Down Expand Up @@ -217,7 +217,7 @@ The `db-postgres-hammer` is aimed to stress the database from the `select` point

#### Results

The following results were obtained by using the sandbox machine (metal-01.he-eu-hel1.wakudev.misc) and running nim-waku nodes from https://github.com/waku-org/nwaku/tree/b452ed865466a33b7f5b87fa937a8471b28e466e and using the `test-waku-query` project from https://github.com/waku-org/test-waku-query/tree/fef29cea182cc744c7940abc6c96d38a68739356
The following results were obtained by using the sandbox machine (metal-01.he-eu-hel1.misc.wakudev) and running nim-waku nodes from https://github.com/waku-org/nwaku/tree/b452ed865466a33b7f5b87fa937a8471b28e466e and using the `test-waku-query` project from https://github.com/waku-org/test-waku-query/tree/fef29cea182cc744c7940abc6c96d38a68739356

The following shows the results

Expand Down
44 changes: 44 additions & 0 deletions examples/golang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

## Pre-requisite
libwaku.so is needed to be compiled and present in build folder. To create it:

- Run only the first time and after changing the current commit
```code
make update
```
- Run the next every time you want to compile libwaku
```code
make POSTGRES=1 libwaku -j4
```

Also needed:

- Install libpq (needed by Postgres client)
- On Linux:
```code
sudo apt install libpq5
```
- On MacOS (not tested)
```code
brew install libpq
```

## Compilation

From the nwaku root folder:

```code
go build -o waku-go examples/golang/waku.go
```

## Run
From the nwaku root folder:


```code
export LD_LIBRARY_PATH=build
```

```code
./waku-go
```
2 changes: 1 addition & 1 deletion examples/golang/waku.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

/*
#cgo LDFLAGS: -L../../build/ -lwaku -lnegentropy
#cgo LDFLAGS: -L../../build/ -lwaku
#cgo LDFLAGS: -L../../ -Wl,-rpath,../../

#include "../../library/libwaku.h"
Expand Down
46 changes: 21 additions & 25 deletions examples/rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@

use std::os::raw::{c_char, c_int, c_void};
use std::{slice, thread, time};
use std::cell::OnceCell;
use std::ffi::CString;
use std::os::raw::{c_char, c_int, c_void};
use std::{slice, thread, time};

pub type WakuCallback =
unsafe extern "C" fn(
c_int,
*const c_char,
usize,
*const c_void,
);
pub type WakuCallback = unsafe extern "C" fn(c_int, *const c_char, usize, *const c_void);

extern "C" {
pub fn waku_new(
Expand All @@ -19,11 +12,9 @@ extern "C" {
user_data: *const c_void,
) -> *mut c_void;

pub fn waku_version(
ctx: *const c_void,
cb: WakuCallback,
user_data: *const c_void,
) -> c_int;
pub fn waku_version(ctx: *const c_void, cb: WakuCallback, user_data: *const c_void) -> c_int;

pub fn waku_start(ctx: *const c_void, cb: WakuCallback, user_data: *const c_void) -> c_int;

pub fn waku_default_pubsub_topic(
ctx: *mut c_void,
Expand All @@ -43,9 +34,8 @@ pub unsafe extern "C" fn trampoline<C>(
let closure = &mut *(data as *mut C);

let buffer_utf8 =
String::from_utf8(slice::from_raw_parts(buffer as *mut u8, buffer_len)
.to_vec())
.expect("valid utf8");
String::from_utf8(slice::from_raw_parts(buffer as *mut u8, buffer_len).to_vec())
.expect("valid utf8");

closure(return_val, &buffer_utf8);
}
Expand All @@ -70,7 +60,7 @@ fn main() {
unsafe {
// Create the waku node
let closure = |ret: i32, data: &str| {
println!("Ret {ret}. Error creating waku node {data}");
println!("Ret {ret}. waku_new closure called {data}");
};
let cb = get_trampoline(&closure);
let config_json_str = CString::new(config_json).unwrap();
Expand Down Expand Up @@ -99,14 +89,20 @@ fn main() {
let _ = default_pubsub_topic.set(data.to_string());
};
let cb = get_trampoline(&closure);
let _ret = waku_default_pubsub_topic(
ctx,
cb,
&closure as *const _ as *const c_void,
);
let _ret = waku_default_pubsub_topic(ctx, cb, &closure as *const _ as *const c_void);

println!("Version: {}", version.get_or_init(|| unreachable!()));
println!("Default pubsubTopic: {}", default_pubsub_topic.get_or_init(|| unreachable!()));
println!(
"Default pubsubTopic: {}",
default_pubsub_topic.get_or_init(|| unreachable!())
);

// Start the Waku node
let closure = |ret: i32, data: &str| {
println!("Ret {ret}. waku_start closure called {data}");
};
let cb = get_trampoline(&closure);
let _ret = waku_start(ctx, cb, &closure as *const _ as *const c_void);
}

loop {
Expand Down
5 changes: 5 additions & 0 deletions library/alloc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ type SharedSeq*[T] = tuple[data: ptr UncheckedArray[T], len: int]
proc alloc*(str: cstring): cstring =
# Byte allocation from the given address.
# There should be the corresponding manual deallocation with deallocShared !
if str.isNil():
var ret = cast[cstring](allocShared(1)) # Allocate memory for the null terminator
ret[0] = '\0' # Set the null terminator
return ret

let ret = cast[cstring](allocShared(len(str) + 1))
copyMem(ret, str, len(str) + 1)
return ret
Expand Down
20 changes: 20 additions & 0 deletions library/events/json_connection_change_event.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import system, std/json, libp2p/[connmanager, peerid]

import ../../waku/common/base64, ./json_base_event

type JsonConnectionChangeEvent* = ref object of JsonEvent
peerId*: string
peerEvent*: PeerEventKind

proc new*(
T: type JsonConnectionChangeEvent, peerId: string, peerEvent: PeerEventKind
): T =
# Returns a JsonConnectionChangeEvent event as indicated in
# https://rfc.vac.dev/spec/36/#jsonmessageevent-type

return JsonConnectionChangeEvent(
eventType: "connection_change", peerId: peerId, peerEvent: peerEvent
)

method `$`*(jsonConnectionChangeEvent: JsonConnectionChangeEvent): string =
$(%*jsonConnectionChangeEvent)
3 changes: 0 additions & 3 deletions library/events/json_message_event.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ proc toWakuMessage*(self: JsonMessage): Result[WakuMessage, string] =
proc `%`*(value: Base64String): JsonNode =
%(value.string)

proc `%`*(value: WakuMessageHash): JsonNode =
%(to0xHex(value))

type JsonMessageEvent* = ref object of JsonEvent
pubsubTopic*: string
messageHash*: WakuMessageHash
Expand Down
23 changes: 23 additions & 0 deletions library/events/json_topic_health_change_event.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import system, results, std/json
import stew/byteutils
import ../../waku/common/base64, ./json_base_event
import ../../waku/waku_relay

type JsonTopicHealthChangeEvent* = ref object of JsonEvent
pubsubTopic*: string
topicHealth*: TopicHealth

proc new*(
T: type JsonTopicHealthChangeEvent, pubsubTopic: string, topicHealth: TopicHealth
): T =
# Returns a TopicHealthChange event as indicated in
# https://rfc.vac.dev/spec/36/#jsonmessageevent-type

return JsonTopicHealthChangeEvent(
eventType: "relay_topic_health_change",
pubsubTopic: pubsubTopic,
topicHealth: topicHealth,
)

method `$`*(jsonTopicHealthChange: JsonTopicHealthChangeEvent): string =
$(%*jsonTopicHealthChange)
7 changes: 7 additions & 0 deletions library/libwaku.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ int waku_relay_subscribe(void* ctx,
WakuCallBack callback,
void* userData);

int waku_relay_add_protected_shard(void* ctx,
int clusterId,
int shardId,
char* publicKey,
WakuCallBack callback,
void* userData);

int waku_relay_unsubscribe(void* ctx,
const char* pubSubTopic,
WakuCallBack callback,
Expand Down
Loading
Loading