Skip to content

Commit

Permalink
test: added more noir tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xThemis authored and dkales committed Sep 2, 2024
1 parent 69ce83e commit 9b3da88
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test_vectors/noir/poseidon2/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "poseidon2"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
poseidon2 = { tag = "v0.1.0", git = "https://github.com/TaceoLabs/noir-poseidon", directory = "poseidon2" }
1 change: 1 addition & 0 deletions test_vectors/noir/poseidon2/Prover.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plains = ["0", "1", "2", "3", "4", "5", "6", "7"]
6 changes: 6 additions & 0 deletions test_vectors/noir/poseidon2/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use dep::poseidon2;

//-8724675007627701394367576277397137785970603800817593955743442482136808733218
fn main(plains: [Field; 8]) -> pub Field {
poseidon2::bn254::hash_8(plains)
}
7 changes: 7 additions & 0 deletions test_vectors/noir/poseidon_stdlib/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "poseidon_stdlib"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
4 changes: 4 additions & 0 deletions test_vectors/noir/poseidon_stdlib/Prover.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x1 = ["1", "2"]
x2 = ["3", "4", "5", "6"]
y1 = "0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a"
y2 = "0x24995e31c5b1cf0c406e7f25ac0a8e6315ec4a341f241a472ce5b459d38ddf44"
9 changes: 9 additions & 0 deletions test_vectors/noir/poseidon_stdlib/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use std::hash::poseidon;

fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) {
let hash1 = poseidon::bn254::hash_2(x1);
assert(hash1 == y1);

let hash2 = poseidon::bn254::hash_4(x2);
assert(hash2 == y2);
}
2 changes: 2 additions & 0 deletions tests/tests/noir/witness_extension_tests/plain_solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ use super::add_plain_acvm_test;

add_plain_acvm_test!("addition_multiplication");
add_plain_acvm_test!("poseidon");
add_plain_acvm_test!("poseidon2");
add_plain_acvm_test!("poseidon_stdlib");
2 changes: 2 additions & 0 deletions tests/tests/noir/witness_extension_tests/rep3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ use tests::rep3_network::Rep3TestNetwork;
use super::add_rep3_acvm_test;
add_rep3_acvm_test!("addition_multiplication");
add_rep3_acvm_test!("poseidon");
add_rep3_acvm_test!("poseidon2");
add_rep3_acvm_test!("poseidon_stdlib");

0 comments on commit 9b3da88

Please sign in to comment.