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 @@ -544,13 +544,14 @@ TEST_F(AcirComponentsCheckTest, DetectsSplitComponents)

TEST_F(AcirComponentsCheckTest, DetectsUnconstrainedWitnesses)
{
constexpr uint32_t unconstrained_witness = 9;
Acir::Circuit circuit = make_circuit({
Acir::Opcode{ .value = Acir::Opcode::AssertZero{
.value = Acir::Expression{
.linear_combinations =
{
{ bb::fr::one().to_buffer(), make_witness(8) },
{ bb::fr(-1).to_buffer(), make_witness(9) },
{ bb::fr(-1).to_buffer(), make_witness(unconstrained_witness) },
},
.q_c = bb::fr::zero().to_buffer(),
} } },
Expand All @@ -559,8 +560,22 @@ 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);
// Corrupt the circuit without invalidating the builder's variable-index vectors. Shrinking
// real_variable_index makes debug STL builds abort inside the static analyzer before the
// components checker can classify the witness.
for (auto& block : builder.blocks.get()) {
auto replace_witness = [&](auto& wire) {
for (size_t row = 0; row < wire.size(); ++row) {
if (wire[row] == unconstrained_witness) {
wire[row] = builder.zero_idx();
}
}
};
replace_witness(block.w_l());
replace_witness(block.w_r());
replace_witness(block.w_o());
replace_witness(block.w_4());
}

acir_components_check::ComponentsChecker checker(circuit, builder);
auto errors = checker.check();
Expand Down
7 changes: 5 additions & 2 deletions ci3/source_cache
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ function cache_persistent {

cat | gzip > "$tmpfile"

# Write to Redis (synchronous)
cat "$tmpfile" | redis_cli -x SETEX "$key" "$expire" &>/dev/null
# Write to Redis (synchronous) when available. The S3 upload below is the
# persistent fallback when the runner cannot reach Redis.
if [ "$CI_REDIS_AVAILABLE" -eq 1 ]; then
cat "$tmpfile" | redis_cli -x SETEX "$key" "$expire" &>/dev/null
fi

# Write to S3 in background
{
Expand Down
6 changes: 5 additions & 1 deletion ci3/source_redis
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ function redis_cli {
}

function redis_setexz {
gzip | redis_cli -x SETEX $1 $2 &>/dev/null
if [ "$CI_REDIS_AVAILABLE" -eq 1 ]; then
gzip | redis_cli -x SETEX "$1" "$2" &>/dev/null
else
cat >/dev/null
fi
}

function redis_getz {
Expand Down
Loading