Skip to content

Commit

Permalink
Merge 25deae0 into 2790bd7
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasxia01 authored Jan 14, 2025
2 parents 2790bd7 + 25deae0 commit 3f3dcbc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 1 addition & 2 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,8 +1314,7 @@ int main(int argc, char* argv[])
{
try {
std::vector<std::string> args(argv + 1, argv + argc);
debug_logging = flag_present(args, "-d") || flag_present(args, "--debug_logging");
verbose_logging = debug_logging || flag_present(args, "-v") || flag_present(args, "--verbose_logging");
verbose_logging = flag_present(args, "-v") || flag_present(args, "--verbose_logging");
if (args.empty()) {
std::cerr << "No command provided.\n";
return 1;
Expand Down
3 changes: 0 additions & 3 deletions barretenberg/cpp/src/barretenberg/common/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ bool verbose_logging = std::getenv("BB_VERBOSE") == nullptr ? false : std::strin
#else
bool verbose_logging = true;
#endif

// Used for `debug` in log.hpp.
bool debug_logging = false;
5 changes: 1 addition & 4 deletions barretenberg/cpp/src/barretenberg/common/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ template <typename... Args> std::string benchmark_format(Args... args)
return os.str();
}

extern bool debug_logging;
#ifndef NDEBUG
template <typename... Args> inline void debug(Args... args)
{
if (debug_logging) {
logstr(format(args...).c_str());
}
logstr(format(args...).c_str());
}
#else
template <typename... Args> inline void debug(Args... /*unused*/) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ template <typename FF_> class CircuitBuilderBase {
using EmbeddedCurve = std::conditional_t<std::same_as<FF, bb::g1::coordinate_field>, curve::BN254, curve::Grumpkin>;

size_t num_gates = 0;
// true if we have dummy witnesses (in the write_vk case)
bool has_dummy_witnesses = false;

std::vector<uint32_t> public_inputs;
std::vector<FF> variables;
Expand Down Expand Up @@ -56,7 +58,7 @@ template <typename FF_> class CircuitBuilderBase {
static constexpr uint32_t REAL_VARIABLE = UINT32_MAX - 1;
static constexpr uint32_t FIRST_VARIABLE_IN_CLASS = UINT32_MAX - 2;

CircuitBuilderBase(size_t size_hint = 0);
CircuitBuilderBase(size_t size_hint = 0, bool has_dummy_witnesses = false);

CircuitBuilderBase(const CircuitBuilderBase& other) = default;
CircuitBuilderBase(CircuitBuilderBase&& other) noexcept = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include "circuit_builder_base.hpp"

namespace bb {
template <typename FF_> CircuitBuilderBase<FF_>::CircuitBuilderBase(size_t size_hint)
template <typename FF_>
CircuitBuilderBase<FF_>::CircuitBuilderBase(size_t size_hint, bool has_dummy_witnesses)
: has_dummy_witnesses(has_dummy_witnesses)
{
variables.reserve(size_hint * 3);
variable_names.reserve(size_hint * 3);
Expand Down Expand Up @@ -286,6 +288,10 @@ template <typename FF_> void CircuitBuilderBase<FF_>::set_err(std::string msg)

template <typename FF_> void CircuitBuilderBase<FF_>::failure(std::string msg)
{
if (!has_dummy_witnesses) {
// We have a builder failure when we have real witnesses which is a mistake.
info("Builder failure when we have real witnesses!"); // not a catch-all error
}
_failed = true;
set_err(std::move(msg));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase<typename ExecutionTrace_:
const std::vector<uint32_t>& public_inputs,
size_t varnum,
bool recursive = false)
: CircuitBuilderBase<FF>(size_hint)
: CircuitBuilderBase<FF>(size_hint, witness_values.empty())
{
// TODO(https://github.com/AztecProtocol/barretenberg/issues/870): reserve space in blocks here somehow?

Expand Down

0 comments on commit 3f3dcbc

Please sign in to comment.