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

Update crypto3 to the latest master (the last time, to the commit f15b449). #9

Merged
merged 5 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crypto3/libs/algebra/crypto3.algebra.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/block/crypto3.block.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/block/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ macro(define_block_cipher_test name)
${Boost_INCLUDE_DIRS})

if(NOT CMAKE_CXX_STANDARD)
set_target_properties(${test_name} PROPERTIES CXX_STANDARD 14)
set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17)
endif()

string(CONCAT TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR} "/data/" "${name}" ".json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <nil/crypto3/algebra/curves/pallas.hpp>
#include <nil/crypto3/algebra/curves/vesta.hpp>
#include <nil/crypto3/algebra/curves/ed25519.hpp>
#include <nil/crypto3/algebra/fields/bls12/base_field.hpp>
#include <nil/crypto3/algebra/fields/bls12/scalar_field.hpp>

#include <boost/multiprecision/cpp_int.hpp>
#include <nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp>
Expand Down Expand Up @@ -251,8 +253,6 @@ namespace nil {
typedef std::array<var, ratio> non_native_var_type;
};



/*
* Native element type.
*/
Expand Down
3 changes: 2 additions & 1 deletion crypto3/libs/blueprint/test/zkevm/opcodes/iszero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include <boost/test/unit_test.hpp>

#include <nil/blueprint/zkevm/zkevm_machine_interface.hpp>
#include <nil/crypto3/algebra/fields/arithmetic_params/goldilocks64.hpp>

#include <nil/blueprint/blueprint/plonk/circuit.hpp>
Expand All @@ -35,6 +34,8 @@
#include <nil/blueprint/zkevm/zkevm_circuit.hpp>
#include "../opcode_tester.hpp"

#include <nil/blueprint/zkevm/operations/iszero.hpp>

using namespace nil::blueprint;
using namespace nil::crypto3::algebra;

Expand Down
5 changes: 2 additions & 3 deletions crypto3/libs/blueprint/test/zkevm/opcodes/mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@
#include <nil/blueprint/blueprint/plonk/assignment.hpp>

#include <nil/blueprint/zkevm/zkevm_circuit.hpp>
#include <nil/blueprint/zkevm/zkevm_operation.hpp>
#include <nil/blueprint/zkevm/operations/mul.hpp>

#include "../opcode_tester.hpp"

#include <nil/blueprint/zkevm/operations/mul.hpp>

using namespace nil::blueprint;
using namespace nil::crypto3::algebra;

Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/codec/crypto3.codec.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/codec/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro(define_codec_test name)

if(NOT CMAKE_CXX_STANDARD)
set_target_properties(codec_${name}_test PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE)
endif()

Expand Down
1 change: 0 additions & 1 deletion crypto3/libs/containers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTER

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INCLUDE include NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

include(CMTest)
cm_add_test_subdirectory(test)

if (BUILD_EXAMPLES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ namespace nil {

typedef typename node_type::value_type value_type;
constexpr static const std::size_t value_bits = node_type::value_bits;
constexpr static const std::size_t arity = Arity;

typedef std::vector<value_type> container_type;

Expand Down Expand Up @@ -253,15 +254,15 @@ namespace nil {
}

bool operator==(const merkle_tree_impl &rhs) const {
return _hashes == rhs.val;
return _hashes == rhs._hashes;
}

bool operator!=(const merkle_tree_impl &rhs) const {
return !(rhs == *this);
}

allocator_type get_allocator() const BOOST_NOEXCEPT {
return this->val.__alloc();
return this->_hashes.__alloc();
}

iterator begin() BOOST_NOEXCEPT {
Expand Down
14 changes: 7 additions & 7 deletions crypto3/libs/containers/test/merkle/merkle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@

#define BOOST_TEST_MODULE containter_merkletree_test

#include <chrono>
#include <cstdio>
#include <limits>
#include <type_traits>
#include <cstdint>

#include <nil/crypto3/algebra/random_element.hpp>
#include <nil/crypto3/algebra/type_traits.hpp>
#include <nil/crypto3/hash/block_to_field_elements_wrapper.hpp>
Expand All @@ -41,7 +35,6 @@
#include <nil/crypto3/hash/keccak.hpp>
#include <nil/crypto3/hash/pedersen.hpp>
#include <nil/crypto3/hash/poseidon.hpp>
#include <nil/crypto3/hash/algorithm/hash.hpp>

#include <nil/crypto3/container/merkle/tree.hpp>
#include <nil/crypto3/container/merkle/proof.hpp>
Expand All @@ -50,6 +43,13 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

#include <chrono>
#include <cstdio>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <nil/crypto3/hash/algorithm/hash.hpp>

using namespace nil::crypto3;
using namespace nil::crypto3::containers;

Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/hash/crypto3.hash.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
13 changes: 7 additions & 6 deletions crypto3/libs/hash/test/crc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@

#define BOOST_TEST_MODULE crc_test

#include <iostream>
#include <string>
#include <cassert>
#include <cstdint>
#include <unordered_map>

#include <nil/crypto3/hash/algorithm/hash.hpp>

#include <nil/crypto3/hash/crc.hpp>
#include <nil/crypto3/hash/hash_state.hpp>

Expand All @@ -24,6 +19,12 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

#include <iostream>
#include <string>
#include <cassert>
#include <cstdint>
#include <unordered_map>

using namespace nil::crypto3;
using namespace nil::crypto3::hashes;
using namespace nil::crypto3::accumulators;
Expand Down
12 changes: 6 additions & 6 deletions crypto3/libs/hash/test/tiger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@

#define BOOST_TEST_MODULE tiger_test

#include <iostream>
#include <string>
#include <unordered_map>
#include <cstdio>
#include <cstdint>

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/adaptor/hashed.hpp>

Expand All @@ -45,6 +39,12 @@

#include <boost/static_assert.hpp>

#include <iostream>
#include <string>
#include <unordered_map>
#include <cstdio>
#include <cstdint>

using namespace nil::crypto3;
using namespace nil::crypto3::accumulators;

Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/kdf/crypto3.kdf.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/mac/crypto3.mac.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"branch": "master"
},
"xcconfig": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"CLANG_CXX_LIBRARY": "libc++",
"HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/include/\""
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,16 @@ namespace nil {
// return field;
// }

template<typename FieldValueType, typename Endianness>
nil::marshalling::types::array_list<
nil::marshalling::field_type<Endianness>,
field_element<nil::marshalling::field_type<Endianness>, FieldValueType>,

template<typename FieldValueType, typename TTypeBase>
using field_element_vector = nil::marshalling::types::array_list<
TTypeBase,
field_element<TTypeBase, FieldValueType>,
nil::marshalling::option::sequence_size_field_prefix<
nil::marshalling::types::integral<nil::marshalling::field_type<Endianness>, std::size_t>>>
nil::marshalling::types::integral<TTypeBase, std::size_t>>>;

template<typename FieldValueType, typename Endianness>
field_element_vector<FieldValueType, nil::marshalling::field_type<Endianness>>
fill_field_element_vector(const std::vector<FieldValueType> &field_elem_vector) {

using TTypeBase = nil::marshalling::field_type<Endianness>;
Expand All @@ -711,12 +715,7 @@ namespace nil {

template<typename FieldValueType, typename Endianness>
std::vector<FieldValueType> make_field_element_vector(
const nil::marshalling::types::array_list<
nil::marshalling::field_type<Endianness>,
field_element<nil::marshalling::field_type<Endianness>, FieldValueType>,
nil::marshalling::option::sequence_size_field_prefix<
nil::marshalling::types::integral<nil::marshalling::field_type<Endianness>, std::size_t>>>
&field_elem_vector) {
const field_element_vector<FieldValueType, nil::marshalling::field_type<Endianness>>& field_elem_vector) {

std::vector<FieldValueType> result;
result.reserve(field_elem_vector.value().size());
Expand Down
4 changes: 4 additions & 0 deletions crypto3/libs/marshalling/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ if(CRYPTO3_MARSHALLING_THROWS)
add_definitions(-DCRYPTO3_MARSHALLING_THROWS)
endif()

if(NOT CMAKE_CXX_STANDARD)
set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17)
endif()

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
Expand Down
10 changes: 10 additions & 0 deletions crypto3/libs/marshalling/core/include/nil/marshalling/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@

namespace nil {
namespace marshalling {
namespace types {
// We cannot include integral.hpp, it includes this file. So just declare the class.
template<typename TFieldBase, typename T, typename... TOptions>
class integral;
}

namespace option {
namespace detail {

Expand Down Expand Up @@ -286,6 +292,10 @@ namespace nil {
template<typename TField>
struct sequence_size_field_prefix { };

template <typename TTypeBase>
using size_t_sequence_size_field_prefix = sequence_size_field_prefix<
nil::marshalling::types::integral<TTypeBase, std::size_t>>;

/// @brief Option that modifies the default behaviour of collection fields to
/// prepend the serialized data with number of @b bytes information.
/// @details Similar to @ref sequence_size_field_prefix, but instead of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
namespace nil {
namespace marshalling {
namespace types {

namespace adapter {

template<typename TSizeField, typename TBase>
Expand Down Expand Up @@ -129,7 +130,6 @@ namespace nil {
base_impl_type::write_no_status(iter);
}
};

} // namespace adapter
} // namespace types
} // namespace marshalling
Expand Down
Loading
Loading