Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ void create_merkle_check_membership_constraint(waffle::TurboComposer& composer,
/// struct which requires the method create_witness_hashpath
hash_path<waffle::TurboComposer> hash_path;

for (size_t i = 0; i < input.hash_path.size(); i = i + 2) {
field_t left = field_t::from_witness_index(&composer, input.hash_path[i]);
field_t right = field_t::from_witness_index(&composer, input.hash_path[i + 1]);
hash_path.push_back(std::make_pair(left, right));
// In Noir we accept a hash path that only contains one hash per tree level
// It is ok to reuse the leaf as it will be overridden in check_subtree_membership when computing the current root
// at each tree level
for (size_t i = 0; i < input.hash_path.size(); i++) {
if (index_bits[i].get_value() == false) {
field_t left = leaf;
field_t right = field_t::from_witness_index(&composer, input.hash_path[i]);
hash_path.push_back(std::make_pair(left, right));
} else {
field_t left = field_t::from_witness_index(&composer, input.hash_path[i]);
field_t right = leaf;
hash_path.push_back(std::make_pair(left, right));
}
}

auto exists = check_subtree_membership(root, hash_path, leaf, index_bits, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ uint32_t c_get_exact_circuit_size(uint8_t const* constraint_system_buf)
auto crs_factory = std::make_unique<waffle::ReferenceStringFactory>();
auto composer = create_circuit(constraint_system, std::move(crs_factory));

bool checked_circuit_res = composer.check_circuit();
printf("check_circuit result: %d\n", checked_circuit_res);

auto num_gates = composer.get_num_gates();
return static_cast<uint32_t>(num_gates);
}
Expand Down
12 changes: 11 additions & 1 deletion barretenberg/src/aztec/stdlib/encryption/schnorr/schnorr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,17 @@ point<C> variable_base_mul(const point<C>& pub_key, const point<C>& current_accu
grumpkin::g1::affine_element pub_key_native(pub_key.x.get_value(), pub_key.y.get_value());
grumpkin::g1::affine_element current_accumulator_native(current_accumulator.x.get_value(),
current_accumulator.y.get_value());
ASSERT(pub_key_native.on_curve() && current_accumulator_native.on_curve());

const auto validate_on_curve = [&](const auto& pt) {
const auto& x = pt.x;
const auto& y = pt.y;
auto on_curve = x * x;
on_curve = on_curve * x + grumpkin::g1::curve_b; // x^3 - 17
on_curve = y.madd(y, -on_curve); // on_curve = y^2 - (x^3 - 17) == 0
on_curve.assert_is_zero("create_point_witness: point not on curve");
};
validate_on_curve(pub_key);
validate_on_curve(current_accumulator);

field_t<C> two(pub_key.x.context, 2);

Expand Down
14 changes: 9 additions & 5 deletions barretenberg_wrapper/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ fn link_lib_omp(toolchain: &'static str) {
ARM_APPLE => println!("cargo:rustc-link-search=/opt/homebrew/lib"),
&_ => unimplemented!("lomp linking of {} is not supported", toolchain),
}
if toolchain == ARM_LINUX {
// only arm linux uses gcc
println!("cargo:rustc-link-lib=gomp")
} else {
println!("cargo:rustc-link-lib=omp")
match toolchain {
ARM_LINUX => {
// only arm linux uses gcc
println!("cargo:rustc-link-lib=gomp")
}
INTEL_APPLE | ARM_APPLE => {
println!("cargo:rustc-link-lib=omp")
}
&_ => println!("cargo:rustc-link-lib=omp5")
}
}

Expand Down