Skip to content

Commit 6421685

Browse files
chore: bump v0.38.0 (#3712)
1 parent 2c2d8e1 commit 6421685

33 files changed

Lines changed: 227 additions & 87 deletions

.github/workflows/windows-build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
make
3434
cmake
3535
upx
36+
unzip
3637
mingw-w64-x86_64-rust
3738
mingw-w64-x86_64-postgresql
3839
mingw-w64-x86_64-gcc
@@ -44,6 +45,12 @@ jobs:
4445
mingw-w64-x86_64-cmake
4546
mingw-w64-x86_64-llvm
4647
mingw-w64-x86_64-clang
48+
mingw-w64-x86_64-nasm
49+
50+
- name: Manually install nasm
51+
run: |
52+
bash scripts/install_nasm_in_windows.sh
53+
source $HOME/.bashrc
4754
4855
- name: Add UPX to PATH
4956
run: |
@@ -54,7 +61,7 @@ jobs:
5461
5562
- name: Verify dependencies
5663
run: |
57-
which upx gcc g++ make cmake cargo rustc python
64+
which upx gcc g++ make cmake cargo rustc python nasm
5865
5966
- name: Updating submodules
6067
run: git submodule update --init --recursive

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ ifeq ($(detected_OS),Windows)
4343

4444
LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq
4545
NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)")
46+
NIM_PARAMS += --passL:"-Wl,--allow-multiple-definition"
4647

4748
export PATH := /c/msys64/usr/bin:/c/msys64/mingw64/bin:/c/msys64/usr/lib:/c/msys64/mingw64/lib:$(PATH)
4849

scripts/build_rln.sh

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22

3-
# This script is used to build the rln library for the current platform, or download it from the
4-
# release page if it is available.
3+
# This script is used to build the rln library for the current platform.
4+
# Previously downloaded prebuilt binaries, but due to compatibility issues
5+
# we now always build from source.
56

67
set -e
78

@@ -14,41 +15,26 @@ output_filename=$3
1415
[[ -z "${rln_version}" ]] && { echo "No rln version specified"; exit 1; }
1516
[[ -z "${output_filename}" ]] && { echo "No output filename specified"; exit 1; }
1617

17-
# Get the host triplet
18-
host_triplet=$(rustc --version --verbose | awk '/host:/{print $2}')
19-
20-
tarball="${host_triplet}"
21-
tarball+="-stateless"
22-
tarball+="-rln.tar.gz"
23-
24-
# Download the prebuilt rln library if it is available
25-
if curl --silent --fail-with-body -L \
26-
"https://github.com/vacp2p/zerokit/releases/download/$rln_version/$tarball" \
27-
-o "${tarball}";
28-
then
29-
echo "Downloaded ${tarball}"
30-
tar -xzf "${tarball}"
31-
mv "release/librln.a" "${output_filename}"
32-
rm -rf "${tarball}" release
18+
echo "Building RLN library from source (version ${rln_version})..."
19+
20+
# Check if submodule version = version in Makefile
21+
cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml"
22+
23+
detected_OS=$(uname -s)
24+
if [[ "$detected_OS" == MINGW* || "$detected_OS" == MSYS* ]]; then
25+
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p')
3326
else
34-
echo "Failed to download ${tarball}"
35-
# Build rln instead
36-
# first, check if submodule version = version in Makefile
37-
cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml"
38-
39-
detected_OS=$(uname -s)
40-
if [[ "$detected_OS" == MINGW* || "$detected_OS" == MSYS* ]]; then
41-
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p')
42-
else
43-
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | jq -r '.packages[] | select(.name == "rln") | .version')
44-
fi
45-
46-
if [[ "v${submodule_version}" != "${rln_version}" ]]; then
47-
echo "Submodule version (v${submodule_version}) does not match version in Makefile (${rln_version})"
48-
echo "Please update the submodule to ${rln_version}"
49-
exit 1
50-
fi
51-
# if submodule version = version in Makefile, build rln
52-
cargo build --release -p rln --manifest-path "${build_dir}/rln/Cargo.toml"
53-
cp "${build_dir}/target/release/librln.a" "${output_filename}"
27+
submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | jq -r '.packages[] | select(.name == "rln") | .version')
28+
fi
29+
30+
if [[ "v${submodule_version}" != "${rln_version}" ]]; then
31+
echo "Submodule version (v${submodule_version}) does not match version in Makefile (${rln_version})"
32+
echo "Please update the submodule to ${rln_version}"
33+
exit 1
5434
fi
35+
36+
# Build rln from source
37+
cargo build --release -p rln --manifest-path "${build_dir}/rln/Cargo.toml"
38+
cp "${build_dir}/target/release/librln.a" "${output_filename}"
39+
40+
echo "Successfully built ${output_filename}"

scripts/install_nasm_in_windows.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
4+
NASM_VERSION="2.16.01"
5+
NASM_ZIP="nasm-${NASM_VERSION}-win64.zip"
6+
NASM_URL="https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/win64/${NASM_ZIP}"
7+
8+
INSTALL_DIR="$HOME/.local/nasm"
9+
BIN_DIR="$INSTALL_DIR/bin"
10+
11+
echo "Installing NASM ${NASM_VERSION}..."
12+
13+
# Create directories
14+
mkdir -p "$BIN_DIR"
15+
cd "$INSTALL_DIR"
16+
17+
# Download
18+
if [ ! -f "$NASM_ZIP" ]; then
19+
echo "Downloading NASM..."
20+
curl -LO "$NASM_URL"
21+
fi
22+
23+
# Extract
24+
echo "Extracting..."
25+
unzip -o "$NASM_ZIP"
26+
27+
# Move binaries
28+
cp nasm-*/nasm.exe "$BIN_DIR/"
29+
cp nasm-*/ndisasm.exe "$BIN_DIR/"
30+
31+
# Add to PATH in bashrc (idempotent)
32+
if ! grep -q 'nasm/bin' "$HOME/.bashrc"; then
33+
echo '' >> "$HOME/.bashrc"
34+
echo '# NASM' >> "$HOME/.bashrc"
35+
echo 'export PATH="$HOME/.local/nasm/bin:$PATH"' >> "$HOME/.bashrc"
36+
fi
37+

scripts/regenerate_anvil_state.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env bash
2+
3+
# Simple script to regenerate the Anvil state file
4+
# This creates a state file compatible with the current Foundry version
5+
6+
set -e
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
10+
STATE_DIR="$PROJECT_ROOT/tests/waku_rln_relay/anvil_state"
11+
STATE_FILE="$STATE_DIR/state-deployed-contracts-mint-and-approved.json"
12+
STATE_FILE_GZ="${STATE_FILE}.gz"
13+
14+
echo "==================================="
15+
echo "Anvil State File Regeneration Tool"
16+
echo "==================================="
17+
echo ""
18+
19+
# Check if Foundry is installed
20+
if ! command -v anvil &> /dev/null; then
21+
echo "ERROR: anvil is not installed!"
22+
echo "Please run: make rln-deps"
23+
exit 1
24+
fi
25+
26+
ANVIL_VERSION=$(anvil --version 2>/dev/null | head -n1)
27+
echo "Using Foundry: $ANVIL_VERSION"
28+
echo ""
29+
30+
# Backup existing state file
31+
if [ -f "$STATE_FILE_GZ" ]; then
32+
BACKUP_FILE="${STATE_FILE_GZ}.backup-$(date +%Y%m%d-%H%M%S)"
33+
echo "Backing up existing state file to: $(basename $BACKUP_FILE)"
34+
cp "$STATE_FILE_GZ" "$BACKUP_FILE"
35+
fi
36+
37+
# Remove old state files
38+
rm -f "$STATE_FILE" "$STATE_FILE_GZ"
39+
40+
echo ""
41+
echo "Running test to generate fresh state file..."
42+
echo "This will:"
43+
echo " 1. Build RLN library"
44+
echo " 2. Start Anvil with state dump enabled"
45+
echo " 3. Deploy contracts"
46+
echo " 4. Save state and compress it"
47+
echo ""
48+
49+
cd "$PROJECT_ROOT"
50+
51+
# Run a single test that deploys contracts
52+
# The test framework will handle state dump
53+
make test tests/waku_rln_relay/test_rln_group_manager_onchain.nim "RLN instances" || {
54+
echo ""
55+
echo "Test execution completed (exit status: $?)"
56+
echo "Checking if state file was generated..."
57+
}
58+
59+
# Check if state file was created
60+
if [ -f "$STATE_FILE" ]; then
61+
echo ""
62+
echo "✓ State file generated: $STATE_FILE"
63+
64+
# Compress it
65+
gzip -c "$STATE_FILE" > "$STATE_FILE_GZ"
66+
echo "✓ Compressed: $STATE_FILE_GZ"
67+
68+
# File sizes
69+
STATE_SIZE=$(du -h "$STATE_FILE" | cut -f1)
70+
GZ_SIZE=$(du -h "$STATE_FILE_GZ" | cut -f1)
71+
echo ""
72+
echo "File sizes:"
73+
echo " Uncompressed: $STATE_SIZE"
74+
echo " Compressed: $GZ_SIZE"
75+
76+
# Optionally remove uncompressed
77+
echo ""
78+
read -p "Remove uncompressed state file? [y/N] " -n 1 -r
79+
echo
80+
if [[ $REPLY =~ ^[Yy]$ ]]; then
81+
rm "$STATE_FILE"
82+
echo "✓ Removed uncompressed file"
83+
fi
84+
85+
echo ""
86+
echo "============================================"
87+
echo "✓ SUCCESS! State file regenerated"
88+
echo "============================================"
89+
echo ""
90+
echo "Next steps:"
91+
echo " 1. Test locally: make test tests/node/test_wakunode_lightpush.nim"
92+
echo " 2. If tests pass, commit: git add $STATE_FILE_GZ"
93+
echo " 3. Push and verify CI passes"
94+
echo ""
95+
else
96+
echo ""
97+
echo "============================================"
98+
echo "✗ ERROR: State file was not generated"
99+
echo "============================================"
100+
echo ""
101+
echo "The state file should have been created at: $STATE_FILE"
102+
echo "Please check the test output above for errors."
103+
exit 1
104+
fi

tests/testlib/wakunode.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import
2727
# TODO: migrate to usage of a test cluster conf
2828
proc defaultTestWakuConfBuilder*(): WakuConfBuilder =
2929
var builder = WakuConfBuilder.init()
30-
builder.withP2pTcpPort(Port(60000))
30+
builder.withP2pTcpPort(Port(0))
3131
builder.withP2pListenAddress(parseIpAddress("0.0.0.0"))
3232
builder.restServerConf.withListenAddress(parseIpAddress("127.0.0.1"))
3333
builder.withDnsAddrsNameServers(
@@ -80,7 +80,7 @@ proc newTestWakuNode*(
8080
# Update extPort to default value if it's missing and there's an extIp or a DNS domain
8181
let extPort =
8282
if (extIp.isSome() or dns4DomainName.isSome()) and extPort.isNone():
83-
some(Port(60000))
83+
some(Port(0))
8484
else:
8585
extPort
8686

tests/waku_core/test_message_digest.nim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ suite "Waku Message - Deterministic hashing":
3535
byteutils.toHex(message.payload) == "010203045445535405060708"
3636
byteutils.toHex(message.meta) == ""
3737
byteutils.toHex(toBytesBE(uint64(message.timestamp))) == "175789bfa23f8400"
38-
messageHash.toHex() ==
38+
byteutils.toHex(messageHash) ==
3939
"cccab07fed94181c83937c8ca8340c9108492b7ede354a6d95421ad34141fd37"
4040

4141
test "digest computation - meta field (12 bytes)":
@@ -69,7 +69,7 @@ suite "Waku Message - Deterministic hashing":
6969
byteutils.toHex(message.payload) == "010203045445535405060708"
7070
byteutils.toHex(message.meta) == "73757065722d736563726574"
7171
byteutils.toHex(toBytesBE(uint64(message.timestamp))) == "175789bfa23f8400"
72-
messageHash.toHex() ==
72+
byteutils.toHex(messageHash) ==
7373
"b9b4852f9d8c489846e8bfc6c5ca6a1a8d460a40d28832a966e029eb39619199"
7474

7575
test "digest computation - meta field (64 bytes)":
@@ -104,7 +104,7 @@ suite "Waku Message - Deterministic hashing":
104104
byteutils.toHex(message.meta) ==
105105
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
106106
byteutils.toHex(toBytesBE(uint64(message.timestamp))) == "175789bfa23f8400"
107-
messageHash.toHex() ==
107+
byteutils.toHex(messageHash) ==
108108
"653460d04f66c5b11814d235152f4f246e6f03ef80a305a825913636fbafd0ba"
109109

110110
test "digest computation - zero length payload":
@@ -132,7 +132,7 @@ suite "Waku Message - Deterministic hashing":
132132

133133
## Then
134134
check:
135-
messageHash.toHex() ==
135+
byteutils.toHex(messageHash) ==
136136
"0f6448cc23b2db6c696aa6ab4b693eff4cf3549ff346fe1dbeb281697396a09f"
137137

138138
test "waku message - check meta size is enforced":
Binary file not shown.

tests/waku_store/test_wakunode_store.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ procSuite "WakuNode - Store":
386386
let mountArchiveRes = server.mountArchive(archiveA)
387387
assert mountArchiveRes.isOk(), mountArchiveRes.error
388388

389-
waitFor server.mountStore((3, 500.millis))
389+
waitFor server.mountStore((3, 200.millis))
390390

391391
client.mountStoreClient()
392392

@@ -413,11 +413,11 @@ procSuite "WakuNode - Store":
413413

414414
for count in 0 ..< 3:
415415
waitFor successProc()
416-
waitFor sleepAsync(5.millis)
416+
waitFor sleepAsync(1.millis)
417417

418418
waitFor failsProc()
419419

420-
waitFor sleepAsync(500.millis)
420+
waitFor sleepAsync(200.millis)
421421

422422
for count in 0 ..< 3:
423423
waitFor successProc()

0 commit comments

Comments
 (0)