mirror of
https://github.com/logos-messaging/go-zerokit-rln-x86_64.git
synced 2026-01-02 05:23:12 +00:00
feat: tree config
This commit is contained in:
parent
0a4e68d0b8
commit
ea636e5b40
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
|
||||
@ -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)))
|
||||
}
|
||||
|
||||
2
zerokit
2
zerokit
@ -1 +1 @@
|
||||
Subproject commit d1414a44c5e088bbf23523f032a001122e35f0c2
|
||||
Subproject commit d015c4ab591cb7b260a92a077d3cd1d76609667f
|
||||
Loading…
x
Reference in New Issue
Block a user