Skip to content

Commit

Permalink
Update bb submodule and perform related fixes in circuits.
Browse files Browse the repository at this point in the history
  • Loading branch information
suyash67 committed Apr 21, 2023
1 parent 1aea566 commit 978cd43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ fr NullifierMemoryTreeTestingHarness::append_value(fr const& value)
std::tie(current, is_already_present) = find_closest_leaf(leaves_, value);

nullifier_leaf new_leaf = { .value = value,
.nextIndex = leaves_[current].nextIndex,
.nextValue = leaves_[current].nextValue };
.nextIndex = leaves_[current].data->nextIndex,
.nextValue = leaves_[current].data->nextValue };
if (!is_already_present) {
// Update the current leaf to point it to the new leaf
leaves_[current].nextIndex = leaves_.size();
leaves_[current].nextValue = value;
leaves_[current].data->nextIndex = leaves_.size();
leaves_[current].data->nextValue = value;

// Insert the new leaf with (nextIndex, nextValue) of the current leaf
leaves_.push_back(new_leaf);
Expand Down Expand Up @@ -160,7 +160,10 @@ NullifierMemoryTreeTestingHarness::circuit_prep_batch_insert(std::vector<fr> con
prev_nodes->second.push_back(new_value);
}

nullifier_leaf low_nullifier = leaves_[current];
nullifier_leaf low_nullifier;
if (leaves_[current].data.has_value()) {
low_nullifier = leaves_[current].data.value();
}
std::vector<fr> sibling_path = this->get_sibling_path(current);

sibling_paths.push_back(sibling_path);
Expand Down Expand Up @@ -197,8 +200,8 @@ std::pair<nullifier_leaf, size_t> NullifierMemoryTreeTestingHarness::find_lower(

// TODO: handle is already present case
if (!is_already_present) {
return std::make_pair(leaves_[current], current);
return std::make_pair(leaves_[current].data.value(), current);
} else {
return std::make_pair(leaves_[current], current);
return std::make_pair(leaves_[current].data.value(), current);
}
}

0 comments on commit 978cd43

Please sign in to comment.