Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 23c85b8

Browse files
akokoshnakokoshn
andauthored
Check accessible lookup gates only on the used selector rows (#296)
Co-authored-by: akokoshn <[email protected]>
1 parent 168922f commit 23c85b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/nil/blueprint/blueprint/plonk/assignment_proxy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ namespace nil {
501501

502502
for (std::size_t selector_row = 0;
503503
selector_row < selector.size(); selector_row++) {
504-
if (!selector[selector_row].is_zero()) {
504+
if (!selector[selector_row].is_zero() && private_rows.find(selector_row) != private_rows.end()) {
505505
row_index = selector_row;
506506
for (const auto &lookup_constraint: lookup_gates[i].constraints) {
507507
for (const auto &constraint : lookup_constraint.lookup_input) {

test/proxy.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,17 @@ BOOST_AUTO_TEST_CASE(blueprint_proxy_call_pack_lookup_tables_test) {
409409

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

414-
nil::crypto3::zk::snark::pack_lookup_tables(
415+
nil::crypto3::zk::snark::pack_lookup_tables_horizontal(
415416
bp.get_reserved_indices(),
416417
bp.get_reserved_tables(),
417-
bp.get(), assignment.get(), lookup_columns_indices,
418+
bp.get(), assignment.get(), lookup_columns_indices, min_selector_index,
418419
usable_rows_amount);
419420

420421
std::set<uint32_t> lookup_constant_cols = {0, 1, 2, 3, 4};
421422
BOOST_ASSERT(assignment.get_lookup_constant_cols() == lookup_constant_cols);
422-
std::set<uint32_t> lookup_selector_cols = {1};
423+
std::set<uint32_t> lookup_selector_cols = {min_selector_index};
423424
BOOST_ASSERT(assignment.get_lookup_selector_cols() == lookup_selector_cols);
424425
}

0 commit comments

Comments
 (0)