From 0c91004615799f8143275331e08e0ee979b6d856 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Fri, 2 Jan 2026 01:02:13 +0530 Subject: [PATCH 1/3] chore: initial commit of deprecte vendor --- .gitmodules | 180 +----------------- Makefile | 154 ++++++++------- README.md | 24 ++- apps/networkmonitor/networkmonitor.nim | 2 +- config.nims | 7 +- examples/filter_subscriber.nim | 2 +- .../lightpush_mix/lightpush_publisher_mix.nim | 2 +- examples/lightpush_publisher.nim | 2 +- examples/publisher.nim | 2 +- examples/subscriber.nim | 2 +- library/kernel_api/debug_node_api.nim | 2 +- .../peer_store/test_waku_peer_storage.nim | 2 +- tests/node/test_wakunode_peer_exchange.nim | 2 +- tests/test_peer_storage.nim | 2 +- tests/test_waku_metadata.nim | 2 +- tests/test_wakunode.nim | 2 +- tests/waku_discv5/test_waku_discv5.nim | 2 +- tests/waku_peer_exchange/test_rpc_codec.nim | 2 +- tests/waku_peer_exchange/utils.nim | 2 +- vendor/db_connector | 1 - vendor/dnsclient.nim | 1 - vendor/nim-bearssl | 1 - vendor/nim-chronicles | 1 - vendor/nim-chronos | 1 - vendor/nim-confutils | 1 - vendor/nim-dnsdisc | 1 - vendor/nim-eth | 1 - vendor/nim-faststreams | 1 - vendor/nim-http-utils | 1 - vendor/nim-json-rpc | 1 - vendor/nim-json-serialization | 1 - vendor/nim-libbacktrace | 1 - vendor/nim-libp2p | 1 - vendor/nim-metrics | 1 - vendor/nim-minilru | 1 - vendor/nim-nat-traversal | 1 - vendor/nim-presto | 1 - vendor/nim-regex | 1 - vendor/nim-results | 1 - vendor/nim-secp256k1 | 1 - vendor/nim-serialization | 1 - vendor/nim-sqlite3-abi | 1 - vendor/nim-stew | 1 - vendor/nim-stint | 1 - vendor/nim-taskpools | 1 - vendor/nim-testutils | 1 - vendor/nim-toml-serialization | 1 - vendor/nim-unicodedb | 1 - vendor/nim-unittest2 | 1 - vendor/nim-web3 | 1 - vendor/nim-websock | 1 - vendor/nim-zlib | 1 - vendor/nimbus-build-system | 1 - vendor/nimcrypto | 1 - vendor/nph | 1 - waku.nimble | 76 +++++--- waku/api/entry_nodes.nim | 2 +- waku/common/enr.nim | 2 +- waku/common/enr/builder.nim | 6 +- waku/common/enr/typed_record.nim | 2 +- waku/discovery/waku_dnsdisc.nim | 2 +- waku/factory/waku.nim | 2 +- waku/node/kernel_api/filter.nim | 2 +- waku/node/kernel_api/lightpush.nim | 2 +- waku/node/kernel_api/peer_exchange.nim | 2 +- waku/node/kernel_api/relay.nim | 2 +- waku/node/kernel_api/store.nim | 2 +- .../peer_store/waku_peer_storage.nim | 2 +- waku/node/peer_manager/waku_peer_store.nim | 2 +- waku/node/waku_node.nim | 2 +- waku/waku_core/peers.nim | 2 +- waku/waku_metadata/protocol.nim | 2 +- waku/waku_peer_exchange/protocol.nim | 2 +- waku/waku_store/resume.nim | 2 +- waku/waku_store_sync/reconciliation.nim | 2 +- waku/waku_store_sync/transfer.nim | 2 +- 76 files changed, 193 insertions(+), 358 deletions(-) delete mode 160000 vendor/db_connector delete mode 160000 vendor/dnsclient.nim delete mode 160000 vendor/nim-bearssl delete mode 160000 vendor/nim-chronicles delete mode 160000 vendor/nim-chronos delete mode 160000 vendor/nim-confutils delete mode 160000 vendor/nim-dnsdisc delete mode 160000 vendor/nim-eth delete mode 160000 vendor/nim-faststreams delete mode 160000 vendor/nim-http-utils delete mode 160000 vendor/nim-json-rpc delete mode 160000 vendor/nim-json-serialization delete mode 160000 vendor/nim-libbacktrace delete mode 160000 vendor/nim-libp2p delete mode 160000 vendor/nim-metrics delete mode 160000 vendor/nim-minilru delete mode 160000 vendor/nim-nat-traversal delete mode 160000 vendor/nim-presto delete mode 160000 vendor/nim-regex delete mode 160000 vendor/nim-results delete mode 160000 vendor/nim-secp256k1 delete mode 160000 vendor/nim-serialization delete mode 160000 vendor/nim-sqlite3-abi delete mode 160000 vendor/nim-stew delete mode 160000 vendor/nim-stint delete mode 160000 vendor/nim-taskpools delete mode 160000 vendor/nim-testutils delete mode 160000 vendor/nim-toml-serialization delete mode 160000 vendor/nim-unicodedb delete mode 160000 vendor/nim-unittest2 delete mode 160000 vendor/nim-web3 delete mode 160000 vendor/nim-websock delete mode 160000 vendor/nim-zlib delete mode 160000 vendor/nimbus-build-system delete mode 160000 vendor/nimcrypto delete mode 160000 vendor/nph diff --git a/.gitmodules b/.gitmodules index 4d56c4333..faf5084ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,184 +1,12 @@ -[submodule "vendor/nim-eth"] - path = vendor/nim-eth - url = https://github.com/status-im/nim-eth.git - ignore = dirty - branch = master -[submodule "vendor/nim-secp256k1"] - path = vendor/nim-secp256k1 - url = https://github.com/status-im/nim-secp256k1.git - ignore = dirty - branch = master -[submodule "vendor/nim-libp2p"] - path = vendor/nim-libp2p - url = https://github.com/vacp2p/nim-libp2p.git - ignore = dirty - branch = master -[submodule "vendor/nim-stew"] - path = vendor/nim-stew - url = https://github.com/status-im/nim-stew.git - ignore = dirty - branch = master -[submodule "vendor/nimbus-build-system"] - path = vendor/nimbus-build-system - url = https://github.com/status-im/nimbus-build-system.git - ignore = dirty - branch = master -[submodule "vendor/nim-nat-traversal"] - path = vendor/nim-nat-traversal - url = https://github.com/status-im/nim-nat-traversal.git - ignore = dirty - branch = master -[submodule "vendor/nim-libbacktrace"] - path = vendor/nim-libbacktrace - url = https://github.com/status-im/nim-libbacktrace.git - ignore = dirty - branch = master -[submodule "vendor/nim-confutils"] - path = vendor/nim-confutils - url = https://github.com/status-im/nim-confutils.git - ignore = dirty - branch = master -[submodule "vendor/nim-chronicles"] - path = vendor/nim-chronicles - url = https://github.com/status-im/nim-chronicles.git - ignore = dirty - branch = master -[submodule "vendor/nim-faststreams"] - path = vendor/nim-faststreams - url = https://github.com/status-im/nim-faststreams.git - ignore = dirty - branch = master -[submodule "vendor/nim-chronos"] - path = vendor/nim-chronos - url = https://github.com/status-im/nim-chronos.git - ignore = dirty - branch = master -[submodule "vendor/nim-json-serialization"] - path = vendor/nim-json-serialization - url = https://github.com/status-im/nim-json-serialization.git - ignore = dirty - branch = master -[submodule "vendor/nim-serialization"] - path = vendor/nim-serialization - url = https://github.com/status-im/nim-serialization.git - ignore = dirty - branch = master -[submodule "vendor/nimcrypto"] - path = vendor/nimcrypto - url = https://github.com/cheatfate/nimcrypto.git - ignore = dirty - branch = master -[submodule "vendor/nim-metrics"] - path = vendor/nim-metrics - url = https://github.com/status-im/nim-metrics.git - ignore = dirty - branch = master -[submodule "vendor/nim-stint"] - path = vendor/nim-stint - url = https://github.com/status-im/nim-stint.git - ignore = dirty - branch = master -[submodule "vendor/nim-json-rpc"] - path = vendor/nim-json-rpc - url = https://github.com/status-im/nim-json-rpc.git - ignore = dirty - branch = master -[submodule "vendor/nim-http-utils"] - path = vendor/nim-http-utils - url = https://github.com/status-im/nim-http-utils.git - ignore = dirty - branch = master -[submodule "vendor/nim-bearssl"] - path = vendor/nim-bearssl - url = https://github.com/status-im/nim-bearssl.git - ignore = dirty - branch = master -[submodule "vendor/nim-sqlite3-abi"] - path = vendor/nim-sqlite3-abi - url = https://github.com/arnetheduck/nim-sqlite3-abi.git - ignore = dirty - branch = master -[submodule "vendor/nim-web3"] - path = vendor/nim-web3 - url = https://github.com/status-im/nim-web3.git -[submodule "vendor/nim-testutils"] - path = vendor/nim-testutils - url = https://github.com/status-im/nim-testutils.git - ignore = untracked - branch = master -[submodule "vendor/nim-unittest2"] - path = vendor/nim-unittest2 - url = https://github.com/status-im/nim-unittest2.git - ignore = untracked - branch = master -[submodule "vendor/nim-websock"] - path = vendor/nim-websock - url = https://github.com/status-im/nim-websock.git - ignore = untracked - branch = main -[submodule "vendor/nim-zlib"] - path = vendor/nim-zlib - url = https://github.com/status-im/nim-zlib.git - ignore = untracked - branch = master -[submodule "vendor/nim-dnsdisc"] - path = vendor/nim-dnsdisc - url = https://github.com/status-im/nim-dnsdisc.git - ignore = untracked - branch = main -[submodule "vendor/dnsclient.nim"] - path = vendor/dnsclient.nim - url = https://github.com/ba0f3/dnsclient.nim.git - ignore = untracked - branch = master -[submodule "vendor/nim-toml-serialization"] - path = vendor/nim-toml-serialization - url = https://github.com/status-im/nim-toml-serialization.git -[submodule "vendor/nim-presto"] - path = vendor/nim-presto - url = https://github.com/status-im/nim-presto.git - ignore = untracked - branch = master +# Only zerokit, waku-rlnv2-contract, and nim-ffi are kept as vendor submodules. +# nim-ffi is kept because it has an invalid .nimble file that breaks nimble dependency resolution. +# All other dependencies are managed via Nimble. + [submodule "vendor/zerokit"] path = vendor/zerokit url = https://github.com/vacp2p/zerokit.git ignore = dirty branch = v0.5.1 -[submodule "vendor/nim-regex"] - path = vendor/nim-regex - url = https://github.com/nitely/nim-regex.git - ignore = untracked - branch = master -[submodule "vendor/nim-unicodedb"] - path = vendor/nim-unicodedb - url = https://github.com/nitely/nim-unicodedb.git - ignore = untracked - branch = master -[submodule "vendor/nim-taskpools"] - path = vendor/nim-taskpools - url = https://github.com/status-im/nim-taskpools.git - ignore = untracked - branch = stable -[submodule "vendor/nim-results"] - ignore = untracked - branch = master - path = vendor/nim-results - url = https://github.com/arnetheduck/nim-results.git -[submodule "vendor/db_connector"] - path = vendor/db_connector - url = https://github.com/nim-lang/db_connector.git - ignore = untracked - branch = devel -[submodule "vendor/nph"] - ignore = untracked - branch = master - path = vendor/nph - url = https://github.com/arnetheduck/nph.git -[submodule "vendor/nim-minilru"] - path = vendor/nim-minilru - url = https://github.com/status-im/nim-minilru.git - ignore = untracked - branch = master [submodule "vendor/waku-rlnv2-contract"] path = vendor/waku-rlnv2-contract url = https://github.com/logos-messaging/waku-rlnv2-contract.git diff --git a/Makefile b/Makefile index 87bd7bc74..19a1075ac 100644 --- a/Makefile +++ b/Makefile @@ -4,42 +4,55 @@ # - MIT license # at your option. This file may not be copied, modified, or distributed except # according to those terms. -export BUILD_SYSTEM_DIR := vendor/nimbus-build-system -export EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor + +# Nimble-only build system (no vendor dependencies except zerokit) +SHELL := bash LINK_PCRE := 0 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 +BUILD_MSG := "\\x1B[92mBuilding:\\x1B[39m" +# Compiler settings +CC ?= gcc +NIMC ?= nim +NIM_PARAMS := $(NIMFLAGS) -ifeq ($(NIM_PARAMS),) -# "variables.mk" was not included, so we update the submodules. -GIT_SUBMODULE_UPDATE := git submodule update --init --recursive -.DEFAULT: - +@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \ - $(GIT_SUBMODULE_UPDATE); \ - echo -# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself: -# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles -# -# After restarting, it will execute its original goal, so we don't have to start a child Make here -# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great? +# Verbosity +V := 0 +NIM_PARAMS := $(NIM_PARAMS) --verbosity:$(V) +HANDLE_OUTPUT := +ifeq ($(V), 0) + NIM_PARAMS := $(NIM_PARAMS) --hints:off + HANDLE_OUTPUT := >/dev/null +endif -else # "variables.mk" was included. Business as usual until the end of this file. +# Chronicles log level +ifdef LOG_LEVEL + NIM_PARAMS := $(NIM_PARAMS) -d:chronicles_log_level="$(LOG_LEVEL)" +endif -# Determine the OS +# OS detection detected_OS := $(shell uname -s) ifneq (,$(findstring MINGW,$(detected_OS))) detected_OS := Windows endif +ifeq ($(OS), Windows_NT) + EXE_SUFFIX := .exe +else + EXE_SUFFIX := +endif + ifeq ($(detected_OS),Windows) # Update MINGW_PATH to standard MinGW location MINGW_PATH = /mingw64 NIM_PARAMS += --passC:"-I$(MINGW_PATH)/include" NIM_PARAMS += --passL:"-L$(MINGW_PATH)/lib" - NIM_PARAMS += --passL:"-Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc" - NIM_PARAMS += --passL:"-Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream" + # NAT libs paths resolved via nimble packages + NAT_TRAVERSAL_PKG := $(shell nimble path nat_traversal 2>/dev/null) + ifneq ($(NAT_TRAVERSAL_PKG),) + NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PKG)/vendor/miniupnp/miniupnpc" + NIM_PARAMS += --passL:"-L$(NAT_TRAVERSAL_PKG)/vendor/libnatpmp-upstream" + endif LIBS = -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)") @@ -75,7 +88,8 @@ endif waku.nims: ln -s waku.nimble $@ -update: | update-common +update: + nimble install -y rm -rf waku.nims && \ $(MAKE) waku.nims $(HANDLE_OUTPUT) $(MAKE) build-nph @@ -83,8 +97,9 @@ update: | update-common clean: rm -rf build -# must be included after the default target --include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk +# Build directory +build: + mkdir -p $@ ## Possible values: prod; debug TARGET ?= prod @@ -134,7 +149,8 @@ endif rln-deps: rustup ./scripts/install_rln_tests_dependencies.sh $(FOUNDRY_VERSION) $(PNPM_VERSION) -deps: | deps-common nat-libs waku.nims +deps: | waku.nims + nimble install -y ### nim-libbacktrace @@ -153,16 +169,9 @@ endif # enable experimental exit is dest feature in libp2p mix NIM_PARAMS := $(NIM_PARAMS) -d:libp2p_mix_experimental_exit_is_dest -libbacktrace: - + $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0 - +# libbacktrace is now managed via nimble package clean-libbacktrace: - + $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT) - -# Extend deps and clean targets -ifneq ($(USE_LIBBACKTRACE), 0) -deps: | libbacktrace -endif + @true ifeq ($(POSTGRES), 1) NIM_PARAMS := $(NIM_PARAMS) -d:postgres -d:nimDebugDlOpen @@ -216,7 +225,7 @@ clean: | clean-librln testcommon: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim testcommon $(NIM_PARAMS) waku.nims + nimble testcommon $(NIM_PARAMS) ########## @@ -227,57 +236,56 @@ testcommon: | build deps # install rln-deps only for the testwaku target testwaku: | build deps rln-deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim test -d:os=$(shell uname) $(NIM_PARAMS) waku.nims + nimble test -d:os=$(shell uname) $(NIM_PARAMS) wakunode2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - \ - $(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims + nimble wakunode2 $(NIM_PARAMS) benchmarks: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim benchmarks $(NIM_PARAMS) waku.nims + nim benchmarks $(NIM_PARAMS) waku.nims testwakunode2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim testwakunode2 $(NIM_PARAMS) waku.nims + nim testwakunode2 $(NIM_PARAMS) waku.nims example2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims + nim example2 $(NIM_PARAMS) waku.nims chat2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims + nim chat2 $(NIM_PARAMS) waku.nims chat2mix: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2mix $(NIM_PARAMS) waku.nims + nim chat2mix $(NIM_PARAMS) waku.nims rln-db-inspector: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim rln_db_inspector $(NIM_PARAMS) waku.nims + nim rln_db_inspector $(NIM_PARAMS) waku.nims chat2bridge: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim chat2bridge $(NIM_PARAMS) waku.nims + nim chat2bridge $(NIM_PARAMS) waku.nims liteprotocoltester: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim liteprotocoltester $(NIM_PARAMS) waku.nims + nim liteprotocoltester $(NIM_PARAMS) waku.nims lightpushwithmix: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim lightpushwithmix $(NIM_PARAMS) waku.nims + nim lightpushwithmix $(NIM_PARAMS) waku.nims build/%: | build deps librln echo -e $(BUILD_MSG) "build/$*" && \ - $(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $* + nim buildone $(NIM_PARAMS) waku.nims $* compile-test: | build deps librln echo -e $(BUILD_MSG) "$(TEST_FILE)" "\"$(TEST_NAME)\"" && \ - $(ENV_SCRIPT) nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \ - $(ENV_SCRIPT) nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "\"$(TEST_NAME)\""; \ + nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \ + nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "\"$(TEST_NAME)\""; \ ################ ## Waku tools ## @@ -288,25 +296,25 @@ tools: networkmonitor wakucanary wakucanary: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim wakucanary $(NIM_PARAMS) waku.nims + nim wakucanary $(NIM_PARAMS) waku.nims networkmonitor: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim networkmonitor $(NIM_PARAMS) waku.nims + nim networkmonitor $(NIM_PARAMS) waku.nims ############ ## Format ## ############ .PHONY: build-nph install-nph clean-nph print-nph-path -# Default location for nph binary shall be next to nim binary to make it available on the path. -NPH:=$(shell dirname $(NIM_BINARY))/nph +# nph is installed via nimble +NPH:=$(shell which nph 2>/dev/null || echo "") build-nph: | build deps -ifeq ("$(wildcard $(NPH))","") - $(ENV_SCRIPT) nim c --skipParentCfg:on vendor/nph/src/nph.nim && \ - mv vendor/nph/src/nph $(shell dirname $(NPH)) - echo "nph utility is available at " $(NPH) +ifeq ($(NPH),) + nimble install nph -y + $(eval NPH := $(shell which nph)) + echo "nph utility installed via nimble" else echo "nph utility already exists at " $(NPH) endif @@ -342,11 +350,11 @@ clean: | clean-nph # TODO: Remove unused target docs: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim doc --run --index:on --project --out:.gh-pages waku/waku.nim waku.nims + nim doc --run --index:on --project --out:.gh-pages waku/waku.nim waku.nims coverage: echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) ./scripts/run_cov.sh -y + ./scripts/run_cov.sh -y ##################### @@ -450,7 +458,7 @@ ifeq ($(STATIC), 1) endif libwaku: | build deps librln - echo -e $(BUILD_MSG) "build/$@.$(LIB_EXT)" && $(ENV_SCRIPT) nim $(BUILD_COMMAND) $(NIM_PARAMS) waku.nims $@.$(LIB_EXT) + echo -e $(BUILD_MSG) "build/$@.$(LIB_EXT)" && nim $(BUILD_COMMAND) $(NIM_PARAMS) waku.nims $@.$(LIB_EXT) ##################### ## Mobile Bindings ## @@ -481,7 +489,7 @@ endif build-libwaku-for-android-arch: $(MAKE) rebuild-nat-libs CC=$(ANDROID_TOOLCHAIN_DIR)/bin/$(ANDROID_COMPILER) && \ ./scripts/build_rln_android.sh $(CURDIR)/build $(LIBRLN_BUILDDIR) $(LIBRLN_VERSION) $(CROSS_TARGET) $(ABIDIR) && \ - CPU=$(CPU) ABIDIR=$(ABIDIR) ANDROID_ARCH=$(ANDROID_ARCH) ANDROID_COMPILER=$(ANDROID_COMPILER) ANDROID_TOOLCHAIN_DIR=$(ANDROID_TOOLCHAIN_DIR) $(ENV_SCRIPT) nim libWakuAndroid $(NIM_PARAMS) waku.nims + CPU=$(CPU) ABIDIR=$(ABIDIR) ANDROID_ARCH=$(ANDROID_ARCH) ANDROID_COMPILER=$(ANDROID_COMPILER) ANDROID_TOOLCHAIN_DIR=$(ANDROID_TOOLCHAIN_DIR) nim libWakuAndroid $(NIM_PARAMS) waku.nims libwaku-android-arm64: ANDROID_ARCH=aarch64-linux-android libwaku-android-arm64: CPU=arm64 @@ -541,7 +549,7 @@ endif # Build for iOS architecture build-libwaku-for-ios-arch: - IOS_SDK=$(IOS_SDK) IOS_ARCH=$(IOS_ARCH) IOS_SDK_PATH=$(IOS_SDK_PATH) $(ENV_SCRIPT) nim libWakuIOS $(NIM_PARAMS) waku.nims + IOS_SDK=$(IOS_SDK) IOS_ARCH=$(IOS_ARCH) IOS_SDK_PATH=$(IOS_SDK_PATH) nim libWakuIOS $(NIM_PARAMS) waku.nims # iOS device (arm64) libwaku-ios-device: IOS_ARCH=arm64 @@ -562,6 +570,10 @@ libwaku-ios: $(MAKE) libwaku-ios-device $(MAKE) libwaku-ios-simulator +# Get nimble package paths for C examples +NAT_TRAVERSAL_PKG_PATH := $(shell nimble path nat_traversal 2>/dev/null) +LIBBACKTRACE_PKG_PATH := $(shell nimble path libbacktrace 2>/dev/null) + cwaku_example: | build libwaku echo -e $(BUILD_MSG) "build/$@" && \ cc -o "build/$@" \ @@ -569,10 +581,10 @@ cwaku_example: | build libwaku ./examples/cbindings/base64.c \ -lwaku -Lbuild/ \ -pthread -ldl -lm \ - -lminiupnpc -Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build/ \ - -lnatpmp -Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream/ \ - vendor/nim-libbacktrace/libbacktrace_wrapper.o \ - vendor/nim-libbacktrace/install/usr/lib/libbacktrace.a + -lminiupnpc -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/miniupnp/miniupnpc/build/ \ + -lnatpmp -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/libnatpmp-upstream/ \ + $(LIBBACKTRACE_PKG_PATH)/libbacktrace_wrapper.o \ + $(LIBBACKTRACE_PKG_PATH)/install/usr/lib/libbacktrace.a cppwaku_example: | build libwaku echo -e $(BUILD_MSG) "build/$@" && \ @@ -581,17 +593,15 @@ cppwaku_example: | build libwaku ./examples/cpp/base64.cpp \ -lwaku -Lbuild/ \ -pthread -ldl -lm \ - -lminiupnpc -Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build/ \ - -lnatpmp -Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream/ \ - vendor/nim-libbacktrace/libbacktrace_wrapper.o \ - vendor/nim-libbacktrace/install/usr/lib/libbacktrace.a + -lminiupnpc -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/miniupnp/miniupnpc/build/ \ + -lnatpmp -L$(NAT_TRAVERSAL_PKG_PATH)/vendor/libnatpmp-upstream/ \ + $(LIBBACKTRACE_PKG_PATH)/libbacktrace_wrapper.o \ + $(LIBBACKTRACE_PKG_PATH)/install/usr/lib/libbacktrace.a nodejswaku: | build deps echo -e $(BUILD_MSG) "build/$@" && \ node-gyp build --directory=examples/nodejs/ -endif # "variables.mk" was not included - ################### # Release Targets # ################### diff --git a/README.md b/README.md index c64479738..0f50f71e6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ These instructions are generic. For more detailed instructions, see the source c The standard developer tools, including a C compiler, GNU Make, Bash, and Git. More information on these installations can be found [here](https://docs.waku.org/guides/nwaku/build-source#install-dependencies). +**Nimble 0.99.0** or later is required for dependency management. Verify your version with: +```bash +nimble -v +# Expected output: 0.99.0 or higher +``` + > In some distributions (Fedora linux for example), you may need to install `which` utility separately. Nimbus build system is relying on it. You'll also need an installation of Rust and its toolchain (specifically `rustc` and `cargo`). @@ -100,17 +106,17 @@ If `wakunode2.exe` isn't generated: ### Developing -#### Nim Runtime -This repository is bundled with a Nim runtime that includes the necessary dependencies for the project. - -Before you can utilize the runtime you'll need to build the project, as detailed in a previous section. -This will generate a `vendor` directory containing various dependencies, including the `nimbus-build-system` which has the bundled nim runtime. - -After successfully building the project, you may bring the bundled runtime into scope by running: +#### Dependencies +This project uses **Nimble** for dependency management. All dependencies are automatically installed when you run: ```bash -source env.sh +make deps +# or directly: +nimble install -y ``` -If everything went well, you should see your prompt suffixed with `[Nimbus env]$`. Now you can run `nim` commands as usual. + +The only vendor submodules kept are: +- `vendor/zerokit` - RLN (Rate Limiting Nullifier) library +- `vendor/waku-rlnv2-contract` - Smart contract for RLN tests ### Test Suite diff --git a/apps/networkmonitor/networkmonitor.nim b/apps/networkmonitor/networkmonitor.nim index 23607b118..88727208e 100644 --- a/apps/networkmonitor/networkmonitor.nim +++ b/apps/networkmonitor/networkmonitor.nim @@ -9,7 +9,7 @@ import chronos/timer as ctime, confutils, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/nameresolving/dnsresolver, libp2p/protocols/ping, diff --git a/config.nims b/config.nims index f74fe183f..27ef97f1d 100644 --- a/config.nims +++ b/config.nims @@ -9,11 +9,7 @@ if defined(windows): switch("passL", "rln.lib") switch("define", "postgres=false") - # Automatically add all vendor subdirectories - for dir in walkDir("./vendor"): - if dir.kind == pcDir: - switch("path", dir.path) - switch("path", dir.path / "src") + # Dependencies are now managed via nimble, no vendor paths needed # disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries switch("passL", "-Wl,--no-insert-timestamp") @@ -117,7 +113,6 @@ 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) diff --git a/examples/filter_subscriber.nim b/examples/filter_subscriber.nim index 03a5de4eb..6743761f0 100644 --- a/examples/filter_subscriber.nim +++ b/examples/filter_subscriber.nim @@ -6,7 +6,7 @@ import confutils, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/examples/lightpush_mix/lightpush_publisher_mix.nim b/examples/lightpush_mix/lightpush_publisher_mix.nim index 104de8552..105bee336 100644 --- a/examples/lightpush_mix/lightpush_publisher_mix.nim +++ b/examples/lightpush_mix/lightpush_publisher_mix.nim @@ -11,7 +11,7 @@ import libp2p/protocols/mix/curve25519, libp2p/multiaddress, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, metrics, metrics/chronos_httpserver diff --git a/examples/lightpush_publisher.nim b/examples/lightpush_publisher.nim index c7eacdd30..70d381e3e 100644 --- a/examples/lightpush_publisher.nim +++ b/examples/lightpush_publisher.nim @@ -7,7 +7,7 @@ import confutils, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/examples/publisher.nim b/examples/publisher.nim index 6f5d34bc4..4ae8bcaa7 100644 --- a/examples/publisher.nim +++ b/examples/publisher.nim @@ -6,7 +6,7 @@ import confutils, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/examples/subscriber.nim b/examples/subscriber.nim index ce64bb803..ff206a863 100644 --- a/examples/subscriber.nim +++ b/examples/subscriber.nim @@ -6,7 +6,7 @@ import confutils, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/library/kernel_api/debug_node_api.nim b/library/kernel_api/debug_node_api.nim index 98f5332b4..79283cd4b 100644 --- a/library/kernel_api/debug_node_api.nim +++ b/library/kernel_api/debug_node_api.nim @@ -3,7 +3,7 @@ import chronicles, chronos, results, - eth/p2p/discoveryv5/enr, + eth/enr/enr, strutils, libp2p/peerid, metrics, diff --git a/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim b/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim index c0e25ec6a..3bf3a3cb0 100644 --- a/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim +++ b/tests/node/peer_manager/peer_store/test_waku_peer_storage.nim @@ -4,7 +4,7 @@ import libp2p/[multiaddress, peerid], libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, nimcrypto/utils import waku/waku_core/peers, waku/node/peer_manager/peer_store/waku_peer_storage diff --git a/tests/node/test_wakunode_peer_exchange.nim b/tests/node/test_wakunode_peer_exchange.nim index e6649c455..eeaf2c700 100644 --- a/tests/node/test_wakunode_peer_exchange.nim +++ b/tests/node/test_wakunode_peer_exchange.nim @@ -9,7 +9,7 @@ import libp2p/peerId, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/tests/test_peer_storage.nim b/tests/test_peer_storage.nim index 6cb48d71e..55476962d 100644 --- a/tests/test_peer_storage.nim +++ b/tests/test_peer_storage.nim @@ -1,6 +1,6 @@ {.used.} -import std/options, testutils/unittests, eth/p2p/discoveryv5/enr, libp2p/crypto/crypto +import std/options, testutils/unittests, eth/enr/enr, libp2p/crypto/crypto import waku/[ common/databases/db_sqlite, diff --git a/tests/test_waku_metadata.nim b/tests/test_waku_metadata.nim index b30fd1712..9b8b7d96b 100644 --- a/tests/test_waku_metadata.nim +++ b/tests/test_waku_metadata.nim @@ -11,7 +11,7 @@ import libp2p/multistream, libp2p/muxers/muxer, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/ [ diff --git a/tests/test_wakunode.nim b/tests/test_wakunode.nim index a7f1084fb..69486b7d7 100644 --- a/tests/test_wakunode.nim +++ b/tests/test_wakunode.nim @@ -14,7 +14,7 @@ import libp2p/protocols/pubsub/pubsub, libp2p/protocols/pubsub/gossipsub, libp2p/nameresolving/mockresolver, - eth/p2p/discoveryv5/enr, + eth/enr/enr, eth/net/utils import waku/[waku_core, waku_node, node/peer_manager], ./testlib/wakucore, ./testlib/wakunode diff --git a/tests/waku_discv5/test_waku_discv5.nim b/tests/waku_discv5/test_waku_discv5.nim index 20a0c6965..679d3e1ae 100644 --- a/tests/waku_discv5/test_waku_discv5.nim +++ b/tests/waku_discv5/test_waku_discv5.nim @@ -8,7 +8,7 @@ import testutils/unittests, libp2p/crypto/crypto as libp2p_keys, eth/keys as eth_keys, - eth/p2p/discoveryv5/enr as ethEnr, + eth/enr/enr as ethEnr, libp2p/crypto/secp, libp2p/protocols/rendezvous diff --git a/tests/waku_peer_exchange/test_rpc_codec.nim b/tests/waku_peer_exchange/test_rpc_codec.nim index 84aec7ec4..648455834 100644 --- a/tests/waku_peer_exchange/test_rpc_codec.nim +++ b/tests/waku_peer_exchange/test_rpc_codec.nim @@ -8,7 +8,7 @@ import libp2p/peerId, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/tests/waku_peer_exchange/utils.nim b/tests/waku_peer_exchange/utils.nim index ce7660bf0..3fa1ecaa4 100644 --- a/tests/waku_peer_exchange/utils.nim +++ b/tests/waku_peer_exchange/utils.nim @@ -8,7 +8,7 @@ import libp2p/peerId, libp2p/crypto/crypto, eth/keys, - eth/p2p/discoveryv5/enr + eth/enr/enr import waku/[ diff --git a/vendor/db_connector b/vendor/db_connector deleted file mode 160000 index 74aef399e..000000000 --- a/vendor/db_connector +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 74aef399e5c232f95c9fc5c987cebac846f09d62 diff --git a/vendor/dnsclient.nim b/vendor/dnsclient.nim deleted file mode 160000 index 23214235d..000000000 --- a/vendor/dnsclient.nim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 23214235d4784d24aceed99bbfe153379ea557c8 diff --git a/vendor/nim-bearssl b/vendor/nim-bearssl deleted file mode 160000 index 11e798b62..000000000 --- a/vendor/nim-bearssl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 11e798b62b8e6beabe958e048e9e24c7e0f9ee63 diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles deleted file mode 160000 index 54f5b7260..000000000 --- a/vendor/nim-chronicles +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 54f5b726025e8c7385e3a6529d3aa27454c6e6ff diff --git a/vendor/nim-chronos b/vendor/nim-chronos deleted file mode 160000 index 0646c444f..000000000 --- a/vendor/nim-chronos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0646c444fce7c7ed08ef6f2c9a7abfd172ffe655 diff --git a/vendor/nim-confutils b/vendor/nim-confutils deleted file mode 160000 index e214b3992..000000000 --- a/vendor/nim-confutils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e214b3992a31acece6a9aada7d0a1ad37c928f3b diff --git a/vendor/nim-dnsdisc b/vendor/nim-dnsdisc deleted file mode 160000 index b71d029f4..000000000 --- a/vendor/nim-dnsdisc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b71d029f4da4ec56974d54c04518bada00e1b623 diff --git a/vendor/nim-eth b/vendor/nim-eth deleted file mode 160000 index d9135e6c3..000000000 --- a/vendor/nim-eth +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9135e6c3c5d6d819afdfb566aa8d958756b73a8 diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams deleted file mode 160000 index c3ac3f639..000000000 --- a/vendor/nim-faststreams +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c3ac3f639ed1d62f59d3077d376a29c63ac9750c diff --git a/vendor/nim-http-utils b/vendor/nim-http-utils deleted file mode 160000 index 79cbab146..000000000 --- a/vendor/nim-http-utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 79cbab1460f4c0cdde2084589d017c43a3d7b4f1 diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc deleted file mode 160000 index 9665c2650..000000000 --- a/vendor/nim-json-rpc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9665c265035f49f5ff94bbffdeadde68e19d6221 diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization deleted file mode 160000 index b65fd6a7e..000000000 --- a/vendor/nim-json-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac diff --git a/vendor/nim-libbacktrace b/vendor/nim-libbacktrace deleted file mode 160000 index d8bd4ce5c..000000000 --- a/vendor/nim-libbacktrace +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p deleted file mode 160000 index e82080f7b..000000000 --- a/vendor/nim-libp2p +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e82080f7b1aa61c6d35fa5311b873f41eff4bb52 diff --git a/vendor/nim-metrics b/vendor/nim-metrics deleted file mode 160000 index ecf64c607..000000000 --- a/vendor/nim-metrics +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecf64c6078d1276d3b7d9b3d931fbdb70004db11 diff --git a/vendor/nim-minilru b/vendor/nim-minilru deleted file mode 160000 index 0c4b2bce9..000000000 --- a/vendor/nim-minilru +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c4b2bce959591f0a862e9b541ba43c6d0cf3476 diff --git a/vendor/nim-nat-traversal b/vendor/nim-nat-traversal deleted file mode 160000 index 860e18c37..000000000 --- a/vendor/nim-nat-traversal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 860e18c37667b5dd005b94c63264560c35d88004 diff --git a/vendor/nim-presto b/vendor/nim-presto deleted file mode 160000 index 92b1c7ff1..000000000 --- a/vendor/nim-presto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 92b1c7ff141e6920e1f8a98a14c35c1fa098e3be diff --git a/vendor/nim-regex b/vendor/nim-regex deleted file mode 160000 index 4593305ed..000000000 --- a/vendor/nim-regex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4593305ed1e49731fc75af1dc572dd2559aad19c diff --git a/vendor/nim-results b/vendor/nim-results deleted file mode 160000 index df8113dda..000000000 --- a/vendor/nim-results +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27 diff --git a/vendor/nim-secp256k1 b/vendor/nim-secp256k1 deleted file mode 160000 index 9dd3df621..000000000 --- a/vendor/nim-secp256k1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9dd3df62124aae79d564da636bb22627c53c7676 diff --git a/vendor/nim-serialization b/vendor/nim-serialization deleted file mode 160000 index 6f525d544..000000000 --- a/vendor/nim-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f525d5447d97256750ca7856faead03e562ed20 diff --git a/vendor/nim-sqlite3-abi b/vendor/nim-sqlite3-abi deleted file mode 160000 index bdf01cf42..000000000 --- a/vendor/nim-sqlite3-abi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bdf01cf4236fb40788f0733466cdf6708783cbac diff --git a/vendor/nim-stew b/vendor/nim-stew deleted file mode 160000 index e57400149..000000000 --- a/vendor/nim-stew +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e5740014961438610d336cd81706582dbf2c96f0 diff --git a/vendor/nim-stint b/vendor/nim-stint deleted file mode 160000 index 470b78925..000000000 --- a/vendor/nim-stint +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 470b7892561b5179ab20bd389a69217d6213fe58 diff --git a/vendor/nim-taskpools b/vendor/nim-taskpools deleted file mode 160000 index 9e8ccc754..000000000 --- a/vendor/nim-taskpools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9e8ccc754631ac55ac2fd495e167e74e86293edb diff --git a/vendor/nim-testutils b/vendor/nim-testutils deleted file mode 160000 index 94d68e796..000000000 --- a/vendor/nim-testutils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94d68e796c045d5b37cabc6be32d7bfa168f8857 diff --git a/vendor/nim-toml-serialization b/vendor/nim-toml-serialization deleted file mode 160000 index fea85b27f..000000000 --- a/vendor/nim-toml-serialization +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fea85b27f0badcf617033ca1bc05444b5fd8aa7a diff --git a/vendor/nim-unicodedb b/vendor/nim-unicodedb deleted file mode 160000 index 66f245871..000000000 --- a/vendor/nim-unicodedb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66f2458710dc641dd4640368f9483c8a0ec70561 diff --git a/vendor/nim-unittest2 b/vendor/nim-unittest2 deleted file mode 160000 index 8b51e99b4..000000000 --- a/vendor/nim-unittest2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8b51e99b4a57fcfb31689230e75595f024543024 diff --git a/vendor/nim-web3 b/vendor/nim-web3 deleted file mode 160000 index 81ee8ce47..000000000 --- a/vendor/nim-web3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 81ee8ce479d86acb73be7c4f365328e238d9b4a3 diff --git a/vendor/nim-websock b/vendor/nim-websock deleted file mode 160000 index ebe308a79..000000000 --- a/vendor/nim-websock +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ebe308a79a7b440a11dfbe74f352be86a3883508 diff --git a/vendor/nim-zlib b/vendor/nim-zlib deleted file mode 160000 index daa8723fd..000000000 --- a/vendor/nim-zlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit daa8723fd32299d4ca621c837430c29a5a11e19a diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system deleted file mode 160000 index e6c2c9da3..000000000 --- a/vendor/nimbus-build-system +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e6c2c9da39c2d368d9cf420ac22692e99715d22c diff --git a/vendor/nimcrypto b/vendor/nimcrypto deleted file mode 160000 index 721fb99ee..000000000 --- a/vendor/nimcrypto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 721fb99ee099b632eb86dfad1f0d96ee87583774 diff --git a/vendor/nph b/vendor/nph deleted file mode 160000 index c6e03162d..000000000 --- a/vendor/nph +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c6e03162dc2820d3088660f644818d7040e95791 diff --git a/waku.nimble b/waku.nimble index 5c5c09763..c0a853049 100644 --- a/waku.nimble +++ b/waku.nimble @@ -21,6 +21,7 @@ requires "nim >= 2.2.4", "libbacktrace", "nimcrypto", "serialization", + "toml_serialization", "stew", "stint", "metrics", @@ -31,9 +32,19 @@ requires "nim >= 2.2.4", "results", "db_connector", "minilru", - "ffi" + "unittest2", + "testutils" ### Helper functions + +# Get nimble package paths for compilation +proc getNimblePkgDir(): string = + # Get nimble's package directory + when defined(windows): + getEnv("USERPROFILE") / ".nimble" / "pkgs2" + else: + getEnv("HOME") / ".nimble" / "pkgs2" + proc buildModule(filePath, params = "", lang = "c"): bool = if not dirExists "build": mkDir "build" @@ -55,12 +66,10 @@ 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 & " " & - srcDir & name & ".nim" + # Use nimble c command which automatically handles package paths + # Add vendor/nim-ffi explicitly since it's a submodule + let nimbleCmd = "nimble c --out:build/" & name & " --mm:refc --path:vendor/nim-ffi " & params & " " & srcDir & name & ".nim" + exec nimbleCmd proc buildLibrary(lib_name: string, srcDir = "./", params = "", `type` = "static") = if not dirExists "build": @@ -217,6 +226,23 @@ task libWakuAndroid, "Build the mobile bindings for Android": ### Mobile iOS import std/sequtils +# Helper to get nimble package path +proc getNimblePkgPath(pkgName: string): string = + let (output, exitCode) = gorgeEx("nimble path " & pkgName) + if exitCode != 0: + quit "Error: Could not find nimble package: " & pkgName + result = output.strip() + +# Helper to get Nim lib path +proc getNimLibPath(): string = + let (output, exitCode) = gorgeEx("nim --verbosity:0 --hints:off dump --dump.format:json 2>/dev/null | grep -o '\"libpath\":\"[^\"]*\"' | cut -d'\"' -f4") + if exitCode != 0 or output.strip().len == 0: + # Fallback: try to find it relative to nim binary + let (nimPath, _) = gorgeEx("which nim") + result = nimPath.strip().parentDir().parentDir() / "lib" + else: + result = output.strip() + proc buildMobileIOS(srcDir = ".", params = "") = echo "Building iOS libwaku library" @@ -265,12 +291,18 @@ proc buildMobileIOS(srcDir = ".", params = "") = " " & extra_params & " " & srcDir & "/libwaku.nim" - # Compile vendor C libraries for iOS + # Get nimble package paths + let bearSslPkgDir = getNimblePkgPath("bearssl") + let secp256k1PkgDir = getNimblePkgPath("secp256k1") + let natTraversalPkgDir = getNimblePkgPath("nat_traversal") + let nimLibDir = getNimLibPath() + + # Compile C libraries for iOS # --- BearSSL --- echo "Compiling BearSSL for iOS..." - let bearSslSrcDir = "./vendor/nim-bearssl/bearssl/csources/src" - let bearSslIncDir = "./vendor/nim-bearssl/bearssl/csources/inc" + let bearSslSrcDir = bearSslPkgDir / "bearssl/csources/src" + let bearSslIncDir = bearSslPkgDir / "bearssl/csources/inc" for path in walkDirRec(bearSslSrcDir): if path.endsWith(".c"): let relPath = path.replace(bearSslSrcDir & "/", "").replace("/", "_") @@ -281,7 +313,7 @@ proc buildMobileIOS(srcDir = ".", params = "") = # --- secp256k1 --- echo "Compiling secp256k1 for iOS..." - let secp256k1Dir = "./vendor/nim-secp256k1/vendor/secp256k1" + let secp256k1Dir = secp256k1PkgDir / "vendor/secp256k1" let secp256k1Flags = " -I" & secp256k1Dir & "/include" & " -I" & secp256k1Dir & "/src" & " -I" & secp256k1Dir & @@ -306,9 +338,9 @@ proc buildMobileIOS(srcDir = ".", params = "") = # --- miniupnpc --- echo "Compiling miniupnpc for iOS..." - let miniupnpcSrcDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/src" - let miniupnpcIncDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/include" - let miniupnpcBuildDir = "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/build" + let miniupnpcSrcDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/src" + let miniupnpcIncDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/include" + let miniupnpcBuildDir = natTraversalPkgDir / "vendor/miniupnp/miniupnpc/build" let miniupnpcFiles = @[ "addr_is_reserved.c", "connecthostport.c", "igd_desc_parse.c", "minisoap.c", "minissdpc.c", "miniupnpc.c", "miniwget.c", @@ -329,7 +361,7 @@ proc buildMobileIOS(srcDir = ".", params = "") = # --- libnatpmp --- echo "Compiling libnatpmp for iOS..." - let natpmpSrcDir = "./vendor/nim-nat-traversal/vendor/libnatpmp-upstream" + let natpmpSrcDir = natTraversalPkgDir / "vendor/libnatpmp-upstream" # Only compile natpmp.c - getgateway.c uses net/route.h which is not available on iOS let natpmpObj = vendorObjDir / "natpmp_natpmp.o" if not fileExists(natpmpObj): @@ -363,13 +395,13 @@ proc buildMobileIOS(srcDir = ".", params = "") = let oFile = objDir / baseName exec clangBase & " -DENABLE_STRNATPMPERR" & - " -I./vendor/nimbus-build-system/vendor/Nim/lib/" & - " -I./vendor/nim-bearssl/bearssl/csources/inc/" & - " -I./vendor/nim-bearssl/bearssl/csources/tools/" & - " -I./vendor/nim-bearssl/bearssl/abi/" & - " -I./vendor/nim-secp256k1/vendor/secp256k1/include/" & - " -I./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc/include/" & - " -I./vendor/nim-nat-traversal/vendor/libnatpmp-upstream/" & + " -I" & nimLibDir & "/" & + " -I" & bearSslPkgDir & "/bearssl/csources/inc/" & + " -I" & bearSslPkgDir & "/bearssl/csources/tools/" & + " -I" & bearSslPkgDir & "/bearssl/abi/" & + " -I" & secp256k1PkgDir & "/vendor/secp256k1/include/" & + " -I" & natTraversalPkgDir & "/vendor/miniupnp/miniupnpc/include/" & + " -I" & natTraversalPkgDir & "/vendor/libnatpmp-upstream/" & " -I" & nimcacheDir & " -c " & cFile & " -o " & oFile diff --git a/waku/api/entry_nodes.nim b/waku/api/entry_nodes.nim index 2dad853b8..4ef72c559 100644 --- a/waku/api/entry_nodes.nim +++ b/waku/api/entry_nodes.nim @@ -1,6 +1,6 @@ import std/strutils -import results, eth/p2p/discoveryv5/enr +import results, eth/enr/enr import waku/waku_core/peers diff --git a/waku/common/enr.nim b/waku/common/enr.nim index 9c5ff3575..799b91e97 100644 --- a/waku/common/enr.nim +++ b/waku/common/enr.nim @@ -1,6 +1,6 @@ ## An extension wrapper around nim-eth's ENR module -import eth/p2p/discoveryv5/enr +import eth/enr/enr import ./enr/builder, ./enr/typed_record export diff --git a/waku/common/enr/builder.nim b/waku/common/enr/builder.nim index 3c5455d52..47e1bf469 100644 --- a/waku/common/enr/builder.nim +++ b/waku/common/enr/builder.nim @@ -4,7 +4,7 @@ import std/[options, net], results, eth/keys as eth_keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto as libp2p_crypto import ./typed_record @@ -49,7 +49,7 @@ proc addFieldPair*[V](builder: var EnrBuilder, key: string, value: V) = proc build*(builder: EnrBuilder): EnrResult[enr.Record] = # Note that nim-eth's `Record.init` does not deduplicate the field pairs. - # See: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/p2p/discoveryv5/enr.nim#L143-L144 + # See: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/enr/enr.nim#L143-L144 enr.Record.init( seqNum = builder.seqNumber, pk = builder.privateKey, @@ -69,7 +69,7 @@ proc addAddressAndPorts( builder.udpPort = udpPort.toOpt() proc addPorts(builder: var EnrBuilder, tcp, udp: Option[Port]) = - # Based on: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/p2p/discoveryv5/enr.nim#L166 + # Based on: https://github.com/status-im/nim-eth/blob/4b22fcd/eth/enr/enr.nim#L166 builder.tcpPort = tcp.toOpt() builder.udpPort = udp.toOpt() diff --git a/waku/common/enr/typed_record.nim b/waku/common/enr/typed_record.nim index 1db357621..3d5a1ee47 100644 --- a/waku/common/enr/typed_record.nim +++ b/waku/common/enr/typed_record.nim @@ -2,7 +2,7 @@ import std/options, results, eth/keys as eth_keys, libp2p/crypto/crypto as libp2p_crypto -import eth/p2p/discoveryv5/enr except TypedRecord, toTypedRecord +import eth/enr/enr except TypedRecord, toTypedRecord ## Since enr changed to result.Opt[T] from Option[T] for intercompatibility introduce a conversion between func toOpt*[T](o: Option[T]): Opt[T] = diff --git a/waku/discovery/waku_dnsdisc.nim b/waku/discovery/waku_dnsdisc.nim index 0d0a82948..d8764fd57 100644 --- a/waku/discovery/waku_dnsdisc.nim +++ b/waku/discovery/waku_dnsdisc.nim @@ -11,7 +11,7 @@ import chronos, metrics, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/crypto/secp, libp2p/multiaddress, diff --git a/waku/factory/waku.nim b/waku/factory/waku.nim index c0380ccc9..d95f18193 100644 --- a/waku/factory/waku.nim +++ b/waku/factory/waku.nim @@ -15,7 +15,7 @@ import libp2p/peerid, libp2p/discovery/rendezvousinterface, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, presto, metrics, metrics/chronos_httpserver diff --git a/waku/node/kernel_api/filter.nim b/waku/node/kernel_api/filter.nim index 948035f14..26e11e6ad 100644 --- a/waku/node/kernel_api/filter.nim +++ b/waku/node/kernel_api/filter.nim @@ -9,7 +9,7 @@ import stew/byteutils, eth/keys, nimcrypto, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, diff --git a/waku/node/kernel_api/lightpush.nim b/waku/node/kernel_api/lightpush.nim index 2a5f6acbb..a0121a630 100644 --- a/waku/node/kernel_api/lightpush.nim +++ b/waku/node/kernel_api/lightpush.nim @@ -8,7 +8,7 @@ import results, stew/byteutils, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, diff --git a/waku/node/kernel_api/peer_exchange.nim b/waku/node/kernel_api/peer_exchange.nim index a4bec727b..5e06340ca 100644 --- a/waku/node/kernel_api/peer_exchange.nim +++ b/waku/node/kernel_api/peer_exchange.nim @@ -7,7 +7,7 @@ import metrics, results, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, diff --git a/waku/node/kernel_api/relay.nim b/waku/node/kernel_api/relay.nim index 827cc1e5f..568924971 100644 --- a/waku/node/kernel_api/relay.nim +++ b/waku/node/kernel_api/relay.nim @@ -8,7 +8,7 @@ import results, stew/byteutils, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, diff --git a/waku/node/kernel_api/store.nim b/waku/node/kernel_api/store.nim index 7edae7966..5e8cdc1e0 100644 --- a/waku/node/kernel_api/store.nim +++ b/waku/node/kernel_api/store.nim @@ -7,7 +7,7 @@ import metrics, results, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/protocols/ping, libp2p/protocols/pubsub/gossipsub, diff --git a/waku/node/peer_manager/peer_store/waku_peer_storage.nim b/waku/node/peer_manager/peer_store/waku_peer_storage.nim index dc1452618..02a997a90 100644 --- a/waku/node/peer_manager/peer_store/waku_peer_storage.nim +++ b/waku/node/peer_manager/peer_store/waku_peer_storage.nim @@ -4,7 +4,7 @@ import std/[sets, options], results, sqlite3_abi, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/protobuf/minprotobuf import ../../../common/databases/db_sqlite, diff --git a/waku/node/peer_manager/waku_peer_store.nim b/waku/node/peer_manager/waku_peer_store.nim index b7f2669e5..f900984fe 100644 --- a/waku/node/peer_manager/waku_peer_store.nim +++ b/waku/node/peer_manager/waku_peer_store.nim @@ -4,7 +4,7 @@ import std/[tables, sequtils, sets, options, strutils], chronos, chronicles, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/builders, libp2p/peerstore, libp2p/crypto/curve25519 diff --git a/waku/node/waku_node.nim b/waku/node/waku_node.nim index 07e36dd13..b6dfd2ab3 100644 --- a/waku/node/waku_node.nim +++ b/waku/node/waku_node.nim @@ -10,7 +10,7 @@ import nimcrypto, bearssl/rand, stew/byteutils, - eth/p2p/discoveryv5/enr, + eth/enr/enr, libp2p/crypto/crypto, libp2p/crypto/curve25519, libp2p/[multiaddress, multicodec], diff --git a/waku/waku_core/peers.nim b/waku/waku_core/peers.nim index 48c994403..decb38565 100644 --- a/waku/waku_core/peers.nim +++ b/waku/waku_core/peers.nim @@ -6,7 +6,7 @@ import chronos, chronicles, eth/keys, - eth/p2p/discoveryv5/enr, + eth/enr/enr, eth/net/utils, libp2p/crypto/crypto, libp2p/crypto/curve25519, diff --git a/waku/waku_metadata/protocol.nim b/waku/waku_metadata/protocol.nim index 623cbb6c3..70303d4b6 100644 --- a/waku/waku_metadata/protocol.nim +++ b/waku/waku_metadata/protocol.nim @@ -9,7 +9,7 @@ import libp2p/protocols/protocol, libp2p/stream/connection, libp2p/crypto/crypto, - eth/p2p/discoveryv5/enr + eth/enr/enr import ../common/nimchronos, ../waku_core, ./rpc, ../common/callbacks from ../waku_core/codecs import WakuMetadataCodec diff --git a/waku/waku_peer_exchange/protocol.nim b/waku/waku_peer_exchange/protocol.nim index b99f5eabf..c8c13a777 100644 --- a/waku/waku_peer_exchange/protocol.nim +++ b/waku/waku_peer_exchange/protocol.nim @@ -6,7 +6,7 @@ import metrics, libp2p/protocols/protocol, libp2p/crypto/crypto, - eth/p2p/discoveryv5/enr + eth/enr/enr import ../common/nimchronos, ../node/peer_manager, diff --git a/waku/waku_store/resume.nim b/waku/waku_store/resume.nim index b7864da94..31ecef6a6 100644 --- a/waku/waku_store/resume.nim +++ b/waku/waku_store/resume.nim @@ -9,7 +9,7 @@ import libp2p/protocols/protocol, libp2p/stream/connection, libp2p/crypto/crypto, - eth/p2p/discoveryv5/enr + eth/enr/enr import ../common/databases/db_sqlite, diff --git a/waku/waku_store_sync/reconciliation.nim b/waku/waku_store_sync/reconciliation.nim index 0cc15d0df..55953b5b6 100644 --- a/waku/waku_store_sync/reconciliation.nim +++ b/waku/waku_store_sync/reconciliation.nim @@ -11,7 +11,7 @@ import libp2p/protocols/protocol, libp2p/stream/connection, libp2p/crypto/crypto, - eth/p2p/discoveryv5/enr + eth/enr/enr import ../common/nimchronos, ../common/protobuf, diff --git a/waku/waku_store_sync/transfer.nim b/waku/waku_store_sync/transfer.nim index 6a600b4e3..500ce0986 100644 --- a/waku/waku_store_sync/transfer.nim +++ b/waku/waku_store_sync/transfer.nim @@ -10,7 +10,7 @@ import libp2p/protocols/protocol, libp2p/stream/connection, libp2p/crypto/crypto, - eth/p2p/discoveryv5/enr + eth/enr/enr import ../common/nimchronos, ../common/protobuf, From f3506027a077e52d0c38ecb0dc9b7feeeab8d6f6 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Fri, 2 Jan 2026 02:04:03 +0530 Subject: [PATCH 2/3] chore: initial commit of deprecte vendor --- waku.nimble | 59 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/waku.nimble b/waku.nimble index c0a853049..4347c7462 100644 --- a/waku.nimble +++ b/waku.nimble @@ -12,28 +12,43 @@ license = "MIT or Apache License 2.0" ### Dependencies requires "nim >= 2.2.4", - "chronicles", - "confutils", - "chronos", - "dnsdisc", - "eth", - "json_rpc", - "libbacktrace", - "nimcrypto", - "serialization", - "toml_serialization", - "stew", - "stint", - "metrics", - "libp2p >= 1.14.3", - "web3", - "presto", - "regex", - "results", - "db_connector", - "minilru", - "unittest2", - "testutils" + "https://github.com/status-im/nim-chronicles.git#54f5b726025e8c7385e3a6529d3aa27454c6e6ff", + "https://github.com/status-im/nim-confutils.git#e214b3992a31acece6a9aada7d0a1ad37c928f3b", + "https://github.com/status-im/nim-chronos.git#0646c444fce7c7ed08ef6f2c9a7abfd172ffe655", + "https://github.com/status-im/nim-dnsdisc.git#b71d029f4da4ec56974d54c04518bada00e1b623", + "https://github.com/status-im/nim-eth.git#d9135e6c3c5d6d819afdfb566aa8d958756b73a8", + "https://github.com/status-im/nim-json-rpc.git#9665c265035f49f5ff94bbffdeadde68e19d6221", + "https://github.com/status-im/nim-libbacktrace.git#d8bd4ce5c46bb6d2f984f6b3f3d7380897d95ecb", + "https://github.com/cheatfate/nimcrypto.git#721fb99ee099b632eb86dfad1f0d96ee87583774", + "https://github.com/status-im/nim-serialization.git#6f525d5447d97256750ca7856faead03e562ed20", + "https://github.com/status-im/nim-toml-serialization.git#fea85b27f0badcf617033ca1bc05444b5fd8aa7a", + "https://github.com/status-im/nim-stew.git#e5740014961438610d336cd81706582dbf2c96f0", + "https://github.com/status-im/nim-stint.git#470b7892561b5179ab20bd389a69217d6213fe58", + "https://github.com/status-im/nim-metrics.git#ecf64c6078d1276d3b7d9b3d931fbdb70004db11", + "https://github.com/vacp2p/nim-libp2p.git#e82080f7b1aa61c6d35fa5311b873f41eff4bb52", + "https://github.com/status-im/nim-web3.git#81ee8ce479d86acb73be7c4f365328e238d9b4a3", + "https://github.com/status-im/nim-presto.git#92b1c7ff141e6920e1f8a98a14c35c1fa098e3be", + "https://github.com/nitely/nim-regex.git#4593305ed1e49731fc75af1dc572dd2559aad19c", + "https://github.com/arnetheduck/nim-results.git#df8113dda4c2d74d460a8fa98252b0b771bf1f27", + "https://github.com/nim-lang/db_connector.git#74aef399e5c232f95c9fc5c987cebac846f09d62", + "https://github.com/status-im/nim-minilru.git#0c4b2bce959591f0a862e9b541ba43c6d0cf3476", + "https://github.com/status-im/nim-unittest2.git#8b51e99b4a57fcfb31689230e75595f024543024", + "https://github.com/status-im/nim-testutils.git#94d68e796c045d5b37cabc6be32d7bfa168f8857", + "https://github.com/status-im/nim-bearssl.git#11e798b62b8e6beabe958e048e9e24c7e0f9ee63", + "https://github.com/status-im/nim-secp256k1.git#9dd3df62124aae79d564da636bb22627c53c7676", + "https://github.com/status-im/nim-nat-traversal.git#860e18c37667b5dd005b94c63264560c35d88004", + "https://github.com/status-im/nim-faststreams.git#c3ac3f639ed1d62f59d3077d376a29c63ac9750c", + "https://github.com/status-im/nim-http-utils.git#79cbab1460f4c0cdde2084589d017c43a3d7b4f1", + "https://github.com/status-im/nim-json-serialization.git#b65fd6a7e64c864dabe40e7dfd6c7d07db0014ac", + "https://github.com/status-im/nim-websock.git#ebe308a79a7b440a11dfbe74f352be86a3883508", + "https://github.com/status-im/nim-zlib.git#daa8723fd32299d4ca621c837430c29a5a11e19a", + "https://github.com/arnetheduck/nim-sqlite3-abi.git#bdf01cf4236fb40788f0733466cdf6708783cbac", + "https://github.com/status-im/nim-taskpools.git#9e8ccc754631ac55ac2fd495e167e74e86293edb", + "https://github.com/nitely/nim-unicodedb.git#66f2458710dc641dd4640368f9483c8a0ec70561", + "https://github.com/ba0f3/dnsclient.nim.git#23214235d4784d24aceed99bbfe153379ea557c8", + "https://github.com/logos-messaging/nim-ffi.git#d7a5492121aad190cf549436836e2fa42e34ff9b", + "https://github.com/logos-messaging/waku-rlnv2-contract.git#8a338f354481e8a3f3d64a72e38fad4c62e32dcd", + "https://github.com/vacp2p/zerokit.git#a4bb3feb5054e6fd24827adf204493e6e173437b" ### Helper functions From ea9b54f87379bc0b9f8136802295ffda2e169122 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Fri, 2 Jan 2026 02:11:34 +0530 Subject: [PATCH 3/3] chore: not forcing value --- waku.nimble | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/waku.nimble b/waku.nimble index 4347c7462..bc88ab9e9 100644 --- a/waku.nimble +++ b/waku.nimble @@ -45,10 +45,7 @@ requires "nim >= 2.2.4", "https://github.com/arnetheduck/nim-sqlite3-abi.git#bdf01cf4236fb40788f0733466cdf6708783cbac", "https://github.com/status-im/nim-taskpools.git#9e8ccc754631ac55ac2fd495e167e74e86293edb", "https://github.com/nitely/nim-unicodedb.git#66f2458710dc641dd4640368f9483c8a0ec70561", - "https://github.com/ba0f3/dnsclient.nim.git#23214235d4784d24aceed99bbfe153379ea557c8", - "https://github.com/logos-messaging/nim-ffi.git#d7a5492121aad190cf549436836e2fa42e34ff9b", - "https://github.com/logos-messaging/waku-rlnv2-contract.git#8a338f354481e8a3f3d64a72e38fad4c62e32dcd", - "https://github.com/vacp2p/zerokit.git#a4bb3feb5054e6fd24827adf204493e6e173437b" + "https://github.com/ba0f3/dnsclient.nim.git#23214235d4784d24aceed99bbfe153379ea557c8" ### Helper functions