-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing the performance test. The same test is fixed in crypto3-zk ver…
…sion.
- Loading branch information
Showing
14 changed files
with
356 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
test/systems/plonk/placeholder/data/many_hashes/many_hashes.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <nil/crypto3/hash/algorithm/hash.hpp> | ||
#include <nil/crypto3/hash/poseidon.hpp> | ||
#include <nil/crypto3/hash/sha2.hpp> | ||
|
||
using namespace nil::crypto3; | ||
using namespace nil::crypto3::algebra::curves; | ||
|
||
[[circuit]] typename hashes::sha2<256>::block_type poseidon_example1( | ||
typename pallas::base_field_type::value_type b, | ||
typename pallas::base_field_type::value_type c, | ||
typename hashes::sha2<256>::block_type d, | ||
typename hashes::sha2<256>::block_type e, | ||
__zkllvm_field_curve25519_base f, | ||
__zkllvm_field_curve25519_base g | ||
) { | ||
typename pallas::base_field_type::value_type poseidon_result = hash<hashes::poseidon>(b, c); | ||
typename pallas::base_field_type::value_type poseidon_result2 = hash<hashes::poseidon>(c, b); | ||
typename pallas::base_field_type::value_type poseidon_tmp; | ||
|
||
typename hashes::sha2<256>::block_type sha2_result = hash<hashes::sha2<256>>(d, e); | ||
typename hashes::sha2<256>::block_type sha2_result2 = hash<hashes::sha2<256>>(e, d); | ||
typename hashes::sha2<256>::block_type sha2_tmp; | ||
|
||
__zkllvm_field_curve25519_base curve_add; | ||
__zkllvm_field_curve25519_base curve_mul; | ||
__zkllvm_field_curve25519_base curve_sub; | ||
|
||
for( int i = 0; i < 3; i++ ) { | ||
curve_add = f+g; | ||
curve_sub = f-g; | ||
curve_mul = f*g; | ||
|
||
f = curve_add; | ||
g = curve_sub; | ||
|
||
poseidon_tmp = hash<hashes::poseidon>(poseidon_result, poseidon_result2); | ||
poseidon_result = poseidon_result2; | ||
poseidon_result2 = poseidon_tmp; | ||
|
||
sha2_tmp = hash<hashes::sha2<256>>(sha2_result, sha2_result2); | ||
sha2_result = sha2_result2; | ||
sha2_result2 = sha2_tmp; | ||
} | ||
|
||
return sha2_result2; | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
test/systems/plonk/placeholder/data/many_hashes/many_hashes.inp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ | ||
{"field": 0}, | ||
{"field": 1}, | ||
{"vector": [{"field": "85070591730234615865843651857942052864"}, {"field": "85070591730234615865843651857942052865"}]}, | ||
{"vector": [{"field": "85070591730234615865843651857942052866"}, {"field": "85070591730234615865843651857942052867"}]}, | ||
{"field": "999"}, | ||
{"field": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"} | ||
] | ||
|
1 change: 1 addition & 0 deletions
1
test/systems/plonk/placeholder/data/many_hashes/many_hashes_assignment.tbl
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
test/systems/plonk/placeholder/data/many_hashes/many_hashes_circuit.crct
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
.../systems/plonk/placeholder/data/merkle_tree_poseidon/merkle_tree_posseidon_assignment.tbl
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
test/systems/plonk/placeholder/data/merkle_tree_poseidon/merkle_tree_posseidon_circuit.crct
Large diffs are not rendered by default.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
test/systems/plonk/placeholder/data/merkle_tree_poseidon/poseidon.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <nil/crypto3/hash/algorithm/hash.hpp> | ||
#include <nil/crypto3/hash/poseidon.hpp> | ||
|
||
using namespace nil::crypto3; | ||
using namespace nil::crypto3::algebra::curves; | ||
|
||
[[circuit]] typename pallas::base_field_type::value_type poseidon_example1(typename pallas::base_field_type::value_type b, | ||
typename pallas::base_field_type::value_type c) { | ||
|
||
typename pallas::base_field_type::value_type hash_result = hash<hashes::poseidon>(b, c); | ||
|
||
return hash_result; | ||
} |
1 change: 1 addition & 0 deletions
1
test/systems/plonk/placeholder/data/merkle_tree_poseidon/poseidon.inp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"field": 0}, {"field": 1}] |
Oops, something went wrong.