diff --git a/libs/x86_64-pc-windows-gnu/librln.a b/libs/x86_64-pc-windows-gnu/librln.a index 757c88e..e180f5a 100644 Binary files a/libs/x86_64-pc-windows-gnu/librln.a and b/libs/x86_64-pc-windows-gnu/librln.a differ diff --git a/libs/x86_64-unknown-linux-gnu/librln.a b/libs/x86_64-unknown-linux-gnu/librln.a index 9f2684d..a9f3a91 100644 Binary files a/libs/x86_64-unknown-linux-gnu/librln.a and b/libs/x86_64-unknown-linux-gnu/librln.a differ diff --git a/libs/x86_64-unknown-linux-musl/librln.a b/libs/x86_64-unknown-linux-musl/librln.a index 2a1d282..7575d12 100644 Binary files a/libs/x86_64-unknown-linux-musl/librln.a and b/libs/x86_64-unknown-linux-musl/librln.a differ diff --git a/rln/librln.h b/rln/librln.h index 65432b1..92201a6 100644 --- a/rln/librln.h +++ b/rln/librln.h @@ -31,6 +31,7 @@ bool new_with_params(uintptr_t tree_height, const struct Buffer *circom_buffer, const struct Buffer *zkey_buffer, const struct Buffer *vk_buffer, + const struct Buffer *tree_config, struct RLN **ctx); bool set_tree(struct RLN *ctx, uintptr_t tree_height); diff --git a/rln/wrapper.go b/rln/wrapper.go index 1e338cf..91d8c97 100644 --- a/rln/wrapper.go +++ b/rln/wrapper.go @@ -41,28 +41,33 @@ func sliceToPtr(slice []byte) (*C.uchar, C.int) { } } -func NewWithParams(depth int, wasm []byte, zkey []byte, verifKey []byte) (*RLN, error) { +func NewWithParams(depth int, wasm []byte, zkey []byte, verifKey []byte, treeConfig []byte) (*RLN, error) { wasmBuffer := toCBufferPtr(wasm) zkeyBuffer := toCBufferPtr(zkey) verifKeyBuffer := toCBufferPtr(verifKey) + treeConfigBuffer := toCBufferPtr(treeConfig) r := &RLN{} - if !bool(C.new_with_params(C.uintptr_t(depth), wasmBuffer, zkeyBuffer, verifKeyBuffer, &r.ptr)) { + if !bool(C.new_with_params(C.uintptr_t(depth), wasmBuffer, zkeyBuffer, verifKeyBuffer, treeConfigBuffer, &r.ptr)) { return nil, errors.New("failed to initialize") } return r, nil } -func NewWithFolder(depth int, resourcesFolderPath string) (*RLN, error) { +func New(depth uint, config []byte) (*RLN, error) { r := &RLN{} - pathBuffer := toCBufferPtr([]byte(resourcesFolderPath)) - if !bool(C.new(C.uintptr_t(depth), pathBuffer, &r.ptr)) { + configBuffer := toCBufferPtr(config) + if !bool(C.new(C.uintptr_t(depth), configBuffer, &r.ptr)) { return nil, errors.New("failed to initialize") } return r, nil } +func (r *RLN) Flush() bool { + return bool(C.flush(r.ptr)) +} + func (r *RLN) SetTree(treeHeight uint) bool { return bool(C.set_tree(r.ptr, C.uintptr_t(treeHeight))) } diff --git a/zerokit b/zerokit index d1414a4..d015c4a 160000 --- a/zerokit +++ b/zerokit @@ -1 +1 @@ -Subproject commit d1414a44c5e088bbf23523f032a001122e35f0c2 +Subproject commit d015c4ab591cb7b260a92a077d3cd1d76609667f