Skip to content

Commit

Permalink
fix(circuits): fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Apr 9, 2024
1 parent 00ed86b commit 6ab210f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/circuits/noir/crates/smt_pedersen/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ global TREE_DEPTH: u32 = 256;
* @param root The expected root of the tree
*/
pub fn verify(entry: [Field; 2], matching_entry: [Option<Field>; 2], siblings: [Field; TREE_DEPTH], root: Field) {
let mut calculcated_root: Field = 0;
let mut calculated_root: Field = 0;
let path = utils::key_to_path(entry[0]);
// if there is no matching_entry it is a membership proof
// if there is a matching_entry it is a non_membership proof
if matching_entry[0].is_none() | matching_entry[1].is_none() {
// membership proof: the root is calculated based on the entry, the siblings,
// and the path determined by the key of entry through consecutive hashing
calculcated_root = utils::calculcate_root(entry, siblings, path);
calculated_root = utils::calculcate_root(entry, siblings, path);
} else {
// non-membership proof: the root is calculated based on the matching_entry, the siblings
// and the path that is determined by the key of entry. This makes sure that matching_entry is in fact
// a matching entry for entry meaning that it shares the same first bits as path
calculcated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
calculated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
}
assert(calculcated_root == root);
assert(calculated_root == root);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/circuits/noir/crates/smt_poseidon/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ global TREE_DEPTH: u32 = 256;
* @param root The expected root of the tree
*/
pub fn verify(entry: [Field; 2], matching_entry: [Option<Field>; 2], siblings: [Field; TREE_DEPTH], root: Field) {
let mut calculcated_root: Field = 0;
let mut calculated_root: Field = 0;
let path = utils::key_to_path(entry[0]);
// if there is no matching_entry it is a membership proof
// if there is a matching_entry it is a non_membership proof
if matching_entry[0].is_none() | matching_entry[1].is_none() {
// membership proof: the root is calculated based on the entry, the siblings,
// and the path determined by the key of entry through consecutive hashing
calculcated_root = utils::calculcate_root(entry, siblings, path);
calculated_root = utils::calculcate_root(entry, siblings, path);
} else {
// non-membership proof: the root is calculated based on the matching_entry, the siblings
// and the path that is determined by the key of entry. This makes sure that matching_entry is in fact
// a matching entry for entry meaning that it shares the same first bits as path
calculcated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
calculated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
}
assert(calculcated_root == root);
assert(calculated_root == root);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/circuits/noir/crates/smt_poseidon2/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ global TREE_DEPTH: u32 = 256;
* @param root The expected root of the tree
*/
pub fn verify(entry: [Field; 2], matching_entry: [Option<Field>; 2], siblings: [Field; TREE_DEPTH], root: Field) {
let mut calculcated_root: Field = 0;
let mut calculated_root: Field = 0;
let path = utils::key_to_path(entry[0]);
// if there is no matching_entry it is a membership proof
// if there is a matching_entry it is a non_membership proof
if matching_entry[0].is_none() | matching_entry[1].is_none() {
// membership proof: the root is calculated based on the entry, the siblings,
// and the path determined by the key of entry through consecutive hashing
calculcated_root = utils::calculcate_root(entry, siblings, path);
calculated_root = utils::calculcate_root(entry, siblings, path);
} else {
// non-membership proof: the root is calculated based on the matching_entry, the siblings
// and the path that is determined by the key of entry. This makes sure that matching_entry is in fact
// a matching entry for entry meaning that it shares the same first bits as path
calculcated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
calculated_root = utils::calculcate_root([matching_entry[0].unwrap(), matching_entry[1].unwrap()], siblings, path);
}
assert(calculcated_root == root);
assert(calculated_root == root);
}

/**
Expand Down

0 comments on commit 6ab210f

Please sign in to comment.