Skip to content

Commit a793d83

Browse files
authored
Merge 902aa3d into 163c3a6
2 parents 163c3a6 + 902aa3d commit a793d83

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,14 @@ bool AvmCircuitBuilder::check_circuit() const
742742

743743
std::string errors;
744744
std::mutex m;
745+
const bool verbose_errors = std::getenv("AVM_VERBOSE_ERRORS") != nullptr;
745746
auto signal_error = [&](const std::string& error) {
746747
std::lock_guard<std::mutex> lock(m);
747-
errors += error + "\n";
748+
if (verbose_errors) {
749+
errors += error + "\n";
750+
} else if (errors.empty()) {
751+
errors = "Circuit check failed. Use AVM_VERBOSE_ERRORS=1 to see more details.";
752+
}
748753
};
749754
bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); });
750755
if (!errors.empty()) {

barretenberg/cpp/src/barretenberg/vm/avm/tests/helpers.test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void validate_trace(std::vector<Row>&& trace,
4141
bool with_proof,
4242
bool expect_proof_failure)
4343
{
44+
setenv("AVM_VERBOSE_ERRORS", "1", 1);
4445
auto circuit_builder = AvmCircuitBuilder();
4546
circuit_builder.set_trace(std::move(trace));
4647
EXPECT_TRUE(circuit_builder.check_circuit());

bb-pilcom/bb-pil-backend/templates/circuit_builder.cpp.hbs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,14 @@ bool {{name}}CircuitBuilder::check_circuit() const {
106106

107107
std::string errors;
108108
std::mutex m;
109+
const bool verbose_errors = std::getenv("AVM_VERBOSE_ERRORS") != nullptr;
109110
auto signal_error = [&](const std::string& error) {
110111
std::lock_guard<std::mutex> lock(m);
111-
errors += error + "\n";
112+
if (verbose_errors) {
113+
errors += error + "\n";
114+
} else if (errors.empty()) {
115+
errors = "Circuit check failed. Use AVM_VERBOSE_ERRORS=1 to see more details.";
116+
}
112117
};
113118
bb::parallel_for(checks.size(), [&](size_t i) { checks[i](signal_error); });
114119
if (!errors.empty()) {

0 commit comments

Comments
 (0)