From 3b4b6a0a9adfc3e4fad8d6422cef3f92a7bf339d Mon Sep 17 00:00:00 2001 From: Miki <100796045+mickeyasa@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:05:48 +0200 Subject: [PATCH] moving poseidon constants to icicle/hash/poseidon_constants (#658) * moving poseidon constants to icicle/include/icicle/hash/poseidon_constants * aligne path to new loation of poseidon constants * small fix * format * rerun --- docs/docs/icicle/primitives/poseidon.md | 4 ++-- icicle/backend/cpu/src/hash/cpu_poseidon.cpp | 16 ++++++++-------- .../hash/poseidon_constants}/babybear_poseidon.h | 0 .../poseidon_constants}/bls12_377_poseidon.h | 0 .../poseidon_constants}/bls12_381_poseidon.h | 0 .../hash/poseidon_constants}/bn254_poseidon.h | 0 .../hash/poseidon_constants}/bw6_761_poseidon.h | 0 .../poseidon_constants}/constants_template.h | 0 .../poseidon_constants}/generate_parameters.py | 0 .../hash/poseidon_constants}/grumpkin_poseidon.h | 0 .../hash/poseidon_constants}/m31_poseidon.h | 0 .../hash/poseidon_constants}/stark252_poseidon.h | 0 icicle/tests/test_hash_api.cpp | 4 ++-- 13 files changed, 12 insertions(+), 12 deletions(-) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/babybear_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/bls12_377_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/bls12_381_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/bn254_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/bw6_761_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/constants_template.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/generate_parameters.py (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/grumpkin_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/m31_poseidon.h (100%) rename icicle/include/{poseidon/constants => icicle/hash/poseidon_constants}/stark252_poseidon.h (100%) diff --git a/docs/docs/icicle/primitives/poseidon.md b/docs/docs/icicle/primitives/poseidon.md index 37ea7455a..3ce77dda3 100644 --- a/docs/docs/icicle/primitives/poseidon.md +++ b/docs/docs/icicle/primitives/poseidon.md @@ -62,9 +62,9 @@ So for Poseidon of arity 2 and input of size 1024 * 2, we would expect 1024 elem Poseidon is extremely customizable and using different constants will produce different hashes, security levels and performance results. -We support pre-calculated and optimized constants for each of the [supported curves](../libraries#supported-curves-and-operations).The constants can be found [here](https://github.com/ingonyama-zk/icicle/tree/main/icicle/include/poseidon/constants) and are labeled clearly per curve `_poseidon.h`. +We support pre-calculated and optimized constants for each of the [supported curves](../libraries#supported-curves-and-operations).The constants can be found [here](https://github.com/ingonyama-zk/icicle/tree/main/icicle/include/icicle/hash/poseidon_constants) and are labeled clearly per curve `_poseidon.h`. -If you wish to generate your own constants you can use our python script which can be found [here](https://github.com/ingonyama-zk/icicle/tree/main/icicle/include/poseidon/constants/generate_parameters.py). +If you wish to generate your own constants you can use our python script which can be found [here](https://github.com/ingonyama-zk/icicle/tree/main/icicle/include/icicle/hash/poseidon_constants/generate_parameters.py). Prerequisites: diff --git a/icicle/backend/cpu/src/hash/cpu_poseidon.cpp b/icicle/backend/cpu/src/hash/cpu_poseidon.cpp index 850063308..1bcac40fd 100644 --- a/icicle/backend/cpu/src/hash/cpu_poseidon.cpp +++ b/icicle/backend/cpu/src/hash/cpu_poseidon.cpp @@ -4,28 +4,28 @@ #include #if FIELD_ID == BN254 - #include "poseidon/constants/bn254_poseidon.h" + #include "icicle/hash/poseidon_constants/bn254_poseidon.h" using namespace poseidon_constants_bn254; #elif FIELD_ID == BLS12_381 - #include "poseidon/constants/bls12_381_poseidon.h" + #include "icicle/hash/poseidon_constants/bls12_381_poseidon.h" using namespace poseidon_constants_bls12_381; #elif FIELD_ID == BLS12_377 - #include "poseidon/constants/bls12_377_poseidon.h" + #include "icicle/hash/poseidon_constants/bls12_377_poseidon.h" using namespace poseidon_constants_bls12_377; #elif FIELD_ID == BW6_761 - #include "poseidon/constants/bw6_761_poseidon.h" + #include "icicle/hash/poseidon_constants/bw6_761_poseidon.h" using namespace poseidon_constants_bw6_761; #elif FIELD_ID == GRUMPKIN - #include "poseidon/constants/grumpkin_poseidon.h" + #include "icicle/hash/poseidon_constants/grumpkin_poseidon.h" using namespace poseidon_constants_grumpkin; #elif FIELD_ID == M31 - #include "poseidon/constants/m31_poseidon.h" + #include "icicle/hash/poseidon_constants/m31_poseidon.h" using namespace poseidon_constants_m31; #elif FIELD_ID == BABY_BEAR - #include "poseidon/constants/babybear_poseidon.h" + #include "icicle/hash/poseidon_constants/babybear_poseidon.h" using namespace poseidon_constants_babybear; #elif FIELD_ID == STARK_252 - #include "poseidon/constants/stark252_poseidon.h" + #include "icicle/hash/poseidon_constants/stark252_poseidon.h" using namespace poseidon_constants_stark252; #endif diff --git a/icicle/include/poseidon/constants/babybear_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/babybear_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/babybear_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/babybear_poseidon.h diff --git a/icicle/include/poseidon/constants/bls12_377_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/bls12_377_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/bls12_377_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/bls12_377_poseidon.h diff --git a/icicle/include/poseidon/constants/bls12_381_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/bls12_381_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/bls12_381_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/bls12_381_poseidon.h diff --git a/icicle/include/poseidon/constants/bn254_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/bn254_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/bn254_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/bn254_poseidon.h diff --git a/icicle/include/poseidon/constants/bw6_761_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/bw6_761_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/bw6_761_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/bw6_761_poseidon.h diff --git a/icicle/include/poseidon/constants/constants_template.h b/icicle/include/icicle/hash/poseidon_constants/constants_template.h similarity index 100% rename from icicle/include/poseidon/constants/constants_template.h rename to icicle/include/icicle/hash/poseidon_constants/constants_template.h diff --git a/icicle/include/poseidon/constants/generate_parameters.py b/icicle/include/icicle/hash/poseidon_constants/generate_parameters.py similarity index 100% rename from icicle/include/poseidon/constants/generate_parameters.py rename to icicle/include/icicle/hash/poseidon_constants/generate_parameters.py diff --git a/icicle/include/poseidon/constants/grumpkin_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/grumpkin_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/grumpkin_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/grumpkin_poseidon.h diff --git a/icicle/include/poseidon/constants/m31_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/m31_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/m31_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/m31_poseidon.h diff --git a/icicle/include/poseidon/constants/stark252_poseidon.h b/icicle/include/icicle/hash/poseidon_constants/stark252_poseidon.h similarity index 100% rename from icicle/include/poseidon/constants/stark252_poseidon.h rename to icicle/include/icicle/hash/poseidon_constants/stark252_poseidon.h diff --git a/icicle/tests/test_hash_api.cpp b/icicle/tests/test_hash_api.cpp index d53082be3..782321b6a 100644 --- a/icicle/tests/test_hash_api.cpp +++ b/icicle/tests/test_hash_api.cpp @@ -594,7 +594,7 @@ TEST_F(HashApiTest, MerkleTreeBasic) TEST_F(HashApiTest, MerkleTreeZeroPadding) { - // TODO add loop on devices (and change hash to one supported on gpu) + // TODO:add loop on devices (and change hash to one supported on gpu) const int leaf_size = sizeof(uint32_t); const int nof_leaves = 100; uint32_t leaves[nof_leaves]; @@ -915,7 +915,7 @@ TEST_F(HashApiTest, MerkleTreeLarge) // p = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001 #include "icicle/fields/field_config.h" - #include "poseidon/constants/bn254_poseidon.h" + #include "icicle/hash/poseidon_constants/bn254_poseidon.h" using namespace field_config; using namespace poseidon_constants_bn254;