From c359bef38923ebca18c710ce6e090d4a85413808 Mon Sep 17 00:00:00 2001 From: Duncan Tebbs Date: Fri, 1 Apr 2022 16:43:29 +0100 Subject: [PATCH] submodule: zeth [mimc-selector] --- .github/workflows/dev-docs.yml | 4 +- .github/workflows/onpullrequest.yml | 6 +- depends/zeth | 2 +- .../compression_function_selector.hpp | 57 ------------------- .../circuits/verification_key_hash_gadget.hpp | 5 +- .../tests/aggregator/aggregator_test.cpp | 32 +++++------ 6 files changed, 24 insertions(+), 82 deletions(-) delete mode 100644 libzecale/circuits/compression_function_selector.hpp diff --git a/.github/workflows/dev-docs.yml b/.github/workflows/dev-docs.yml index 1779d7b3..c520261a 100644 --- a/.github/workflows/dev-docs.yml +++ b/.github/workflows/dev-docs.yml @@ -19,7 +19,7 @@ jobs: - name: Build grpc run: | pushd depends/zeth - if ! [ -d depends/grpc ] ; then scripts/install-grpc /usr v1.31.x ; fi + if ! [ -d depends/grpc ] ; then scripts/install-grpc /usr v1.32.x ; fi popd build-documentation: @@ -39,7 +39,7 @@ jobs: run: | sudo apt update -y pushd depends/zeth - INSTALL_ONLY=1 scripts/install-grpc /usr v1.31.x + INSTALL_ONLY=1 scripts/install-grpc /usr v1.32.x popd sudo apt install -y doxygen graphviz - name: Generate documentation diff --git a/.github/workflows/onpullrequest.yml b/.github/workflows/onpullrequest.yml index a4121c01..4632e36a 100644 --- a/.github/workflows/onpullrequest.yml +++ b/.github/workflows/onpullrequest.yml @@ -20,7 +20,7 @@ jobs: - name: Build grpc run: | pushd depends/zeth - if ! [ -d depends/grpc ] ; then scripts/install-grpc /usr v1.31.x ; fi + if ! [ -d depends/grpc ] ; then scripts/install-grpc /usr v1.32.x ; fi popd build-linux-full-tests: @@ -55,7 +55,7 @@ jobs: - name: Install dependencies run: | pushd depends/zeth - INSTALL_ONLY=1 scripts/install-grpc /usr v1.31.x + INSTALL_ONLY=1 scripts/install-grpc /usr v1.32.x popd - name: Execute run: CI_FULL_TESTS=1 CI_CONFIG=Release scripts/ci build @@ -92,7 +92,7 @@ jobs: - name: Install dependencies run: | pushd depends/zeth - INSTALL_ONLY=1 scripts/install-grpc /usr v1.31.x + INSTALL_ONLY=1 scripts/install-grpc /usr v1.32.x popd - name: Execute run: CI_INTEGRATION_TESTS=1 CI_CONFIG=Release scripts/ci build diff --git a/depends/zeth b/depends/zeth index 4ff89152..550da0c2 160000 --- a/depends/zeth +++ b/depends/zeth @@ -1 +1 @@ -Subproject commit 4ff89152cce8afaaab2a44bb9779463dd208e892 +Subproject commit 550da0c26e16e33b9bfb44e217aad24ef4be014e diff --git a/libzecale/circuits/compression_function_selector.hpp b/libzecale/circuits/compression_function_selector.hpp deleted file mode 100644 index 7ce53200..00000000 --- a/libzecale/circuits/compression_function_selector.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2015-2022 Clearmatics Technologies Ltd -// -// SPDX-License-Identifier: LGPL-3.0+ - -#include -#include -#include -#include - -namespace libzecale -{ - -/// Used to select a compression function depending on the scalar field of the -/// wrapping pairing-friendly curve. -template class compression_function_selector -{ -public: - /// By default, use the tree_hash_selector from zeth. - using compression_function = - typename libzeth::tree_hash_selector::tree_hash; -}; - -template<> class compression_function_selector -{ -public: - // Constants e=17, r=93 computed via scripts/mimc_constraints.sage in - // http://github.com/clearmatics/zeth. - using compression_function = libzeth::MiMC_mp_gadget< - libff::bw6_761_Fr, - libzeth::MiMC_permutation_gadget>; -}; - -template<> class compression_function_selector -{ -public: - // Constants e=17, r=73 computed via scripts/mimc_constraints.sage in - // http://github.com/clearmatics/zeth. - using compression_function = libzeth::MiMC_mp_gadget< - libff::mnt4_Fr, - libzeth::MiMC_permutation_gadget>; -}; - -template<> class compression_function_selector -{ -public: - // Constants e=17, r=73 computed via scripts/mimc_constraints.sage in - // http://github.com/clearmatics/zeth. - using compression_function = libzeth::MiMC_mp_gadget< - libff::mnt6_Fr, - libzeth::MiMC_permutation_gadget>; -}; - -template -using compression_function_gadget = - typename compression_function_selector::compression_function; - -} // namespace libzecale diff --git a/libzecale/circuits/verification_key_hash_gadget.hpp b/libzecale/circuits/verification_key_hash_gadget.hpp index bf725cbb..d8652d26 100644 --- a/libzecale/circuits/verification_key_hash_gadget.hpp +++ b/libzecale/circuits/verification_key_hash_gadget.hpp @@ -5,11 +5,10 @@ #ifndef __ZECALE_CIRCUITS_VERIFICATION_KEY_HASH_GADGET_HPP__ #define __ZECALE_CIRCUITS_VERIFICATION_KEY_HASH_GADGET_HPP__ -#include "libzecale/circuits/compression_function_selector.hpp" - #include #include #include +#include namespace libzecale { @@ -22,7 +21,7 @@ class verification_key_hash_gadget : public libsnark::gadget> { public: using FieldT = libff::Fr; - using compFnT = compression_function_gadget; + using compFnT = libzeth::mimc_compression_function_gadget; using scalarHasherT = libzeth::mimc_input_hasher; using nsnark = typename nverifierT::snark; diff --git a/libzecale/tests/aggregator/aggregator_test.cpp b/libzecale/tests/aggregator/aggregator_test.cpp index f3f992a7..ce3596b3 100644 --- a/libzecale/tests/aggregator/aggregator_test.cpp +++ b/libzecale/tests/aggregator/aggregator_test.cpp @@ -30,21 +30,21 @@ using namespace libzeth; namespace libzeth { -// Use mimc7 by default -template<> class tree_hash_selector -{ -public: - using tree_hash = MiMC_mp_gadget< - libff::mnt4_Fr, - MiMC_permutation_gadget>; -}; -template<> class tree_hash_selector -{ -public: - using tree_hash = MiMC_mp_gadget< - libff::mnt6_Fr, - MiMC_permutation_gadget>; -}; +// // Use mimc7 by default +// template<> class tree_hash_selector +// { +// public: +// using tree_hash = MiMC_mp_gadget< +// libff::mnt4_Fr, +// MiMC_permutation_gadget>; +// }; +// template<> class tree_hash_selector +// { +// public: +// using tree_hash = MiMC_mp_gadget< +// libff::mnt6_Fr, +// MiMC_permutation_gadget>; +// }; } // namespace libzeth @@ -52,7 +52,7 @@ template<> class tree_hash_selector template using hash = libzeth::BLAKE2s_256>; template using hashTree = - typename libzeth::tree_hash_selector>::tree_hash; + typename libzeth::mimc_compression_function_gadget>; static const size_t tree_depth = 4; static const size_t inputs_number = 2;