From 47aadf6dbd53aac6dfa811feff2c5f44fa806909 Mon Sep 17 00:00:00 2001 From: G <28568419+s1fr0@users.noreply.github.com> Date: Tue, 6 Dec 2022 00:33:03 +0100 Subject: [PATCH] feat(rln): use zerokit as static lib (#1385) --- Dockerfile | 3 +-- Makefile | 8 +++----- waku/v2/protocol/waku_rln_relay/rln.nim | 6 ------ 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6bb1c17df..74e7cb6a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,5 @@ CMD ["--help"] FROM prod AS experimental -# If RLN enabled, copy the librln artifacts -COPY --from=nim-build /app/vendor/zerokit/target/release/librln.so vendor/zerokit/target/release/librln.so +# If RLN enabled, copy RLN resources (WASM ZK circuit, proving and verification keys) used by tests COPY --from=nim-build /app/vendor/zerokit/rln/resources/ vendor/zerokit/rln/resources/ diff --git a/Makefile b/Makefile index fc1741681..e8b28a893 100644 --- a/Makefile +++ b/Makefile @@ -108,11 +108,9 @@ endif LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit/target/release ifeq ($(OS),Windows_NT) -LIBRLN_FILE := rln.dll -else ifeq ($(shell uname -s),Darwin) -LIBRLN_FILE := librln.dylib +LIBRLN_FILE := rln.lib else -LIBRLN_FILE := librln.so +LIBRLN_FILE := librln.a endif $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE): @@ -122,7 +120,7 @@ $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE): ifneq ($(RLN), true) librln: ; # noop else -EXPERIMENTAL_PARAMS += -d:rln -d:rln_libpath=$(LIBRLN_BUILDDIR)/$(LIBRLN_FILE) +EXPERIMENTAL_PARAMS += -d:rln --dynlibOverride:rln --passL:$(LIBRLN_BUILDDIR)/$(LIBRLN_FILE) --passL:-lm librln: $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE) endif diff --git a/waku/v2/protocol/waku_rln_relay/rln.nim b/waku/v2/protocol/waku_rln_relay/rln.nim index ad9537eda..1ad1d8e22 100644 --- a/waku/v2/protocol/waku_rln_relay/rln.nim +++ b/waku/v2/protocol/waku_rln_relay/rln.nim @@ -9,10 +9,6 @@ else: {.push raises: [].} -const rln_libpath {.strdefine.} = "vendor/zerokit/target/release/librln.so" - -{.push dynlib: static(rln_libpath).} - ## Buffer struct is taken from # https://github.com/celo-org/celo-threshold-bls-rs/blob/master/crates/threshold-bls-ffi/src/ffi.rs type Buffer* = object @@ -152,5 +148,3 @@ proc hash*(ctx: ptr RLN, ## inputs_buffer holds the hash input as a byte seq ## the hash output is generated and populated inside output_buffer ## the output_buffer contains 32 bytes hash output - -{.pop.}