Skip to content

Commit

Permalink
fix: remove max lookup table size constant (for now) (#11095)
Browse files Browse the repository at this point in the history
Remove the MAX_LOOKUP_TABLES_SIZE constant (for now) to avoid pain for
developers. Added TODO to reconsider this in the future to continue to
benefit from the memory gains afforded by MAX_LOOKUP_TABLES_SIZE
  • Loading branch information
ledwards2225 authored Jan 8, 2025
1 parent b8ef30e commit 7e9e268
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ static constexpr uint32_t CONST_PG_LOG_N = 20;

static constexpr uint32_t CONST_ECCVM_LOG_N = 15;

static constexpr uint32_t MAX_LOOKUP_TABLES_SIZE = 75000;
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1193): potentially reenable for better memory performance
// static constexpr uint32_t MAX_LOOKUP_TABLES_SIZE = 80000;

static constexpr uint32_t MAX_DATABUS_SIZE = 10000;

Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "barretenberg/crypto/merkle_tree/merkle_tree.hpp"
#include "barretenberg/srs/global_crs.hpp"
#include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp"
#include "barretenberg/stdlib/hash/keccak/keccak.hpp"
#include "barretenberg/stdlib/hash/sha256/sha256.hpp"
#include "barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.hpp"
#include "barretenberg/stdlib/primitives/curves/secp256k1.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void construct_lookup_table_polynomials(const RefArray<typename Flavor::Polynomi
// ignored, as used for regular constraints and padding to the next power of 2.
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1033): construct tables and counts at top of trace
const size_t tables_size = circuit.get_tables_size();
ASSERT(tables_size <= MAX_LOOKUP_TABLES_SIZE); // if false, may need to increase constant
ASSERT(dyadic_circuit_size > tables_size + additional_offset);
size_t offset = circuit.blocks.lookup.trace_offset;
if constexpr (IsPlonkFlavor<Flavor>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(ultra_honk sumcheck stdlib_primitives)
barretenberg_module(ultra_honk sumcheck stdlib_primitives stdlib_keccak stdlib_sha256)
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void DeciderProvingKey_<Flavor>::allocate_table_lookup_polynomials(const Circuit
PROFILE_THIS_NAME("allocate_table_lookup_polynomials");

size_t table_offset = circuit.blocks.lookup.trace_offset;
const size_t max_tables_size =
std::min(static_cast<size_t>(MAX_LOOKUP_TABLES_SIZE), dyadic_circuit_size - table_offset);
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1193): can potentially improve memory footprint
const size_t max_tables_size = dyadic_circuit_size - table_offset;
ASSERT(dyadic_circuit_size > max_tables_size);

// Allocate the polynomials containing the actual table data
Expand Down

0 comments on commit 7e9e268

Please sign in to comment.