feat(rln): use zerokit as static lib (#1385)

This commit is contained in:
G 2022-12-06 00:33:03 +01:00 committed by GitHub
parent f48687fc45
commit 47aadf6dbd
3 changed files with 4 additions and 13 deletions

View File

@ -60,6 +60,5 @@ CMD ["--help"]
FROM prod AS experimental FROM prod AS experimental
# If RLN enabled, copy the librln artifacts # If RLN enabled, copy RLN resources (WASM ZK circuit, proving and verification keys) used by tests
COPY --from=nim-build /app/vendor/zerokit/target/release/librln.so vendor/zerokit/target/release/librln.so
COPY --from=nim-build /app/vendor/zerokit/rln/resources/ vendor/zerokit/rln/resources/ COPY --from=nim-build /app/vendor/zerokit/rln/resources/ vendor/zerokit/rln/resources/

View File

@ -108,11 +108,9 @@ endif
LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit/target/release LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit/target/release
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
LIBRLN_FILE := rln.dll LIBRLN_FILE := rln.lib
else ifeq ($(shell uname -s),Darwin)
LIBRLN_FILE := librln.dylib
else else
LIBRLN_FILE := librln.so LIBRLN_FILE := librln.a
endif endif
$(LIBRLN_BUILDDIR)/$(LIBRLN_FILE): $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE):
@ -122,7 +120,7 @@ $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE):
ifneq ($(RLN), true) ifneq ($(RLN), true)
librln: ; # noop librln: ; # noop
else 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) librln: $(LIBRLN_BUILDDIR)/$(LIBRLN_FILE)
endif endif

View File

@ -9,10 +9,6 @@ else:
{.push raises: [].} {.push raises: [].}
const rln_libpath {.strdefine.} = "vendor/zerokit/target/release/librln.so"
{.push dynlib: static(rln_libpath).}
## Buffer struct is taken from ## Buffer struct is taken from
# https://github.com/celo-org/celo-threshold-bls-rs/blob/master/crates/threshold-bls-ffi/src/ffi.rs # https://github.com/celo-org/celo-threshold-bls-rs/blob/master/crates/threshold-bls-ffi/src/ffi.rs
type Buffer* = object type Buffer* = object
@ -152,5 +148,3 @@ proc hash*(ctx: ptr RLN,
## inputs_buffer holds the hash input as a byte seq ## inputs_buffer holds the hash input as a byte seq
## the hash output is generated and populated inside output_buffer ## the hash output is generated and populated inside output_buffer
## the output_buffer contains 32 bytes hash output ## the output_buffer contains 32 bytes hash output
{.pop.}