Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync from aztec-packages #6151

Merged
merged 9 commits into from
Sep 25, 2024
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
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bcec12dbf79b658406dc21083f8fdeef8962085e
b0d1bab1f02819e7efbe0db73c3c805b5927b66a
2 changes: 1 addition & 1 deletion .github/scripts/playwright-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -eu

npx playwright install && npx playwright install-deps
npx -y playwright@1.42 install --with-deps
106 changes: 3 additions & 103 deletions acvm-repo/acir/codegen/acir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,6 @@ namespace Program {
static AES128Encrypt bincodeDeserialize(std::vector<uint8_t>);
};

struct Sha256 {
Program::HeapVector message;
Program::HeapArray output;

friend bool operator==(const Sha256&, const Sha256&);
std::vector<uint8_t> bincodeSerialize() const;
static Sha256 bincodeDeserialize(std::vector<uint8_t>);
};

struct Blake2s {
Program::HeapVector message;
Program::HeapArray output;
Expand Down Expand Up @@ -462,7 +453,7 @@ namespace Program {

struct ToRadix {
Program::MemoryAddress input;
uint32_t radix;
Program::MemoryAddress radix;
Program::HeapArray output;
bool output_bits;

Expand All @@ -471,7 +462,7 @@ namespace Program {
static ToRadix bincodeDeserialize(std::vector<uint8_t>);
};

std::variant<AES128Encrypt, Sha256, Blake2s, Blake3, Keccak256, Keccakf1600, EcdsaSecp256k1, EcdsaSecp256r1, SchnorrVerify, PedersenCommitment, PedersenHash, MultiScalarMul, EmbeddedCurveAdd, BigIntAdd, BigIntSub, BigIntMul, BigIntDiv, BigIntFromLeBytes, BigIntToLeBytes, Poseidon2Permutation, Sha256Compression, ToRadix> value;
std::variant<AES128Encrypt, Blake2s, Blake3, Keccak256, Keccakf1600, EcdsaSecp256k1, EcdsaSecp256r1, SchnorrVerify, PedersenCommitment, PedersenHash, MultiScalarMul, EmbeddedCurveAdd, BigIntAdd, BigIntSub, BigIntMul, BigIntDiv, BigIntFromLeBytes, BigIntToLeBytes, Poseidon2Permutation, Sha256Compression, ToRadix> value;

friend bool operator==(const BlackBoxOp&, const BlackBoxOp&);
std::vector<uint8_t> bincodeSerialize() const;
Expand Down Expand Up @@ -827,15 +818,6 @@ namespace Program {
static RANGE bincodeDeserialize(std::vector<uint8_t>);
};

struct SHA256 {
std::vector<Program::FunctionInput> inputs;
std::array<Program::Witness, 32> outputs;

friend bool operator==(const SHA256&, const SHA256&);
std::vector<uint8_t> bincodeSerialize() const;
static SHA256 bincodeDeserialize(std::vector<uint8_t>);
};

struct Blake2s {
std::vector<Program::FunctionInput> inputs;
std::array<Program::Witness, 32> outputs;
Expand Down Expand Up @@ -1040,7 +1022,7 @@ namespace Program {
static Sha256Compression bincodeDeserialize(std::vector<uint8_t>);
};

std::variant<AES128Encrypt, AND, XOR, RANGE, SHA256, Blake2s, Blake3, SchnorrVerify, PedersenCommitment, PedersenHash, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Keccak256, Keccakf1600, RecursiveAggregation, BigIntAdd, BigIntSub, BigIntMul, BigIntDiv, BigIntFromLeBytes, BigIntToLeBytes, Poseidon2Permutation, Sha256Compression> value;
std::variant<AES128Encrypt, AND, XOR, RANGE, Blake2s, Blake3, SchnorrVerify, PedersenCommitment, PedersenHash, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Keccak256, Keccakf1600, RecursiveAggregation, BigIntAdd, BigIntSub, BigIntMul, BigIntDiv, BigIntFromLeBytes, BigIntToLeBytes, Poseidon2Permutation, Sha256Compression> value;

friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&);
std::vector<uint8_t> bincodeSerialize() const;
Expand Down Expand Up @@ -2630,47 +2612,6 @@ Program::BlackBoxFuncCall::RANGE serde::Deserializable<Program::BlackBoxFuncCall
return obj;
}

namespace Program {

inline bool operator==(const BlackBoxFuncCall::SHA256 &lhs, const BlackBoxFuncCall::SHA256 &rhs) {
if (!(lhs.inputs == rhs.inputs)) { return false; }
if (!(lhs.outputs == rhs.outputs)) { return false; }
return true;
}

inline std::vector<uint8_t> BlackBoxFuncCall::SHA256::bincodeSerialize() const {
auto serializer = serde::BincodeSerializer();
serde::Serializable<BlackBoxFuncCall::SHA256>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline BlackBoxFuncCall::SHA256 BlackBoxFuncCall::SHA256::bincodeDeserialize(std::vector<uint8_t> input) {
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<BlackBoxFuncCall::SHA256>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw serde::deserialization_error("Some input bytes were not read");
}
return value;
}

} // end of namespace Program

template <>
template <typename Serializer>
void serde::Serializable<Program::BlackBoxFuncCall::SHA256>::serialize(const Program::BlackBoxFuncCall::SHA256 &obj, Serializer &serializer) {
serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
}

template <>
template <typename Deserializer>
Program::BlackBoxFuncCall::SHA256 serde::Deserializable<Program::BlackBoxFuncCall::SHA256>::deserialize(Deserializer &deserializer) {
Program::BlackBoxFuncCall::SHA256 obj;
obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
return obj;
}

namespace Program {

inline bool operator==(const BlackBoxFuncCall::Blake2s &lhs, const BlackBoxFuncCall::Blake2s &rhs) {
Expand Down Expand Up @@ -3652,47 +3593,6 @@ Program::BlackBoxOp::AES128Encrypt serde::Deserializable<Program::BlackBoxOp::AE
return obj;
}

namespace Program {

inline bool operator==(const BlackBoxOp::Sha256 &lhs, const BlackBoxOp::Sha256 &rhs) {
if (!(lhs.message == rhs.message)) { return false; }
if (!(lhs.output == rhs.output)) { return false; }
return true;
}

inline std::vector<uint8_t> BlackBoxOp::Sha256::bincodeSerialize() const {
auto serializer = serde::BincodeSerializer();
serde::Serializable<BlackBoxOp::Sha256>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline BlackBoxOp::Sha256 BlackBoxOp::Sha256::bincodeDeserialize(std::vector<uint8_t> input) {
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<BlackBoxOp::Sha256>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw serde::deserialization_error("Some input bytes were not read");
}
return value;
}

} // end of namespace Program

template <>
template <typename Serializer>
void serde::Serializable<Program::BlackBoxOp::Sha256>::serialize(const Program::BlackBoxOp::Sha256 &obj, Serializer &serializer) {
serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
}

template <>
template <typename Deserializer>
Program::BlackBoxOp::Sha256 serde::Deserializable<Program::BlackBoxOp::Sha256>::deserialize(Deserializer &deserializer) {
Program::BlackBoxOp::Sha256 obj;
obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
return obj;
}

namespace Program {

inline bool operator==(const BlackBoxOp::Blake2s &lhs, const BlackBoxOp::Blake2s &rhs) {
Expand Down
8 changes: 0 additions & 8 deletions acvm-repo/acir/src/circuit/black_box_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#[cfg_attr(test, derive(EnumIter))]
pub enum BlackBoxFunc {
/// Ciphers (encrypts) the provided plaintext using AES128 in CBC mode,
/// padding the input using PKCS#7.

Check warning on line 15 in acvm-repo/acir/src/circuit/black_box_functions.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (PKCS)
/// - inputs: byte array `[u8; N]`
/// - iv: initialization vector `[u8; 16]`
/// - key: user key `[u8; 16]`
Expand Down Expand Up @@ -40,12 +40,6 @@
/// - input: (witness, bit_size)
RANGE,

/// Computes SHA256 of the inputs
/// - inputs are a byte array, i.e a vector of (witness, 8)
/// - output is a byte array of len 32, i.e an array of 32 (witness, 8),
/// constrained to be the sha256 of the inputs.
SHA256,

/// Computes the Blake2s hash of the inputs, as specified in
/// https://tools.ietf.org/html/rfc7693
/// - inputs are a byte array, i.e a vector of (witness, 8)
Expand Down Expand Up @@ -213,7 +207,6 @@
pub fn name(&self) -> &'static str {
match self {
BlackBoxFunc::AES128Encrypt => "aes128_encrypt",
BlackBoxFunc::SHA256 => "sha256",
BlackBoxFunc::SchnorrVerify => "schnorr_verify",
BlackBoxFunc::Blake2s => "blake2s",
BlackBoxFunc::Blake3 => "blake3",
Expand Down Expand Up @@ -243,7 +236,6 @@
pub fn lookup(op_name: &str) -> Option<BlackBoxFunc> {
match op_name {
"aes128_encrypt" => Some(BlackBoxFunc::AES128Encrypt),
"sha256" => Some(BlackBoxFunc::SHA256),
"schnorr_verify" => Some(BlackBoxFunc::SchnorrVerify),
"blake2s" => Some(BlackBoxFunc::Blake2s),
"blake3" => Some(BlackBoxFunc::Blake3),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ pub enum BlackBoxFuncCall<F> {
RANGE {
input: FunctionInput<F>,
},
SHA256 {
inputs: Vec<FunctionInput<F>>,
outputs: Box<[Witness; 32]>,
},
Blake2s {
inputs: Vec<FunctionInput<F>>,
outputs: Box<[Witness; 32]>,
Expand Down Expand Up @@ -251,7 +247,6 @@ impl<F: Copy> BlackBoxFuncCall<F> {
BlackBoxFuncCall::AND { .. } => BlackBoxFunc::AND,
BlackBoxFuncCall::XOR { .. } => BlackBoxFunc::XOR,
BlackBoxFuncCall::RANGE { .. } => BlackBoxFunc::RANGE,
BlackBoxFuncCall::SHA256 { .. } => BlackBoxFunc::SHA256,
BlackBoxFuncCall::Blake2s { .. } => BlackBoxFunc::Blake2s,
BlackBoxFuncCall::Blake3 { .. } => BlackBoxFunc::Blake3,
BlackBoxFuncCall::SchnorrVerify { .. } => BlackBoxFunc::SchnorrVerify,
Expand Down Expand Up @@ -282,7 +277,6 @@ impl<F: Copy> BlackBoxFuncCall<F> {
pub fn get_inputs_vec(&self) -> Vec<FunctionInput<F>> {
match self {
BlackBoxFuncCall::AES128Encrypt { inputs, .. }
| BlackBoxFuncCall::SHA256 { inputs, .. }
| BlackBoxFuncCall::Blake2s { inputs, .. }
| BlackBoxFuncCall::Blake3 { inputs, .. }
| BlackBoxFuncCall::BigIntFromLeBytes { inputs, .. }
Expand Down Expand Up @@ -391,8 +385,7 @@ impl<F: Copy> BlackBoxFuncCall<F> {

pub fn get_outputs_vec(&self) -> Vec<Witness> {
match self {
BlackBoxFuncCall::SHA256 { outputs, .. }
| BlackBoxFuncCall::Blake2s { outputs, .. }
BlackBoxFuncCall::Blake2s { outputs, .. }
| BlackBoxFuncCall::Blake3 { outputs, .. }
| BlackBoxFuncCall::Keccak256 { outputs, .. } => outputs.to_vec(),

Expand Down
44 changes: 22 additions & 22 deletions acvm-repo/acir/tests/test_program_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ fn multi_scalar_mul_circuit() {
let bytes = Program::serialize_program(&program);

let expected_serialization: Vec<u8> = vec![
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 8, 67, 43, 181, 15, 116, 255,
227, 70, 74, 11, 86, 194, 195, 169, 83, 115, 58, 49, 156, 12, 29, 121, 58, 66, 117, 176,
144, 11, 105, 161, 222, 245, 42, 205, 13, 186, 58, 205, 233, 240, 25, 249, 11, 238, 40,
245, 19, 253, 255, 119, 159, 216, 103, 157, 249, 169, 193, 0, 0, 0,
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 8, 67, 43, 181, 15, 221, 255,
186, 145, 210, 130, 149, 240, 112, 234, 212, 156, 78, 12, 39, 67, 71, 158, 142, 80, 29, 44,
228, 66, 90, 168, 119, 189, 74, 115, 131, 174, 78, 115, 58, 124, 70, 254, 130, 59, 74, 253,
68, 255, 255, 221, 39, 54, 29, 134, 27, 102, 193, 0, 0, 0,
];

assert_eq!(bytes, expected_serialization)
Expand Down Expand Up @@ -134,24 +134,24 @@ fn schnorr_verify_circuit() {
let bytes = Program::serialize_program(&program);

let expected_serialization: Vec<u8> = vec![
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 85, 211, 103, 78, 2, 81, 24, 70, 225, 193, 6, 216, 123,
47, 216, 123, 239, 136, 136, 136, 136, 136, 187, 96, 255, 75, 32, 112, 194, 55, 201, 129,
100, 50, 79, 244, 7, 228, 222, 243, 102, 146, 254, 167, 221, 123, 50, 97, 222, 217, 120,
243, 116, 226, 61, 36, 15, 247, 158, 92, 120, 68, 30, 149, 199, 228, 172, 156, 147, 243,
242, 184, 60, 33, 79, 202, 83, 242, 180, 60, 35, 207, 202, 115, 242, 188, 188, 32, 47, 202,
75, 242, 178, 188, 34, 175, 202, 107, 242, 186, 188, 33, 111, 202, 91, 242, 182, 188, 35,
23, 228, 93, 121, 79, 222, 151, 15, 228, 67, 249, 72, 62, 150, 79, 228, 83, 249, 76, 62,
151, 47, 228, 75, 249, 74, 190, 150, 111, 228, 91, 249, 78, 190, 151, 31, 228, 71, 249, 73,
126, 150, 95, 228, 87, 185, 40, 191, 201, 37, 249, 93, 46, 203, 31, 114, 69, 254, 148, 171,
97, 58, 77, 226, 111, 95, 250, 127, 77, 254, 150, 235, 242, 143, 220, 144, 127, 229, 166,
252, 39, 183, 194, 255, 241, 253, 45, 253, 14, 182, 201, 38, 217, 34, 27, 100, 123, 233,
230, 242, 241, 155, 217, 20, 91, 98, 67, 108, 135, 205, 176, 21, 54, 194, 54, 216, 4, 91,
96, 3, 180, 79, 243, 180, 78, 227, 180, 77, 211, 180, 76, 195, 180, 75, 179, 133, 164, 223,
40, 109, 210, 36, 45, 210, 32, 237, 209, 28, 173, 209, 24, 109, 209, 20, 45, 209, 16, 237,
208, 12, 173, 208, 8, 109, 208, 4, 45, 208, 0, 119, 207, 157, 115, 215, 220, 113, 49, 238,
180, 20, 119, 88, 142, 59, 171, 196, 29, 85, 227, 46, 106, 113, 246, 245, 56, 235, 70, 156,
109, 51, 206, 50, 61, 179, 244, 220, 18, 157, 231, 192, 167, 11, 75, 28, 99, 152, 25, 5, 0,
0,
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 85, 211, 103, 78, 2, 81, 24, 70, 225, 193, 130, 96, 239,
189, 96, 239, 189, 35, 34, 34, 34, 34, 238, 130, 253, 47, 129, 192, 9, 223, 36, 7, 146,
201, 60, 209, 31, 144, 123, 207, 155, 73, 250, 159, 118, 239, 201, 132, 121, 103, 227, 205,
211, 137, 247, 144, 60, 220, 123, 114, 225, 17, 121, 84, 206, 202, 99, 114, 78, 206, 203,
227, 242, 132, 60, 41, 79, 201, 211, 242, 140, 60, 43, 207, 201, 243, 242, 130, 188, 40,
47, 201, 203, 242, 138, 188, 42, 175, 201, 235, 242, 134, 188, 41, 111, 201, 219, 242, 142,
92, 144, 119, 229, 61, 121, 95, 62, 144, 15, 229, 35, 249, 88, 62, 145, 79, 229, 51, 249,
92, 190, 144, 47, 229, 43, 249, 90, 190, 145, 111, 229, 59, 249, 94, 126, 144, 31, 229, 39,
249, 89, 126, 145, 95, 229, 162, 252, 38, 151, 228, 119, 185, 44, 127, 200, 21, 249, 83,
174, 134, 233, 52, 137, 191, 125, 233, 255, 53, 249, 91, 174, 203, 63, 114, 67, 254, 149,
155, 242, 159, 220, 10, 255, 199, 247, 183, 244, 59, 216, 38, 155, 100, 139, 108, 144, 237,
165, 155, 203, 199, 111, 102, 83, 108, 137, 13, 177, 29, 54, 195, 86, 216, 8, 219, 96, 19,
108, 129, 13, 208, 62, 205, 211, 58, 141, 211, 54, 77, 211, 50, 13, 211, 46, 205, 22, 146,
126, 163, 180, 73, 147, 180, 72, 131, 180, 71, 115, 180, 70, 99, 180, 69, 83, 180, 68, 67,
180, 67, 51, 180, 66, 35, 180, 65, 19, 180, 64, 3, 220, 61, 119, 206, 93, 115, 199, 197,
184, 211, 82, 220, 97, 57, 238, 172, 18, 119, 84, 141, 187, 168, 197, 217, 215, 227, 172,
27, 113, 182, 205, 56, 203, 244, 204, 210, 115, 75, 116, 158, 3, 159, 46, 43, 32, 188, 53,
25, 5, 0, 0,
];

assert_eq!(bytes, expected_serialization)
Expand Down
4 changes: 2 additions & 2 deletions acvm-repo/acvm/src/pwg/blackbox/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use acir::{
native_types::{Witness, WitnessMap},
AcirField,
};
use acvm_blackbox_solver::{sha256compression, BlackBoxFunctionSolver, BlackBoxResolutionError};
use acvm_blackbox_solver::{sha256_compression, BlackBoxFunctionSolver, BlackBoxResolutionError};

use crate::pwg::{input_to_value, insert_value};
use crate::OpcodeResolutionError;
Expand Down Expand Up @@ -94,7 +94,7 @@ pub(crate) fn solve_sha_256_permutation_opcode<F: AcirField>(
let message = to_u32_array(initial_witness, inputs)?;
let mut state = to_u32_array(initial_witness, hash_values)?;

sha256compression(&mut state, &message);
sha256_compression(&mut state, &message);

for (output_witness, value) in outputs.iter().zip(state.into_iter()) {
insert_value(output_witness, F::from(value as u128), initial_witness)?;
Expand Down
5 changes: 1 addition & 4 deletions acvm-repo/acvm/src/pwg/blackbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
native_types::{Witness, WitnessMap},
AcirField,
};
use acvm_blackbox_solver::{blake2s, blake3, keccak256, keccakf1600, sha256};
use acvm_blackbox_solver::{blake2s, blake3, keccak256, keccakf1600};

use self::{
aes128::solve_aes128_encryption_opcode, bigint::AcvmBigIntSolver,
Expand All @@ -30,7 +30,7 @@
use pedersen::{pedersen, pedersen_hash};
pub(crate) use range::solve_range_opcode;
use signature::{
ecdsa::{secp256k1_prehashed, secp256r1_prehashed},

Check warning on line 33 in acvm-repo/acvm/src/pwg/blackbox/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (prehashed)

Check warning on line 33 in acvm-repo/acvm/src/pwg/blackbox/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (prehashed)
schnorr::schnorr_verify,
};

Expand Down Expand Up @@ -84,9 +84,6 @@
BlackBoxFuncCall::AND { lhs, rhs, output } => and(initial_witness, lhs, rhs, output),
BlackBoxFuncCall::XOR { lhs, rhs, output } => xor(initial_witness, lhs, rhs, output),
BlackBoxFuncCall::RANGE { input } => solve_range_opcode(initial_witness, input),
BlackBoxFuncCall::SHA256 { inputs, outputs } => {
solve_generic_256_hash_opcode(initial_witness, inputs, None, outputs, sha256)
}
BlackBoxFuncCall::Blake2s { inputs, outputs } => {
solve_generic_256_hash_opcode(initial_witness, inputs, None, outputs, blake2s)
}
Expand Down Expand Up @@ -145,7 +142,7 @@
signature,
hashed_message: message,
output,
} => secp256k1_prehashed(

Check warning on line 145 in acvm-repo/acvm/src/pwg/blackbox/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (prehashed)
initial_witness,
public_key_x,
public_key_y,
Expand All @@ -159,7 +156,7 @@
signature,
hashed_message: message,
output,
} => secp256r1_prehashed(

Check warning on line 159 in acvm-repo/acvm/src/pwg/blackbox/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (prehashed)
initial_witness,
public_key_x,
public_key_y,
Expand Down
31 changes: 0 additions & 31 deletions acvm-repo/acvm/tests/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,18 +1075,6 @@
Ok(witness_map[&Witness(3)])
}

// N inputs
// 32 outputs
fn sha256_op(
function_inputs_and_outputs: (Vec<FunctionInput<FieldElement>>, Vec<Witness>),
) -> Result<BlackBoxFuncCall<FieldElement>, OpcodeResolutionError<FieldElement>> {
let (function_inputs, outputs) = function_inputs_and_outputs;
Ok(BlackBoxFuncCall::SHA256 {
inputs: function_inputs,
outputs: outputs.try_into().expect("SHA256 returns 32 outputs"),
})
}

// N inputs
// 32 outputs
fn blake2s_op(
Expand Down Expand Up @@ -1377,9 +1365,9 @@
let message = format!("not injective:\n{:?}\n{:?}", &inputs, &distinct_inputs);
let outputs_not_equal =
solve_array_input_blackbox_call(inputs, num_outputs, num_bits, op.clone())
.expect("injectivity test operations to have valid input")

Check warning on line 1368 in acvm-repo/acvm/tests/solver.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (injectivity)
!= solve_array_input_blackbox_call(distinct_inputs, num_outputs, num_bits, op)
.expect("injectivity test operations to have valid input");

Check warning on line 1370 in acvm-repo/acvm/tests/solver.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (injectivity)
(equal_inputs || outputs_not_equal, message)
}

Expand Down Expand Up @@ -1457,19 +1445,6 @@
assert_eq!(results, expected_results);
}

#[test]
fn sha256_zeros() {
let results = solve_array_input_blackbox_call(vec![], 32, None, sha256_op);
let expected_results: Vec<_> = vec![
227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65,
228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85,
]
.into_iter()
.map(|x: u128| FieldElement::from(x))
.collect();
assert_eq!(results, Ok(expected_results));
}

#[test]
fn sha256_compression_zeros() {
let results = solve_array_input_blackbox_call(
Expand Down Expand Up @@ -1643,12 +1618,6 @@
prop_assert_eq!(result, expected_result)
}

#[test]
fn sha256_injective(inputs_distinct_inputs in any_distinct_inputs(None, 0, 32)) {
let (inputs, distinct_inputs) = inputs_distinct_inputs;
let (result, message) = prop_assert_injective(inputs, distinct_inputs, 32, None, sha256_op);
prop_assert!(result, "{}", message);
}

#[test]
fn sha256_compression_injective(inputs_distinct_inputs in any_distinct_inputs(None, 24, 24)) {
Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acvm_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@esm-bundle/chai": "^4.3.4-fix.0",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.18.1",
"@web/test-runner-playwright": "^0.10.0",
"@web/test-runner-playwright": "^0.11.0",
"chai": "^4.4.1",
"eslint": "^8.57.0",
"eslint-plugin-prettier": "^5.1.3",
Expand Down
Loading
Loading