Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal test with crypto3::sha256 usage #29

Closed

Conversation

color-typea
Copy link
Contributor

@color-typea color-typea commented Jun 19, 2023

Minimal changes illustrating the issue with tests:

  • "Main" build works: cmake -S . -B build && cmake --build build --target template -> produces build/template.bc
  • Test build fails: cmake -S . -B build && cmake --build build --target lib_test - fails test compilation with
/usr/local/include/boost/concept_check.hpp: In instantiation of ‘struct boost::InputIterator<std::array<unsigned int, 16> >’:
/usr/local/include/boost/concept_check.hpp:502:3:   required from ‘struct boost::InputIteratorConcept<std::array<unsigned int, 16> >’
/usr/local/include/boost/concept/detail/has_constraints.hpp:32:62:   required by substitution of ‘template<class Model> boost::concepts::detail::yes boost::concepts::detail::has_constraints_(Model*, boost::concepts::detail::wrap_constraints<Model, (& Model::constraints)>*) [with Model = boost::InputIteratorConcept<std::array<unsigned int, 16> >]’
/usr/local/include/boost/concept/detail/has_constraints.hpp:42:5:   required from ‘const bool boost::concepts::not_satisfied<boost::InputIteratorConcept<std::array<unsigned int, 16> > >::value’
/usr/local/include/boost/concept/detail/has_constraints.hpp:45:51:   required from ‘struct boost::concepts::not_satisfied<boost::InputIteratorConcept<std::array<unsigned int, 16> > >’
/usr/local/include/boost/concept/detail/general.hpp:72:8:   required from ‘struct boost::concepts::requirement_<void (*)(boost::InputIteratorConcept<std::array<unsigned int, 16> >)>’
/home/john/Projects/crypto/zkllvm/lido-zkllvm-accounting-curcuit/libs/crypto3/libs/hash/include/nil/crypto3/hash/hash_value.hpp:104:25:   required from ‘nil::crypto3::hashes::detail::range_hash_impl<HashStateImpl>::range_hash_impl(InputIterator, InputIterator, nil::crypto3::hashes::detail::range_hash_impl<HashStateImpl>::accumulator_set_type&&) [with InputIterator = std::array<unsigned int, 16>; HashStateImpl = nil::crypto3::hashes::detail::value_hash_impl<nil::crypto3::accumulator_set<nil::crypto3::hashes::sha2<256>, void> >; nil::crypto3::hashes::detail::range_hash_impl<HashStateImpl>::accumulator_set_type = nil::crypto3::accumulator_set<nil::crypto3::hashes::sha2<256>, void>]’
/home/john/Projects/crypto/zkllvm/lido-zkllvm-accounting-curcuit/libs/crypto3/libs/hash/include/nil/crypto3/hash/algorithm/hash.hpp:143:20:   required from ‘nil::crypto3::hashes::detail::range_hash_impl<nil::crypto3::hashes::detail::value_hash_impl<typename std::enable_if<boost::accumulators::detail::is_accumulator_set<OutputIterator>::value, HashAccumulator>::type> > nil::crypto3::hash(InputIterator, InputIterator) [with Hash = nil::crypto3::hashes::sha2<256>; InputIterator = std::array<unsigned int, 16>; HashAccumulator = nil::crypto3::accumulator_set<nil::crypto3::hashes::sha2<256>, void>; typename std::enable_if<boost::accumulators::detail::is_accumulator_set<OutputIterator>::value, HashAccumulator>::type = nil::crypto3::accumulator_set<nil::crypto3::hashes::sha2<256>, void>]’
/home/john/Projects/crypto/zkllvm/lido-zkllvm-accounting-curcuit/src/lib.hpp:10:35:   required from here
/usr/local/include/boost/concept_check.hpp:506:61: error: no type named ‘value_type’ in ‘struct std::iterator_traits<std::array<unsigned int, 16> >’
  506 |       typedef typename std::iterator_traits<TT>::value_type value_type;
      |                                                             ^~~~~~~~~~

Full build command for tests (via VERBOSE=1 cmake --build build --target lib_test)

cd /home/me/Projects/crypto/zkllvm/template/build/test && /usr/bin/c++ 
-DBOOST_CONTAINER_DYN_LINK 
-DBOOST_CONTAINER_NO_LIB 
-DBOOST_RANDOM_DYN_LINK 
-DBOOST_RANDOM_NO_LIB 
-DBOOST_SYSTEM_DYN_LINK 
-DBOOST_SYSTEM_NO_LIB 
-DBOOST_TEST_DYN_LINK=1 
-DBOOST_TEST_NO_AUTO_LINK=1 
-DBOOST_UNIT_TEST_FRAMEWORK_DYN_LINK 
-DBOOST_UNIT_TEST_FRAMEWORK_NO_LIB 
-DCRYPTO3_CODEC_BASE58 
-DCRYPTO3_HAS_AVX2 
-DCRYPTO3_HAS_CHACHA_AVX2 
-DCRYPTO3_HAS_RIJNDAEL_NI 
-DCRYPTO3_VDF_BOOST 
-I/home/me/Projects/crypto/zkllvm/template/test 
-I/home/me/Projects/crypto/zkllvm/template/src 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/algebra/include 
-I/home/me/Projects/crypto/zkllvm/template/build/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/hash/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/multiprecision/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/marshalling/algebra/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/marshalling/multiprecision/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/marshalling/core/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/block/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/codec/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/containers/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/kdf/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/mac/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/modes/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/marshalling/zk/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/zk/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/math/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/pubkey/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/pkpad/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/passhash/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/pbkdf/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/pkmodes/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/random/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/stream/include 
-I/home/me/Projects/crypto/zkllvm/template/libs/crypto3/libs/vdf/include 
-mavx2 
-maes 
-mpclmul 
-mssse3 
-std=gnu++20 
-MD 
-MT test/CMakeFiles/lib_test.dir/lib.cpp.o 
-MF CMakeFiles/lib_test.dir/lib.cpp.o.d 
-o CMakeFiles/lib_test.dir/lib.cpp.o 
-c /home/me/Projects/crypto/zkllvm/template/test/lib.cpp
  • c++ --version: c++ (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
  • clang --version: clang version 16.0.0 (git@github.com:NilFoundation/zkllvm-circifier.git bf352a2e14522504a0c832f2b66f73268c95e621)
  • Boost version: 1.81.0

@color-typea color-typea force-pushed the minimal_test_example branch 2 times, most recently from ce98e41 to 51de5ff Compare June 27, 2023 11:35
@color-typea
Copy link
Contributor Author

color-typea commented Jun 27, 2023

Changes in lib.hpp (#ifdef __ZKLLVM__ - commit 32912dd) fixed the build, however the test still fail.

The essence of test is basically sha256(1, 2) == "". The expected value is generated via this python code: https://gist.github.com/color-typea/b2438416f9aeac232b50a94a57d29e03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants