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

Sync with crypto3 93edae7a #16

Merged
merged 11 commits into from
Jul 18, 2024
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
.cache
build
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"actor_zk_systems_plonk_placeholder_placeholder_quotient_polynomial_chunks_test"
# "actor_zk_commitment_powers_of_tau_test"
"actor_zk_commitment_proof_of_knowledge_test"
"actor_zk_commitment_r1cs_gg_ppzksnark_mpc_test"
# "actor_zk_commitment_r1cs_gg_ppzksnark_mpc_test"
"actor_zk_math_expression_test"
"actor_zk_systems_plonk_plonk_constraint_test"
];
Expand Down
2 changes: 1 addition & 1 deletion libs/parallel-math/include/nil/crypto3/math/domains/arithmetic_sequence_domain.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace nil {

nil::crypto3::parallel_for(0, arithmetic_sequence.size(),
[this](std::size_t i) {
this->arithmetic_sequence[i] *= field_value_type(i);
this->arithmetic_sequence[i] = this->arithmetic_generator * field_value_type(i);
});

precomputation_sentinel = true;
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified libs/parallel-math/include/nil/crypto3/math/polynomial/xgcd.hpp
100755 → 100644
Empty file.
14 changes: 0 additions & 14 deletions libs/parallel-zk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
cmake_minimum_required(VERSION 2.8.12)

cmake_policy(SET CMP0025 NEW)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0076 NEW)

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake"
"${CMAKE_CURRENT_LIST_DIR}/cmake/packages"
"${CMAKE_CURRENT_LIST_DIR}/cmake/modules/share/modules/cmake")

include(CMConfig)
include(CMSetupVersion)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ namespace nil {
using value_type = typename FieldType::value_type;
using integral_type = typename FieldType::integral_type;

static inline value_type generate(transcript_type &transcript,
nil::crypto3::random::algebraic_engine<FieldType> random_engine, std::size_t GrindingBits=16) {

static inline value_type generate(transcript_type &transcript, std::size_t GrindingBits=16) {
static boost::random::random_device dev;
static nil::crypto3::random::algebraic_engine<FieldType> random_engine(dev);
value_type pow_seed = random_engine();

integral_type mask =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,9 @@ namespace nil {
} else {
nil::marshalling::status_type status;
typename scalar_field_type::integral_type scalar_f(f.data);
#if defined(BOOST_OS_MACOS) && defined(BOOST_LIB_STD_CXX)
boost::container::vector<bool> bits = nil::marshalling::pack<nil::marshalling::option::big_endian>(
scalar_f, status);
boost::container::vector<bool> shifted_bits(bits.size(), false);
#else
std::vector<bool> bits = nil::marshalling::pack<nil::marshalling::option::big_endian>(
scalar_f, status);
std::vector<bool> shifted_bits(bits.size(), false);
#endif

std::copy(bits.begin(), bits.end() - 1, shifted_bits.begin() + 1);

Expand Down
37 changes: 21 additions & 16 deletions libs/parallel-zk/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,27 @@ set(TESTS_NAMES
"commitment/fri"
"commitment/kzg"
"commitment/fold_polynomial"
"commitment/lpc_performance"
"commitment/pedersen"
"commitment/proof_of_knowledge"
"commitment/powers_of_tau"
"commitment/r1cs_gg_ppzksnark_mpc"
"commitment/type_traits"
"commitment/kimchi_pedersen"
# "commitment/powers_of_tau"
# "commitment/r1cs_gg_ppzksnark_mpc"
# "commitment/type_traits"
# "commitment/kimchi_pedersen"
"commitment/proof_of_work"

"math/expression"

"routing_algorithms/test_routing_algorithms"
# "routing_algorithms/test_routing_algorithms"

# "relations/numeric/qap"
# "relations/numeric/sap"
# "relations/numeric/ssp"

"systems/plonk/pickles/pickles"
"systems/plonk/pickles/kimchi"
"systems/plonk/pickles/oracles"
"systems/plonk/pickles/to_field"
"systems/plonk/pickles/to_group"
# "systems/plonk/pickles/pickles"
# "systems/plonk/pickles/kimchi"
# "systems/plonk/pickles/oracles"
# "systems/plonk/pickles/to_field"
# "systems/plonk/pickles/to_group"

"systems/plonk/placeholder/placeholder_circuits"
"systems/plonk/placeholder/placeholder_goldilocks"
Expand All @@ -121,21 +120,27 @@ set(TESTS_NAMES
"systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark"
# "systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark_marshalling"
# "systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark_tvm_marshalling"
"systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark"
# "systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark"
# "systems/ppzksnark/r1cs_se_ppzksnark/r1cs_se_ppzksnark"
# "systems/ppzksnark/ram_ppzksnark/ram_ppzksnark"
# "systems/ppzksnark/tbcs_ppzksnark/tbcs_ppzksnark"
# "systems/ppzksnark/uscs_ppzksnark/uscs_ppzksnark"
"systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark_aggregation_conformity"
# "systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark_aggregation_conformity"

"transcript/transcript"
"transcript/kimchi_transcript"

# TODO: either delete this code with the test, or fix it later.
# "transcript/kimchi_transcript"

"systems/plonk/plonk_constraint")

foreach(TEST_NAME ${TESTS_NAMES})
define_zk_test(${TEST_NAME})
endforeach()

string(CONCAT TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR} "/systems/plonk/pickles/data/kimchi")
target_compile_definitions(actor_zk_systems_plonk_pickles_kimchi_test PRIVATE TEST_DATA="${TEST_DATA}")
#string(CONCAT TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR} "/systems/plonk/pickles/data/kimchi")
#target_compile_definitions(actor_zk_systems_plonk_pickles_kimchi_test PRIVATE TEST_DATA="${TEST_DATA}")

if(BUILD_BENCH_TESTS)
cm_add_test_subdirectory(bench_test)
endif()
45 changes: 45 additions & 0 deletions libs/parallel-zk/test/bench_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#---------------------------------------------------------------------------#
# Copyright (c) 2018-2021 Mikhail Komarov <nemo@nil.foundation>
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

include(CMTest)

add_custom_target(zk_runtime_bench_tests)

macro(define_runtime_zk_test name)
set(test_name "zk_${name}_bench_test")
add_dependencies(zk_runtime_bench_tests ${test_name})

cm_test(NAME ${test_name} SOURCES ${name}.cpp)

target_include_directories(${test_name} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"

${Boost_INCLUDE_DIRS})

set_target_properties(${test_name} PROPERTIES CXX_STANDARD 17
CXX_STANDARD_REQUIRED TRUE)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${test_name} PRIVATE "-fconstexpr-steps=2147483647")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${test_name} PRIVATE "-fconstexpr-ops-limit=4294967295")
endif()

target_compile_definitions(${test_name} PRIVATE TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/")
endmacro()

set(RUNTIME_TESTS_NAMES
"pedersen"
"lpc"
)

foreach(TEST_NAME ${RUNTIME_TESTS_NAMES})
define_runtime_zk_test(${TEST_NAME})
endforeach()

Loading
Loading