Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nwaku #16512

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
66 changes: 58 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,48 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk

EXCLUDED_NIM_PACKAGES := vendor/status-go/third_party/nwaku/vendor/nim-bearssl \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-bearssl \
vendor/status-go/third_party/nwaku/vendor/nim-chronicles \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-chronicles \
vendor/status-go/third_party/nwaku/vendor/nim-chronos \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-chronos \
vendor/status-go/third_party/nwaku/vendor/nim-confutils \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-confutils \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-eth \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-faststreams \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-http-utils \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-json-rpc \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-json-serialization \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-secp256k1 \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-serialization \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-stew \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-websock \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nim-zlib \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nimbus-build-system/vendor/Nim \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nimbus-build-system/vendor/nimble \
vendor/status-go/third_party/nwaku/vendor/nim-dnsdisc/vendor/nimcrypto \
vendor/status-go/third_party/nwaku/vendor/nim-eth \
vendor/status-go/third_party/nwaku/vendor/nim-faststreams \
vendor/status-go/third_party/nwaku/vendor/nim-http-utils \
vendor/status-go/third_party/nwaku/vendor/nim-json-rpc \
vendor/status-go/third_party/nwaku/vendor/nim-json-serialization \
vendor/status-go/third_party/nwaku/vendor/nim-libp2p \
vendor/status-go/third_party/nwaku/vendor/nim-metrics \
vendor/status-go/third_party/nwaku/vendor/nim-results \
vendor/status-go/third_party/nwaku/vendor/nim-secp256k1 \
vendor/status-go/third_party/nwaku/vendor/nim-serialization \
vendor/status-go/third_party/nwaku/vendor/nim-stew \
vendor/status-go/third_party/nwaku/vendor/nim-stint \
vendor/status-go/third_party/nwaku/vendor/nim-taskpools \
vendor/status-go/third_party/nwaku/vendor/nim-testutils \
vendor/status-go/third_party/nwaku/vendor/nim-unittest2 \
vendor/status-go/third_party/nwaku/vendor/nim-web3 \
vendor/status-go/third_party/nwaku/vendor/nim-websock \
vendor/status-go/third_party/nwaku/vendor/nim-zlib \
vendor/status-go/third_party/nwaku/vendor/nimbus-build-system/vendor/Nim \
vendor/status-go/third_party/nwaku/vendor/nimcrypto

.PHONY: \
all \
nix-shell \
Expand Down Expand Up @@ -83,7 +125,7 @@ ifeq ($(detected_OS),Darwin)
export CFLAGS
CGO_CFLAGS := -mmacosx-version-min=12.0
export CGO_CFLAGS
LIBSTATUS_EXT := dylib
LIB_EXT := dylib
# keep in sync with BOTTLE_MACOS_VERSION
MACOSX_DEPLOYMENT_TARGET := 12.0
export MACOSX_DEPLOYMENT_TARGET
Expand All @@ -92,14 +134,14 @@ ifeq ($(detected_OS),Darwin)
QMAKE_PATH := $(shell which qmake);
QT_ARCH := $(shell lipo -archs $(QMAKE_PATH))
else ifeq ($(detected_OS),Windows)
LIBSTATUS_EXT := dll
LIB_EXT := dll
PKG_TARGET := pkg-windows
QRCODEGEN_MAKE_PARAMS := CC=gcc
RUN_TARGET := run-windows
VCINSTALLDIR ?= C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\
export VCINSTALLDIR
else
LIBSTATUS_EXT := so
LIB_EXT := so
PKG_TARGET := pkg-linux
RUN_TARGET := run-linux
endif
Expand Down Expand Up @@ -217,6 +259,14 @@ ifeq ($(detected_OS),Darwin)
endif
endif

ifeq ($(USE_NWAKU), true)
STATUSGO_MAKE_PARAMS += USE_NWAKU=true
LIBWAKU := vendor/status-go/third_party/nwaku/build/libwaku.$(LIB_EXT)
LIBWAKU_LIBDIR := $(shell pwd)/$(shell dirname "$(LIBWAKU)")
export LIBWAKU
NIM_EXTRA_PARAMS += --passL:"-L$(LIBWAKU_LIBDIR)" --passL:"-lwaku"
endif

INCLUDE_DEBUG_SYMBOLS ?= false
ifeq ($(INCLUDE_DEBUG_SYMBOLS),true)
# We need `-d:debug` to get Nim's default stack traces
Expand Down Expand Up @@ -440,14 +490,14 @@ dotherside: | dotherside-build
## status-go
##

STATUSGO := vendor/status-go/build/bin/libstatus.$(LIBSTATUS_EXT)
STATUSGO := vendor/status-go/build/bin/libstatus.$(LIB_EXT)
STATUSGO_LIBDIR := $(shell pwd)/$(shell dirname "$(STATUSGO)")
export STATUSGO_LIBDIR

$(STATUSGO): | deps status-go-deps
echo -e $(BUILD_MSG) "status-go"
# FIXME: Nix shell usage breaks builds due to Glibc mismatch.
$(MAKE) -C vendor/status-go statusgo-shared-library SHELL=/bin/sh \
$(MAKE) -C vendor/status-go statusgo-shared-library SHELL=/bin/bash \
SENTRY_CONTEXT_NAME="status-desktop" \
SENTRY_CONTEXT_VERSION="$(DESKTOP_VERSION)" \
$(STATUSGO_MAKE_PARAMS) $(HANDLE_OUTPUT)
Expand All @@ -463,7 +513,7 @@ status-go-clean:
echo -e "\033[92mCleaning:\033[39m status-go"
rm -f $(STATUSGO)

export STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$(LIBSTATUS_EXT)
export STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$(LIB_EXT)
export STATUSKEYCARDGO_LIBDIR := "$(shell pwd)/$(shell dirname "$(STATUSKEYCARDGO)")"

status-keycard-go: $(STATUSKEYCARDGO)
Expand Down Expand Up @@ -838,12 +888,12 @@ ICON_TOOL := node_modules/.bin/fileicon

run-linux: nim_status_client
echo -e "\033[92mRunning:\033[39m bin/nim_status_client"
LD_LIBRARY_PATH="$(QT5_LIBDIR)":"$(STATUSGO_LIBDIR)":"$(STATUSKEYCARDGO_LIBDIR)":"$(STATUSQ_INSTALL_PATH)/StatusQ":"$(LD_LIBRARY_PATH)" \
LD_LIBRARY_PATH="$(QT5_LIBDIR)":"$(LIBWAKU_LIBDIR)":"$(STATUSGO_LIBDIR)":"$(STATUSKEYCARDGO_LIBDIR)":"$(STATUSQ_INSTALL_PATH)/StatusQ":"$(LD_LIBRARY_PATH)" \
./bin/nim_status_client $(ARGS)

run-linux-gdb: nim_status_client
echo -e "\033[92mRunning:\033[39m bin/nim_status_client"
LD_LIBRARY_PATH="$(QT5_LIBDIR)":"$(STATUSGO_LIBDIR)":"$(STATUSKEYCARDGO_LIBDIR)":"$(STATUSQ_INSTALL_PATH)/StatusQ":"$(LD_LIBRARY_PATH)" \
LD_LIBRARY_PATH="$(QT5_LIBDIR)":"$(LIBWAKU_LIBDIR)":"$(STATUSGO_LIBDIR)":"$(STATUSKEYCARDGO_LIBDIR)":"$(STATUSQ_INSTALL_PATH)/StatusQ":"$(LD_LIBRARY_PATH)" \
gdb -ex=r ./bin/nim_status_client $(ARGS)

run-macos: nim_status_client
Expand Down
2 changes: 1 addition & 1 deletion build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ docker run -it --rm \
-u jenkins:$(getent group $(whoami) | cut -d: -f3) \
-v "${PWD}:/status-desktop" \
-w /status-desktop \
statusteam/nim-status-client-build:1.3.0-qt5.15.2 \
statusteam/nim-status-client-build:latest \
./docker-linux-app-image.sh
11 changes: 9 additions & 2 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ FROM ubuntu:20.04 AS qt-install

ARG QT_VERSION

RUN apt update && apt full-upgrade -y && apt install -y --no-install-recommends sudo python3 python3-pip \
&& apt-get -qq clean
RUN apt update && apt full-upgrade -y && apt install -y --no-install-recommends \
sudo python3 python3-pip python3-dev \
build-essential gcc g++ \
&& apt-get -qq clean

RUN chmod -R 777 /opt

Expand Down Expand Up @@ -118,8 +120,13 @@ ENV HOME="/home/jenkins"
ENV PATH="${HOME}/go/bin:${PATH}"

# Nix for jenkins user to build status-go.
RUN curl -s https://nixos.org/releases/nix/nix-2.19.3/install | sh -s -- --no-daemon# Nix for jenkins user to build status-go.
RUN curl -s https://nixos.org/releases/nix/nix-2.19.3/install | sh -s -- --no-daemon

# Installing rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.78 -y
ENV PATH="~/.cargo/bin:${PATH}"

LABEL maintainer="[email protected]"
LABEL source="https://github.com/status-im/status-desktop"
LABEL description="Build image for the Status Desktop client written in Nim."
8 changes: 7 additions & 1 deletion docker-linux-app-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
cp -R . ~/status-desktop
cd ~/status-desktop



git clean -dfx && rm -rf vendor/* && git checkout vendor/DOtherSide && make -j4 V=1 update
make V=1 pkg


sed -i 's|\t\$(MAKE) -C \./third_party/nwaku libwaku|\tsed -i '\''s/c++20/c++2a/g'\'' ./third_party/nwaku/vendor/negentropy/cpp/Makefile; $(MAKE) -C ./third_party/nwaku libwaku|' ./vendor/status-go/Makefile

make V=1 pkg USE_NWAKU=true

# Make AppImage build accessible to the docker host
cd - && cp -R ~/status-desktop/pkg .
Expand Down
5 changes: 5 additions & 0 deletions scripts/fix_app_dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ if [[ ! -z "${IN_NIX_SHELL}" ]]; then
"${APP_DIR}/usr/lib/libcom_err.so.3" \
"${APP_DIR}/usr/lib/libstatus.so"

if [ -f "${APP_DIR}/usr/lib/libwaku.so" ]; then
patchelf --set-rpath '$ORIGIN' \
"${APP_DIR}/usr/lib/libwaku.so"
fi

patchelf --set-rpath '$ORIGIN/../' \
"${APP_DIR}"/usr/lib/gstreamer-1.0/* \
"${APP_DIR}"/usr/lib/nss/*.so
Expand Down
1 change: 1 addition & 0 deletions scripts/init_app_dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cp -R "${FLEETS_FILE}" "${APP_DIR}/usr/"
cp bin/i18n/* "${APP_DIR}/usr/i18n"
cp vendor/status-go/build/bin/libstatus.so "${APP_DIR}/usr/lib/"
cp vendor/status-go/build/bin/libstatus.so.0 "${APP_DIR}/usr/lib/"
cp "${LIBWAKU}" "${APP_DIR}/usr/lib/"
cp "${STATUSKEYCARDGO}" "${APP_DIR}/usr/lib/"
cp "${FCITX5_QT}" "${APP_DIR}/usr/plugins/platforminputcontexts/"

Expand Down
2 changes: 1 addition & 1 deletion vendor/status-go
Submodule status-go updated 85 files
+2 −1 .github/CODEOWNERS
+0 −1 .gitignore
+3 −0 .gitmodules
+3 −0 .vscode/settings.json
+25 −0 Makefile
+90 −0 _docs/policies/README.md
+71 −0 _docs/policies/introduce-policy.md
+0 −97 _docs/policies/tests.md
+7 −8 cmd/ping-community/main.go
+5 −1 cmd/status-cli/util.go
+1 −1 go.mod
+2 −2 go.sum
+1 −1 nix/shell.nix
+11 −3 node/status_node_services.go
+5 −5 protocol/communities/community.go
+11 −11 protocol/communities/manager.go
+4 −4 protocol/communities/persistence.go
+3 −3 protocol/communities/persistence_mapping.go
+2 −2 protocol/communities/persistence_test.go
+4 −3 protocol/communities_messenger_token_permissions_test.go
+3 −3 protocol/linkpreview_unfurler_status.go
+11 −10 protocol/messenger.go
+20 −20 protocol/messenger_communities.go
+10 −10 protocol/messenger_communities_sharding_test.go
+3 −3 protocol/messenger_community_shard.go
+2 −2 protocol/messenger_filter_init.go
+31 −31 protocol/messenger_mailserver.go
+0 −24 protocol/messenger_mailserver_cycle.go
+0 −4 protocol/messenger_peers.go
+4 −4 protocol/messenger_share_urls.go
+7 −7 protocol/messenger_store_node_request_manager.go
+10 −6 protocol/messenger_storenode_comunity_test.go
+27 −18 protocol/messenger_storenode_request_test.go
+3 −4 protocol/messenger_testing_utils.go
+3 −3 protocol/requests/set_community_shard.go
+3 −4 protocol/transport/filters_manager.go
+7 −11 protocol/transport/transport.go
+16 −5 protocol/waku_builder_test.go
+3 −11 services/ext/api.go
+9 −9 services/mailservers/api_test.go
+2 −2 services/status/service.go
+2 −2 signal/events_shhext.go
+3 −5 telemetry/client.go
+3 −0 telemetry/client_test.go
+1 −0 third_party/nwaku
+27 −14 timesource/timesource.go
+4 −5 timesource/timesource_test.go
+1 −1 vendor/github.com/waku-org/go-waku/waku/v2/api/common/storenode_requestor.go
+34 −0 vendor/github.com/waku-org/go-waku/waku/v2/api/history/cycle.go
+10 −10 vendor/github.com/waku-org/go-waku/waku/v2/api/history/history.go
+2 −2 vendor/github.com/waku-org/go-waku/waku/v2/api/missing/criteria_interest.go
+4 −4 vendor/github.com/waku-org/go-waku/waku/v2/api/missing/default_requestor.go
+6 −6 vendor/github.com/waku-org/go-waku/waku/v2/api/missing/missing_messages.go
+2 −2 vendor/github.com/waku-org/go-waku/waku/v2/api/publish/default_verifier.go
+5 −5 vendor/github.com/waku-org/go-waku/waku/v2/api/publish/message_check.go
+2 −2 vendor/github.com/waku-org/go-waku/waku/v2/node/wakunode2.go
+10 −7 vendor/github.com/waku-org/go-waku/waku/v2/peermanager/peer_manager.go
+2 −1 vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/client.go
+2 −1 vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/test_utils.go
+1 −1 vendor/github.com/waku-org/go-waku/waku/v2/protocol/legacy_store/waku_store_client.go
+2 −1 vendor/github.com/waku-org/go-waku/waku/v2/protocol/lightpush/waku_lightpush.go
+2 −1 vendor/github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/client.go
+3 −3 vendor/github.com/waku-org/go-waku/waku/v2/protocol/store/client.go
+3 −3 vendor/github.com/waku-org/go-waku/waku/v2/protocol/store/options.go
+1 −1 vendor/modules.txt
+6 −6 waku/bridge/waku.go
+9 −13 waku/bridge/wakuv2.go
+6 −8 waku/types/waku.go
+3 −2 wakuv2/api_test.go
+79 −0 wakuv2/common/envelope.go
+2 −3 wakuv2/common/message.go
+3 −5 wakuv2/config.go
+61 −21 wakuv2/gowaku.go
+2 −2 wakuv2/history_processor_wrapper.go
+2 −1 wakuv2/message_publishing.go
+3,363 −32 wakuv2/nwaku.go
+999 −0 wakuv2/nwaku_test.go
+58 −0 wakuv2/nwaku_test_utils.go
+27 −0 wakuv2/pinger.go
+38 −0 wakuv2/publisher.go
+78 −0 wakuv2/result.go
+1 −1 wakuv2/shard.go
+60 −0 wakuv2/storenode_message_verifier.go
+77 −0 wakuv2/storenode_requestor.go
+34 −25 wakuv2/waku_test.go