Skip to content

Commit

Permalink
Check accessible lookup gates only on the used selector rows (#296)
Browse files Browse the repository at this point in the history
Co-authored-by: akokoshn <alexeikokoshnikof@nil.foundation>
  • Loading branch information
akokoshn and akokoshn authored Dec 4, 2023
1 parent 168922f commit 23c85b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/nil/blueprint/blueprint/plonk/assignment_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ namespace nil {

for (std::size_t selector_row = 0;
selector_row < selector.size(); selector_row++) {
if (!selector[selector_row].is_zero()) {
if (!selector[selector_row].is_zero() && private_rows.find(selector_row) != private_rows.end()) {
row_index = selector_row;
for (const auto &lookup_constraint: lookup_gates[i].constraints) {
for (const auto &constraint : lookup_constraint.lookup_input) {
Expand Down
7 changes: 4 additions & 3 deletions test/proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,17 @@ BOOST_AUTO_TEST_CASE(blueprint_proxy_call_pack_lookup_tables_test) {

std::vector<std::size_t> lookup_columns_indices = {0, 1, 2, 3, 4};
std::size_t usable_rows_amount = assignment.allocated_rows();
std::uint32_t min_selector_index = 5;
bp.reserve_table("binary_xor_table/full");

nil::crypto3::zk::snark::pack_lookup_tables(
nil::crypto3::zk::snark::pack_lookup_tables_horizontal(
bp.get_reserved_indices(),
bp.get_reserved_tables(),
bp.get(), assignment.get(), lookup_columns_indices,
bp.get(), assignment.get(), lookup_columns_indices, min_selector_index,
usable_rows_amount);

std::set<uint32_t> lookup_constant_cols = {0, 1, 2, 3, 4};
BOOST_ASSERT(assignment.get_lookup_constant_cols() == lookup_constant_cols);
std::set<uint32_t> lookup_selector_cols = {1};
std::set<uint32_t> lookup_selector_cols = {min_selector_index};
BOOST_ASSERT(assignment.get_lookup_selector_cols() == lookup_selector_cols);
}

0 comments on commit 23c85b8

Please sign in to comment.