Skip to content

Commit d995e06

Browse files
authored
chore: enable constant inputs for more blackbox (#5647)
# Description ## Problem\* We create witness for blackbox inputs, even when the value is constant, which generates un-optimal circuit. ## Summary\* Some blackbox can now support constant inputs (cf. PR AztecProtocol/aztec-packages#7613) so we enable the use of constant inputs for them. ## Additional Context ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
1 parent eba5312 commit d995e06

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,8 +1428,20 @@ impl<F: AcirField> AcirContext<F> {
14281428
}
14291429
_ => (vec![], vec![]),
14301430
};
1431-
// Allow constant inputs only for MSM for now
1432-
let allow_constant_inputs = name.eq(&BlackBoxFunc::MultiScalarMul);
1431+
// Allow constant inputs for most blackbox
1432+
// EmbeddedCurveAdd needs to be fixed first in bb
1433+
// Poseidon2Permutation requires witness input
1434+
let allow_constant_inputs = matches!(
1435+
name,
1436+
BlackBoxFunc::MultiScalarMul
1437+
| BlackBoxFunc::Keccakf1600
1438+
| BlackBoxFunc::Sha256Compression
1439+
| BlackBoxFunc::Blake2s
1440+
| BlackBoxFunc::Blake3
1441+
| BlackBoxFunc::AND
1442+
| BlackBoxFunc::XOR
1443+
| BlackBoxFunc::AES128Encrypt
1444+
);
14331445
// Convert `AcirVar` to `FunctionInput`
14341446
let inputs = self.prepare_inputs_for_black_box_func_call(inputs, allow_constant_inputs)?;
14351447
// Call Black box with `FunctionInput`

0 commit comments

Comments
 (0)