diff --git a/barretenberg/cpp/src/barretenberg/acir_components_check/components_check.test.cpp b/barretenberg/cpp/src/barretenberg/acir_components_check/components_check.test.cpp index 40e7d8fa16e2..cbcd198a46f1 100644 --- a/barretenberg/cpp/src/barretenberg/acir_components_check/components_check.test.cpp +++ b/barretenberg/cpp/src/barretenberg/acir_components_check/components_check.test.cpp @@ -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(), } } }, @@ -559,8 +560,22 @@ TEST_F(AcirComponentsCheckTest, DetectsUnconstrainedWitnesses) auto constraints = circuit_serde_to_acir_format(circuit, IsMegaBuilder); AcirProgram program{ .constraints = constraints, .witness = {} }; auto builder = create_circuit(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(); diff --git a/ci3/source_cache b/ci3/source_cache index f9d88c651601..b2be34c9c985 100644 --- a/ci3/source_cache +++ b/ci3/source_cache @@ -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 { diff --git a/ci3/source_redis b/ci3/source_redis index 6bf9a3b94809..765515336f85 100644 --- a/ci3/source_redis +++ b/ci3/source_redis @@ -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 {