mirror of https://github.com/zcash/halo2.git
poseidon: Add circuit test case that fails
This exposes a bug in the way padding was being handled by the invalid sponge-duplex hybrid construction.
This commit is contained in:
parent
bfc65d5985
commit
fdeb2fb817
|
@ -823,6 +823,22 @@ mod tests {
|
||||||
assert_eq!(prover.verify(), Ok(()))
|
assert_eq!(prover.verify(), Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn poseidon_hash_longer_input() {
|
||||||
|
let message = [Fp::rand(), Fp::rand(), Fp::rand()];
|
||||||
|
let output =
|
||||||
|
poseidon::Hash::<_, OrchardNullifier, ConstantLength<3>, 3, 2>::init().hash(message);
|
||||||
|
|
||||||
|
let k = 7;
|
||||||
|
let circuit = HashCircuit::<OrchardNullifier, 3, 2, 3> {
|
||||||
|
message: Some(message),
|
||||||
|
output: Some(output),
|
||||||
|
_spec: PhantomData,
|
||||||
|
};
|
||||||
|
let prover = MockProver::run(k, &circuit, vec![]).unwrap();
|
||||||
|
assert_eq!(prover.verify(), Ok(()))
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hash_test_vectors() {
|
fn hash_test_vectors() {
|
||||||
for tv in crate::primitives::poseidon::test_vectors::fp::hash() {
|
for tv in crate::primitives::poseidon::test_vectors::fp::hash() {
|
||||||
|
|
Loading…
Reference in New Issue