Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
chore: update commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Apr 26, 2023
1 parent 5b950a1 commit 40d0bda
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 16 additions & 15 deletions acvm_backend_barretenberg/src/acvm_interop/pwg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,22 @@ impl PartialWitnessGenerator for Barretenberg {
func_call: &BlackBoxFuncCall,
) -> Result<OpcodeResolution, OpcodeResolutionError> {
match func_call.name {
BlackBoxFunc::SHA256 => {
hash::sha256(initial_witness, func_call)?;
}
BlackBoxFunc::Blake2s => {
hash::blake2s(initial_witness, func_call)?;
}
BlackBoxFunc::SHA256 => hash::sha256(initial_witness, func_call),
BlackBoxFunc::Blake2s => hash::blake2s(initial_witness, func_call),
BlackBoxFunc::EcdsaSecp256k1 => {
signature::ecdsa::secp256k1_prehashed(initial_witness, func_call)?
signature::ecdsa::secp256k1_prehashed(initial_witness, func_call)
}

BlackBoxFunc::AND | BlackBoxFunc::XOR => {
logic::solve_logic_opcode(initial_witness, func_call)?
logic::solve_logic_opcode(initial_witness, func_call)
}
BlackBoxFunc::RANGE => range::solve_range_opcode(initial_witness, func_call)?,
BlackBoxFunc::AES | BlackBoxFunc::Keccak256 => {
return Err(OpcodeResolutionError::UnsupportedBlackBoxFunc(
func_call.name,
))
BlackBoxFunc::RANGE => {
range::solve_range_opcode(initial_witness, func_call)?;
Ok(OpcodeResolution::Solved)
}
BlackBoxFunc::AES | BlackBoxFunc::Keccak256 => Err(
OpcodeResolutionError::UnsupportedBlackBoxFunc(func_call.name),
),
BlackBoxFunc::ComputeMerkleRoot => {
let mut inputs_iter = func_call.inputs.iter();

Expand All @@ -61,6 +59,7 @@ impl PartialWitnessGenerator for Barretenberg {
);

initial_witness.insert(func_call.outputs[0], computed_merkle_root);
Ok(OpcodeResolution::Solved)
}
BlackBoxFunc::SchnorrVerify => {
// In barretenberg, if the signature fails, then the whole thing fails.
Expand Down Expand Up @@ -115,6 +114,7 @@ impl PartialWitnessGenerator for Barretenberg {
};

initial_witness.insert(func_call.outputs[0], result);
Ok(OpcodeResolution::Solved)
}
BlackBoxFunc::Pedersen => {
let inputs_iter = func_call.inputs.iter();
Expand All @@ -127,6 +127,7 @@ impl PartialWitnessGenerator for Barretenberg {
let (res_x, res_y) = self.encrypt(scalars);
initial_witness.insert(func_call.outputs[0], res_x);
initial_witness.insert(func_call.outputs[1], res_y);
Ok(OpcodeResolution::Solved)
}
BlackBoxFunc::HashToField128Security => {
let mut hasher = <Blake2s as blake2::Digest>::new();
Expand All @@ -148,6 +149,7 @@ impl PartialWitnessGenerator for Barretenberg {
assert_eq!(func_call.outputs.len(), 1);

initial_witness.insert(func_call.outputs[0], reduced_res);
Ok(OpcodeResolution::Solved)
}
BlackBoxFunc::FixedBaseScalarMul => {
let scalar = witness_to_value(initial_witness, func_call.inputs[0].witness)?;
Expand All @@ -156,9 +158,8 @@ impl PartialWitnessGenerator for Barretenberg {

initial_witness.insert(func_call.outputs[0], pub_x);
initial_witness.insert(func_call.outputs[1], pub_y);
Ok(OpcodeResolution::Solved)
}
}

Ok(OpcodeResolution::Solved)
}
}
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ publish = false

[dependencies]
#acvm = { version = "0.9.0", features = ["bn254"] }
acvm = { git = "https://github.com/noir-lang/acvm", rev = "82eee6ab08ae480f04904ca8571fd88f4466c000", features = ["bn254"] }
acvm = { git = "https://github.com/noir-lang/acvm", rev = "e8e93fda0db18f0d266dd1aacbb53ec787992dc9", features = ["bn254"] }

0 comments on commit 40d0bda

Please sign in to comment.