diff --git a/barretenberg/src/aztec/dsl/standard_format/merkle_membership_constraint.hpp b/barretenberg/src/aztec/dsl/standard_format/merkle_membership_constraint.hpp index 586c1aa92..47a364f8e 100644 --- a/barretenberg/src/aztec/dsl/standard_format/merkle_membership_constraint.hpp +++ b/barretenberg/src/aztec/dsl/standard_format/merkle_membership_constraint.hpp @@ -42,10 +42,19 @@ void create_merkle_check_membership_constraint(waffle::TurboComposer& composer, /// struct which requires the method create_witness_hashpath hash_path 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); diff --git a/barretenberg/src/aztec/rollup/proofs/standard_example/standard_example.cpp b/barretenberg/src/aztec/rollup/proofs/standard_example/standard_example.cpp index e40dbdec9..bfe1295e5 100644 --- a/barretenberg/src/aztec/rollup/proofs/standard_example/standard_example.cpp +++ b/barretenberg/src/aztec/rollup/proofs/standard_example/standard_example.cpp @@ -48,6 +48,9 @@ uint32_t c_get_exact_circuit_size(uint8_t const* constraint_system_buf) auto crs_factory = std::make_unique(); 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(num_gates); } diff --git a/barretenberg/src/aztec/stdlib/encryption/schnorr/schnorr.cpp b/barretenberg/src/aztec/stdlib/encryption/schnorr/schnorr.cpp index 863ad67b7..2be979571 100644 --- a/barretenberg/src/aztec/stdlib/encryption/schnorr/schnorr.cpp +++ b/barretenberg/src/aztec/stdlib/encryption/schnorr/schnorr.cpp @@ -152,7 +152,17 @@ point variable_base_mul(const point& pub_key, const point& 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 two(pub_key.x.context, 2); diff --git a/barretenberg_wrapper/build.rs b/barretenberg_wrapper/build.rs index 0d1164289..dae01733a 100644 --- a/barretenberg_wrapper/build.rs +++ b/barretenberg_wrapper/build.rs @@ -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") } }