Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c9ffe13
feat: ensure waku is installable via nimble
fryorcraken Oct 14, 2025
9c078e2
remove --verbose to avoid issue with long logs
fryorcraken Oct 15, 2025
2049746
continue-on-error: true
fryorcraken Oct 15, 2025
0dfcc62
only run for ubuntu
fryorcraken Oct 15, 2025
21a09be
set fail-fast false
fryorcraken Oct 15, 2025
76f7272
ignore nimbledeps folder
fryorcraken Oct 15, 2025
d70f6bb
specific commit hash
fryorcraken Oct 17, 2025
1e5f1e8
pin nim-stew to match vendor
fryorcraken Oct 17, 2025
3879208
remove ver in .nimble file
fryorcraken Oct 20, 2025
f4fe8ff
test
arnetheduck Oct 19, 2025
5754fb5
ci
arnetheduck Oct 19, 2025
02eb038
fixing rln
fryorcraken Oct 20, 2025
b449120
remove unused import
fryorcraken Oct 20, 2025
265c4d1
update gitignore
fryorcraken Oct 20, 2025
f9ae30e
pull submodules for RLN
fryorcraken Oct 20, 2025
b15085f
fix rln script
fryorcraken Oct 20, 2025
7eb9790
ensure build dir for RLN exists
fryorcraken Oct 20, 2025
415249d
update example to waku commit with rendezvous fix
fryorcraken Oct 20, 2025
3f45909
Update commit hash after rebase
fryorcraken Oct 20, 2025
983ced4
use new commit with correct nim-libp2p branch
fryorcraken Oct 20, 2025
6228dab
try with nimble nightly
fryorcraken Oct 20, 2025
933b281
run the executable instead of using nimble run
fryorcraken Oct 20, 2025
ee6b7a4
unpin stew
fryorcraken Oct 20, 2025
d7c09f2
upgrade libp2p to fix nimble
fryorcraken Oct 20, 2025
d67b42c
add nimble check directly on the waku library
fryorcraken Oct 20, 2025
531b001
fix format
fryorcraken Oct 21, 2025
8edd68d
bump waku in example with latest libp2p lib
fryorcraken Oct 21, 2025
50a3799
remove `--verbose` on nimble install as the CI job gets "cancelled"
fryorcraken Oct 21, 2025
b2a4c90
run nimble check first
fryorcraken Oct 21, 2025
224f769
installation first but add timeout
fryorcraken Oct 21, 2025
1d9cc37
ignore nimbledeps folders
fryorcraken Oct 21, 2025
37dd27f
re-add mix (needed)
fryorcraken Oct 21, 2025
0877554
fix ambiguous call
fryorcraken Oct 21, 2025
6cf2203
use nimble 0.20.1
fryorcraken Oct 21, 2025
6acf807
upgrade to nwaku with toHex fix
fryorcraken Oct 21, 2025
071334d
more toHex fix
fryorcraken Oct 21, 2025
0824c00
bump waku with more toHex fix
fryorcraken Oct 21, 2025
ce19d16
try to fix tag on mix
fryorcraken Oct 21, 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
53 changes: 53 additions & 0 deletions .github/workflows/test-nimble-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test Nimble Installation

on:
pull_request:
push:
branches:
- simpler-deps

jobs:
test-nimble-install:
continue-on-error: true # Some runs get oddly cancelled
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # TODO: Windows
nim-version: ['2.2.4'] # TODO: tests with more versions

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "true" # Needed to pull RLN script

- uses: nim-lang/setup-nimble-action@v1
with:
nimble-version: "0.20.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Display Nimble version
run: nimble --version

- name: Run nimble install on waku
run: nimble install
timeout-minutes: 60

- name: Run nimble check on waku
run: nimble check -l
timeout-minutes: 60

- name: Build example project
working-directory: examples/nimble
run: |
echo "Building example project..."
nimble --verbose build

- name: Run example project
working-directory: examples/nimble
run: |
echo "Running example project..."
# nimble --verbose run # TODO: Use nimble run
./example
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Nimble packages
/vendor/.nimble
nimbledeps

# Generated Files
*.generated.nim
Expand Down
4 changes: 4 additions & 0 deletions examples/nimble/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nimbledeps
nimble.develop
nimble.paths
example
11 changes: 11 additions & 0 deletions examples/nimble/config.nims
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# begin Nimble config (version 2)
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config

import os

let rlnLib = getCurrentDir() / "build" / "librln.a"
echo "RLN lib path: ", rlnLib
switch("passL", rlnLib)
switch("passL", "-lm")
33 changes: 33 additions & 0 deletions examples/nimble/example.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Package

version = "0.1.0"
author = "fryorcraken"
description = "Test Waku with nimble"
license = "MIT"
srcDir = "src"
bin = @["example"]

# Dependencies

requires "chronos"
requires "results"
requires "waku#44bfddb245e30eeab850730dee67c41cbe7f7252"

import os

proc ensureRln(libFile: string = "build/librln.a", version = "v0.8.0") =
if not fileExists(libFile):
echo "Building RLN library..."
let buildDir = parentDir(parentDir(getCurrentDir())) & "/vendor/zerokit"
let outFile = libFile

let outDir = parentDir(outFile)
if not dirExists(outDir):
mkDir(outDir) # Ensure build directory exists

exec "bash ../../scripts/build_rln.sh " & buildDir & " " & version & " " & outFile
else:
echo "RLN library already exists: " & libFile

before build:
ensureRln()
28 changes: 28 additions & 0 deletions examples/nimble/src/example.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import chronos, results
import waku

proc main() {.async.} =
echo("Starting Waku node...")

# Create a basic configuration for the Waku node
# No RLN so we don't need to path an eth rpc endpoint
let config = NodeConfig.init(
protocolsConfig = ProtocolsConfig.init(entryNodes = @[], clusterId = 42)
)

# Create the node using the library API's createNode function
let node = (await createNode(config)).valueOr:
echo("Failed to create node: ", error)
quit(1)

echo("Waku node created successfully!")

# Start the node
(await startWaku(addr node)).isOkOr:
echo("Failed to start node: ", error)
quit(1)

echo("Node started successfully! exiting")

when isMainModule:
waitFor main()
2 changes: 1 addition & 1 deletion scripts/build_rln.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ host_triplet=$(rustc --version --verbose | awk '/host:/{print $2}')

tarball="${host_triplet}"

tarball+="-rln.tar.gz"
tarball+="-default-rln.tar.gz"

# Download the prebuilt rln library if it is available
if curl --silent --fail-with-body -L \
Expand Down
4 changes: 3 additions & 1 deletion waku.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "0.36.0"
author = "Status Research & Development GmbH"
description = "Waku, Private P2P Messaging for Resource-Restricted Devices"
license = "MIT or Apache License 2.0"
srcDir = "waku"
#bin = @["build/waku"]

### Dependencies
Expand All @@ -30,7 +31,8 @@ requires "nim >= 2.2.4",
"regex",
"results",
"db_connector",
"minilru"
"minilru",
"https://github.com/vacp2p/mix#v0.1.0"

### Helper functions
proc buildModule(filePath, params = "", lang = "c"): bool =
Expand Down
2 changes: 1 addition & 1 deletion waku/utils/requests.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import bearssl/rand, stew/byteutils
proc generateRequestId*(rng: ref HmacDrbgContext): string =
var bytes: array[10, byte]
hmacDrbgGenerate(rng[], bytes)
return toHex(bytes)
return byteutils.toHex(bytes)
2 changes: 1 addition & 1 deletion waku/waku_filter_v2/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type WakuFilterClient* = ref object of LPProtocol
func generateRequestId(rng: ref HmacDrbgContext): string =
var bytes: array[10, byte]
hmacDrbgGenerate(rng[], bytes)
return toHex(bytes)
return byteutils.toHex(bytes)

proc addSubscrObserver*(wfc: WakuFilterClient, obs: SubscriptionObserver) =
wfc.subscrObservers.add(obs)
Expand Down
8 changes: 4 additions & 4 deletions waku/waku_store_sync/reconciliation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ proc messageIngress*(
let id = SyncID(time: msg.timestamp, hash: msgHash)

self.storage.insert(id, pubsubTopic, msg.contentTopic).isOkOr:
error "failed to insert new message", msg_hash = $id.hash.toHex(), error = $error
error "failed to insert new message", msg_hash = $byteutils.toHex(id.hash), error = $error

proc messageIngress*(
self: SyncReconciliation,
msgHash: WakuMessageHash,
pubsubTopic: PubsubTopic,
msg: WakuMessage,
) =
trace "message ingress", msg_hash = msgHash.toHex(), msg = msg
trace "message ingress", msg_hash = byteutils.toHex(msgHash), msg = msg

if msg.ephemeral:
return

let id = SyncID(time: msg.timestamp, hash: msgHash)

self.storage.insert(id, pubsubTopic, msg.contentTopic).isOkOr:
error "failed to insert new message", msg_hash = $id.hash.toHex(), error = $error
error "failed to insert new message", msg_hash = $byteutils.toHex(id.hash), error = $error

proc messageIngress*(
self: SyncReconciliation,
Expand All @@ -104,7 +104,7 @@ proc messageIngress*(
contentTopic: ContentTopic,
) =
self.storage.insert(id, pubsubTopic, contentTopic).isOkOr:
error "failed to insert new message", msg_hash = $id.hash.toHex(), error = $error
error "failed to insert new message", msg_hash = $byteutils.toHex(id.hash), error = $error

proc preProcessPayload(
self: SyncReconciliation, payload: RangesData
Expand Down
Loading