Skip to content

Commit

Permalink
Update crypto3, actor to pre-multiprecision-refactor state
Browse files Browse the repository at this point in the history
  • Loading branch information
x-mass committed Jun 3, 2024
1 parent ef8cd91 commit 3bdbd30
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 64 deletions.
44 changes: 14 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
#---------------------------------------------------------------------------#
# Copyright (c) 2022 Mikhail Komarov <[email protected]>
# Copyright (c) 2022 Aleksei Moskvin <[email protected]>
# Copyright (c) 2024 Iosif (x-mass) <[email protected]>
#
# 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
#---------------------------------------------------------------------------#

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)

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"
)

cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0057 NEW)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

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(CMDeploy)
include(CMSetupVersion)
include_directories(${Boost_INCLUDE_DIRS})

cm_workspace(proof-producer)

option(BUILD_TESTS "Build unit tests" FALSE)
option(BUILD_EXAMPLES "Build unit tests" FALSE)

macro(cm_find_package NAME)
if(NOT "${NAME}" MATCHES "^${CMAKE_WORKSPACE_NAME}_.*$" AND NOT "${NAME}" STREQUAL CM)
find_package(${ARGV})
else()
set(${ARGV0}_FOUND ON CACHE BOOL "")
endif()
endmacro()
cm_project(proof-generator WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES CXX)

option(BUILD_TESTS "Build unit tests" FALSE)
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
option(BUILD_WITH_BOOST_STATIC_LIBS "Build using Boost static libraries" TRUE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

if(BUILD_WITH_BOOST_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS TRUE)
else()
set(Boost_USE_STATIC_LIBS FALSE)
# TODO: move thread to actor-core
find_package(Boost REQUIRED COMPONENTS filesystem log program_options thread)
if(ENABLE_TESTS)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
endif()

# EXCLUDE_FROM_ALL is needed so crypto3 and other headers won't be installed
Expand Down
30 changes: 2 additions & 28 deletions bin/proof-generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#

cmake_minimum_required(VERSION 3.5)

cm_find_package(CM)
include(CMDeploy)
include(CMSetupVersion)

cm_project(proof-generator WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES ASM C CXX)

if (CPACK_PACKAGE_VERSION)
add_compile_definitions(PROOF_GENERATOR_VERSION=${CPACK_PACKAGE_VERSION})
endif()
Expand All @@ -32,12 +27,6 @@ if(ZK_PLACEHOLDER_DEBUG)
add_definitions(-DZK_PLACEHOLDER_DEBUG_ENABLED)
endif()

if (NOT Boost_FOUND)
find_package(Boost COMPONENTS REQUIRED filesystem log log_setup program_options thread system)
endif ()

cm_setup_version(VERSION 0.1.0)

# Function to setup common properties for a target
function(setup_proof_generator_target)
set(options "")
Expand Down Expand Up @@ -92,29 +81,14 @@ function(setup_proof_generator_target)
Boost::program_options
Boost::thread
)

if (APPLE OR NOT ${CMAKE_TARGET_ARCHITECTURE} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
set_target_properties(${CURRENT_PROJECT_NAME} PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${APPLE_CODE_SIGN_IDENTITY}"
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}")
elseif (CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set_target_properties(${CURRENT_PROJECT_NAME} PROPERTIES
COMPILE_FLAGS "-s USE_BOOST_HEADERS=1 -s USE_PTHREADS -s PROXY_TO_PTHREAD"
LINK_FLAGS "-s USE_BOOST_HEADERS=1 -s USE_PTHREADS -s PROXY_TO_PTHREAD"
LINK_DIRECTORIES "${CMAKE_BINARY_DIR}/libs/boost/src/boost/stage/lib")
endif ()

add_dependencies(${CURRENT_PROJECT_NAME} boost)
endif ()
endfunction()

# Declare single-threaded target
set(SINGLE_THREADED_TARGET "${CURRENT_PROJECT_NAME}-single-threaded")
setup_proof_generator_target(TARGET_NAME ${SINGLE_THREADED_TARGET} ADDITIONAL_DEPENDENCIES crypto3::zk)

# Declare multi-threaded target
# set(MUTLI_THREADED_TARGET "${CURRENT_PROJECT_NAME}-multi-threaded")
# setup_proof_generator_target(TARGET_NAME ${MUTLI_THREADED_TARGET} ADDITIONAL_DEPENDENCIES actor::zk)
set(MUTLI_THREADED_TARGET "${CURRENT_PROJECT_NAME}-multi-threaded")
setup_proof_generator_target(TARGET_NAME ${MUTLI_THREADED_TARGET} ADDITIONAL_DEPENDENCIES actor::zk)

install(TARGETS ${SINGLE_THREADED_TARGET} ${MUTLI_THREADED_TARGET} RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion cmake/modules
2 changes: 1 addition & 1 deletion libs/actor/zk
Submodule zk updated 25 files
+0 −103 CMakeLists.txt
+47 −42 include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp
+36 −32 include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp
+34 −41 include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp
+37 −6 include/nil/crypto3/zk/commitments/polynomial/kzg.hpp
+41 −6 include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp
+111 −0 include/nil/crypto3/zk/detail/field_element_consumer.hpp
+4 −0 include/nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp
+52 −0 include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp
+15 −40 include/nil/crypto3/zk/snark/arithmetization/plonk/copy_constraint.hpp
+5 −0 include/nil/crypto3/zk/snark/arithmetization/plonk/table_description.hpp
+8 −3 include/nil/crypto3/zk/snark/arithmetization/plonk/variable.hpp
+143 −26 include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/profiling.hpp
+9 −1 include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp
+5 −1 include/nil/crypto3/zk/snark/systems/plonk/placeholder/gates_argument.hpp
+6 −2 include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp
+1 −1 include/nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp
+3 −2 include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp
+4 −2 include/nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp
+43 −23 include/nil/crypto3/zk/transcript/fiat_shamir.hpp
+4 −1 test/CMakeLists.txt
+95 −0 test/include/nil/crypto3/zk/test_tools/random_test_initializer.hpp
+0 −422 test/systems/plonk/placeholder/performance.cpp
+209 −159 test/systems/plonk/placeholder/placeholder.cpp
+14 −1 test/transcript/transcript.cpp
2 changes: 1 addition & 1 deletion libs/crypto3
12 changes: 10 additions & 2 deletions tests/make_proof_for_pairs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ make_proof_for_pair() {
if [ -f "$crct_file" ]; then
mkdir -p "$proof_dir" # Ensure the output directory exists
echo -n "Processing $tbl_file and $crct_file (proof will be at $proof_dir): "
if $proof_generator_binary -t "$tbl_file" --circuit "$crct_file" --proof "$proof_dir/proof.bin"; then
if $proof_generator_binary -t "$tbl_file" --circuit "$crct_file" --proof "$proof_dir/proof.bin" ${args_to_forward[@]}; then
color_green "success"
else
color_red "failed"
Expand All @@ -41,8 +41,9 @@ clean_up() {
parse_args() {
base_dir="."
output_dir=""
targets=()
use_multithreaded=false
args_to_forward=()
targets=()

while [ "$#" -gt 0 ]; do
case "$1" in
Expand All @@ -58,6 +59,13 @@ parse_args() {
use_multithreaded=true
shift
;;
--)
shift
while [ "$#" -gt 0 ]; do
args_to_forward+=("$1") # Collect remaining arguments
shift
done
;;
*)
targets+=("$1") # Add remaining arguments as targets
shift
Expand Down

0 comments on commit 3bdbd30

Please sign in to comment.