mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-06 22:19:30 +00:00
Combines five dep-and-build changes that all flow from the libp2p v2.0.0
upgrade and the move to the extracted libp2p_mix / mix-rln plugin stack:
waku.nimble:
* libp2p: ff8d51857 -> c43199378 (release/v2.0.0 tip; sha-pinned until
vacp2p cuts a v2.0.0 tag).
* Drop the bare `zlib < 0.2` cap — no longer needed by the upgraded
libp2p.
* websock: bare ">= 0.4.0" — replaces the d4cd68b URL+SHA workaround
that pinned through a libp2p commit-specific websock SHA.
* nim-json-rpc: switch to chaitanyaprem/nim-json-rpc#f05fad25 — relaxes
websock cap to allow >=0.4.0. TODO: revert to status-im/nim-json-rpc
once status-im/nim-json-rpc#277 merges and a tag is cut.
* lsquic: bare ">= 0.4.1" (drops URL form).
* Add mix-rln-spam-protection-plugin pin (23b278b4) and nim-libp2p-mix
pin (50c4ab4f — PR #14 HEAD); the plugin pins the same libp2p_mix
SHA so the diamond dep collapses to a single source.
waku/factory/waku.nim:
* Explicit HPService.setup(switch) / AutonatService.setup(switch)
calls. libp2p v2.0.0's Service lifecycle refactor (libp2p#2462)
removed switch.start's auto-setup loop, so any caller that assigns
directly to switch.services (we do) is responsible for calling
setup() themselves. Without it, AutonatService.addressMapper stays
nil and peerInfo.expandAddrs SIGSEGVs during start(). Wrapped in
try/except for ServiceSetupError so a setup failure surfaces as a
logged error rather than a crash.
Build / scripts:
* scripts/build_rln_mix.sh removed and Makefile simplified — librln
is now a single shared archive built from zerokit's `stateless`
features (no separate librln_mix archive).
* simulations/mixnet/build_setup.sh + setup_credentials.nim updated
to use librln_v2.0.2.a directly and run RLN keystore setup before
nodes start.
Validated:
* Cold local-cache nimble setup --localdeps -y.
* wakunode2 and chat2mix link cleanly.
* Mixnet roundtrip sim: [PASS] bob received message from alice.
* RLN proof generation + verification on every in-path mix node:
5 gen_called == 5 verified, 0 SPAM_PROOF_* errors.
132 lines
5.0 KiB
Nim
132 lines
5.0 KiB
Nim
import os
|
|
|
|
if defined(release):
|
|
switch("nimcache", "nimcache/release/$projectName")
|
|
else:
|
|
switch("nimcache", "nimcache/debug/$projectName")
|
|
|
|
if defined(windows):
|
|
switch("passL", "rln.lib")
|
|
switch("define", "postgres=false")
|
|
|
|
# disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries
|
|
switch("passL", "-Wl,--no-insert-timestamp")
|
|
# increase stack size
|
|
switch("passL", "-Wl,--stack,8388608")
|
|
# https://github.com/nim-lang/Nim/issues/4057
|
|
--tlsEmulation:
|
|
off
|
|
if defined(i386):
|
|
# set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag so we can use PAE, if enabled, and access more than 2 GiB of RAM
|
|
switch("passL", "-Wl,--large-address-aware")
|
|
|
|
# https://github.com/status-im/nimbus-eth2/blob/stable/docs/cpu_features.md#ssse3-supplemental-sse3
|
|
# suggests that SHA256 hashing with SSSE3 is 20% faster than without SSSE3, so
|
|
# given its near-ubiquity in the x86 installed base, it renders a distribution
|
|
# build more viable on an overall broader range of hardware.
|
|
#
|
|
if defined(disableMarchNative):
|
|
if defined(i386) or defined(amd64):
|
|
if defined(macosx):
|
|
# macOS Catalina is EOL as of 2022-09
|
|
# https://support.apple.com/kb/sp833
|
|
# "macOS Big Sur - Technical Specifications" lists current oldest
|
|
# supported models: MacBook (2015 or later), MacBook Air (2013 or later),
|
|
# MacBook Pro (Late 2013 or later), Mac mini (2014 or later), iMac (2014
|
|
# or later), iMac Pro (2017 or later), Mac Pro (2013 or later).
|
|
#
|
|
# These all have Haswell or newer CPUs.
|
|
#
|
|
# This ensures AVX2, AES-NI, PCLMUL, BMI1, and BMI2 instruction set support.
|
|
switch("passC", "-march=haswell -mtune=generic")
|
|
switch("passL", "-march=haswell -mtune=generic")
|
|
else:
|
|
if defined(marchOptimized):
|
|
# -march=broadwell: https://github.com/status-im/nimbus-eth2/blob/stable/docs/cpu_features.md#bmi2--adx
|
|
# Changed to x86-64-v2 for broader support
|
|
switch("passC", "-march=x86-64-v2 -mtune=generic")
|
|
switch("passL", "-march=x86-64-v2 -mtune=generic")
|
|
else:
|
|
switch("passC", "-mssse3")
|
|
switch("passL", "-mssse3")
|
|
elif defined(macosx) and defined(arm64):
|
|
# Apple's Clang can't handle "-march=native" on M1: https://github.com/status-im/nimbus-eth2/issues/2758
|
|
switch("passC", "-mcpu=apple-m1")
|
|
switch("passL", "-mcpu=apple-m1")
|
|
else:
|
|
if not defined(android):
|
|
switch("passC", "-march=native")
|
|
switch("passL", "-march=native")
|
|
if defined(windows):
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782
|
|
# ("-fno-asynchronous-unwind-tables" breaks Nim's exception raising, sometimes)
|
|
switch("passC", "-mno-avx512f")
|
|
switch("passL", "-mno-avx512f")
|
|
|
|
--threads:
|
|
on
|
|
--opt:
|
|
speed
|
|
|
|
--excessiveStackTrace:
|
|
on
|
|
# enable metric collection
|
|
--define:
|
|
metrics
|
|
# for heap-usage-by-instance-type metrics and object base-type strings
|
|
--define:
|
|
nimTypeNames
|
|
|
|
# the default open files limit is too low on macOS (512), breaking the
|
|
# "--debugger:native" build. It can be increased with `ulimit -n 1024`.
|
|
if not defined(macosx) and not defined(android):
|
|
# add debugging symbols and original files and line numbers
|
|
--debugger:
|
|
native
|
|
when defined(enable_libbacktrace):
|
|
# light-weight stack traces using libbacktrace and libunwind
|
|
# opt-in: pass -d:enable_libbacktrace (requires libbacktrace in project deps)
|
|
--define:
|
|
nimStackTraceOverride
|
|
switch("import", "libbacktrace")
|
|
|
|
# Auto-import the Option[T] valueOr/withValue shim for every compilation
|
|
# unit (libp2p 1.15.3 dropped the Option overloads previously provided by
|
|
# libp2p/utility). Per-file imports follow cover-traffic's pattern for
|
|
# the 15 files touched there, but our branch has additional downstream
|
|
# call sites that need the shim too -- auto-import covers them without
|
|
# requiring every file to remember the explicit import.
|
|
switch("import", "waku/common/option_shims")
|
|
|
|
--define:
|
|
nimOldCaseObjects
|
|
# https://github.com/status-im/nim-confutils/issues/9
|
|
|
|
# `switch("warning[CaseTransition]", "off")` fails with "Error: invalid command line option: '--warning[CaseTransition]'"
|
|
switch("warning", "CaseTransition:off")
|
|
|
|
# The compiler doth protest too much, methinks, about all these cases where it can't
|
|
# do its (N)RVO pass: https://github.com/nim-lang/RFCs/issues/230
|
|
switch("warning", "ObservableStores:off")
|
|
|
|
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
|
|
switch("warning", "LockLevel:off")
|
|
|
|
if defined(android):
|
|
var clang = getEnv("ANDROID_COMPILER")
|
|
var ndk_home = getEnv("ANDROID_TOOLCHAIN_DIR")
|
|
var sysroot = ndk_home & "/sysroot"
|
|
var cincludes = sysroot & "/usr/include/" & getEnv("ANDROID_ARCH")
|
|
|
|
switch("clang.path", ndk_home & "/bin")
|
|
switch("clang.exe", clang)
|
|
switch("clang.linkerexe", clang)
|
|
switch("passC", "--sysroot=" & sysRoot)
|
|
switch("passL", "--sysroot=" & sysRoot)
|
|
switch("cincludes", sysRoot & "/usr/include/")
|
|
# begin Nimble config (version 2)
|
|
--noNimblePath
|
|
when withDir(thisDir(), system.fileExists("nimble.paths")):
|
|
include "nimble.paths"
|
|
# end Nimble config
|