diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 4552e66deb58..ba972bd23cb3 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -1314,8 +1314,7 @@ int main(int argc, char* argv[]) { try { std::vector 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; diff --git a/barretenberg/cpp/src/barretenberg/common/log.cpp b/barretenberg/cpp/src/barretenberg/common/log.cpp index 60c9679cedb8..a3917413603c 100644 --- a/barretenberg/cpp/src/barretenberg/common/log.cpp +++ b/barretenberg/cpp/src/barretenberg/common/log.cpp @@ -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; \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/common/log.hpp b/barretenberg/cpp/src/barretenberg/common/log.hpp index dcf5d841dc05..19486b163073 100644 --- a/barretenberg/cpp/src/barretenberg/common/log.hpp +++ b/barretenberg/cpp/src/barretenberg/common/log.hpp @@ -47,13 +47,10 @@ template std::string benchmark_format(Args... args) return os.str(); } -extern bool debug_logging; #ifndef NDEBUG template inline void debug(Args... args) { - if (debug_logging) { - logstr(format(args...).c_str()); - } + logstr(format(args...).c_str()); } #else template inline void debug(Args... /*unused*/) {} diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp index b2eedbd74e56..8587fcf98b5c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base.hpp @@ -18,6 +18,8 @@ template class CircuitBuilderBase { using EmbeddedCurve = std::conditional_t, 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 public_inputs; std::vector variables; @@ -56,7 +58,7 @@ template 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; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base_impl.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base_impl.hpp index e3e4bbcfe9d6..620d10757de7 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/circuit_builder_base_impl.hpp @@ -3,7 +3,9 @@ #include "circuit_builder_base.hpp" namespace bb { -template CircuitBuilderBase::CircuitBuilderBase(size_t size_hint) +template +CircuitBuilderBase::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); @@ -286,6 +288,10 @@ template void CircuitBuilderBase::set_err(std::string msg) template void CircuitBuilderBase::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)); } diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp index c70c8d062e02..86dc5210ce12 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp @@ -359,7 +359,7 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase& public_inputs, size_t varnum, bool recursive = false) - : CircuitBuilderBase(size_hint) + : CircuitBuilderBase(size_hint, witness_values.empty()) { // TODO(https://github.com/AztecProtocol/barretenberg/issues/870): reserve space in blocks here somehow?