Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

feat!: added hash index to pedersen #281

Merged
merged 5 commits into from
May 30, 2023
Merged
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
13 changes: 11 additions & 2 deletions acir/src/circuit/opcodes/black_box_function_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub enum BlackBoxFuncCall {
},
Pedersen {
inputs: Vec<FunctionInput>,
domain_separator: u32,
outputs: Vec<Witness>,
},
// 128 here specifies that this function
Expand Down Expand Up @@ -106,7 +107,7 @@ impl BlackBoxFuncCall {
output: Witness(0),
},
BlackBoxFunc::Pedersen => {
BlackBoxFuncCall::Pedersen { inputs: vec![], outputs: vec![] }
BlackBoxFuncCall::Pedersen { inputs: vec![], domain_separator: 0, outputs: vec![] }
}
BlackBoxFunc::HashToField128Security => {
BlackBoxFuncCall::HashToField128Security { inputs: vec![], output: Witness(0) }
Expand Down Expand Up @@ -298,7 +299,15 @@ impl std::fmt::Display for BlackBoxFuncCall {

write!(f, "{outputs_str}")?;

write!(f, "]")
write!(f, "]")?;

// SPECIFIC PARAMETERS
match self {
BlackBoxFuncCall::Pedersen { domain_separator, .. } => {
write!(f, " domain_separator: {domain_separator}")
}
_ => write!(f, ""),
}
}
}

Expand Down
1 change: 1 addition & 0 deletions acvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub trait PartialWitnessGenerator {
&self,
initial_witness: &mut WitnessMap,
inputs: &[FunctionInput],
domain_separator: u32,
outputs: &[Witness],
) -> Result<OpcodeResolution, OpcodeResolutionError>;
fn fixed_base_scalar_mul(
Expand Down
1 change: 1 addition & 0 deletions acvm/src/pwg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ mod test {
&self,
_initial_witness: &mut WitnessMap,
_inputs: &[FunctionInput],
_domain_separator: u32,
_outputs: &[Witness],
) -> Result<OpcodeResolution, OpcodeResolutionError> {
panic!("Path not trodden by this test")
Expand Down
4 changes: 2 additions & 2 deletions acvm/src/pwg/blackbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub(crate) fn solve(
message,
output,
),
BlackBoxFuncCall::Pedersen { inputs, outputs } => {
backend.pedersen(initial_witness, inputs, outputs)
BlackBoxFuncCall::Pedersen { inputs, domain_separator, outputs } => {
backend.pedersen(initial_witness, inputs, *domain_separator, outputs)
}
BlackBoxFuncCall::HashToField128Security { inputs, output } => {
hash_to_field_128_security(initial_witness, inputs, output)
Expand Down