Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ template <typename Builder> void ComponentsChecker_<Builder>::build_circuit_comp
// Collect range_list variables
for (const auto& [_, range_list] : builder_.range_lists) {
for (auto var_idx : range_list.variable_indices) {
if (var_idx >= builder_.real_variable_index.size()) {
continue;
}
range_list_vars_.insert(builder_.real_variable_index[var_idx]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,9 @@ TEST_F(AcirComponentsCheckTest, DetectsUnconstrainedWitnesses)
auto constraints = circuit_serde_to_acir_format(circuit, IsMegaBuilder<AcirComponentsCheckBuilder>);
AcirProgram program{ .constraints = constraints, .witness = {} };
auto builder = create_circuit<AcirComponentsCheckBuilder>(program);
// Corrupt the circuit
builder.real_variable_index.resize(9);
// Remove the synthesized gate while leaving the builder's witness map internally valid.
builder.blocks.arithmetic.tiles.clear();
builder.blocks.arithmetic.num_rows_ = 0;

acir_components_check::ComponentsChecker checker(circuit, builder);
auto errors = checker.check();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ struct BbStackTrace : backward::StackTrace {
struct StackTraces {
std::vector<BbStackTrace> stack_traces;
void populate() { stack_traces.emplace_back(); }
void print(size_t gate_idx) const { backward::Printer{}.print(stack_traces.at(gate_idx)); }
void print(size_t gate_idx) const
{
if (gate_idx < stack_traces.size()) {
backward::Printer{}.print(stack_traces[gate_idx]);
}
}
// Don't interfere with equality semantics of structs that include this in debug builds
bool operator==(const StackTraces& other) const
{
Expand Down Expand Up @@ -397,13 +402,19 @@ template <typename FF, size_t NUM_WIRES_> class ExecutionTraceBlock {
, tiles(other.tiles)
, num_rows_(other.num_rows_)
{
#ifdef CHECK_CIRCUIT_STACKTRACES
stack_traces = other.stack_traces;
#endif
copy_gate_columns_from(other);
}
ExecutionTraceBlock& operator=(const ExecutionTraceBlock& other)
{
if (this == &other) {
return *this;
}
#ifdef CHECK_CIRCUIT_STACKTRACES
stack_traces = other.stack_traces;
#endif
cached_size_ = other.cached_size_;
data_freed_ = other.data_freed_;
trace_offset_ = other.trace_offset_;
Expand All @@ -419,13 +430,19 @@ template <typename FF, size_t NUM_WIRES_> class ExecutionTraceBlock {
, tiles(std::move(other.tiles))
, num_rows_(other.num_rows_)
{
#ifdef CHECK_CIRCUIT_STACKTRACES
stack_traces = std::move(other.stack_traces);
#endif
copy_gate_columns_from(other);
}
ExecutionTraceBlock& operator=(ExecutionTraceBlock&& other) noexcept
{
cached_size_ = other.cached_size_;
data_freed_ = other.data_freed_;
trace_offset_ = other.trace_offset_;
#ifdef CHECK_CIRCUIT_STACKTRACES
stack_traces = std::move(other.stack_traces);
#endif
tiles = std::move(other.tiles);
num_rows_ = other.num_rows_;
copy_gate_columns_from(other);
Expand Down
Loading