chore: fix rln in nimble

# Conflicts:
#	waku.nimble
This commit is contained in:
kaichaosun 2025-08-29 16:49:58 +08:00 committed by fryorcraken
parent 2691dcb325
commit 687e093a56
5 changed files with 40 additions and 10 deletions

3
.gitignore vendored
View File

@ -79,3 +79,6 @@ waku_handler.moc.cpp
# Nix build result
result
# Nimble
nimble.paths

View File

@ -5,6 +5,20 @@
set -e
# --- lock setup ---
lockdir="build/rln.lock"
mkdir -p build
# try to acquire lock (atomic)
while ! mkdir "${lockdir}" 2>/dev/null; do
echo "Another process is building RLN, waiting..."
sleep 1
done
# cleanup on exit
cleanup() { rm -rf "${lockdir}"; }
trap cleanup EXIT
# first argument is the build directory
build_dir=$1
rln_version=$2
@ -14,6 +28,11 @@ output_filename=$3
[[ -z "${rln_version}" ]] && { echo "No rln version specified"; exit 1; }
[[ -z "${output_filename}" ]] && { echo "No output filename specified"; exit 1; }
if [[ -f "${output_filename}" ]]; then
echo "RLN library already exists: ${output_filename}, skipping build."
exit 0
fi
# Get the host triplet
host_triplet=$(rustc --version --verbose | awk '/host:/{print $2}')

@ -1 +1 @@
Subproject commit 6f525d5447d97256750ca7856faead03e562ed20
Subproject commit 73d6108d9c7ad0a1283d1e361a3f86e6c676a305

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit 81ee8ce479d86acb73be7c4f365328e238d9b4a3
Subproject commit 48fb2d4a215c20326b0cb945913b1d614a0564b9

View File

@ -13,27 +13,37 @@ license = "MIT or Apache License 2.0"
### Dependencies
requires "nim >= 2.2.4",
"chronicles",
"confutils",
"confutils#e214b39",
"chronos",
"dnsdisc",
"eth",
"json_rpc",
"libbacktrace",
"nimcrypto",
"serialization >= 0.4.9",
"stew",
"stint",
"metrics",
"libp2p >= 1.13.0",
"web3",
"web3#48fb2d4", # fix 0.7.0 undeclared field: 'stream' error
"presto",
"regex",
"results",
"db_connector",
"minilru",
"quic",
"https://github.com/vacp2p/mix#0.1.0"
### Helper functions
proc ensureRln(libFile: string = "build/librln.a", version = "v0.7.0") =
if not fileExists(libFile):
echo "Building RLN library..."
let buildDir = getCurrentDir()
let outFile = libFile
exec "bash ./scripts/build_rln.sh " & buildDir & " " & version & " " & outFile
else:
echo "RLN library already exists: " & libFile
proc buildModule(filePath, params = "", lang = "c"): bool =
if not dirExists "build":
mkDir "build"
@ -55,11 +65,9 @@ proc buildModule(filePath, params = "", lang = "c"): bool =
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
for i in 2 ..< paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:build/" & name & " --mm:refc " & extra_params & " " &
ensureRln()
exec "nim " & lang & " --out:build/" & name & " --mm:refc " & " --passL:build/librln.a --passL:-lm --passL:-L" & getCurrentDir() & " " & params & " " &
srcDir & name & ".nim"
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =