Skip to content

Commit

Permalink
chore: simplify marking black box function outputs as solvable (#4194)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

smol refactor I noticed.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** 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.
  • Loading branch information
TomAFrench authored Jan 29, 2024
1 parent ebdb24f commit 1fd3e6d
Showing 1 changed file with 2 additions and 44 deletions.
46 changes: 2 additions & 44 deletions acvm-repo/acvm/src/compiler/transformers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,50 +99,8 @@ pub(super) fn transform_internal(
}
}
Opcode::BlackBoxFuncCall(ref func) => {
match func {
acir::circuit::opcodes::BlackBoxFuncCall::AND { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::XOR { output, .. } => {
transformer.mark_solvable(*output);
}
acir::circuit::opcodes::BlackBoxFuncCall::RANGE { .. }
| acir::circuit::opcodes::BlackBoxFuncCall::RecursiveAggregation { .. } => (),
acir::circuit::opcodes::BlackBoxFuncCall::SHA256 { outputs, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::Keccak256 { outputs, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::Keccak256VariableLength {
outputs,
..
}
| acir::circuit::opcodes::BlackBoxFuncCall::Keccakf1600 { outputs, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::Blake2s { outputs, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::Blake3 { outputs, .. } => {
for witness in outputs {
transformer.mark_solvable(*witness);
}
}
acir::circuit::opcodes::BlackBoxFuncCall::FixedBaseScalarMul {
outputs,
..
}
| acir::circuit::opcodes::BlackBoxFuncCall::EmbeddedCurveAdd {
outputs, ..
}
| acir::circuit::opcodes::BlackBoxFuncCall::EmbeddedCurveDouble {
outputs,
..
}
| acir::circuit::opcodes::BlackBoxFuncCall::PedersenCommitment {
outputs,
..
} => {
transformer.mark_solvable(outputs.0);
transformer.mark_solvable(outputs.1);
}
acir::circuit::opcodes::BlackBoxFuncCall::EcdsaSecp256k1 { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::EcdsaSecp256r1 { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::SchnorrVerify { output, .. }
| acir::circuit::opcodes::BlackBoxFuncCall::PedersenHash { output, .. } => {
transformer.mark_solvable(*output);
}
for witness in func.get_outputs_vec() {
transformer.mark_solvable(witness);
}

new_acir_opcode_positions.push(acir_opcode_positions[index]);
Expand Down

0 comments on commit 1fd3e6d

Please sign in to comment.