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 a7a87f1f10
commit 002316cceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

@ -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/

View File

@ -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

View File

@ -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.}