mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
zkas/zk: add sparse_tree_is_member() opcode
This commit is contained in:
21
proof/smt.zk
Normal file
21
proof/smt.zk
Normal file
@@ -0,0 +1,21 @@
|
||||
k = 13;
|
||||
field = "pallas";
|
||||
|
||||
constant "SMT" {
|
||||
}
|
||||
|
||||
witness "SMT" {
|
||||
Base root,
|
||||
SparseMerklePath path,
|
||||
Base leaf,
|
||||
}
|
||||
|
||||
circuit "SMT" {
|
||||
is_member = sparse_tree_is_member(root, path, leaf);
|
||||
|
||||
ONE = witness_base(1);
|
||||
constrain_equal_base(is_member, ONE);
|
||||
|
||||
constrain_instance(root);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user