forked from noir-lang/noir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/4824-multiple-acir-calls
- Loading branch information
Showing
234 changed files
with
5,436 additions
and
2,152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12af650f0d27c37dca06bb329bf76a5574534d78 | ||
ed815a3713fc311056a8bd0a616945f12d9be2a8 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use acir::{ | ||
circuit::opcodes::FunctionInput, | ||
native_types::{Witness, WitnessMap}, | ||
AcirField, | ||
}; | ||
|
||
use crate::{ | ||
pwg::{insert_value, witness_to_value, OpcodeResolutionError}, | ||
BlackBoxFunctionSolver, | ||
}; | ||
|
||
pub(super) fn pedersen<F: AcirField>( | ||
backend: &impl BlackBoxFunctionSolver<F>, | ||
initial_witness: &mut WitnessMap<F>, | ||
inputs: &[FunctionInput], | ||
domain_separator: u32, | ||
outputs: (Witness, Witness), | ||
) -> Result<(), OpcodeResolutionError<F>> { | ||
let scalars: Result<Vec<_>, _> = | ||
inputs.iter().map(|input| witness_to_value(initial_witness, input.witness)).collect(); | ||
let scalars: Vec<_> = scalars?.into_iter().cloned().collect(); | ||
|
||
let (res_x, res_y) = backend.pedersen_commitment(&scalars, domain_separator)?; | ||
|
||
insert_value(&outputs.0, res_x, initial_witness)?; | ||
insert_value(&outputs.1, res_y, initial_witness)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub(super) fn pedersen_hash<F: AcirField>( | ||
backend: &impl BlackBoxFunctionSolver<F>, | ||
initial_witness: &mut WitnessMap<F>, | ||
inputs: &[FunctionInput], | ||
domain_separator: u32, | ||
output: Witness, | ||
) -> Result<(), OpcodeResolutionError<F>> { | ||
let scalars: Result<Vec<_>, _> = | ||
inputs.iter().map(|input| witness_to_value(initial_witness, input.witness)).collect(); | ||
let scalars: Vec<_> = scalars?.into_iter().cloned().collect(); | ||
|
||
let res = backend.pedersen_hash(&scalars, domain_separator)?; | ||
|
||
insert_value(&output, res, initial_witness)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.