smt: simplify ZK gadget. Use root = sparse_merkle_root(pos, path, leaf) instead of the more complicated is_member = sparse_tree_is_member(root, path, pos, leaf)

This commit is contained in:
zero
2024-04-02 09:38:32 +02:00
parent 4d0c36a508
commit 9188a62bb3
11 changed files with 45 additions and 87 deletions

View File

@@ -5,17 +5,12 @@ constant "SMT" {
}
witness "SMT" {
Base root,
SparseMerklePath path,
Base leaf,
}
circuit "SMT" {
is_member = sparse_tree_is_member(root, path, leaf, leaf);
ONE = witness_base(1);
constrain_equal_base(is_member, ONE);
root = sparse_merkle_root(leaf, path, leaf);
constrain_instance(root);
}